zant-admin 1.0.1 → 2.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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +414 -25
  3. package/README.md +426 -277
  4. package/bin/cli.js +99 -99
  5. package/bin/generator.js +502 -502
  6. package/bin/prompts.js +158 -158
  7. package/bin/utils.js +133 -133
  8. package/package.json +3 -3
  9. package/public/logo.png +0 -0
  10. package/src/App.vue +1 -1
  11. package/src/api/methods/sysAccount.js +0 -1
  12. package/src/api/methods/sysDictItem.js +3 -3
  13. package/src/api/methods/system.js +10 -11
  14. package/src/api/request.js +39 -39
  15. package/src/assets/css/style.css +0 -11
  16. package/src/assets/css/zcui.css +1002 -319
  17. package/src/assets/imgs/logo.png +0 -0
  18. package/src/assets/imgs/md/console.png +0 -0
  19. package/src/assets/imgs/md/login.png +0 -0
  20. package/src/assets/imgs/md/menu.png +0 -0
  21. package/src/assets/imgs/md/serviceMonitoring.png +0 -0
  22. package/src/assets/imgs/md/statistics.png +0 -0
  23. package/src/components/FormTable.vue +50 -37
  24. package/src/components/IconPicker.vue +351 -344
  25. package/src/components/MainPage.vue +220 -339
  26. package/src/components/edit/QuartzEdit.vue +1 -1
  27. package/src/components/edit/SysAccountEdit.vue +15 -8
  28. package/src/components/edit/SysDictEdit.vue +6 -4
  29. package/src/components/edit/SysDictItemEdit.vue +8 -6
  30. package/src/components/edit/SysRoleEdit.vue +5 -3
  31. package/src/components/edit/sysMenuEdit.vue +10 -25
  32. package/src/config/index.js +74 -74
  33. package/src/directives/permission.js +49 -45
  34. package/src/main.js +2 -3
  35. package/src/router/index.js +48 -30
  36. package/src/stores/config.js +7 -1
  37. package/src/stores/menu.js +32 -8
  38. package/src/stores/user.js +17 -17
  39. package/src/utils/regionUtils.js +20 -16
  40. package/src/utils/useFormCRUD.js +59 -60
  41. package/src/views/baiscstatis/center.vue +53 -42
  42. package/src/views/baiscstatis/iframePage.vue +9 -11
  43. package/src/views/console.vue +92 -42
  44. package/src/views/demo/button.vue +269 -0
  45. package/src/views/demo/importexport.vue +8 -12
  46. package/src/views/demo/region.vue +103 -21
  47. package/src/views/demo/statistics.vue +38 -19
  48. package/src/views/home.vue +2 -3
  49. package/src/views/login.vue +254 -149
  50. package/src/views/operations/log/logQuartz.vue +0 -1
  51. package/src/views/operations/quartz.vue +22 -24
  52. package/src/views/system/sysAccount.vue +16 -11
  53. package/src/views/system/sysDict.vue +9 -6
  54. package/src/views/system/sysMenu.vue +17 -15
  55. package/src/views/system/sysRole.vue +44 -21
  56. package/SCAFFOLD_README.md +0 -215
  57. package/src/assets/imgs/md/1.png +0 -0
  58. package/src/assets/imgs/md/10.png +0 -0
  59. package/src/assets/imgs/md/11.png +0 -0
  60. package/src/assets/imgs/md/2.png +0 -0
  61. package/src/assets/imgs/md/3.png +0 -0
  62. package/src/assets/imgs/md/4.png +0 -0
  63. package/src/assets/imgs/md/5.png +0 -0
  64. package/src/assets/imgs/md/6.png +0 -0
  65. package/src/assets/imgs/md/7.png +0 -0
  66. package/src/assets/imgs/md/8.png +0 -0
  67. package/src/assets/imgs/md/9.png +0 -0
@@ -162,7 +162,7 @@ const { loading, save } = useFormCRUD(quartz)
162
162
  * @param {string} id - 任务ID,如果为空或默认UUID则表示新增任务
163
163
  */
