zant-admin 2.0.0 → 2.0.1

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 (81) hide show
  1. package/README.md +460 -268
  2. package/bin/cli.js +1 -1
  3. package/bin/generator.js +502 -502
  4. package/bin/prompts.js +158 -158
  5. package/bin/utils.js +133 -133
  6. package/package.json +1 -1
  7. package/public/logo.png +0 -0
  8. package/src/App.vue +16 -16
  9. package/src/api/methods/department.js +36 -0
  10. package/src/api/methods/employee.js +22 -0
  11. package/src/api/methods/logError.js +8 -8
  12. package/src/api/methods/logOperation.js +8 -8
  13. package/src/api/methods/login.js +6 -6
  14. package/src/api/methods/position.js +26 -0
  15. package/src/api/methods/quartz.js +36 -36
  16. package/src/api/methods/region.js +16 -16
  17. package/src/api/methods/sysAccount.js +29 -29
  18. package/src/api/methods/sysDict.js +29 -29
  19. package/src/api/methods/sysDictItem.js +26 -26
  20. package/src/api/methods/sysMenu.js +42 -42
  21. package/src/api/methods/sysRole.js +35 -35
  22. package/src/api/methods/sysUser.js +25 -25
  23. package/src/api/methods/system.js +15 -15
  24. package/src/api/request.js +225 -225
  25. package/src/assets/css/style.css +2 -2
  26. package/src/assets/css/zcui.css +1023 -1023
  27. package/src/assets/imgs/logo.png +0 -0
  28. package/src/assets/imgs/md/console.png +0 -0
  29. package/src/assets/imgs/md/login.png +0 -0
  30. package/src/assets/imgs/md/menu.png +0 -0
  31. package/src/assets/imgs/md/serviceMonitoring.png +0 -0
  32. package/src/assets/imgs/md/statistics.png +0 -0
  33. package/src/components/FormTable.vue +5 -19
  34. package/src/components/IconPicker.vue +351 -351
  35. package/src/components/MainPage.vue +838 -838
  36. package/src/components/details/logErrorDetails.vue +58 -58
  37. package/src/components/details/logOperationDetails.vue +76 -76
  38. package/src/components/edit/QuartzEdit.vue +221 -221
  39. package/src/components/edit/SysAccountEdit.vue +185 -185
  40. package/src/components/edit/SysDictEdit.vue +116 -116
  41. package/src/components/edit/SysDictItemEdit.vue +136 -136
  42. package/src/components/edit/SysRoleEdit.vue +111 -111
  43. package/src/components/edit/organizationalStructure/DepartmentEdit.vue +162 -0
  44. package/src/components/edit/organizationalStructure/EmployeeEdit.vue +295 -0
  45. package/src/components/edit/organizationalStructure/PositionEdit.vue +166 -0
  46. package/src/components/edit/sysMenuEdit.vue +2 -1
  47. package/src/config/index.js +74 -74
  48. package/src/directives/permission.js +49 -49
  49. package/src/main.js +37 -37
  50. package/src/stores/config.js +43 -43
  51. package/src/stores/dict.js +33 -33
  52. package/src/stores/menu.js +81 -81
  53. package/src/stores/user.js +21 -21
  54. package/src/utils/baseEcharts.js +661 -661
  55. package/src/utils/dictTemplate.js +26 -26
  56. package/src/utils/regionUtils.js +173 -173
  57. package/src/utils/useFormCRUD.js +59 -59
  58. package/src/views/baiscstatis/center.vue +474 -474
  59. package/src/views/baiscstatis/iframePage.vue +29 -29
  60. package/src/views/baiscstatis/notFound.vue +192 -192
  61. package/src/views/console.vue +821 -821
  62. package/src/views/demo/button.vue +269 -269
  63. package/src/views/demo/importexport.vue +119 -119
  64. package/src/views/demo/region.vue +322 -322
  65. package/src/views/demo/statistics.vue +214 -214
  66. package/src/views/home.vue +6 -6
  67. package/src/views/login.vue +12 -2
  68. package/src/views/operations/log/logError.vue +78 -78
  69. package/src/views/operations/log/logLogin.vue +66 -66
  70. package/src/views/operations/log/logOperation.vue +103 -103
  71. package/src/views/operations/log/logQuartz.vue +56 -56
  72. package/src/views/operations/quartz.vue +179 -179
  73. package/src/views/operations/serviceMonitoring.vue +134 -134
  74. package/src/views/organizationalStructure/department.vue +194 -0
  75. package/src/views/organizationalStructure/employee.vue +234 -0
  76. package/src/views/organizationalStructure/position.vue +196 -0
  77. package/src/views/system/sysAccount.vue +128 -128
  78. package/src/views/system/sysDict.vue +159 -159
  79. package/src/views/system/sysDictItem.vue +118 -118
  80. package/src/views/system/sysMenu.vue +225 -225
  81. package/src/views/system/sysRole.vue +207 -207
