|
@@ -0,0 +1,140 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <search-form
|
|
|
+ @change="searchHandle"/>
|
|
|
+ <table-list
|
|
|
+ :listLoading="listLoading"
|
|
|
+ :data="tableData2"
|
|
|
+ :columns="listConfig"
|
|
|
+ :currentPage="currentPage"
|
|
|
+ :pageSize="pageSize"
|
|
|
+ :totalRecords="totalRecords"
|
|
|
+ @currentChange="pageHandle"
|
|
|
+ :isAdd="true"
|
|
|
+ @add="openPopup"
|
|
|
+ />
|
|
|
+ <popup-edit
|
|
|
+ :isShow="isPopupShow"
|
|
|
+ :curObj="curObj"
|
|
|
+ @close="closePopup"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { arrToObj } from '@/utils'
|
|
|
+import SearchForm from './components/searchForm/ThemeDtl'
|
|
|
+import PopupEdit from './components/popup/ThemeDtlEdit'
|
|
|
+import baseTable from '_m/baseTable.js'
|
|
|
+export default {
|
|
|
+ // name: 'basePublicDictSys',
|
|
|
+ components: {
|
|
|
+ SearchForm,
|
|
|
+ PopupEdit
|
|
|
+ },
|
|
|
+ provide () {
|
|
|
+ return {
|
|
|
+ parentData: this
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mixins: [baseTable],
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ apiStr: 'other.admthemedatalist',
|
|
|
+ searchForm: null,
|
|
|
+ isPopupShow: false,
|
|
|
+ noCreated: true,
|
|
|
+ curObj: {},
|
|
|
+ curId: '',
|
|
|
+ curType: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ tableData2 () {
|
|
|
+ let arr = [...this.tableData]
|
|
|
+ arr.map(item => {
|
|
|
+ if (Number(item.system) === 1) item.nosys = true
|
|
|
+ })
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.listConfig = {
|
|
|
+ rows: [
|
|
|
+ { label: '分类', prop: 'type', type: 'tag', tags: arrToObj(this.$dictData.app_theme_type) },
|
|
|
+ { label: '标题', prop: 'title' },
|
|
|
+ { label: '链接', prop: 'link' },
|
|
|
+ { label: '排序', prop: 'sort' },
|
|
|
+ { label: '图片', prop: 'icon', type: 'img' },
|
|
|
+ { label: '状态', prop: 'hide_status', type: 'tag', tags: arrToObj(this.$dictData.hide_status), tagTypeObj: {'1': 'success', '2': 'danger'} },
|
|
|
+ { label: '自定义值1', prop: 'option1' },
|
|
|
+ { label: '自定义值2', prop: 'option2' },
|
|
|
+ { label: '备注', prop: 'remark' },
|
|
|
+ { label: '更新人', prop: 'update_by' },
|
|
|
+ { label: '更新时间', prop: 'update_at' },
|
|
|
+ { label: '操作', width: 200, type: 'handle2',
|
|
|
+ operations: [
|
|
|
+ // { labelFor: 'status', disabled: true, func: this.statusHandle, hide: 'nosys',
|
|
|
+ // labelConfig: {
|
|
|
+ // texts: {
|
|
|
+ // 1: '停用',
|
|
|
+ // 2: '启用'
|
|
|
+ // },
|
|
|
+ // btnTypes: {
|
|
|
+ // 1: 'danger',
|
|
|
+ // 2: 'success'
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ { label: '编辑', func: this.openPopup, btnType: 'primary' },
|
|
|
+ { label: '删除', func: this.delHandle, btnType: 'danger', hide: 'nosys' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ const query = this.$route.query
|
|
|
+ if (query.id) {
|
|
|
+ this.searchForm = {
|
|
|
+ theme_id: query.id
|
|
|
+ }
|
|
|
+ this.fetchData()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ delHandle (row) {
|
|
|
+ const msgHtml = `确定要删除此数据吗?`
|
|
|
+ this.$msg(msgHtml, 'confirm', ()=> {
|
|
|
+ this.$api.other.admthemedatadel({
|
|
|
+ id: row.id,
|
|
|
+ }).then(data => {
|
|
|
+ this.$msgs(`删除成功!`)
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ }, null, true)
|
|
|
+ },
|
|
|
+ // statusHandle (row) {
|
|
|
+ // const status = Number(row.status) === 1 ? 2 : 1
|
|
|
+ // const msgText = Number(row.status) === 1 ? '停用' : '启用'
|
|
|
+ // this.$msg(`确定要${msgText}该字典吗?`, 'confirm', ()=> {
|
|
|
+ // this.$api.other.dictupdate({
|
|
|
+ // id: row.id,
|
|
|
+ // status
|
|
|
+ // }).then(data => {
|
|
|
+ // this.$msgs(`${msgText}成功!`)
|
|
|
+ // this.fetchData()
|
|
|
+ // })
|
|
|
+ // }, null, true)
|
|
|
+ // },
|
|
|
+ openPopup (row) {
|
|
|
+ this.curObj = row || {}
|
|
|
+ this.curObj.theme_id = this.searchForm.theme_id
|
|
|
+ this.isPopupShow = true
|
|
|
+ },
|
|
|
+ closePopup (obj) {
|
|
|
+ this.isPopupShow = false
|
|
|
+ if (obj) {
|
|
|
+ this.fetchData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|