diff --git a/data/magic-api/api/后台/菜单管理/修改是否显示.ms b/data/magic-api/api/后台/菜单管理/修改是否显示.ms index 8d1b8cd..3f37ad9 100644 --- a/data/magic-api/api/后台/菜单管理/修改是否显示.ms +++ b/data/magic-api/api/后台/菜单管理/修改是否显示.ms @@ -4,11 +4,11 @@ "script" : null, "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "修改是否显示", - "createTime" : 1634724871168, - "updateTime" : 1634724871168, + "createTime" : null, + "updateTime" : 1641482987357, "lock" : "0", "method" : "GET", - "path" : "/change/show", + "path" : "/change", "parameters" : [ ], "option" : "[{\"name\":\"wrap_request_parameter\",\"value\":\"data\",\"description\":\"包装请求参数到一个变量中\"}]", "requestBody" : "", diff --git a/data/magic-api/api/后台/菜单管理/当前用户菜单.ms b/data/magic-api/api/后台/菜单管理/当前用户菜单.ms index 2e0dc77..9fb3b5b 100644 --- a/data/magic-api/api/后台/菜单管理/当前用户菜单.ms +++ b/data/magic-api/api/后台/菜单管理/当前用户菜单.ms @@ -5,7 +5,7 @@ "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "当前用户菜单", "createTime" : null, - "updateTime" : 1641279378685, + "updateTime" : 1641482674575, "lock" : "0", "method" : "POST", "path" : "/current/menus", @@ -453,7 +453,8 @@ var menus = db.select(""" sm.is_show, sm.url, sm.sort, - sm.icon + sm.icon, + sm.keep_alive from sys_menu sm where 1=1 ?{userId != '1', and sm.id in ( @@ -470,6 +471,7 @@ for(menu in menus){ menu.meta = {} menu.meta.title = menu.name menu.meta.icon = menu.icon + menu.meta.keepAlive = (menu.keepAlive == '1' ? true : false) } var nodes = menus.toMap(it => it.id) nodes.each((key, node) => { diff --git a/data/magic-api/api/后台/菜单管理/获取菜单tree.ms b/data/magic-api/api/后台/菜单管理/获取菜单tree.ms index d6ea5b4..ea9d551 100644 --- a/data/magic-api/api/后台/菜单管理/获取菜单tree.ms +++ b/data/magic-api/api/后台/菜单管理/获取菜单tree.ms @@ -5,7 +5,7 @@ "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "获取菜单tree", "createTime" : null, - "updateTime" : 1641016870466, + "updateTime" : 1641483087321, "lock" : "0", "method" : "GET", "path" : "/tree", @@ -94,7 +94,7 @@ } ================================ var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid -var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon from sys_menu where is_del = 0 order by sort'),'0') +var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon,keep_alive from sys_menu where is_del = 0 order by sort'),'0') return { list: list, diff --git a/magic-boot-ui/src/layout/components/AppMain.vue b/magic-boot-ui/src/layout/components/AppMain.vue index a897638..8dcca10 100644 --- a/magic-boot-ui/src/layout/components/AppMain.vue +++ b/magic-boot-ui/src/layout/components/AppMain.vue @@ -1,10 +1,9 @@ @@ -12,9 +11,6 @@ export default { name: 'AppMain', computed: { - cachedViews() { - return this.$store.state.tagsView.cachedViews - }, key() { return this.$route.path } diff --git a/magic-boot-ui/src/layout/none.vue b/magic-boot-ui/src/layout/none.vue index 98240ae..ec08fd8 100644 --- a/magic-boot-ui/src/layout/none.vue +++ b/magic-boot-ui/src/layout/none.vue @@ -1,3 +1,19 @@ + + diff --git a/magic-boot-ui/src/router/index.js b/magic-boot-ui/src/router/index.js index 5149a7e..797b387 100644 --- a/magic-boot-ui/src/router/index.js +++ b/magic-boot-ui/src/router/index.js @@ -14,9 +14,9 @@ export const constantRoutes = [ redirect: '/dashboard', children: [{ path: 'dashboard', - name: '首页', + name: 'Dashboard', component: () => import('@/views/dashboard/index'), - meta: { title: '首页', icon: 'home' } + meta: { title: '首页', icon: 'home', noCache: false } }] }, diff --git a/magic-boot-ui/src/views/system/menu/menu-list.vue b/magic-boot-ui/src/views/system/menu/menu-list.vue index 3e11023..61dc97d 100644 --- a/magic-boot-ui/src/views/system/menu/menu-list.vue +++ b/magic-boot-ui/src/views/system/menu/menu-list.vue @@ -3,50 +3,83 @@
- - + + - - 添加菜单 + + 搜索 + + + 清空
+ + + 添加菜单 + + + @@ -90,13 +123,15 @@ export default { { field: 'url', title: '路径', - align: 'left' + align: 'left', + type: 'html' }, { field: 'permission', title: '权限标识', width: 150, - align: 'left' + align: 'left', + type: 'html' }, { field: 'icon', @@ -118,12 +153,24 @@ export default { type: 'switch', width: 100, change: (row) => { - this.$get('menu/change/show', { + this.$get('menu/change', { id: row.id, isShow: row.isShow }) } }, + { + field: 'keepAlive', + title: '是否缓存', + type: 'switch', + width: 100, + change: (row) => { + this.$get('menu/change', { + id: row.id, + keepAlive: row.keepAlive + }) + } + }, { title: '操作', type: 'btns', @@ -172,13 +219,26 @@ export default { rules: { pid: [{ required: true, message: '请选择上级菜单', trigger: 'change' }], name: [{ required: true, message: '请输入菜单名称', trigger: 'change' }] - } + }, + searchTimeout: '' } }, mounted() { this.reloadTable() }, watch: { + 'temp.type'(type) { + for (var t in this.getTemp()) { + if(t != 'type'){ + this.temp[t] = row[t] + } + } + if(type == 'menu'){ + this.temp.isShow = 1 + }else{ + this.temp.isShow = 0 + } + }, menuData() { this.menuTree = [{ label: '根节点', @@ -234,11 +294,15 @@ export default { return menuTree }, searchMenu() { - if(this.searchValue){ - this.$set(this.tableOptions, 'data', this.recursionSearch(this.$common.copyNew(this.menuData), this.searchValue)) - }else{ - this.$set(this.tableOptions, 'data', this.menuData) - } + var _this = this + clearTimeout(this.searchTimeout) + this.searchTimeout = setTimeout(() => { + if(_this.searchValue){ + _this.$set(_this.tableOptions, 'data', _this.recursionSearch(_this.$common.copyNew(_this.menuData), _this.searchValue)) + }else{ + _this.$set(_this.tableOptions, 'data', _this.menuData) + } + },1000) }, recursionSearch(data, text){ var searchData = [] @@ -248,21 +312,28 @@ export default { if(children && children.length > 0){ var childrenSearch = this.recursionSearch(children, text) treeNode.children = childrenSearch && childrenSearch.length > 0 ? childrenSearch : treeNode.children - if(treeNode.name.indexOf(text) != -1 || childrenSearch.length > 0){ - treeNode.name = treeNode.name.replace(text, `${text}`) - searchData.push(treeNode) - } + this.treeNodeReplace(searchData, treeNode, text, childrenSearch) }else{ - if(treeNode.name.indexOf(text) != -1){ - treeNode.name = treeNode.name.replace(text, `${text}`) - searchData.push(treeNode) - } + this.treeNodeReplace(searchData, treeNode, text) } } return searchData }, + treeNodeReplace(searchData, treeNode, text, childrenSearch){ + var exist = false + var fields = ['name', 'url', 'permission'] + fields.forEach((f) => { + if(treeNode[f] && treeNode[f].indexOf(text) != -1){ + treeNode[f] = treeNode[f].replace(text, `${text}`) + exist = true + } + }) + if(exist || (childrenSearch && childrenSearch.length > 0)){ + searchData.push(treeNode) + } + }, generateIconCode(symbol) { - return `` + return `` }, selectIcon(symbol) { this.$set(this.temp, 'icon', symbol) @@ -279,9 +350,11 @@ export default { permission: '', sort: 0, descRibe: '', - isShow: true, + isShow: 1, pid: '', - icon: '' + icon: '', + type: 'menu', + keepAlive: 1 } }, resetTemp() { @@ -324,7 +397,6 @@ export default { }) return } - this.temp.isShow = this.temp.isShow === true ? 1 : 0 this.$post('menu/save', this.temp).then(() => { this.reloadTable() this.$refs.menuFormDialog.hide() @@ -346,16 +418,9 @@ export default { }, handleUpdate(row) { for (var t in this.temp) { - if (t === 'isShow') { - if (row[t] === 1) { - this.temp[t] = true - } else { - this.temp[t] = false - } - } else { - this.temp[t] = row[t] - } + this.temp[t] = row[t] } + this.temp.type = this.temp.url ? 'menu' : 'button' this.temp.name = this.temp.name.replaceAll(/(.*?)<\/font>/g,'$1') this.dialogStatus = 'update' this.$refs.menuFormDialog.show() diff --git a/magic-boot-ui/src/views/system/user/user-list.vue b/magic-boot-ui/src/views/system/user/user-list.vue index 407f8d9..e70e076 100644 --- a/magic-boot-ui/src/views/system/user/user-list.vue +++ b/magic-boot-ui/src/views/system/user/user-list.vue @@ -11,20 +11,21 @@ 搜索 - - 添加 + + 清空 - + 导出 -
- - + + + 添加 + + -