zant-admin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.en.md +36 -0
  2. package/README.md +248 -0
  3. package/SCAFFOLD_README.md +215 -0
  4. package/bin/cli.js +99 -0
  5. package/bin/generator.js +503 -0
  6. package/bin/prompts.js +159 -0
  7. package/bin/utils.js +134 -0
  8. package/package.json +74 -0
  9. package/public/logo.png +0 -0
  10. package/src/App.vue +16 -0
  11. package/src/api/methods/logError.js +8 -0
  12. package/src/api/methods/logOperation.js +8 -0
  13. package/src/api/methods/login.js +6 -0
  14. package/src/api/methods/quartz.js +36 -0
  15. package/src/api/methods/region.js +16 -0
  16. package/src/api/methods/sysAccount.js +30 -0
  17. package/src/api/methods/sysDict.js +29 -0
  18. package/src/api/methods/sysDictItem.js +26 -0
  19. package/src/api/methods/sysMenu.js +42 -0
  20. package/src/api/methods/sysRole.js +35 -0
  21. package/src/api/methods/sysUser.js +25 -0
  22. package/src/api/methods/system.js +16 -0
  23. package/src/api/request.js +225 -0
  24. package/src/assets/css/style.css +70 -0
  25. package/src/assets/css/zcui.css +340 -0
  26. package/src/assets/imgs/loginbackground.svg +69 -0
  27. package/src/assets/imgs/logo.png +0 -0
  28. package/src/assets/imgs/md/1.png +0 -0
  29. package/src/assets/imgs/md/10.png +0 -0
  30. package/src/assets/imgs/md/11.png +0 -0
  31. package/src/assets/imgs/md/2.png +0 -0
  32. package/src/assets/imgs/md/3.png +0 -0
  33. package/src/assets/imgs/md/4.png +0 -0
  34. package/src/assets/imgs/md/5.png +0 -0
  35. package/src/assets/imgs/md/6.png +0 -0
  36. package/src/assets/imgs/md/7.png +0 -0
  37. package/src/assets/imgs/md/8.png +0 -0
  38. package/src/assets/imgs/md/9.png +0 -0
  39. package/src/components/FormTable.vue +875 -0
  40. package/src/components/IconPicker.vue +344 -0
  41. package/src/components/MainPage.vue +957 -0
  42. package/src/components/details/logErrorDetails.vue +58 -0
  43. package/src/components/details/logOperationDetails.vue +76 -0
  44. package/src/components/edit/QuartzEdit.vue +221 -0
  45. package/src/components/edit/SysAccountEdit.vue +178 -0
  46. package/src/components/edit/SysDictEdit.vue +114 -0
  47. package/src/components/edit/SysDictItemEdit.vue +134 -0
  48. package/src/components/edit/SysRoleEdit.vue +109 -0
  49. package/src/components/edit/sysMenuEdit.vue +305 -0
  50. package/src/config/index.js +74 -0
  51. package/src/directives/permission.js +45 -0
  52. package/src/main.js +38 -0
  53. package/src/router/index.js +270 -0
  54. package/src/stores/config.js +37 -0
  55. package/src/stores/dict.js +33 -0
  56. package/src/stores/menu.js +57 -0
  57. package/src/stores/user.js +21 -0
  58. package/src/utils/baseEcharts.js +661 -0
  59. package/src/utils/dictTemplate.js +26 -0
  60. package/src/utils/regionUtils.js +169 -0
  61. package/src/utils/useFormCRUD.js +60 -0
  62. package/src/views/baiscstatis/center.vue +463 -0
  63. package/src/views/baiscstatis/iframePage.vue +31 -0
  64. package/src/views/baiscstatis/notFound.vue +192 -0
  65. package/src/views/console.vue +771 -0
  66. package/src/views/demo/importexport.vue +123 -0
  67. package/src/views/demo/region.vue +240 -0
  68. package/src/views/demo/statistics.vue +195 -0
  69. package/src/views/home.vue +7 -0
  70. package/src/views/login.vue +272 -0
  71. package/src/views/operations/log/logError.vue +78 -0
  72. package/src/views/operations/log/logLogin.vue +66 -0
  73. package/src/views/operations/log/logOperation.vue +103 -0
  74. package/src/views/operations/log/logQuartz.vue +57 -0
  75. package/src/views/operations/quartz.vue +181 -0
  76. package/src/views/operations/serviceMonitoring.vue +134 -0
  77. package/src/views/system/sysAccount.vue +123 -0
  78. package/src/views/system/sysDict.vue +156 -0
  79. package/src/views/system/sysDictItem.vue +118 -0
  80. package/src/views/system/sysMenu.vue +223 -0
  81. package/src/views/system/sysRole.vue +184 -0
  82. package/templates/env.production +2 -0
