diff --git a/admin/src/components/DictData/index.js b/admin/src/components/DictData/index.js index 35862d4..592a10c 100644 --- a/admin/src/components/DictData/index.js +++ b/admin/src/components/DictData/index.js @@ -1,7 +1,7 @@ import Vue from 'vue' import store from '@/store' import DataDict from '@/utils/dict' -import { sysdicttypeTypesApi } from '@/api/system/dict/data' +import { sysdicttypeTypesApi } from '@/api/sysdicttype' function searchDictByKey(dict, key) { if (key == null && key == "") { diff --git a/admin/src/main.js b/admin/src/main.js index 7e7a0e4..1c16149 100644 --- a/admin/src/main.js +++ b/admin/src/main.js @@ -61,6 +61,9 @@ import * as selfUtil from '@/utils/ZBKJIutil.js'; import SettingMer from "@/utils/settingMer"; import plugins from './plugins' import directive from './directive' //directive +import DictData from '@/components/DictData' +// 字典标签组件 +import DictTag from '@/components/DictTag' Vue.use(VueLazyload, { preLoad: 1.3, @@ -77,7 +80,9 @@ Vue.use(articleFrom) Vue.use(VueAwesomeSwiper) Vue.use(plugins) Vue.use(directive) +DictData.install() +Vue.component('DictTag', DictTag) Vue.component('attrFrom', attrFrom) Vue.component('UploadIndex', UploadIndex) Vue.component('SelfUpload', SelfUpload) diff --git a/admin/src/router/modules/operation.js b/admin/src/router/modules/operation.js index b4d242b..2d871a9 100644 --- a/admin/src/router/modules/operation.js +++ b/admin/src/router/modules/operation.js @@ -21,6 +21,15 @@ const operationRouter = { roles: ['admin'] }, children: [ + { + path: 'dictdata/:dictId(\\d+)', + name: 'dictdata', + component: () => import('@/views/dict/data'), + meta: { + title: '字典数据', + icon: 'clipboard' + } + }, { path: 'setting', name: 'setting', diff --git a/admin/src/store/modules/permission.js b/admin/src/store/modules/permission.js index 8d493b3..ff5e4dc 100644 --- a/admin/src/store/modules/permission.js +++ b/admin/src/store/modules/permission.js @@ -72,9 +72,9 @@ const actions = { router.addRoutes(routes); // 动态添加可访问路由表 console.log('routes-end',routes); menusAll = formatRoutes(menusAll) - + console.log('menusAll',menusAll); const _routerResult = comRouter(menusAll, asyncRoutes) - console.log('_routerResult',_routerResult); + accessedRoutes = filterAsyncRoutes(_routerResult) // todo 这里控制是否过滤路由,经测试有些菜单不能予以设置,比如系统设置等等 this.state.settings.showSettings = false @@ -131,14 +131,20 @@ function findRoutes(menus, level = 0, prePath = '/') { const newPath = components.join('/'); const tempRoute = findRoute(newPath, tempRoutes) || {}; - let component = tempRoute.component || (level === 0 ? Layout : loadView(newPath)); + let component = level === 0 ? Layout : loadView(newPath); let path = newPath; if (newPath.startsWith(prePath)) { path = newPath.replace(prePath, ''); } + if (tempRoute.path) { + path = tempRoute.path; + } + if (path.startsWith('/')) { + path = path.replace('/', ''); + } const route = { - path: tempRoute.path || (level === 0 ? '/' + path : path), // 路由地址 + path: level === 0 ? '/' + path : path, // 路由地址 component, name: tempRoute.name || components[components.length - 1], // 路由名称 meta: { @@ -153,7 +159,7 @@ function findRoutes(menus, level = 0, prePath = '/') { if (menu.childList && menu.childList.length > 0) { route.children = findRoutes(menu.childList, level + 1, prePath + path + '/'); } - if (!tempRoute.component &&level > 0 && route.children && route.children.length > 0) { + if (level > 0 && route.children && route.children.length > 0) { route.component = ParentView; } @@ -179,6 +185,10 @@ function combineRoutes(routers, fromRoutes) { combineRoutes(routers[findex].children, frouter.children); } } + routers[findex].component = frouter.component; + routers[findex].path = frouter.path; + routers[findex].name = frouter.name; + routers[findex].meta = frouter.meta; } else { routers.push(frouter); } diff --git a/admin/src/utils/dict/DictData.js b/admin/src/utils/dict/DictData.js index 5b07cee..e4215cc 100644 --- a/admin/src/utils/dict/DictData.js +++ b/admin/src/utils/dict/DictData.js @@ -8,8 +8,8 @@ export default class DictData { constructor(label, value, raw) { this.label = label this.value = value - this.sort = raw?.dictSort - this.code = raw?.dictCode + this.sort = raw ? raw.dictSort : 0 + this.code = raw ? raw.dictCode : '' this.raw = raw; //保存原始数据 } } diff --git a/admin/src/views/dict/data.vue b/admin/src/views/dict/data.vue new file mode 100644 index 0000000..31524a6 --- /dev/null +++ b/admin/src/views/dict/data.vue @@ -0,0 +1,415 @@ + + + \ No newline at end of file diff --git a/admin/src/views/dict/index.vue b/admin/src/views/dict/index.vue new file mode 100644 index 0000000..dc8fdb1 --- /dev/null +++ b/admin/src/views/dict/index.vue @@ -0,0 +1,377 @@ + + + diff --git a/admin/src/views/dict/type/index.vue b/admin/src/views/dict/type/index.vue deleted file mode 100644 index 7bfd430..0000000 --- a/admin/src/views/dict/type/index.vue +++ /dev/null @@ -1,246 +0,0 @@ - - - diff --git a/admin/src/views/dict/type/sysdicttype-add-and-update.vue b/admin/src/views/dict/type/sysdicttype-add-and-update.vue deleted file mode 100644 index ca4ded2..0000000 --- a/admin/src/views/dict/type/sysdicttype-add-and-update.vue +++ /dev/null @@ -1,100 +0,0 @@ - - -