zant-admin 2.0.2 → 2.0.4
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.
- package/.editorconfig +6 -0
- package/.env.development +3 -0
- package/.env.production +1 -0
- package/.env.test +1 -0
- package/.gitignore +36 -0
- package/.prettierrc.json +9 -0
- package/README.en.md +461 -272
- package/README.md +4 -3
- package/bin/cli.js +1 -1
- package/eslint.config.js +30 -0
- package/index.html +13 -0
- package/jsconfig.json +8 -0
- package/package.json +11 -3
- package/src/App.vue +16 -16
- package/src/api/methods/logError.js +8 -8
- package/src/api/methods/logOperation.js +8 -8
- package/src/api/methods/login.js +6 -6
- package/src/api/methods/quartz.js +36 -36
- package/src/api/methods/region.js +16 -16
- package/src/api/methods/sysAccount.js +29 -29
- package/src/api/methods/sysDict.js +29 -29
- package/src/api/methods/sysDictItem.js +26 -26
- package/src/api/methods/sysMenu.js +42 -42
- package/src/api/methods/sysRole.js +35 -35
- package/src/api/methods/sysUser.js +25 -25
- package/src/api/methods/system.js +15 -15
- package/src/api/request.js +225 -225
- package/src/assets/css/zcui.css +1023 -1023
- package/src/components/IconPicker.vue +351 -351
- package/src/components/MainPage.vue +838 -838
- package/src/components/details/logErrorDetails.vue +58 -58
- package/src/components/details/logOperationDetails.vue +76 -76
- package/src/components/edit/QuartzEdit.vue +221 -221
- package/src/components/edit/SysAccountEdit.vue +185 -185
- package/src/components/edit/SysDictEdit.vue +116 -116
- package/src/components/edit/SysDictItemEdit.vue +136 -136
- package/src/components/edit/SysRoleEdit.vue +111 -111
- package/src/config/index.js +74 -74
- package/src/directives/permission.js +49 -49
- package/src/main.js +37 -37
- package/src/stores/config.js +43 -43
- package/src/stores/dict.js +33 -33
- package/src/stores/menu.js +81 -81
- package/src/stores/user.js +21 -21
- package/src/utils/baseEcharts.js +661 -661
- package/src/utils/dictTemplate.js +26 -26
- package/src/utils/regionUtils.js +173 -173
- package/src/utils/useFormCRUD.js +59 -59
- package/src/views/baiscstatis/center.vue +474 -474
- package/src/views/baiscstatis/iframePage.vue +29 -29
- package/src/views/baiscstatis/notFound.vue +192 -192
- package/src/views/console.vue +821 -821
- package/src/views/demo/button.vue +269 -269
- package/src/views/demo/importexport.vue +119 -119
- package/src/views/demo/region.vue +322 -322
- package/src/views/demo/statistics.vue +214 -214
- package/src/views/home.vue +6 -6
- package/src/views/operations/log/logError.vue +78 -78
- package/src/views/operations/log/logLogin.vue +66 -66
- package/src/views/operations/log/logOperation.vue +103 -103
- package/src/views/operations/log/logQuartz.vue +56 -56
- package/src/views/operations/quartz.vue +179 -179
- package/src/views/operations/serviceMonitoring.vue +134 -134
- package/src/views/system/sysAccount.vue +128 -128
- package/src/views/system/sysDict.vue +159 -159
- package/src/views/system/sysDictItem.vue +118 -118
- package/src/views/system/sysMenu.vue +225 -225
- package/src/views/system/sysRole.vue +207 -207
- package/vite.config.js +33 -0
|
@@ -1,118 +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>
|
|
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>
|
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<form-table
|
|
3
|
-
:formState="formState"
|
|
4
|
-
:columns="columns"
|
|
5
|
-
modulePath="sysMenu"
|
|
6
|
-
pageAction="MenuTreeList"
|
|
7
|
-
:permissionModulePath="permissionModulePath"
|
|
8
|
-
method="get"
|
|
9
|
-
:page="false"
|
|
10
|
-
@update="edit"
|
|
11
|
-
@edit="edit"
|
|
12
|
-
ref="childRef"
|
|
13
|
-
>
|
|
14
|
-
<!-- 可以通过插槽自定义单元格 -->
|
|
15
|
-
<!-- <template #custom-title="{ record }">
|
|
16
|
-
{{record.type != 4 ? record.title : record.btnName}}
|
|
17
|
-
</template> -->
|
|
18
|
-
<template #custom-isEnable="{ record }">
|
|
19
|
-
<a-switch
|
|
20
|
-
v-model:checked="record.isEnable"
|
|
21
|
-
checked-children="是"
|
|
22
|
-
un-checked-children="否"
|
|
23
|
-
@change="handleSwitchIsEnableChange(record)"
|
|
24
|
-
/>
|
|
25
|
-
</template>
|
|
26
|
-
<template #custom-cache="{ record }">
|
|
27
|
-
<a-switch
|
|
28
|
-
v-if="record.type != 4"
|
|
29
|
-
v-model:checked="record.cache"
|
|
30
|
-
checked-children="是"
|
|
31
|
-
un-checked-children="否"
|
|
32
|
-
@change="handleSwitchCacheChange(record)"
|
|
33
|
-
/>
|
|
34
|
-
</template>
|
|
35
|
-
<template #custom-isShowMenu="{ record }">
|
|
36
|
-
<a-switch
|
|
37
|
-
v-if="record.type != 4"
|
|
38
|
-
v-model:checked="record.isShowMenu"
|
|
39
|
-
checked-children="是"
|
|
40
|
-
un-checked-children="否"
|
|
41
|
-
@change="handleSwitchIsShowMenuChange(record)"
|
|
42
|
-
/>
|
|
43
|
-
</template>
|
|
44
|
-
|
|
45
|
-
<template #custom-icon="{ record }">
|
|
46
|
-
<component
|
|
47
|
-
v-if="record.icon && $icons[record.icon]"
|
|
48
|
-
:is="$icons[record.icon]"
|
|
49
|
-
/>
|
|
50
|
-
<span v-else>{{ record.icon }}</span>
|
|
51
|
-
</template>
|
|
52
|
-
<template #custom-type="{ record }">
|
|
53
|
-
<a-tag v-if="record.type == 1" color="blue">目录</a-tag>
|
|
54
|
-
<a-tag v-if="record.type == 2" color="cyan">菜单</a-tag>
|
|
55
|
-
<a-tag v-if="record.type == 3" color="purple">链接</a-tag>
|
|
56
|
-
<a-tag v-if="record.type == 4" color="orange">按钮</a-tag>
|
|
57
|
-
</template>
|
|
58
|
-
<template #custom-operation="{ record }">
|
|
59
|
-
<a-divider type="vertical" />
|
|
60
|
-
<a v-if="record.type == 1" @click="addSubmenu(record)">新增子菜单</a>
|
|
61
|
-
<a v-if="record.type == 2" @click="addSubtn(record)">新增按钮</a>
|
|
62
|
-
</template>
|
|
63
|
-
</form-table>
|
|
64
|
-
<!-- 新增修改 -->
|
|
65
|
-
<sysMenuEdit
|
|
66
|
-
:open="editopen"
|
|
67
|
-
@close="editopen = false"
|
|
68
|
-
@updateData="refreshData"
|
|
69
|
-
ref="editRef"
|
|
70
|
-
>
|
|
71
|
-
</sysMenuEdit>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<style></style>
|
|
75
|
-
|
|
76
|
-
<script setup>
|
|
77
|
-
import { ref, inject, getCurrentInstance } from 'vue'
|
|
78
|
-
import FormTable from '@/components/FormTable.vue'
|
|
79
|
-
import sysMenuEdit from '@/components/edit/sysMenuEdit.vue'
|
|
80
|
-
import sysMenu from '@/api/methods/sysMenu'
|
|
81
|
-
import { menuStore } from '@/stores/menu'
|
|
82
|
-
// 权限模块路径
|
|
83
|
-
const permissionModulePath = ref('system:sysRole')
|
|
84
|
-
// 获取当前实例,以便访问全局图标
|
|
85
|
-
const { proxy } = getCurrentInstance()
|
|
86
|
-
const $icons = proxy.$icons
|
|
87
|
-
// 注入父组件的方法
|
|
88
|
-
const menuinit = inject('menuinit')
|
|
89
|
-
const formState = ref({
|
|
90
|
-
name: { label: '菜单名', value: '', type: 'text' },
|
|
91
|
-
})
|
|
92
|
-
const columns = ref([
|
|
93
|
-
{
|
|
94
|
-
title: '菜单名',
|
|
95
|
-
dataIndex: 'title',
|
|
96
|
-
resizable: true,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
title: '图标',
|
|
100
|
-
key: 'icon',
|
|
101
|
-
resizable: true,
|
|
102
|
-
width: 50,
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
title: '类型',
|
|
106
|
-
key: 'type',
|
|
107
|
-
resizable: true,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
title: '命名路由',
|
|
111
|
-
dataIndex: 'path',
|
|
112
|
-
resizable: true,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
title: '权限标识',
|
|
116
|
-
dataIndex: 'perms',
|
|
117
|
-
resizable: true,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
title: '排序',
|
|
121
|
-
dataIndex: 'sort',
|
|
122
|
-
resizable: true,
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
title: '是否启用',
|
|
126
|
-
key: 'isEnable',
|
|
127
|
-
resizable: true,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
title: '显示系统菜单栏',
|
|
131
|
-
key: 'isShowMenu',
|
|
132
|
-
resizable: 'true',
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
title: '是否缓存',
|
|
136
|
-
key: 'cache',
|
|
137
|
-
resizable: true,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
title: '创建时间',
|
|
141
|
-
dataIndex: 'createTime',
|
|
142
|
-
resizable: true,
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
title: '操作',
|
|
146
|
-
key: 'operation',
|
|
147
|
-
fixed: 'right',
|
|
148
|
-
width: 200,
|
|
149
|
-
},
|
|
150
|
-
])
|
|
151
|
-
const childRef = ref(null)
|
|
152
|
-
|
|
153
|
-
//编辑
|
|
154
|
-
const editopen = ref(false)
|
|
155
|
-
const editRef = ref(null)
|
|
156
|
-
const edit = record => {
|
|
157
|
-
editRef.value.getMenuTree()
|
|
158
|
-
editRef.value.init(record.id)
|
|
159
|
-
editopen.value = true
|
|
160
|
-
}
|
|
161
|
-
//新增子菜单
|
|
162
|
-
const addSubmenu = record => {
|
|
163
|
-
editRef.value.getMenuTree()
|
|
164
|
-
editRef.value.addSubmenu(record)
|
|
165
|
-
editopen.value = true
|
|
166
|
-
}
|
|
167
|
-
const addSubtn = record => {
|
|
168
|
-
editRef.value.getMenuTree()
|
|
169
|
-
editRef.value.addSubtn(record)
|
|
170
|
-
editopen.value = true
|
|
171
|
-
}
|
|
172
|
-
const refreshData = () => {
|
|
173
|
-
const menu = menuStore()
|
|
174
|
-
sysMenu.getRoutesMenu().then(res => {
|
|
175
|
-
menu.menus = res.data
|
|
176
|
-
if (menuinit) {
|
|
177
|
-
menuinit()
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
childRef.value.tableLoad()
|
|
181
|
-
}
|
|
182
|
-
//修改是否启用
|
|
183
|
-
const handleSwitchIsEnableChange = record => {
|
|
184
|
-
var data = {
|
|
185
|
-
id: record.id,
|
|
186
|
-
isEnabled: record.isEnable,
|
|
187
|
-
}
|
|
188
|
-
sysMenu.updateIsEnabled(data).then(() => {
|
|
189
|
-
childRef.value.tableLoad()
|
|
190
|
-
})
|
|
191
|
-
}
|
|
192
|
-
//修改是否缓存
|
|
193
|
-
const handleSwitchCacheChange = record => {
|
|
194
|
-
var data = {
|
|
195
|
-
id: record.id,
|
|
196
|
-
cache: record.cache,
|
|
197
|
-
}
|
|
198
|
-
sysMenu.updateCache(data).then(() => {
|
|
199
|
-
childRef.value.tableLoad()
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
//修改是否启用
|
|
203
|
-
const handleSwitchIsShowMenuChange = record => {
|
|
204
|
-
var data = {
|
|
205
|
-
id: record.id,
|
|
206
|
-
isShowMenu: record.isShowMenu,
|
|
207
|
-
}
|
|
208
|
-
sysMenu.updateIsShowMenu(data).then(() => {
|
|
209
|
-
childRef.value.tableLoad()
|
|
210
|
-
})
|
|
211
|
-
}
|
|
212
|
-
</script>
|
|
213
|
-
|
|
214
|
-
<style>
|
|
215
|
-
.slide-enter-active,
|
|
216
|
-
.slide-leave-active {
|
|
217
|
-
transition: transform 0.5s;
|
|
218
|
-
}
|
|
219
|
-
.slide-enter {
|
|
220
|
-
transform: translateX(-100%);
|
|
221
|
-
}
|
|
222
|
-
.slide-leave-to {
|
|
223
|
-
transform: translateX(-100%);
|
|
224
|
-
}
|
|
225
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<form-table
|
|
3
|
+
:formState="formState"
|
|
4
|
+
:columns="columns"
|
|
5
|
+
modulePath="sysMenu"
|
|
6
|
+
pageAction="MenuTreeList"
|
|
7
|
+
:permissionModulePath="permissionModulePath"
|
|
8
|
+
method="get"
|
|
9
|
+
:page="false"
|
|
10
|
+
@update="edit"
|
|
11
|
+
@edit="edit"
|
|
12
|
+
ref="childRef"
|
|
13
|
+
>
|
|
14
|
+
<!-- 可以通过插槽自定义单元格 -->
|
|
15
|
+
<!-- <template #custom-title="{ record }">
|
|
16
|
+
{{record.type != 4 ? record.title : record.btnName}}
|
|
17
|
+
</template> -->
|
|
18
|
+
<template #custom-isEnable="{ record }">
|
|
19
|
+
<a-switch
|
|
20
|
+
v-model:checked="record.isEnable"
|
|
21
|
+
checked-children="是"
|
|
22
|
+
un-checked-children="否"
|
|
23
|
+
@change="handleSwitchIsEnableChange(record)"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
<template #custom-cache="{ record }">
|
|
27
|
+
<a-switch
|
|
28
|
+
v-if="record.type != 4"
|
|
29
|
+
v-model:checked="record.cache"
|
|
30
|
+
checked-children="是"
|
|
31
|
+
un-checked-children="否"
|
|
32
|
+
@change="handleSwitchCacheChange(record)"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
35
|
+
<template #custom-isShowMenu="{ record }">
|
|
36
|
+
<a-switch
|
|
37
|
+
v-if="record.type != 4"
|
|
38
|
+
v-model:checked="record.isShowMenu"
|
|
39
|
+
checked-children="是"
|
|
40
|
+
un-checked-children="否"
|
|
41
|
+
@change="handleSwitchIsShowMenuChange(record)"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<template #custom-icon="{ record }">
|
|
46
|
+
<component
|
|
47
|
+
v-if="record.icon && $icons[record.icon]"
|
|
48
|
+
:is="$icons[record.icon]"
|
|
49
|
+
/>
|
|
50
|
+
<span v-else>{{ record.icon }}</span>
|
|
51
|
+
</template>
|
|
52
|
+
<template #custom-type="{ record }">
|
|
53
|
+
<a-tag v-if="record.type == 1" color="blue">目录</a-tag>
|
|
54
|
+
<a-tag v-if="record.type == 2" color="cyan">菜单</a-tag>
|
|
55
|
+
<a-tag v-if="record.type == 3" color="purple">链接</a-tag>
|
|
56
|
+
<a-tag v-if="record.type == 4" color="orange">按钮</a-tag>
|
|
57
|
+
</template>
|
|
58
|
+
<template #custom-operation="{ record }">
|
|
59
|
+
<a-divider type="vertical" />
|
|
60
|
+
<a v-if="record.type == 1" @click="addSubmenu(record)">新增子菜单</a>
|
|
61
|
+
<a v-if="record.type == 2" @click="addSubtn(record)">新增按钮</a>
|
|
62
|
+
</template>
|
|
63
|
+
</form-table>
|
|
64
|
+
<!-- 新增修改 -->
|
|
65
|
+
<sysMenuEdit
|
|
66
|
+
:open="editopen"
|
|
67
|
+
@close="editopen = false"
|
|
68
|
+
@updateData="refreshData"
|
|
69
|
+
ref="editRef"
|
|
70
|
+
>
|
|
71
|
+
</sysMenuEdit>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<style></style>
|
|
75
|
+
|
|
76
|
+
<script setup>
|
|
77
|
+
import { ref, inject, getCurrentInstance } from 'vue'
|
|
78
|
+
import FormTable from '@/components/FormTable.vue'
|
|
79
|
+
import sysMenuEdit from '@/components/edit/sysMenuEdit.vue'
|
|
80
|
+
import sysMenu from '@/api/methods/sysMenu'
|
|
81
|
+
import { menuStore } from '@/stores/menu'
|
|
82
|
+
// 权限模块路径
|
|
83
|
+
const permissionModulePath = ref('system:sysRole')
|
|
84
|
+
// 获取当前实例,以便访问全局图标
|
|
85
|
+
const { proxy } = getCurrentInstance()
|
|
86
|
+
const $icons = proxy.$icons
|
|
87
|
+
// 注入父组件的方法
|
|
88
|
+
const menuinit = inject('menuinit')
|
|
89
|
+
const formState = ref({
|
|
90
|
+
name: { label: '菜单名', value: '', type: 'text' },
|
|
91
|
+
})
|
|
92
|
+
const columns = ref([
|
|
93
|
+
{
|
|
94
|
+
title: '菜单名',
|
|
95
|
+
dataIndex: 'title',
|
|
96
|
+
resizable: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: '图标',
|
|
100
|
+
key: 'icon',
|
|
101
|
+
resizable: true,
|
|
102
|
+
width: 50,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: '类型',
|
|
106
|
+
key: 'type',
|
|
107
|
+
resizable: true,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
title: '命名路由',
|
|
111
|
+
dataIndex: 'path',
|
|
112
|
+
resizable: true,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: '权限标识',
|
|
116
|
+
dataIndex: 'perms',
|
|
117
|
+
resizable: true,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
title: '排序',
|
|
121
|
+
dataIndex: 'sort',
|
|
122
|
+
resizable: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
title: '是否启用',
|
|
126
|
+
key: 'isEnable',
|
|
127
|
+
resizable: true,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: '显示系统菜单栏',
|
|
131
|
+
key: 'isShowMenu',
|
|
132
|
+
resizable: 'true',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
title: '是否缓存',
|
|
136
|
+
key: 'cache',
|
|
137
|
+
resizable: true,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
title: '创建时间',
|
|
141
|
+
dataIndex: 'createTime',
|
|
142
|
+
resizable: true,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
title: '操作',
|
|
146
|
+
key: 'operation',
|
|
147
|
+
fixed: 'right',
|
|
148
|
+
width: 200,
|
|
149
|
+
},
|
|
150
|
+
])
|
|
151
|
+
const childRef = ref(null)
|
|
152
|
+
|
|
153
|
+
//编辑
|
|
154
|
+
const editopen = ref(false)
|
|
155
|
+
const editRef = ref(null)
|
|
156
|
+
const edit = record => {
|
|
157
|
+
editRef.value.getMenuTree()
|
|
158
|
+
editRef.value.init(record.id)
|
|
159
|
+
editopen.value = true
|
|
160
|
+
}
|
|
161
|
+
//新增子菜单
|
|
162
|
+
const addSubmenu = record => {
|
|
163
|
+
editRef.value.getMenuTree()
|
|
164
|
+
editRef.value.addSubmenu(record)
|
|
165
|
+
editopen.value = true
|
|
166
|
+
}
|
|
167
|
+
const addSubtn = record => {
|
|
168
|
+
editRef.value.getMenuTree()
|
|
169
|
+
editRef.value.addSubtn(record)
|
|
170
|
+
editopen.value = true
|
|
171
|
+
}
|
|
172
|
+
const refreshData = () => {
|
|
173
|
+
const menu = menuStore()
|
|
174
|
+
sysMenu.getRoutesMenu().then(res => {
|
|
175
|
+
menu.menus = res.data
|
|
176
|
+
if (menuinit) {
|
|
177
|
+
menuinit()
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
childRef.value.tableLoad()
|
|
181
|
+
}
|
|
182
|
+
//修改是否启用
|
|
183
|
+
const handleSwitchIsEnableChange = record => {
|
|
184
|
+
var data = {
|
|
185
|
+
id: record.id,
|
|
186
|
+
isEnabled: record.isEnable,
|
|
187
|
+
}
|
|
188
|
+
sysMenu.updateIsEnabled(data).then(() => {
|
|
189
|
+
childRef.value.tableLoad()
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
//修改是否缓存
|
|
193
|
+
const handleSwitchCacheChange = record => {
|
|
194
|
+
var data = {
|
|
195
|
+
id: record.id,
|
|
196
|
+
cache: record.cache,
|
|
197
|
+
}
|
|
198
|
+
sysMenu.updateCache(data).then(() => {
|
|
199
|
+
childRef.value.tableLoad()
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
//修改是否启用
|
|
203
|
+
const handleSwitchIsShowMenuChange = record => {
|
|
204
|
+
var data = {
|
|
205
|
+
id: record.id,
|
|
206
|
+
isShowMenu: record.isShowMenu,
|
|
207
|
+
}
|
|
208
|
+
sysMenu.updateIsShowMenu(data).then(() => {
|
|
209
|
+
childRef.value.tableLoad()
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<style>
|
|
215
|
+
.slide-enter-active,
|
|
216
|
+
.slide-leave-active {
|
|
217
|
+
transition: transform 0.5s;
|
|
218
|
+
}
|
|
219
|
+
.slide-enter {
|
|
220
|
+
transform: translateX(-100%);
|
|
221
|
+
}
|
|
222
|
+
.slide-leave-to {
|
|
223
|
+
transform: translateX(-100%);
|
|
224
|
+
}
|
|
225
|
+
</style>
|