vue3-admin-gpt 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 (118) hide show
  1. package/.env.development +14 -0
  2. package/.env.production +14 -0
  3. package/LICENSE +21 -0
  4. package/README.en.md +106 -0
  5. package/README.md +104 -0
  6. package/build-zip.cjs +53 -0
  7. package/cli.js +110 -0
  8. package/jsconfig.json +9 -0
  9. package/package.json +92 -0
  10. package/public/index.html +20 -0
  11. package/public/robots.txt +2 -0
  12. package/rspack.config.js +282 -0
  13. package/rspack.js +162 -0
  14. package/src/App.vue +9 -0
  15. package/src/api/icon.js +9 -0
  16. package/src/api/router.js +9 -0
  17. package/src/api/table.js +25 -0
  18. package/src/api/tree.js +9 -0
  19. package/src/api/user.js +34 -0
  20. package/src/assets/error_images/401.png +0 -0
  21. package/src/assets/error_images/404.png +0 -0
  22. package/src/assets/error_images/cloud.png +0 -0
  23. package/src/assets/login_images/background.jpg +0 -0
  24. package/src/assets/logo.png +0 -0
  25. package/src/assets/qr_logo/lqr_logo.png +0 -0
  26. package/src/assets/vuejs-fill.svg +4 -0
  27. package/src/components/VabPageHeader/index.vue +133 -0
  28. package/src/config/index.js +7 -0
  29. package/src/config/net.config.js +20 -0
  30. package/src/config/permission.js +136 -0
  31. package/src/config/setting.config.js +62 -0
  32. package/src/config/settings.js +6 -0
  33. package/src/config/theme.config.js +14 -0
  34. package/src/layouts/EmptyLayout.vue +3 -0
  35. package/src/layouts/components/VabAppMain/index.vue +109 -0
  36. package/src/layouts/components/VabAvatar/index.vue +255 -0
  37. package/src/layouts/components/VabBreadcrumb/index.vue +61 -0
  38. package/src/layouts/components/VabFullScreen/index.vue +61 -0
  39. package/src/layouts/components/VabLogo/index.vue +94 -0
  40. package/src/layouts/components/VabNav/index.vue +176 -0
  41. package/src/layouts/components/VabSide/components/VabMenuItem.vue +80 -0
  42. package/src/layouts/components/VabSide/components/VabSideItem.vue +100 -0
  43. package/src/layouts/components/VabSide/components/VabSubmenu.vue +56 -0
  44. package/src/layouts/components/VabSide/index.vue +123 -0
  45. package/src/layouts/components/VabTabs/index.vue +500 -0
  46. package/src/layouts/components/VabTheme/index.vue +603 -0
  47. package/src/layouts/components/VabTop/index.vue +286 -0
  48. package/src/layouts/export.js +29 -0
  49. package/src/layouts/index.vue +339 -0
  50. package/src/main.js +40 -0
  51. package/src/plugins/echarts.js +4 -0
  52. package/src/plugins/index.js +44 -0
  53. package/src/plugins/support.js +16 -0
  54. package/src/router/index.js +400 -0
  55. package/src/store/index.js +26 -0
  56. package/src/store/modules/errorLog.js +27 -0
  57. package/src/store/modules/routes.js +60 -0
  58. package/src/store/modules/settings.js +73 -0
  59. package/src/store/modules/table.js +22 -0
  60. package/src/store/modules/tabsBar.js +109 -0
  61. package/src/store/modules/user.js +131 -0
  62. package/src/styles/element-variables.scss +13 -0
  63. package/src/styles/loading.scss +345 -0
  64. package/src/styles/nav-icons.scss +52 -0
  65. package/src/styles/normalize.scss +353 -0
  66. package/src/styles/spinner/dots.css +68 -0
  67. package/src/styles/spinner/gauge.css +104 -0
  68. package/src/styles/spinner/inner-circles.css +51 -0
  69. package/src/styles/spinner/plus.css +341 -0
  70. package/src/styles/themes/default.scss +1 -0
  71. package/src/styles/transition.scss +18 -0
  72. package/src/styles/vab.scss +476 -0
  73. package/src/styles/variables.scss +69 -0
  74. package/src/utils/accessToken.js +56 -0
  75. package/src/utils/eventBus.js +8 -0
  76. package/src/utils/handleRoutes.js +100 -0
  77. package/src/utils/index.js +231 -0
  78. package/src/utils/message.js +67 -0
  79. package/src/utils/pageTitle.js +11 -0
  80. package/src/utils/password.js +43 -0
  81. package/src/utils/permission.js +19 -0
  82. package/src/utils/request.js +187 -0
  83. package/src/utils/static.js +81 -0
  84. package/src/utils/vab.js +218 -0
  85. package/src/utils/validate.js +48 -0
  86. package/src/views/401.vue +302 -0
  87. package/src/views/404.vue +302 -0
  88. package/src/views/demo/index.vue +591 -0
  89. package/src/views/index/index.vue +1489 -0
  90. package/src/views/login/index.vue +456 -0
  91. package/src/views/register/index.vue +524 -0
  92. package/src/views/vab/calendar.vue +488 -0
  93. package/src/views/vab/campaign.vue +1006 -0
  94. package/src/views/vab/chart.vue +189 -0
  95. package/src/views/vab/customer.vue +666 -0
  96. package/src/views/vab/editor.vue +84 -0
  97. package/src/views/vab/form.vue +151 -0
  98. package/src/views/vab/help.vue +390 -0
  99. package/src/views/vab/icon.vue +113 -0
  100. package/src/views/vab/knowledge.vue +820 -0
  101. package/src/views/vab/nested/menu1/menu2/menu3.vue +29 -0
  102. package/src/views/vab/nested/menu1/menu2.vue +33 -0
  103. package/src/views/vab/nested/menu1.vue +33 -0
  104. package/src/views/vab/nested.vue +97 -0
  105. package/src/views/vab/notification.vue +416 -0
  106. package/src/views/vab/order.vue +507 -0
  107. package/src/views/vab/permissions.vue +214 -0
  108. package/src/views/vab/product.vue +724 -0
  109. package/src/views/vab/project.vue +559 -0
  110. package/src/views/vab/settings.vue +319 -0
  111. package/src/views/vab/statistics.vue +431 -0
  112. package/src/views/vab/table.vue +110 -0
  113. package/src/views/vab/task.vue +613 -0
  114. package/src/views/vab/team.vue +662 -0
  115. package/src/views/vab/tree.vue +44 -0
  116. package/src/views/vab/upload.vue +180 -0
  117. package/src/views/vab/vue3Demo/index.vue +103 -0
  118. package/src/views/vab/workflow.vue +863 -0