164
164
  const init = async id => {
165
- const isEdit = !!id
165
+ const isEdit = !!id
166
166
  editTitle.value = isEdit ? '修改' : '新增'
167
167
 
168
168
  let assemblyData = null
@@ -21,13 +21,18 @@
21
21
  name="mobile"
22
22
  :rules="[{ required: true, message: '手机号不能为空' }]"
23
23
  >
24
- <a-input-number v-model:value="formInfo.mobile" placeholder="请输入" style="width: 100%" />
24
+ <a-input-number
25
+ v-model:value="formInfo.mobile"
26
+ placeholder="请输入"
27
+ style="width: 100%"
28
+ />
25
29
  </a-form-item>
26
30
  <a-form-item
27
31
  label="密码"
28
32
  name="password"
29
33
  v-if="formInfo.id == 0"
30
- :rules="[{ required: true, message: '密码不能为空' }]" >
34
+ :rules="[{ required: true, message: '密码不能为空' }]"
35
+ >
31
36
  <a-input-password
32
37
  v-model:value="formInfo.password"
33
38
  placeholder="请输入"
@@ -58,8 +63,10 @@
58
63
  </a-form>
59
64
 
60
65
  <template #extra>
61
- <a-space>
62
- <a-button type="primary" @click="onSave" :loading="loading">保存</a-button>
66
+ <a-space>
67
+ <a-button type="primary" @click="onSave" :loading="loading"
68
+ >保存</a-button
69
+ >
63
70
  <a-button @click="resetForm">重置</a-button>
64
71
  </a-space>
65
72
  </template>
@@ -136,8 +143,8 @@ const init = async id => {
136
143
  */
137
144
  const loadRoleList = async () => {
138
145
  try {
139
- const res = await sysRole.getList()
140
- roleList.value = res.data.map(x => ({
146
+ const res = await sysRole.getList()
147
+ roleList.value = res.data.map(x => ({
141
148
  label: x.name,
142
149
  value: x.id,
143
150
  }))
@@ -151,11 +158,11 @@ const loadRoleList = async () => {
151
158
  * 处理表单验证账号新增/修改操作
152
159
  */
153
160
  const onSave = async () => {
154
- await save(formRef.value, formInfo, {
161
+ await save(formRef.value, formInfo, {
155
162
  onSuccess: () => {
156
163
  emit('updateData')
157
164
  onClose()
158
- }
165
+ },
159
166
  })
160
167
  }
161
168
 
@@ -32,7 +32,9 @@
32
32
  </a-form>
33
33
  <template #extra>
34
34
  <a-space>
35
- <a-button type="primary" @click="onSave" :loading="loading">保存</a-button>
35
+ <a-button type="primary" @click="onSave" :loading="loading"
36
+ >保存</a-button
37
+ >
36
38
  <a-button @click="resetForm">重置</a-button>
37
39
  </a-space>
38
40
  </template>
@@ -93,12 +95,12 @@ const init = async id => {
93
95
  * 保存
94
96
  * 处理表单验证和角色新增/修改操作
95
97
  */
96
- const onSave = async() => {
97
- await save(formRef.value, formInfo, {
98
+ const onSave = async () => {
99
+ await save(formRef.value, formInfo, {
98
100
  onSuccess: () => {
99
101
  emit('updateData')
100
102
  onClose()
101
- }
103
+ },
102
104
  })
103
105
  }
104
106
  /**
@@ -48,7 +48,9 @@
48
48
  </a-form>
49
49
  <template #extra>
50
50
  <a-space>
51
- <a-button type="primary" @click="onSave" :loading="loading">保存</a-button>
51
+ <a-button type="primary" @click="onSave" :loading="loading"
52
+ >保存</a-button
53
+ >
52
54
  <a-button @click="resetForm">重置</a-button>
53
55
  </a-space>
54
56
  </template>
@@ -95,9 +97,9 @@ const resetForm = () => {
95
97
  const { loading, save } = useFormCRUD(sysDictItem)
96
98
 
97
99
  const init = async id => {
98
- const isEdit = !!id
100
+ const isEdit = !!id
99
101
  editTitle.value = isEdit ? '修改' : '新增'
100
- if (isEdit) {
102
+ if (isEdit) {
101
103
  try {
102
104
  const res = await sysDictItem.get({ id })
103
105
  Object.assign(formInfo, res.data)
@@ -105,17 +107,17 @@ if (isEdit) {
105
107
  message.error('获取信息失败,请重试')
106
108
  }
107
109
  } else {
108
- console.log("ss"+props.recordwhere)
110
+ console.log('ss' + props.recordwhere)
109
111
  resetForm()
110
112
  }
111
113
  }
112
114
 
113
- const onSave = async() => {
115
+ const onSave = async () => {
114
116
  await save(formRef.value, formInfo, {
115
117
  onSuccess: () => {
116
118
  emit('updateData')
117
119
  onClose()
118
- }
120
+ },
119
121
  })
120
122
  }
121
123
 
@@ -25,7 +25,9 @@
25
25
  </a-form>
26
26
  <template #extra>
27
27
  <a-space>
28
- <a-button type="primary" @click="onSave" :loading="loading">保存</a-button>
28
+ <a-button type="primary" @click="onSave" :loading="loading"
29
+ >保存</a-button
30
+ >
29
31
  <a-button @click="resetForm">重置</a-button>
30
32
  </a-space>
31
33
  </template>
@@ -89,11 +91,11 @@ const init = async id => {
89
91
  * 处理表单验证和角色新增/修改操作
90
92
  */
91
93
  const onSave = async () => {
92
- await save(formRef.value, formInfo, {
94
+ await save(formRef.value, formInfo, {
93
95
  onSuccess: () => {
94
96
  emit('updateData')
95
97
  onClose()
96
- }
98
+ },
97
99
  })
98
100
  }
99
101
  /**
@@ -47,17 +47,12 @@
47
47
  </a-form-item>
48
48
  </a-col>
49
49
  <a-col :span="12">
50
- <a-form-item
51
- label="命名路由"
52
- name="path"
53
- >
50
+ <a-form-item label="命名路由" name="path">
54
51
  <a-input v-model:value="formInfo.path" placeholder="请输入" />
55
52
  </a-form-item>
56
-
57
-
58
53
  </a-col>
59
54
  </a-row>
60
- <a-row :gutter="16" v-if="formInfo.type == 3" >
55
+ <a-row :gutter="16" v-if="formInfo.type == 3">
61
56
  <a-col :span="12">
62
57
  <a-form-item label="是否外链" name="cache">
63
58
  <a-switch v-model:checked="formInfo.isExternalLink" />
@@ -71,12 +66,11 @@
71
66
  </a-row>
72
67
  <a-row :gutter="16">
73
68
  <a-col :span="12">
74
- <a-form-item label="权限标识" name="perms">
69
+ <a-form-item label="权限标识" name="perms">
75
70
  <a-input v-model:value="formInfo.perms" placeholder="请输入" />
76
71
  </a-form-item>
77
72
  </a-col>
78
73
  <a-col :span="12">
79
-
80
74
  <a-form-item label="排序" name="Sort">
81
75
  <a-input-number
82
76
  v-model:value="formInfo.sort"
@@ -111,20 +105,12 @@
111
105
  </a-form-item>
112
106
  </a-col>
113
107
  <a-col :span="12">
114
- <a-form-item
115
- label="是否开启缓存"
116
- name="cache"
117
-
118
- >
108
+ <a-form-item label="是否开启缓存" name="cache">
119
109
  <a-switch v-model:checked="formInfo.cache" />
120
110
  </a-form-item>
121
111
  </a-col>
122
- <a-col :span="12">
123
- <a-form-item
124
- label="显示系统菜单栏"
125
- name="isShowMenu"
126
-
127
- >
112
+ <a-col :span="12">
113
+ <a-form-item label="显示系统菜单栏" name="isShowMenu">
128
114
  <a-switch v-model:checked="formInfo.isShowMenu" />
129
115
  </a-form-item>
130
116
  </a-col>
@@ -156,7 +142,7 @@ const props = defineProps({
156
142
  })
157
143
  // 根据权限标识动态生成按钮选项
158
144
  const btnoptions = computed(() => {
159
- const basePerms = formInfo.perms || '';
145
+ const basePerms = formInfo.perms || ''
160
146
  return [
161
147
  {
162
148
  label: '详情',
@@ -182,8 +168,8 @@ const btnoptions = computed(() => {
182
168
  label: '导出',
183
169
  value: basePerms ? `${basePerms}:export` : 'export',
184
170
  },
185
- ];
186
- });
171
+ ]
172
+ })
187
173
  //表单字段的默认值
188
174
  const defaultformInfo = {
189
175
  id: null,
@@ -198,7 +184,7 @@ const defaultformInfo = {
198
184
  isShowMenu: true,
199
185
  type: 1,
200
186
  isExternalLink: false,
201
- perms:'',
187
+ perms: '',
202
188
  btnoptions: [],
203
189
  }
204
190
  // 使用 reactive 定义表单状态
@@ -237,7 +223,6 @@ const init = async id => {
237
223
  const res = await sysMenu.get({ id })
238
224
  initloading.value = false
239
225
  Object.assign(formInfo, res.data)
240
-
241
226
  } catch (error) {
242
227
  message.error('获取信息失败,请重试')
243
228
  }
@@ -1,74 +1,74 @@
1
- /**
2
- * 全局配置文件
3
- * 用于定义项目的全局配置信息
4
- */
5
-
6
- // 项目基本信息
7
- export const projectConfig = {
8
- // 项目名称
9
- name: 'ZAntAdmin',
10
- // 项目版本
11
- version: '1.0.0',
12
- // 项目描述
13
- description: '基于 Vue 3.5 + Ant Design Vue 的管理系统',
14
- // 项目作者
15
- author: 'ZC',
16
- // 项目主页
17
- homepage: '',
18
- // 项目仓库
19
- repository: '',
20
- }
21
-
22
- // API 配置
23
- export const apiConfig = {
24
- // API 基础路径
25
- baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
26
- // 请求超时时间
27
- timeout: 10000,
28
- // 请求头
29
- headers: {
30
- 'Content-Type': 'application/json',
31
- },
32
- }
33
-
34
- // 应用配置
35
- export const appConfig = {
36
- // 应用标题
37
- title: projectConfig.name,
38
- // 应用图标
39
- icon: '/logo.png',
40
- // 默认语言
41
- defaultLanguage: 'zh-cn',
42
- // 默认主题
43
- defaultTheme: 'dark',
44
- // 默认导航模式
45
- defaultNavigationMode: 'side',
46
- // 默认表格大小
47
- defaultTableSize: 'middle',
48
- // 默认表格边框
49
- defaultTableBordered: true,
50
- // 是否显示页脚
51
- showFooter: true,
52
- // 页脚文本
53
- footerText: `© ${new Date().getFullYear()} ${projectConfig.name}`,
54
- }
55
-
56
- // 路由配置
57
- export const routerConfig = {
58
- // 首页路径
59
- homePath: '/console',
60
- // 登录页路径
61
- loginPath: '/login',
62
- // 404 页面路径
63
- notFoundPath: '/404',
64
- // 是否开启路由守卫
65
- guard: true,
66
- }
67
-
68
- // 默认导出所有配置
69
- export default {
70
- project: projectConfig,
71
- api: apiConfig,
72
- app: appConfig,
73
- router: routerConfig,
74
- }
1
+ /**
2
+ * 全局配置文件
3
+ * 用于定义项目的全局配置信息
4
+ */
5
+
6
+ // 项目基本信息
7
+ export const projectConfig = {
8
+ // 项目名称
9
+ name: 'ZAntAdmin',
10
+ // 项目版本
11
+ version: '1.0.0',
12
+ // 项目描述
13
+ description: '基于 Vue 3.5 + Ant Design Vue 的管理系统',
14
+ // 项目作者
15
+ author: 'ZC',
16
+ // 项目主页
17
+ homepage: '',
18
+ // 项目仓库
19
+ repository: '',
20
+ }
21
+
22
+ // API 配置
23
+ export const apiConfig = {
24
+ // API 基础路径
25
+ baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
26
+ // 请求超时时间
27
+ timeout: 10000,
28
+ // 请求头
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ },
32
+ }
33
+
34
+ // 应用配置
35
+ export const appConfig = {
36
+ // 应用标题
37
+ title: projectConfig.name,
38
+ // 应用图标
39
+ icon: '/logo.png',
40
+ // 默认语言
41
+ defaultLanguage: 'zh-cn',
42
+ // 默认主题
43
+ defaultTheme: 'dark',
44
+ // 默认导航模式
45
+ defaultNavigationMode: 'side',
46
+ // 默认表格大小
47
+ defaultTableSize: 'middle',
48
+ // 默认表格边框
49
+ defaultTableBordered: true,
50
+ // 是否显示页脚
51
+ showFooter: true,
52
+ // 页脚文本
53
+ footerText: `© ${new Date().getFullYear()} ${projectConfig.name}`,
54
+ }
55
+
56
+ // 路由配置
57
+ export const routerConfig = {
58
+ // 首页路径
59
+ homePath: '/console',
60
+ // 登录页路径
61
+ loginPath: '/login',
62
+ // 404 页面路径
63
+ notFoundPath: '/404',
64
+ // 是否开启路由守卫
65
+ guard: true,
66
+ }
67
+
68
+ // 默认导出所有配置
69
+ export default {
70
+ project: projectConfig,
71
+ api: apiConfig,
72
+ app: appConfig,
73
+ router: routerConfig,
74
+ }
@@ -1,45 +1,49 @@
1
- import { menuStore } from '@/stores/menu'
2
-
3
- /**
4
- * 按钮权限指令
5
- * 使用方式:v-permission="'user:add'" 或 v-permission="['user:add', 'user:edit']"
6
- */
7
- const permission = {
8
- mounted(el, binding) {
9
- const { value } = binding
10
- const store = menuStore()
11
- const { permissions } = store
12
-
13
- if (value && value instanceof Array) {
14
- // 多个权限,满足其中一个即可
15
- const hasPermission = value.some(permission => permissions.includes(permission))
16
- if (!hasPermission) {
17
- el.parentNode && el.parentNode.removeChild(el)
18
- }
19
- } else if (value && typeof value === 'string') {
20
- // 单个权限
21
- if (!permissions.includes(value)) {
22
- el.parentNode && el.parentNode.removeChild(el)
23
- }
24
- }
25
- },
26
- updated(el, binding) {
27
- // 更新时重新检查权限
28
- const { value } = binding
29
- const store = menuStore()
30
- const { permissions } = store
31
-
32
- if (value && value instanceof Array) {
33
- const hasPermission = value.some(permission => permissions.includes(permission))
34
- if (!hasPermission && el.parentNode) {
35
- el.parentNode.removeChild(el)
36
- }
37
- } else if (value && typeof value === 'string') {
38
- if (!permissions.includes(value) && el.parentNode) {
39
- el.parentNode.removeChild(el)
40
- }
41
- }
42
- }
43
- }
44
-
45
- export default permission
1
+ import { menuStore } from '@/stores/menu'
2
+
3
+ /**
4
+ * 按钮权限指令
5
+ * 使用方式:v-permission="'user:add'" 或 v-permission="['user:add', 'user:edit']"
6
+ */
7
+ const permission = {
8
+ mounted(el, binding) {
9
+ const { value } = binding
10
+ const store = menuStore()
11
+ const { permissions } = store
12
+
13
+ if (value && value instanceof Array) {
14
+ // 多个权限,满足其中一个即可
15
+ const hasPermission = value.some(permission =>
16
+ permissions.includes(permission),
17
+ )
18
+ if (!hasPermission) {
19
+ el.parentNode && el.parentNode.removeChild(el)
20
+ }
21
+ } else if (value && typeof value === 'string') {
22
+ // 单个权限
23
+ if (!permissions.includes(value)) {
24
+ el.parentNode && el.parentNode.removeChild(el)
25
+ }
26
+ }
27
+ },
28
+ updated(el, binding) {
29
+ // 更新时重新检查权限
30
+ const { value } = binding
31
+ const store = menuStore()
32
+ const { permissions } = store
33
+
34
+ if (value && value instanceof Array) {
35
+ const hasPermission = value.some(permission =>
36
+ permissions.includes(permission),
37
+ )
38
+ if (!hasPermission && el.parentNode) {
39
+ el.parentNode.removeChild(el)
40
+ }
41
+ } else if (value && typeof value === 'string') {
42
+ if (!permissions.includes(value) && el.parentNode) {
43
+ el.parentNode.removeChild(el)
44
+ }
45
+ }
46
+ },
47
+ }
48
+
49
+ export default permission
package/src/main.js CHANGED
@@ -27,12 +27,11 @@ app.use(pinia)
27
27
  //使用 Ant Design
28
28
  app.use(Antd)
29
29
 
30
- // 使用路由
30
+ // 使用路由
31
31
  app.use(router)
32
32
 
33
33
  // 注册权限指令
34
34
  app.directive('permission', permission)
35
35
 
36
- // 挂载应用
36
+ // 挂载应用
37
37
  app.mount('#app')
38
-