@@ -1,26 +1,26 @@
1
- import { dictStore } from '@/stores/dict'
2
- const dict = dictStore()
3
- const dictTemplate = {
4
- tabletempInt(type, value) {
5
- var data = dict.getDictItems(type)
6
- if (data) {
7
- for (var i = 0; i < data.length; i++) {
8
- if (data[i].value == value) {
9
- return `<span class="${data[i].colorClass}">${data[i].label}</span>`
10
- }
11
- }
12
- }
13
- },
14
- tabletempbool(type, value) {
15
- var data = dict.getDictItems(type)
16
- var val = value ? 1 : 0
17
- if (data) {
18
- for (var i = 0; i < data.length; i++) {
19
- if (data[i].value == val) {
20
- return `<span class="${data[i].colorClass}">${data[i].label}</span>`
21
- }
22
- }
23
- }
24
- },
25
- }
26
- export default dictTemplate
1
+ import { dictStore } from '@/stores/dict'
2
+ const dict = dictStore()
3
+ const dictTemplate = {
4
+ tabletempInt(type, value) {
5
+ var data = dict.getDictItems(type)
6
+ if (data) {
7
+ for (var i = 0; i < data.length; i++) {
8
+ if (data[i].value == value) {
9
+ return `<span class="${data[i].colorClass}">${data[i].label}</span>`
10
+ }
11
+ }
12
+ }
13
+ },
14
+ tabletempbool(type, value) {
15
+ var data = dict.getDictItems(type)
16
+ var val = value ? 1 : 0
17
+ if (data) {
18
+ for (var i = 0; i < data.length; i++) {
19
+ if (data[i].value == val) {
20
+ return `<span class="${data[i].colorClass}">${data[i].label}</span>`
21
+ }
22
+ }
23
+ }
24
+ },
25
+ }
26
+ export default dictTemplate
@@ -1,173 +1,173 @@
1
- import { ref } from 'vue'
2
- import region from '@/api/methods/region'
3
-
4
- // 存储原始省市区数据,用于前端查询
5
- const provinceData = ref([])
6
- const cityData = ref([])
7
- const areaData = ref([])
8
- const allCity = ref([])
9
- const allAreas = ref([])
10
-
11
- /**
12
- * 一次性获取所有省市区数据
13
- * @returns {Promise} 返回获取数据的Promise
14
- */
15
- const fetchAllAddressData = async () => {
16
- try {
17
- // 并行获取所有省市区数据
18
- const [provinceRes, cityRes, areaRes] = await Promise.all([
19
- region.getAllProvince(),
20
- region.getAllCity(),
21
- region.getAllAreas(),
22
- ])
23
-
24
- // 存储原始数据
25
- provinceData.value = provinceRes.data
26
- cityData.value = cityRes.data
27
- areaData.value = areaRes.data
28
-
29
- // 设置所有城市数据
30
- allCity.value = cityData.value.map(item => ({
31
- label: item.name,
32
- value: item.adcode,
33
- }))
34
-
35
- // 设置所有区域数据
36
- allAreas.value = areaData.value.map(item => ({
37
- label: item.name,
38
- value: item.adcode,
39
- }))
40
-
41
- return {
42
- provinces: provinceData.value.map(item => ({
43
- label: item.name,
44
- value: item.adcode,
45
- })),
46
- cities: allCity.value,
47
- areas: allAreas.value,
48
- }
49
- } catch (error) {
50
- console.error('获取省市区数据失败:', error)
51
- throw error
52
- }
53
- }
54
-
55
- /**
56
- * 根据省份代码查询城市数据
57
- * @param {string} provinceCode - 省份代码(adcode)
58
- * @returns {Array} 城市数据数组
59
- */
60
- const getCitiesByProvinceCode = provinceCode => {
61
- if (!provinceCode || !cityData.value.length) return []
62
- return cityData.value
63
- .filter(city => city.parentAdcode === provinceCode)
64
- .map(city => ({
65
- label: city.name,
66
- value: city.adcode,
67
- }))
68
- }
69
-
70
- /**
71
- * 根据城市代码查询区域数据
72
- * @param {string} cityCode - 城市代码(adcode)
73
- * @returns {Array} 区域数据数组
74
- */
75
- const getAreasByCityCode = cityCode => {
76
- if (!cityCode || !areaData.value.length) return []
77
- return areaData.value
78
- .filter(area => area.parentAdcode === cityCode)
79
- .map(area => ({
80
- label: area.name,
81
- value: area.adcode,
82
- }))
83
- }
84
-
85
- /**
86
- * 获取所有省份数据
87
- * @returns {Array} 省份数据数组
88
- */
89
- const getAllProvinces = () => {
90
- return provinceData.value.map(item => ({
91
- label: item.name,
92
- value: item.adcode,
93
- }))
94
- }
95
-
96
- /**
97
- * 获取所有城市数据
98
- * @returns {Array} 城市数据数组
99
- */
100
- const getAllCities = () => {
101
- return allCity.value
102
- }
103
-
104
- /**
105
- * 获取所有区域数据
106
- * @returns {Array} 区域数据数组
107
- */
108
- const getAllAreas = () => {
109
- return allAreas.value
110
- }
111
-
112
- /**
113
- * 根据adcode获取省份信息
114
- * @param {string} adcode - 省份adcode
115
- * @returns {Object} 省份信息对象
116
- */
117
- const getProvinceByAdcode = adcode => {
118
- if (!adcode || !provinceData.value.length) return null
119
- return provinceData.value.find(province => province.adcode === adcode)
120
- }
121
-
122
- /**
123
- * 根据adcode获取城市信息
124
- * @param {string} adcode - 城市adcode
125
- * @returns {Object} 城市信息对象
126
- */
127
- const getCityByAdcode = adcode => {
128
- if (!adcode || !cityData.value.length) return null
129
- return cityData.value.find(city => city.adcode === adcode)
130
- }
131
-
132
- /**
133
- * 根据adcode获取区域信息
134
- * @param {string} adcode - 区域adcode
135
- * @returns {Object} 区域信息对象
136
- */
137
- const getAreaByAdcode = adcode => {
138
- if (!adcode || !areaData.value.length) return null
139
- return areaData.value.find(area => area.adcode === adcode)
140
- }
141
-
142
- /**
143
- * 获取完整的省市区名称
144
- * @param {string} provinceAdcode - 省份adcode
145
- * @param {string} cityAdcode - 城市adcode
146
- * @param {string} areaAdcode - 区域adcode
147
- * @returns {string} 完整的省市区名称
148
- */
149
- const getFullAddressName = (provinceAdcode, cityAdcode, areaAdcode) => {
150
- const province = getProvinceByAdcode(provinceAdcode)
151
- const city = getCityByAdcode(cityAdcode)
152
- const area = getAreaByAdcode(areaAdcode)
153
-
154
- const parts = []
155
- if (province) parts.push(province.name)
156
- if (city) parts.push(city.name)
157
- if (area) parts.push(area.name)
158
-
159
- return parts.join('')
160
- }
161
-
162
- export default {
163
- fetchAllAddressData,
164
- getCitiesByProvinceCode,
165
- getAreasByCityCode,
166
- getAllProvinces,
167
- getAllCities,
168
- getAllAreas,
169
- getProvinceByAdcode,
170
- getCityByAdcode,
171
- getAreaByAdcode,
172
- getFullAddressName,
173
- }
1
+ import { ref } from 'vue'
2
+ import region from '@/api/methods/region'
3
+
4
+ // 存储原始省市区数据,用于前端查询
5
+ const provinceData = ref([])
6
+ const cityData = ref([])
7
+ const areaData = ref([])
8
+ const allCity = ref([])
9
+ const allAreas = ref([])
10
+
11
+ /**
12
+ * 一次性获取所有省市区数据
13
+ * @returns {Promise} 返回获取数据的Promise
14
+ */
15
+ const fetchAllAddressData = async () => {
16
+ try {
17
+ // 并行获取所有省市区数据
18
+ const [provinceRes, cityRes, areaRes] = await Promise.all([
19
+ region.getAllProvince(),
20
+ region.getAllCity(),
21
+ region.getAllAreas(),
22
+ ])
23
+
24
+ // 存储原始数据
25
+ provinceData.value = provinceRes.data
26
+ cityData.value = cityRes.data
27
+ areaData.value = areaRes.data
28
+
29
+ // 设置所有城市数据
30
+ allCity.value = cityData.value.map(item => ({
31
+ label: item.name,
32
+ value: item.adcode,
33
+ }))
34
+
35
+ // 设置所有区域数据
36
+ allAreas.value = areaData.value.map(item => ({
37
+ label: item.name,
38
+ value: item.adcode,
39
+ }))
40
+
41
+ return {
42
+ provinces: provinceData.value.map(item => ({
43
+ label: item.name,
44
+ value: item.adcode,
45
+ })),
46
+ cities: allCity.value,
47
+ areas: allAreas.value,
48
+ }
49
+ } catch (error) {
50
+ console.error('获取省市区数据失败:', error)
51
+ throw error
52
+ }
53
+ }
54
+
55
+ /**
56
+ * 根据省份代码查询城市数据
57
+ * @param {string} provinceCode - 省份代码(adcode)
58
+ * @returns {Array} 城市数据数组
59
+ */
60
+ const getCitiesByProvinceCode = provinceCode => {
61
+ if (!provinceCode || !cityData.value.length) return []
62
+ return cityData.value
63
+ .filter(city => city.parentAdcode === provinceCode)
64
+ .map(city => ({
65
+ label: city.name,
66
+ value: city.adcode,
67
+ }))
68
+ }
69
+
70
+ /**
71
+ * 根据城市代码查询区域数据
72
+ * @param {string} cityCode - 城市代码(adcode)
73
+ * @returns {Array} 区域数据数组
74
+ */
75
+ const getAreasByCityCode = cityCode => {
76
+ if (!cityCode || !areaData.value.length) return []
77
+ return areaData.value
78
+ .filter(area => area.parentAdcode === cityCode)
79
+ .map(area => ({
80
+ label: area.name,
81
+ value: area.adcode,
82
+ }))
83
+ }
84
+
85
+ /**
86
+ * 获取所有省份数据
87
+ * @returns {Array} 省份数据数组
88
+ */
89
+ const getAllProvinces = () => {
90
+ return provinceData.value.map(item => ({
91
+ label: item.name,
92
+ value: item.adcode,
93
+ }))
94
+ }
95
+
96
+ /**
97
+ * 获取所有城市数据
98
+ * @returns {Array} 城市数据数组
99
+ */
100
+ const getAllCities = () => {
101
+ return allCity.value
102
+ }
103
+
104
+ /**
105
+ * 获取所有区域数据
106
+ * @returns {Array} 区域数据数组
107
+ */
108
+ const getAllAreas = () => {
109
+ return allAreas.value
110
+ }
111
+
112
+ /**
113
+ * 根据adcode获取省份信息
114
+ * @param {string} adcode - 省份adcode
115
+ * @returns {Object} 省份信息对象
116
+ */
117
+ const getProvinceByAdcode = adcode => {
118
+ if (!adcode || !provinceData.value.length) return null
119
+ return provinceData.value.find(province => province.adcode === adcode)
120
+ }
121
+
122
+ /**
123
+ * 根据adcode获取城市信息
124
+ * @param {string} adcode - 城市adcode
125
+ * @returns {Object} 城市信息对象
126
+ */
127
+ const getCityByAdcode = adcode => {
128
+ if (!adcode || !cityData.value.length) return null
129
+ return cityData.value.find(city => city.adcode === adcode)
130
+ }
131
+
132
+ /**
133
+ * 根据adcode获取区域信息
134
+ * @param {string} adcode - 区域adcode
135
+ * @returns {Object} 区域信息对象
136
+ */
137
+ const getAreaByAdcode = adcode => {
138
+ if (!adcode || !areaData.value.length) return null
139
+ return areaData.value.find(area => area.adcode === adcode)
140
+ }
141
+
142
+ /**
143
+ * 获取完整的省市区名称
144
+ * @param {string} provinceAdcode - 省份adcode
145
+ * @param {string} cityAdcode - 城市adcode
146
+ * @param {string} areaAdcode - 区域adcode
147
+ * @returns {string} 完整的省市区名称
148
+ */
149
+ const getFullAddressName = (provinceAdcode, cityAdcode, areaAdcode) => {
150
+ const province = getProvinceByAdcode(provinceAdcode)
151
+ const city = getCityByAdcode(cityAdcode)
152
+ const area = getAreaByAdcode(areaAdcode)
153
+
154
+ const parts = []
155
+ if (province) parts.push(province.name)
156
+ if (city) parts.push(city.name)
157
+ if (area) parts.push(area.name)
158
+
159
+ return parts.join('')
160
+ }
161
+
162
+ export default {
163
+ fetchAllAddressData,
164
+ getCitiesByProvinceCode,
165
+ getAreasByCityCode,
166
+ getAllProvinces,
167
+ getAllCities,
168
+ getAllAreas,
169
+ getProvinceByAdcode,
170
+ getCityByAdcode,
171
+ getAreaByAdcode,
172
+ getFullAddressName,
173
+ }
@@ -1,59 +1,59 @@
1
- import { ref } from 'vue'
2
- import { message } from 'ant-design-vue'
3
-
4
- /**
5
- * 通用表单 CRUD Hook
6
- * @param {Object} api - API对象,例如 sysRole
7
- * @param {Object} [options] - 配置
8
- * @param {string} [options.addMethod='add'] - 新增方法名
9
- * @param {string} [options.updateMethod='update'] - 修改方法名
10
- * @param {boolean} [options.autoMessage=true] - 是否自动提示
11
- */
12
- export default function useFormCRUD(
13
- api,
14
- { addMethod = 'add', updateMethod = 'update', autoMessage = true } = {},
15
- ) {
16
- const loading = ref(false)
17
-
18
- /**
19
- * 保存表单
20
- * @param {Object} formRef - 表单 ref
21
- * @param {Object} formData - 表单数据
22
- * @param {Function} [onSuccess] - 成功回调
23
- * @param {Function} [onError] - 错误回调
24
- */
25
- const save = async (formRef, formData, { onSuccess, onError } = {}) => {
26
- try {
27
- // 校验表单
28
- await formRef?.validate()
29
- loading.value = true
30
-
31
- const method = formData.id ? updateMethod : addMethod
32
- const result = await api[method](formData)
33
- // 先显示提示,再执行回调
34
- if (autoMessage) {
35
- message.success(formData.id ? '修改成功' : '新增成功', 1, () => {
36
- onSuccess?.(result)
37
- })
38
- } else {
39
- onSuccess?.(result)
40
- }
41
-
42
- return result
43
- } catch (err) {
44
- if (err?.errorFields) {
45
- message.warning('请完善表单信息')
46
- } else {
47
- onError?.(err)
48
- if (autoMessage && onError) {
49
- message.error('操作失败,请重试')
50
- }
51
- }
52
- throw err
53
- } finally {
54
- loading.value = false
55
- }
56
- }
57
-
58
- return { loading, save }
59
- }
1
+ import { ref } from 'vue'
2
+ import { message } from 'ant-design-vue'
3
+
4
+ /**
5
+ * 通用表单 CRUD Hook
6
+ * @param {Object} api - API对象,例如 sysRole
7
+ * @param {Object} [options] - 配置
8
+ * @param {string} [options.addMethod='add'] - 新增方法名
9
+ * @param {string} [options.updateMethod='update'] - 修改方法名
10
+ * @param {boolean} [options.autoMessage=true] - 是否自动提示
11
+ */
12
+ export default function useFormCRUD(
13
+ api,
14
+ { addMethod = 'add', updateMethod = 'update', autoMessage = true } = {},
15
+ ) {
16
+ const loading = ref(false)
17
+
18
+ /**
19
+ * 保存表单
20
+ * @param {Object} formRef - 表单 ref
21
+ * @param {Object} formData - 表单数据
22
+ * @param {Function} [onSuccess] - 成功回调
23
+ * @param {Function} [onError] - 错误回调
24
+ */
25
+ const save = async (formRef, formData, { onSuccess, onError } = {}) => {
26
+ try {
27
+ // 校验表单
28
+ await formRef?.validate()
29
+ loading.value = true
30
+
31
+ const method = formData.id ? updateMethod : addMethod
32
+ const result = await api[method](formData)
33
+ // 先显示提示,再执行回调
34
+ if (autoMessage) {
35
+ message.success(formData.id ? '修改成功' : '新增成功', 1, () => {
36
+ onSuccess?.(result)
37
+ })
38
+ } else {
39
+ onSuccess?.(result)
40
+ }
41
+
42
+ return result
43
+ } catch (err) {
44
+ if (err?.errorFields) {
45
+ message.warning('请完善表单信息')
46
+ } else {
47
+ onError?.(err)
48
+ if (autoMessage && onError) {
49
+ message.error('操作失败,请重试')
50
+ }
51
+ }
52
+ throw err
53
+ } finally {
54
+ loading.value = false
55
+ }
56
+ }
57
+
58
+ return { loading, save }
59
+ }