diff --git a/README.md b/README.md index 7344e31dae778b4ca9e8c1e920a527940a6f2ba7..ea4d14787c7a2f999235a5dc46234d8371958dff 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,12 @@ $ npm run serve css 工具函数 地址 https://www.tailwindcss.cn/docs/installation#post-css-7 + +已完成: +1、菜单增删改 + + +问题: +1、通知接口 404 导致后续没开发了 +2、角色,新增,修改, functionAuthority 菜单权限这个字段不知道怎么传 +3、系统日志,没发现api,之前系统也没页面。不知道怎么搞 diff --git a/src/api/menu.js b/src/api/menu.js index 11aad8d336b387bd402254cac040a217db838ed9..251636daf0df2c6f1339cc533b06a5254be845de 100644 --- a/src/api/menu.js +++ b/src/api/menu.js @@ -4,17 +4,34 @@ export function delMenuApi(id) { return delReq(`/api/v1/menus/${id}`); } -export function getMenuDataApi() { - return getReq('/api/v1/menus'); +/** + * 缓存下,菜单变化的可能性比较小 + */ +let menus = []; +export async function getMenuDataApi(useCache) { + if (menus.length && useCache) return menus; + return getReq('/api/v1/menus').then(res => { + menus = res; + return res; + }); } export function addMenuApi(data) { return postReq('/api/v1/menus', data); } +export function updateMenuApi(data) { + return putReq('/api/v1/menus', data); +} + export function addRoleApi(data) { return postReq('/api/v1/roles', data); } + +export function getRoleApi(id) { + return getReq(`/api/v1/roles/${id}`); +} + export function updateRoleApi(data) { return putReq('/api/v1/roles', data); } diff --git a/src/components/menu_tree/index.vue b/src/components/menu_tree/index.vue index 269625f776a5e369914ff0f0e3433e23645744e7..b3a255d4ce163a3930499ab7e3ff120a338d71cf 100644 --- a/src/components/menu_tree/index.vue +++ b/src/components/menu_tree/index.vue @@ -7,6 +7,7 @@ :tree-data="treeData" style="max-height:400px" class="tw-overflow-y-auto" + :expandedKeys.sync="expandedKeys" v-bind="$attrs" v-on="$listeners" /> @@ -24,6 +25,7 @@ export default { props: { value: [Object, Array], showMenu: Boolean, + defaultCheckedKeys: Array, }, data() { return { @@ -32,11 +34,22 @@ export default { title: 'menuName', key: 'menuId', }, + expandedKeys: [], }; }, async mounted() { - this.rawData = await getMenuDataApi(); + // 使用 缓存 + this.rawData = await getMenuDataApi(true); this.treeData = convertListToTree(this.rawData, !this.showMenu); + this.$emit('check', this.defaultCheckedKeys); + this.expandedKeys = this.defaultCheckedKeys; + }, + + watch: { + defaultCheckedKeys(val) { + this.$emit('check', val); + this.expandedKeys = val; + }, }, methods: { diff --git a/src/components/menu_tree/select.vue b/src/components/menu_tree/select.vue index 46088dd7388d8beaf8d195f737182b3e04cfb3ca..4f778ffcaef1ddc9e8a904602c9b5777da59b759 100644 --- a/src/components/menu_tree/select.vue +++ b/src/components/menu_tree/select.vue @@ -34,7 +34,6 @@ export default { }, async mounted() { this.treeData = convertListToTree(await getMenuDataApi(), true); - console.log(this.treeData); }, }; diff --git a/src/components/table/index.vue b/src/components/table/index.vue index e6dd07ae8625338c4b9189bb79c50a810777b972..29b8d60e6fc4f1367f0fe139a2e543d8733c61ae 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -125,7 +125,7 @@ export default { }, watch: { addVisible(val) { - if (!val && this.addBtn.onCancel) this.addBtn.onCancel(); + if (!val && this?.addBtn?.onCancel) this.addBtn.onCancel(); }, }, mounted() { @@ -140,6 +140,7 @@ export default { current: this.initQuery.pageNum, pageSize: this.initQuery.pageSize, total: this.total, + showQuickJumper: true, }; }, isRowSelection() { diff --git a/src/config/setting.config.js b/src/config/setting.config.js index 2d831053656f553cca988e91db3e11254f6ce742..e5ec754b1323aca5a46d71d111e997c440d777d4 100644 --- a/src/config/setting.config.js +++ b/src/config/setting.config.js @@ -18,8 +18,8 @@ const settingConfig = { multiPage: true, //多页签模式,true:开启,false:不开启 cachePage: true, //是否缓存页面数据,仅多页签模式下生效,true 缓存, false 不缓存 hideSetting: false, //隐藏设置抽屉,true:隐藏,false:不隐藏 - systemCode: "Akina", //系统编码 - systemName: "Akina Antd Vue Pro", //系统名称 + systemCode: "Karot", //系统编码 + systemName: "Karot文档管理系统", //系统名称 copyright: "2021~ C.T 工作室出品", //copyright asyncRoutes: false, //异步加载路由,true:开启,false:不开启 showPageTitle: true, //是否显示页面标题(PageLayout 布局中的页面标题),true:显示,false:不显示 diff --git a/src/pages/system/view/log/operation/index.vue b/src/pages/system/view/log/operation/index.vue index 87f09df26c8d56f4faaeaf235b0d4a81a5c76c87..a4747fa548c8e19a245e56f0a1914e3724b49352 100644 --- a/src/pages/system/view/log/operation/index.vue +++ b/src/pages/system/view/log/operation/index.vue @@ -21,8 +21,8 @@ valueFormat="YYYY-MM-DD HH:mm:ss" /> - - + + @@ -61,9 +61,6 @@ export default { }; }, methods: { - refreshTable() { - this.$refs.table.getData(); - }, showDrawer(type, noFooter) { this.$refs['table'].show({ type, noFooter }); }, diff --git a/src/pages/system/view/menu/MenuManagement.vue b/src/pages/system/view/menu/MenuManagement.vue index 867c1cde22157524350d184efa9eca4fbddc6bb8..8c0c507fc3e801b380c406d7212f6fad36cc09d9 100644 --- a/src/pages/system/view/menu/MenuManagement.vue +++ b/src/pages/system/view/menu/MenuManagement.vue @@ -55,7 +55,7 @@ export default { edit(data) { this.$refs['table']?.show({ type: 1 }); this.$nextTick(() => { - this.$refs['addForm'].setEdit(data); + this.$refs['addForm'].setEdit({ ...data }); }); }, }, diff --git a/src/pages/system/view/menu/form.vue b/src/pages/system/view/menu/form.vue index 314ca4eadee1c9446e8a648d85c1dea566d8346e..d31e6897029ba07149ba8760f64660ed7b8335fc 100644 --- a/src/pages/system/view/menu/form.vue +++ b/src/pages/system/view/menu/form.vue @@ -31,7 +31,7 @@ diff --git a/src/pages/system/view/user/index.js b/src/pages/system/view/user/index.js deleted file mode 100644 index 39c7198a32d84a355e91e840ebd7d8e5cfbd64c4..0000000000000000000000000000000000000000 --- a/src/pages/system/view/user/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import UserManagement from './UserManagement'; - -export default UserManagement; \ No newline at end of file diff --git a/src/pages/user/components/info.vue b/src/pages/user/components/info.vue index 9bc1b929676844ac2a1deb10b405e4622a65c3a6..eba3c97cad57901fa1280d82607eb0d134b388ea 100644 --- a/src/pages/user/components/info.vue +++ b/src/pages/user/components/info.vue @@ -54,6 +54,16 @@ export default { return this.form.userAvatar ? `${this.$fileUrl}${this.form.userAvatar}` : null; }, }, + mounted() { + if (this.loginId) { + const userInfo = this.$store.state.userInfo; + this.form.userName = userInfo.userName; + this.form.fixedPhone = userInfo.fixedPhone; + this.form.mobilePhone = userInfo.mobilePhone; + this.form.userEmail = userInfo.userEmail; + this.form.userAvatar = userInfo.userAvatar; + } + }, watch: { '$store.state.userInfo'(userInfo) { this.form.userName = userInfo.userName; diff --git a/src/pages/user/components/message.vue b/src/pages/user/components/message.vue index 5fb17f63502a9487bf1fb2292a0ff9b90e33cd4e..487eee8e8dbb1770fc6f68200f0000d345e4397f 100644 --- a/src/pages/user/components/message.vue +++ b/src/pages/user/components/message.vue @@ -1,3 +1,11 @@ diff --git a/src/router/async/router.map.js b/src/router/async/router.map.js index 582d129527420c3cb130e68b356227defeb30722..3e2f10751e630d7cb1b8d4e089a39f7b3fee1b81 100644 --- a/src/router/async/router.map.js +++ b/src/router/async/router.map.js @@ -54,18 +54,5 @@ const routerMap = { name: '菜单管理', component: () => import('@/pages/system/view/menu'), }, - user_management: { - name: '用户管理', - component: () => import('@/pages/system/view/user'), - }, - role_management: { - name: '角色管理', - component: () => import('@/pages/system/view/role'), - }, - - // log_management: { - // name: '日志管理', - // component: () => import('@/pages/system/view/log'), - // }, }; export default routerMap;