@@ -0,0 +1,44 @@
1
+ /* 公共引入,勿随意修改,修改时需经过确认 */
2
+ import "./support";
3
+ import "@/styles/vab.scss";
4
+ import "@/config/permission";
5
+ // 不再导入vab-icon
6
+ import Vab from "@/utils/vab";
7
+ import ElementPlus from "element-plus";
8
+ import "element-plus/dist/index.css";
9
+ import * as ElementPlusIconsVue from "@element-plus/icons-vue";
10
+ import { faToElIcon } from "@/utils/vab";
11
+ import { h } from "vue";
12
+
13
+ // 创建全局VabIcon组件,用于替换之前的vab-icon
14
+ const VabIcon = {
15
+ name: "VabIcon",
16
+ props: {
17
+ icon: {
18
+ type: [String, Array],
19
+ required: true,
20
+ },
21
+ },
22
+ setup(props) {
23
+ return () => {
24
+ const iconName = faToElIcon(props.icon);
25
+ return h("el-icon", {}, [h(iconName)]);
26
+ };
27
+ },
28
+ };
29
+
30
+ export default (app) => {
31
+ // 注册Element Plus
32
+ app.use(ElementPlus);
33
+
34
+ // 注册所有Element Plus图标
35
+ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
36
+ app.component(key, component);
37
+ }
38
+
39
+ // 注册VabIcon组件,替代之前的vab-icon
40
+ app.component("VabIcon", VabIcon);
41
+
42
+ // 注册自定义插件
43
+ app.use(Vab);
44
+ };
@@ -0,0 +1,16 @@
1
+ import { ElMessageBox } from 'element-plus'
2
+
3
+ if (!!window.ActiveXObject || 'ActiveXObject' in window) {
4
+ ElMessageBox({
5
+ title: '温馨提示',
6
+ message:
7
+ '自2015年3月起,微软已宣布弃用IE,且不再对IE提供任何更新维护,请<a target="_blank" style="color:blue" href="https://www.microsoft.com/zh-cn/edge/">点击此处</a>访问微软官网更新浏览器,如果您使用的是双核浏览器,请您切换浏览器内核为极速模式',
8
+ type: 'warning',
9
+ showClose: false,
10
+ showConfirmButton: false,
11
+ closeOnClickModal: false,
12
+ closeOnPressEscape: false,
13
+ closeOnHashChange: false,
14
+ dangerouslyUseHTMLString: true,
15
+ })
16
+ }
@@ -0,0 +1,400 @@
1
+ /**
2
+ * @description router全局配置,如有必要可分文件抽离,其中asyncRoutes只有在intelligence模式下才会用到,vip文档中已提供路由的基础图标与小清新图标的配置方案,请仔细阅读
3
+ */
4
+
5
+ import { createRouter, createWebHashHistory } from "vue-router";
6
+ import Layout from "@/layouts/index.vue";
7
+ import EmptyLayout from "@/layouts/EmptyLayout.vue";
8
+ import { publicPath } from "@/config";
9
+
10
+ export const constantRoutes = [
11
+ {
12
+ path: "/login",
13
+ component: () => import("@/views/login/index.vue"),
14
+ hidden: true,
15
+ },
16
+ {
17
+ path: "/register",
18
+ component: () => import("@/views/register/index.vue"),
19
+ hidden: true,
20
+ },
21
+ {
22
+ path: "/401",
23
+ name: "401",
24
+ component: () => import("@/views/401.vue"),
25
+ hidden: true,
26
+ },
27
+ {
28
+ path: "/404",
29
+ name: "404",
30
+ component: () => import("@/views/404.vue"),
31
+ hidden: true,
32
+ },
33
+ ];
34
+
35
+ export const asyncRoutes = [
36
+ {
37
+ path: "/",
38
+ component: Layout,
39
+ redirect: "/index",
40
+ children: [
41
+ {
42
+ path: "index",
43
+ name: "Index",
44
+ component: () => import("@/views/index/index.vue"),
45
+ meta: {
46
+ title: "首页",
47
+ icon: "home",
48
+ affix: true,
49
+ },
50
+ },
51
+ ],
52
+ },
53
+
54
+ /* {
55
+ path: "/test",
56
+ component: Layout,
57
+ redirect: "noRedirect",
58
+ children: [
59
+ {
60
+ path: "test",
61
+ name: "Test",
62
+ component: () => import("@/views/test/index"),
63
+ meta: {
64
+ title: "test",
65
+ icon: "marker",
66
+ permissions: ["admin"],
67
+ },
68
+ },
69
+ ],
70
+ }, */
71
+ {
72
+ path: "/example",
73
+ component: Layout,
74
+ redirect: "/example/index",
75
+ name: "Example",
76
+ alwaysShow: true,
77
+ meta: { title: "路由案例", icon: "box-open", defaultOpen: true },
78
+ children: [
79
+ {
80
+ path: "index",
81
+ name: "ExampleIndex",
82
+ component: () => import("@/views/demo/index"),
83
+ meta: {
84
+ title: "路由创建教程",
85
+ icon: "document",
86
+ },
87
+ },
88
+ ]
89
+ },
90
+ {
91
+ path: "/vab",
92
+ component: Layout,
93
+ redirect: "noRedirect",
94
+ name: "Vab",
95
+ alwaysShow: true,
96
+ meta: { title: "组件", icon: "box-open", defaultOpen: true },
97
+ children: [
98
+ {
99
+ path: "vue3Demo",
100
+ name: "Vue3Demo",
101
+ component: () => import("@/views/vab/vue3Demo/index.vue"),
102
+ meta: {
103
+ title: "Vue 3 示例",
104
+ permissions: ["admin"],
105
+ noKeepAlive: false,
106
+ },
107
+ },
108
+ {
109
+ path: "table",
110
+ name: "Table",
111
+ component: () => import("@/views/vab/table.vue"),
112
+ meta: {
113
+ title: "表格",
114
+ permissions: ["admin"],
115
+ },
116
+ },
117
+ {
118
+ path: "tree",
119
+ name: "Tree",
120
+ component: () => import("@/views/vab/tree.vue"),
121
+ meta: {
122
+ title: "树形控件",
123
+ permissions: ["admin"],
124
+ },
125
+ },
126
+ {
127
+ path: "icon",
128
+ name: "Icon",
129
+ component: () => import("@/views/vab/icon.vue"),
130
+ meta: {
131
+ title: "图标",
132
+ permissions: ["admin"],
133
+ },
134
+ },
135
+ {
136
+ path: "form",
137
+ name: "Form",
138
+ component: () => import("@/views/vab/form.vue"),
139
+ meta: {
140
+ title: "表单",
141
+ permissions: ["admin"],
142
+ },
143
+ },
144
+ {
145
+ path: "chart",
146
+ name: "Chart",
147
+ component: () => import("@/views/vab/chart.vue"),
148
+ meta: {
149
+ title: "图表",
150
+ permissions: ["admin"],
151
+ },
152
+ },
153
+ {
154
+ path: "permissions",
155
+ name: "Permissions",
156
+ component: () => import("@/views/vab/permissions.vue"),
157
+ meta: {
158
+ title: "权限管理",
159
+ permissions: ["admin"],
160
+ },
161
+ },
162
+ {
163
+ path: "nested",
164
+ component: () => import("@/views/vab/nested.vue"),
165
+ name: "Nested",
166
+ redirect: "/vab/nested/menu1",
167
+ meta: {
168
+ title: "嵌套路由",
169
+ permissions: ["admin"],
170
+ },
171
+ children: [
172
+ {
173
+ path: "menu1",
174
+ component: () => import("@/views/vab/nested/menu1.vue"),
175
+ name: "Menu1",
176
+ redirect: "/vab/nested/menu1/menu2",
177
+ meta: { title: "一级菜单" },
178
+ children: [
179
+ {
180
+ path: "menu2",
181
+ component: () => import("@/views/vab/nested/menu1/menu2.vue"),
182
+ name: "Menu2",
183
+ redirect: "/vab/nested/menu1/menu2/menu3",
184
+ meta: { title: "二级菜单" },
185
+ children: [
186
+ {
187
+ path: "menu3",
188
+ component: () => import("@/views/vab/nested/menu1/menu2/menu3.vue"),
189
+ name: "Menu3",
190
+ meta: { title: "三级菜单" },
191
+ },
192
+ ],
193
+ },
194
+ ],
195
+ },
196
+ ],
197
+ },
198
+ {
199
+ path: "editor",
200
+ name: "Editor",
201
+ component: () => import("@/views/vab/editor.vue"),
202
+ meta: {
203
+ title: "富文本编辑器",
204
+ permissions: ["admin"],
205
+ },
206
+ },
207
+ {
208
+ path: "upload",
209
+ name: "Upload",
210
+ component: () => import("@/views/vab/upload.vue"),
211
+ meta: {
212
+ title: "文件上传",
213
+ permissions: ["admin"],
214
+ },
215
+ },
216
+ {
217
+ path: "settings",
218
+ name: "Settings",
219
+ component: () => import("@/views/vab/settings.vue"),
220
+ meta: {
221
+ title: "系统设置",
222
+ permissions: ["admin"],
223
+ },
224
+ },
225
+ {
226
+ path: "notification",
227
+ name: "Notification",
228
+ component: () => import("@/views/vab/notification.vue"),
229
+ meta: {
230
+ title: "通知中心",
231
+ permissions: ["admin"],
232
+ },
233
+ },
234
+ {
235
+ path: "calendar",
236
+ name: "Calendar",
237
+ component: () => import("@/views/vab/calendar.vue"),
238
+ meta: {
239
+ title: "日历",
240
+ permissions: ["admin"],
241
+ },
242
+ },
243
+ {
244
+ path: "task",
245
+ name: "Task",
246
+ component: () => import("@/views/vab/task.vue"),
247
+ meta: {
248
+ title: "任务管理",
249
+ permissions: ["admin"],
250
+ },
251
+ },
252
+ {
253
+ path: "statistics",
254
+ name: "Statistics",
255
+ component: () => import("@/views/vab/statistics.vue"),
256
+ meta: {
257
+ title: "数据统计",
258
+ permissions: ["admin"],
259
+ },
260
+ },
261
+ {
262
+ path: "help",
263
+ name: "Help",
264
+ component: () => import("@/views/vab/help.vue"),
265
+ meta: {
266
+ title: "帮助中心",
267
+ permissions: ["admin"],
268
+ },
269
+ },
270
+ {
271
+ path: "project",
272
+ name: "Project",
273
+ component: () => import("@/views/vab/project.vue"),
274
+ meta: {
275
+ title: "项目管理",
276
+ permissions: ["admin"],
277
+ },
278
+ },
279
+ {
280
+ path: "team",
281
+ name: "Team",
282
+ component: () => import("@/views/vab/team.vue"),
283
+ meta: {
284
+ title: "团队管理",
285
+ permissions: ["admin"],
286
+ },
287
+ },
288
+ {
289
+ path: "workflow",
290
+ name: "Workflow",
291
+ component: () => import("@/views/vab/workflow.vue"),
292
+ meta: {
293
+ title: "工作流",
294
+ permissions: ["admin"],
295
+ },
296
+ },
297
+ {
298
+ path: "knowledge",
299
+ name: "Knowledge",
300
+ component: () => import("@/views/vab/knowledge.vue"),
301
+ meta: {
302
+ title: "知识库",
303
+ permissions: ["admin"],
304
+ },
305
+ },
306
+ {
307
+ path: "customer",
308
+ name: "Customer",
309
+ component: () => import("@/views/vab/customer.vue"),
310
+ meta: {
311
+ title: "客户管理",
312
+ permissions: ["admin"],
313
+ },
314
+ },
315
+ {
316
+ path: "product",
317
+ name: "Product",
318
+ component: () => import("@/views/vab/product.vue"),
319
+ meta: {
320
+ title: "产品管理",
321
+ permissions: ["admin"],
322
+ },
323
+ },
324
+ {
325
+ path: "order",
326
+ name: "Order",
327
+ component: () => import("@/views/vab/order.vue"),
328
+ meta: {
329
+ title: "订单管理",
330
+ permissions: ["admin"],
331
+ },
332
+ },
333
+ // {
334
+ // path: "campaign",
335
+ // name: "Campaign",
336
+ // component: () => import("@/views/vab/campaign.vue"),
337
+ // meta: {
338
+ // title: "营销活动",
339
+ // permissions: ["admin"],
340
+ // },
341
+ // },
342
+ ],
343
+ },
344
+
345
+ {
346
+ path: "/error",
347
+ component: EmptyLayout,
348
+ redirect: "noRedirect",
349
+ name: "Error",
350
+ meta: { title: "错误页", icon: "bug" },
351
+ children: [
352
+ {
353
+ path: "401",
354
+ name: "Error401",
355
+ component: () => import("@/views/401"),
356
+ meta: { title: "401" },
357
+ },
358
+ {
359
+ path: "404",
360
+ name: "Error404",
361
+ component: () => import("@/views/404"),
362
+ meta: { title: "404" },
363
+ },
364
+ ],
365
+ },
366
+ {
367
+ path: "/:pathMatch(.*)*",
368
+ redirect: "/404",
369
+ hidden: true,
370
+ },
371
+ ];
372
+
373
+ const router = createRouter({
374
+ history: createWebHashHistory(publicPath),
375
+ routes: constantRoutes,
376
+ scrollBehavior(to, from, savedPosition) {
377
+ if (savedPosition) {
378
+ return savedPosition;
379
+ } else {
380
+ return { top: 0 };
381
+ }
382
+ },
383
+ });
384
+
385
+ export function resetRouter() {
386
+ // 注意:所有动态路由路由必须带有name属性,否则可能会不能完全重置干净
387
+ try {
388
+ router.getRoutes().forEach((route) => {
389
+ const { name } = route;
390
+ if (name && name !== "Login") {
391
+ router.hasRoute(name) && router.removeRoute(name);
392
+ }
393
+ });
394
+ } catch (error) {
395
+ // 强制刷新浏览器,不要用这种方式
396
+ window.location.reload();
397
+ }
398
+ }
399
+
400
+ export default router;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @description 导入所有 vuex 模块,自动加入namespaced:true,用于解决vuex命名冲突,请勿修改。
3
+ * @description 这是一个兼容层,允许项目逐步从Vuex迁移到Pinia
4
+ */
5
+
6
+ import { createStore } from 'vuex'
7
+
8
+ // 从modules目录导入所有模块
9
+ const files = require.context('./modules', false, /\.js$/)
10
+ const modules = {}
11
+
12
+ files.keys().forEach((key) => {
13
+ modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
14
+ })
15
+
16
+ // 为所有模块添加namespaced
17
+ Object.keys(modules).forEach((key) => {
18
+ modules[key]['namespaced'] = true
19
+ })
20
+
21
+ // 创建store
22
+ const store = createStore({
23
+ modules,
24
+ })
25
+
26
+ export default store
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @description 异常捕获的状态拦截,请勿修改
3
+ */
4
+
5
+ const state = () => ({
6
+ errorLogs: [],
7
+ })
8
+ const getters = {
9
+ errorLogs: (state) => state.errorLogs,
10
+ }
11
+ const mutations = {
12
+ addErrorLog(state, errorLog) {
13
+ state.errorLogs.push(errorLog)
14
+ },
15
+ clearErrorLog: (state) => {
16
+ state.errorLogs.splice(0)
17
+ },
18
+ }
19
+ const actions = {
20
+ addErrorLog({ commit }, errorLog) {
21
+ commit('addErrorLog', errorLog)
22
+ },
23
+ clearErrorLog({ commit }) {
24
+ commit('clearErrorLog')
25
+ },
26
+ }
27
+ export default { state, getters, mutations, actions }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @description 路由拦截状态管理,目前两种模式:all模式与intelligence模式
3
+ */
4
+ import { asyncRoutes, constantRoutes } from '@/router'
5
+ import { getRouterList } from '@/api/router'
6
+ import { convertRouter, filterAsyncRoutes } from '@/utils/handleRoutes'
7
+
8
+ const state = () => ({
9
+ routes: [],
10
+ partialRoutes: [],
11
+ })
12
+ const getters = {
13
+ routes: (state) => state.routes,
14
+ partialRoutes: (state) => state.partialRoutes,
15
+ }
16
+ const mutations = {
17
+ setRoutes(state, routes) {
18
+ state.routes = constantRoutes.concat(routes)
19
+ },
20
+ setAllRoutes(state, routes) {
21
+ state.routes = constantRoutes.concat(routes)
22
+ },
23
+ }
24
+ const actions = {
25
+ /**
26
+ * @description intelligence模式设置路由
27
+ * @param {*} { commit }
28
+ * @param {*} permissions
29
+ * @returns
30
+ */
31
+ async setRoutes({ commit }, permissions) {
32
+ //根据permissions做路由筛选
33
+ let accessedRoutes = filterAsyncRoutes(asyncRoutes, permissions)
34
+ commit('setRoutes', accessedRoutes)
35
+ return accessedRoutes
36
+ },
37
+ /**
38
+ * @description all模式设置路由
39
+ * @param {*} { commit }
40
+ * @returns
41
+ */
42
+ async setAllRoutes({ commit }) {
43
+ try {
44
+ let { data } = await getRouterList()
45
+ if (!data || !Array.isArray(data)) {
46
+ console.error('后端返回的路由数据格式不正确', data)
47
+ data = []
48
+ }
49
+
50
+ const accessedRoutes = convertRouter(data)
51
+ commit('setAllRoutes', accessedRoutes)
52
+ return accessedRoutes
53
+ } catch (error) {
54
+ console.error('获取路由列表失败', error)
55
+ commit('setAllRoutes', [])
56
+ return []
57
+ }
58
+ },
59
+ }
60
+ export default { state, getters, mutations, actions }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @description 所有全局配置的状态管理,如无必要请勿修改
3
+ */
4
+
5
+ import defaultSettings from '@/config'
6
+
7
+ const { tabsBar, logo, layout, header, themeBar } = defaultSettings
8
+ const theme = JSON.parse(localStorage.getItem('vue3-admin-theme')) || ''
9
+ const state = () => ({
10
+ tabsBar: theme.tabsBar || tabsBar,
11
+ logo,
12
+ collapse: false,
13
+ layout: theme.layout || layout,
14
+ header: theme.header || header,
15
+ device: 'desktop',
16
+ themeBar,
17
+ })
18
+ const getters = {
19
+ collapse: (state) => state.collapse,
20
+ device: (state) => state.device,
21
+ header: (state) => state.header,
22
+ layout: (state) => state.layout,
23
+ logo: (state) => state.logo,
24
+ tabsBar: (state) => state.tabsBar,
25
+ themeBar: (state) => state.themeBar,
26
+ }
27
+ const mutations = {
28
+ changeLayout: (state, layout) => {
29
+ if (layout) state.layout = layout
30
+ },
31
+ changeHeader: (state, header) => {
32
+ if (header) state.header = header
33
+ },
34
+ changeTabsBar: (state, tabsBar) => {
35
+ if (tabsBar) state.tabsBar = tabsBar
36
+ },
37
+ changeCollapse: (state) => {
38
+ state.collapse = !state.collapse
39
+ },
40
+ foldSideBar: (state) => {
41
+ state.collapse = true
42
+ },
43
+ openSideBar: (state) => {
44
+ state.collapse = false
45
+ },
46
+ toggleDevice: (state, device) => {
47
+ state.device = device
48
+ },
49
+ }
50
+ const actions = {
51
+ changeLayout({ commit }, layout) {
52
+ commit('changeLayout', layout)
53
+ },
54
+ changeHeader({ commit }, header) {
55
+ commit('changeHeader', header)
56
+ },
57
+ changeTabsBar({ commit }, tabsBar) {
58
+ commit('changeTabsBar', tabsBar)
59
+ },
60
+ changeCollapse({ commit }) {
61
+ commit('changeCollapse')
62
+ },
63
+ foldSideBar({ commit }) {
64
+ commit('foldSideBar')
65
+ },
66
+ openSideBar({ commit }) {
67
+ commit('openSideBar')
68
+ },
69
+ toggleDevice({ commit }, device) {
70
+ commit('toggleDevice', device)
71
+ },
72
+ }
73
+ export default { state, getters, mutations, actions }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @description 代码生成机状态管理
3
+ */
4
+
5
+ const state = () => ({
6
+ srcCode: '',
7
+ })
8
+ const getters = {
9
+ srcTableCode: (state) => state.srcCode,
10
+ }
11
+
12
+ const mutations = {
13
+ setTableCode(state, srcCode) {
14
+ state.srcCode = srcCode
15
+ },
16
+ }
17
+ const actions = {
18
+ setTableCode({ commit }, srcCode) {
19
+ commit('setTableCode', srcCode)
20
+ },
21
+ }
22
+ export default { state, getters, mutations, actions }