@@ -0,0 +1,181 @@
1
+ <template>
2
+ <form-table
3
+ :formState="formState"
4
+ :columns="columns"
5
+ modulePath="quartz"
6
+ :permissionModulePath="permissionModulePath"
7
+ @edit="edit"
8
+ ftableDeleteAction="deleteTask"
9
+ ref="childRef"
10
+ >
11
+ <template #custom-status="{ record }">
12
+ <span class="" v-if="record.status == 0">暂停</span>
13
+ <span class="text-color-primary" v-if="record.status == 1">开启</span>
14
+ <span class="text-color-success" v-if="record.status == 2">运行中</span>
15
+ </template>
16
+ <template #custom-taskType="{ record }">
17
+ <span class="" v-if="record.taskType == 0">DLL</span>
18
+ <span class="" v-if="record.taskType == 1">API</span>
19
+ </template>
20
+ <template #custom-operation="{ record }">
21
+ <a-divider type="vertical" />
22
+ <a-dropdown class="" >
23
+ <a @click.prevent > 更多 <DownOutlined /></a>
24
+ <template #overlay>
25
+
26
+ <a-menu @click="e => moreClick(e, record.id)" >
27
+ <span v-permission="permissionModulePath+':resumeTask'">
28
+ <a-menu-item key="1">
29
+ <a @click="empower(record)" >恢复任务</a>
30
+ </a-menu-item>
31
+ </span>
32
+ <span v-permission="permissionModulePath+':pauseTask'">
33
+ <a-menu-item key="2">
34
+ <a @click="empower(record)" >暂停任务</a>
35
+ </a-menu-item>
36
+ </span>
37
+ <span v-permission="permissionModulePath+':executeTask'">
38
+ <a-menu-item key="3">
39
+ <a @click="empower(record)" >立即执行</a>
40
+ </a-menu-item>
41
+ </span>
42
+ <span v-permission="permissionModulePath+':viewLog'">
43
+ <a-menu-item key="4">
44
+ <a @click="empower(record)" >执行记录</a>
45
+ </a-menu-item>
46
+ </span>
47
+ </a-menu>
48
+ </template>
49
+ </a-dropdown>
50
+ </template>
51
+ </form-table>
52
+ <!-- 新增修改 -->
53
+ <QuartzEdit
54
+ :open="editopen"
55
+ @close="editopen = false"
56
+ @updateData="refreshData"
57
+ ref="editRef"
58
+ >
59
+ </QuartzEdit>
60
+
61
+ <a-modal
62
+ v-model:open="quartzLogopen"
63
+ width="60%"
64
+ wrap-class-name="full-modal"
65
+ title="执行记录"
66
+ :footer="null"
67
+ :destroyOnClose="true"
68
+ >
69
+ <logQuartz :recordwhere="recordwhere"> </logQuartz>
70
+ </a-modal>
71
+ </template>
72
+ <script setup>
73
+ import { ref } from 'vue'
74
+ import FormTable from '@/components/FormTable.vue'
75
+ import QuartzEdit from '@/components/edit/QuartzEdit.vue'
76
+ import logQuartz from '@/views/operations/log/logQuartz.vue'
77
+ import quartz from '@/api/methods/quartz'
78
+ import { message } from 'ant-design-vue'
79
+ // 权限模块路径
80
+ const permissionModulePath = ref('operations:quartz')
81
+
82
+ const formState = ref({
83
+ name: { label: '任务', value: '', type: 'text' },
84
+ })
85
+ const columns = ref([
86
+ {
87
+ title: '序号',
88
+ key: 'num',
89
+ width: 80,
90
+ },
91
+ {
92
+ title: '任务',
93
+ dataIndex: 'name',
94
+ key: 'name',
95
+ },
96
+ {
97
+ title: '分组',
98
+ dataIndex: 'jobGroup',
99
+ key: 'jobGroup',
100
+ },
101
+ {
102
+ title: 'Cron',
103
+ dataIndex: 'cron',
104
+ key: 'cron',
105
+ },
106
+ {
107
+ title: '任务类型',
108
+ dataIndex: 'taskType',
109
+ key: 'taskType',
110
+ },
111
+ {
112
+ title: '运行状态',
113
+ dataIndex: 'status',
114
+ key: 'status',
115
+ },
116
+ {
117
+ title: '最后一次运行时间',
118
+ dataIndex: 'lastRunTime',
119
+ key: 'lastRunTime',
120
+ },
121
+ {
122
+ title: '任务描述',
123
+ key: 'remark',
124
+ dataIndex: 'remark',
125
+ },
126
+ {
127
+ title: '操作',
128
+ key: 'operation',
129
+ fixed: 'right',
130
+ width: 200,
131
+ },
132
+ ])
133
+ const quartzLogopen = ref(false)
134
+ const recordwhere = ref({})
135
+ // 表格更多点击事件
136
+ const moreClick = (e, id) => {
137
+ switch (e.key) {
138
+ case '1':
139
+ quartz.resumeTask({ id }).then(() => {
140
+ message.success('成功', 1, () => {
141
+ childRef.value.tableLoad()
142
+ })
143
+ })
144
+ break
145
+ case '2':
146
+ quartz.pauseTask({ id }).then(() => {
147
+ message.success('成功', 1, () => {
148
+ childRef.value.tableLoad()
149
+ })
150
+ })
151
+ break
152
+ case '3':
153
+ quartz.triggerTask({ id }).then(() => {
154
+ message.success('成功', 1, () => {
155
+ childRef.value.tableLoad()
156
+ })
157
+ })
158
+ break
159
+ case '4':
160
+ recordwhere.value = { quartzTaskId: id }
161
+ quartzLogopen.value = true
162
+ break
163
+ default:
164
+ break
165
+ }
166
+ }
167
+ //编辑
168
+ const editopen = ref(false)
169
+ const editRef = ref(null)
170
+ const edit = record => {
171
+ editRef.value.init(record.id)
172
+ editopen.value = true
173
+ }
174
+ const childRef = ref(null)
175
+ const refreshData = () => {
176
+ childRef.value.tableLoad()
177
+ }
178
+
179
+ </script>
180
+
181
+ <style></style>
@@ -0,0 +1,134 @@
1
+ <template>
2
+ <a-row :gutter="16">
3
+ <a-col :span="12">
4
+ <a-card :bordered="false" :loading="loading">
5
+ <template #title
6
+ ><DesktopOutlined :style="{ color: '#1677ff' }" /> CPU</template
7
+ >
8
+ <div class="flex-row text-font-bold">
9
+ <div class="flex-item">属性</div>
10
+ <div class="flex-item">值</div>
11
+ </div>
12
+ <hr />
13
+ <div class="flex-row">
14
+ <div class="flex-item">核心数</div>
15
+ <div class="flex-item">{{ data.processorCount }}</div>
16
+ </div>
17
+ <hr />
18
+ <div class="flex-row">
19
+ <div class="flex-item">用户使用率</div>
20
+ <div class="flex-item">{{ data.processorCount }}</div>
21
+ </div>
22
+ <hr />
23
+ <div class="flex-row">
24
+ <div class="flex-item">系统使用率</div>
25
+ <div class="flex-item">{{ data.cpuLoad }}</div>
26
+ </div>
27
+ <hr />
28
+ <div class="flex-row">
29
+ <div class="flex-item">当前空闲率</div>
30
+ <div class="flex-item">{{ data.cpuSurplusLoad }}</div>
31
+ </div>
32
+ </a-card>
33
+ </a-col>
34
+ <a-col :span="12">
35
+ <a-card :bordered="false" :loading="loading">
36
+ <template #title
37
+ ><DatabaseOutlined :style="{ color: '#1677ff' }" /> 内存</template
38
+ >
39
+ <div class="flex-row text-font-bold">
40
+ <div class="flex-item">属性</div>
41
+ <div class="flex-item">值</div>
42
+ </div>
43
+ <hr />
44
+ <div class="flex-row">
45
+ <div class="flex-item">总内存</div>
46
+ <div class="flex-item">{{ data.physicalMemory }}</div>
47
+ </div>
48
+ <hr />
49
+ <div class="flex-row">
50
+ <div class="flex-item">已用内存</div>
51
+ <div class="flex-item">{{ data.memoryUsed }}</div>
52
+ </div>
53
+ <hr />
54
+ <div class="flex-row">
55
+ <div class="flex-item">剩余内存</div>
56
+ <div class="flex-item">{{ data.memoryAvailable }}</div>
57
+ </div>
58
+ <hr />
59
+ <div class="flex-row">
60
+ <div class="flex-item">使用率</div>
61
+ <div class="flex-item">{{ data.memoryUsage }}</div>
62
+ </div>
63
+ </a-card>
64
+ </a-col>
65
+ </a-row>
66
+ <a-card :bordered="false" class="margin-top-10" :loading="loading">
67
+ <template #title
68
+ ><DesktopOutlined :style="{ color: '#1677ff' }" /> 服务器信息</template
69
+ >
70
+ <div class="flex-row text-font-bold">
71
+ <div class="flex-item">服务器名称</div>
72
+ <div class="flex-item">服务器 IP</div>
73
+ <div class="flex-item">操作系统</div>
74
+ <div class="flex-item">系统架构</div>
75
+ </div>
76
+ <hr />
77
+ <div class="flex-row">
78
+ <div class="flex-item">{{ data.hostName }}</div>
79
+ <div class="flex-item">{{ data.stringIP }}</div>
80
+ <div class="flex-item">{{ data.osDescription }}</div>
81
+ <div class="flex-item">{{ data.osArchitecture }}</div>
82
+ </div>
83
+ </a-card>
84
+ <a-card :bordered="false" class="margin-top-10" :loading="loading">
85
+ <template #title
86
+ ><DesktopOutlined :style="{ color: '#1677ff' }" /> 磁盘状态</template
87
+ >
88
+ <div class="flex-row text-font-bold">
89
+ <div class="flex-item">盘符</div>
90
+ <div class="flex-item">总大小</div>
91
+ <div class="flex-item">已用大小</div>
92
+ <div class="flex-item">可用大小</div>
93
+ <div class="flex-item">已用百分比</div>
94
+ </div>
95
+ <hr />
96
+ <template v-for="(item, index) in data.disks" v-bind:key="index">
97
+ <div class="flex-row">
98
+ <div class="flex-item">{{ item.driveletter }}</div>
99
+ <div class="flex-item">{{ item.totalsize }}</div>
100
+ <div class="flex-item">{{ item.usedSize }}</div>
101
+ <div class="flex-item">{{ item.availableSize }}</div>
102
+ <div class="flex-item">{{ item.percentSize }}</div>
103
+ </div>
104
+ <hr />
105
+ </template>
106
+ </a-card>
107
+ </template>
108
+ <script setup>
109
+ import system from '@/api/methods/system'
110
+ import { ref } from 'vue'
111
+ const loading = ref(true)
112
+ const data = ref({})
113
+ const init = () => {
114
+ system.getSystemDescription().then(res => {
115
+ data.value = res.data
116
+
117
+ loading.value = !loading.value
118
+ })
119
+ }
120
+ init()
121
+ </script>
122
+ <style scoped>
123
+ hr {
124
+ height: 0;
125
+ line-height: 0;
126
+ margin: 10px 0;
127
+ padding: 0;
128
+ border: none;
129
+ border-bottom: 1px solid #eee;
130
+ clear: both;
131
+ overflow: hidden;
132
+ background: 0 0;
133
+ }
134
+ </style>
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <form-table
3
+ :formState="formState"
4
+ :columns="columns"
5
+ modulePath="sysAccount"
6
+ :permissionModulePath="permissionModulePath"
7
+ @edit="edit"
8
+ ref="childRef"
9
+ >
10
+ <!-- 可以通过插槽自定义单元格 -->
11
+ <template #custom-isEnable="{ record }">
12
+ <a-switch
13
+ v-model:checked="record.isEnable"
14
+ checked-children="是"
15
+ un-checked-children="否"
16
+ @change="handleSwitchChange(record)"
17
+ />
18
+ </template>
19
+ </form-table>
20
+ <!-- 新增修改 -->
21
+ <SysAccountEdit
22
+ :open="editopen"
23
+ @close="editopen = false"
24
+ @updateData="refreshData"
25
+ ref="editRef"
26
+ >
27
+ </SysAccountEdit>
28
+ </template>
29
+ <script setup>
30
+ import { ref, onMounted } from 'vue'
31
+ import FormTable from '@/components/FormTable.vue'
32
+ import SysAccountEdit from '@/components/edit/SysAccountEdit.vue'
33
+ import sysAccount from '@/api/methods/sysAccount'
34
+ import sysRole from '@/api/methods/sysRole'
35
+ // 权限模块路径
36
+ const permissionModulePath = ref('system:sysAccount')
37
+ const formState = ref({
38
+ name: { label: '账号名称', value: '',defaultvalue:'', type: 'text' },
39
+ mobile: { label: '手机号', value: '',defaultvalue:'', type: 'text' },
40
+ roleId: {
41
+ label: '角色',
42
+ value: null,
43
+ defaultvalue:null,
44
+ type: 'select',
45
+ data: [],
46
+ },
47
+ createTime: { label: '日期范围', value: null, defaultvalue:null, type: 'time' },
48
+ })
49
+
50
+ const fetchRoleData = async () => {
51
+ sysRole.getList().then(res => {
52
+ formState.value.roleId.data = res.data.map(role => ({
53
+ label: role.name,
54
+ value: role.id,
55
+ }))
56
+ })
57
+ }
58
+ // 使用 onMounted 在组件加载时调用 fetchRoleData
59
+ onMounted(() => {
60
+ fetchRoleData()
61
+ })
62
+ const columns = ref([
63
+ {
64
+ title: '账号名称',
65
+ dataIndex: 'name',
66
+ resizable: true,
67
+ },
68
+ {
69
+ title: '手机号',
70
+ dataIndex: 'mobile',
71
+ resizable: true,
72
+ },
73
+ {
74
+ title: '角色',
75
+ dataIndex: 'roleName',
76
+ resizable: true,
77
+ },
78
+ {
79
+ title: '备注',
80
+ dataIndex: 'remark',
81
+ resizable: true,
82
+ },
83
+ {
84
+ title: '是否启用',
85
+ key: 'isEnable',
86
+ resizable: true,
87
+ },
88
+ {
89
+ title: '创建时间',
90
+ dataIndex: 'createTime',
91
+ resizable: true,
92
+ },
93
+ {
94
+ title: '操作',
95
+ key: 'operation',
96
+ fixed: 'right',
97
+ width: 200,
98
+ },
99
+ ])
100
+
101
+ const childRef = ref(null)
102
+ //编辑
103
+ const editopen = ref(false)
104
+ const editRef = ref(null)
105
+ const edit = record => {
106
+ editRef.value.init(record.id)
107
+ editopen.value = true
108
+ }
109
+ const refreshData = () => {
110
+ childRef.value.tableLoad()
111
+ }
112
+ //修改是否启用
113
+ const handleSwitchChange = record => {
114
+ var data = {
115
+ id: record.id,
116
+ isEnabled: record.isEnable,
117
+ }
118
+ sysAccount.updateIsEnabled(data).then(() => {
119
+ childRef.value.tableLoad()
120
+ })
121
+ }
122
+ </script>
123
+ <style></style>
@@ -0,0 +1,156 @@
1
+ <template>
2
+ <form-table
3
+ :formState="formState"
4
+ :columns="columns"
5
+ modulePath="sysDict"
6
+ :permissionModulePath="permissionModulePath"
7
+ @edit="edit"
8
+ ref="childRef"
9
+ >
10
+ <template #table-toolbar="{ record }">
11
+ <a-button @click="refreshCache" size="middle"
12
+ ><RedoOutlined />刷新缓存</a-button
13
+ >
14
+ </template>
15
+ <!-- 可以通过插槽自定义单元格 -->
16
+ <template #custom-isEnable="{ record }">
17
+ <a-switch
18
+ v-model:checked="record.isEnable"
19
+ checked-children="是"
20
+ un-checked-children="否"
21
+ @change="handleSwitchChange(record)"
22
+ />
23
+ </template>
24
+ <template #custom-operation="{ record }">
25
+ <a-divider type="vertical" />
26
+ <a @click="configuration(record)" v-permission="permissionModulePath+':configuration'">配置字典项</a>
27
+ </template>
28
+ </form-table>
29
+ <!-- 编辑 -->
30
+ <SysDictEdit
31
+ :open="editopen"
32
+ @close="editopen = false"
33
+ @updateData="refreshData"
34
+ ref="editRef"
35
+ >
36
+ </SysDictEdit>
37
+
38
+ <!-- 配置字典项 -->
39
+
40
+ <a-modal
41
+ v-model:open="configurationopen"
42
+ :title="configurationtitle"
43
+ width="70%"
44
+ wrap-class-name="full-modal"
45
+ :destroyOnClose="true"
46
+ >
47
+ <SysDictItem :recordwhere="recordwhere" ref="childPageRef">
48
+ </SysDictItem>
49
+ </a-modal>
50
+ </template>
51
+ <script setup>
52
+ import { ref, nextTick } from 'vue'
53
+ import FormTable from '@/components/FormTable.vue'
54
+ import SysDictEdit from '@/components/edit/SysDictEdit.vue'
55
+ import SysDictItem from '@/views/system/sysDictItem.vue'
56
+ import sysDict from '@/api/methods/sysDict'
57
+ import { message } from 'ant-design-vue'
58
+ import { dictStore } from '@/stores/dict'
59
+ // 权限模块路径
60
+ const permissionModulePath = ref('system:sysDict')
61
+ const formState = ref({
62
+ name: { label: '字典名称', value: '', type: 'text' },
63
+ type: { label: '字典类型', value: '', type: 'text' },
64
+ Enable: {
65
+ label: '是否启用',
66
+ value: null,
67
+ type: 'select',
68
+ data: [
69
+ { label: '是', value: true },
70
+ { label: '否', value: false },
71
+ ],
72
+ },
73
+ })
74
+ const columns = ref([
75
+ {
76
+ title: '序号',
77
+ key: 'num',
78
+ width: 80,
79
+ },
80
+ {
81
+ title: '字典名称',
82
+ dataIndex: 'name',
83
+ },
84
+ {
85
+ title: '字典类型',
86
+ dataIndex: 'type',
87
+ },
88
+ {
89
+ title: '是否启用',
90
+ key: 'isEnable',
91
+ },
92
+ {
93
+ title: '备注',
94
+ dataIndex: 'remark',
95
+ },
96
+
97
+ {
98
+ title: '创建时间',
99
+ dataIndex: 'createTime',
100
+ width: 200,
101
+ },
102
+ {
103
+ title: '操作',
104
+ key: 'operation',
105
+ fixed: 'right',
106
+ width: 200,
107
+ },
108
+ ])
109
+ const childRef = ref(null)
110
+ //编辑
111
+ const editopen = ref(false)
112
+ const editRef = ref(null)
113
+ //新增
114
+ const edit = record => {
115
+ editRef.value.init(record.id)
116
+ editopen.value = true
117
+ }
118
+ const refreshData = () => {
119
+ childRef.value.tableLoad()
120
+ }
121
+
122
+ //修改是否启用
123
+ const handleSwitchChange = record => {
124
+ var data = {
125
+ id: record.id,
126
+ isEnabled: record.isEnable,
127
+ }
128
+ sysDict.updateIsEnabled(data).then(() => {
129
+ childRef.value.tableLoad()
130
+ })
131
+ }
132
+ //刷新缓存
133
+ const refreshCache = () => {
134
+ const dict = dictStore()
135
+ dict.$reset()
136
+ dict.initDictList()
137
+ message.success('刷新缓存成功', 1)
138
+ }
139
+ //---------------------------配置字典项----------------------------------
140
+ const configurationopen = ref(false)
141
+ const configurationtitle = ref('配置字典项')
142
+ const recordwhere = ref({})
143
+ const childPageRef = ref(null)
144
+ const configuration = record => {
145
+ configurationtitle.value = '配置字典项-' + record.name
146
+ recordwhere.value = { dictId: record.id }
147
+ configurationopen.value = true
148
+ nextTick(() => {
149
+ if (childPageRef.value) {
150
+ childPageRef.value.refreshData() // 调用子组件暴露的方法
151
+ }
152
+ })
153
+ }
154
+ </script>
155
+
156
+ <style></style>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <form-table
3
+ :columns="columns"
4
+ modulePath="sysDictItem"
5
+ :where="recordwhere"
6
+ :permissionModulePath="permissionModulePath"
7
+ @edit="edit"
8
+ ref="childRef"
9
+ >
10
+ <template #custom-isEnable="{ record }">
11
+ <a-switch
12
+ v-model:checked="record.isEnable"
13
+ checked-children="是"
14
+ un-checked-children="否"
15
+ @change="sysDictItemhandleSwitchChange(record)"
16
+ />
17
+ </template>
18
+ <template #custom-label="{ record }">
19
+ <span :class="record.colorClass">{{ record.label }}</span>
20
+ </template>
21
+ </form-table>
22
+ <!-- 编辑 -->
23
+ <SysDictItemEdit
24
+ :open="editopen"
25
+ @close="editopen = false"
26
+ @updateData="refreshData"
27
+ :recordwhere="recordwhere"
28
+ ref="editRef"
29
+ >
30
+ </SysDictItemEdit>
31
+ </template>
32
+ <script setup>
33
+ import { ref, defineProps, reactive } from 'vue'
34
+ import FormTable from '@/components/FormTable.vue'
35
+ import SysDictItemEdit from '@/components/edit/SysDictItemEdit.vue'
36
+ import sysDictItem from '@/api/methods/sysDictItem'
37
+ // 权限模块路径
38
+ const permissionModulePath = ref('system:sysDictItem')
39
+ const props = defineProps({
40
+ recordwhere: {
41
+ type: Object,
42
+ default: {},
43
+ },
44
+ })
45
+ const columns = ref([
46
+ {
47
+ title: '序号',
48
+ key: 'num',
49
+ width: 80,
50
+ },
51
+ {
52
+ title: '字典标签',
53
+ key: 'label',
54
+ },
55
+ {
56
+ title: '字典值',
57
+ dataIndex: 'value',
58
+ width: 80,
59
+ },
60
+ {
61
+ title: '排序',
62
+ dataIndex: 'sort',
63
+ width: 80,
64
+ },
65
+ {
66
+ title: '颜色样式',
67
+ dataIndex: 'colorClass',
68
+ },
69
+ {
70
+ title: '状态',
71
+ key: 'isEnable',
72
+ width: 80,
73
+ },
74
+ {
75
+ title: '备注',
76
+ dataIndex: 'remark',
77
+ },
78
+
79
+ {
80
+ title: '创建时间',
81
+ dataIndex: 'createTime',
82
+ },
83
+ {
84
+ title: '操作',
85
+ key: 'operation',
86
+ fixed: 'right',
87
+ width: 100,
88
+ },
89
+ ])
90
+ const childRef = ref(null)
91
+
92
+ //修改是否启用
93
+ const sysDictItemhandleSwitchChange = record => {
94
+ var data = {
95
+ id: record.id,
96
+ isEnabled: record.isEnable,
97
+ }
98
+ sysDictItem.updateIsEnabled(data).then(() => {
99
+ refreshData()
100
+ })
101
+ }
102
+ //
103
+
104
+ //编辑
105
+ const editopen = ref(false)
106
+ const editRef = ref(null)
107
+ const edit = record => {
108
+ editRef.value.init(record.id)
109
+ editopen.value = true
110
+ }
111
+
112
+ const refreshData = () => {
113
+ childRef.value.tableLoad()
114
+ }
115
+ defineExpose({
116
+ refreshData,
117
+ })
118
+ </script>