From d2db7d088de88fac0c10cdaf43dca2a7a1b7b286 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Tue, 27 Sep 2022 11:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/workPc/menu-add-or-update.vue | 181 ++++++++++++------ 1 file changed, 121 insertions(+), 60 deletions(-) diff --git a/epmet-oper-web/src/views/modules/workPc/menu-add-or-update.vue b/epmet-oper-web/src/views/modules/workPc/menu-add-or-update.vue index ad90292..2bc463e 100644 --- a/epmet-oper-web/src/views/modules/workPc/menu-add-or-update.vue +++ b/epmet-oper-web/src/views/modules/workPc/menu-add-or-update.vue @@ -1,93 +1,150 @@ @@ -132,9 +189,9 @@ export default { } }, props: { - tableName:{ - type:String, - default:'gov_menu' + tableName: { + type: String, + default: 'gov_menu' } }, watch: { @@ -159,16 +216,16 @@ export default { }, // 获取菜单列表 getMenuList () { - return this.$http.get('/gov/access/menu/list?type=0&tableName='+this.tableName).then(({ data: res }) => { + return this.$http.get('/gov/access/menu/list?type=0&tableName=' + this.tableName).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } this.menuList = res.data - }).catch(() => {}) + }).catch(() => { }) }, // 获取信息 getInfo () { - this.$http.get(`/gov/access/menu/${this.dataForm.id}?tableName=`+this.tableName).then(({ data: res }) => { + this.$http.get(`/gov/access/menu/${this.dataForm.id}?tableName=` + this.tableName).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } @@ -176,11 +233,14 @@ export default { ...this.dataForm, ...res.data } + if (!this.dataForm.resourceList) { + this.dataForm.resourceList = [] + } if (this.dataForm.pid === '0') { return this.deptListTreeSetDefaultHandle() } this.$refs.menuListTree.setCurrentKey(this.dataForm.pid) - }).catch(() => {}) + }).catch(() => { }) }, // 上级菜单树, 设置默认值 deptListTreeSetDefaultHandle () { @@ -200,6 +260,7 @@ export default { }, // 菜单资源, 添加 resourceAddHandle () { + this.dataForm.resourceList.push({ key: new Date().getTime(), resourceMethod: 'GET', @@ -230,7 +291,7 @@ export default { this.$emit('refreshDataList') } }) - }).catch(() => {}) + }).catch(() => { }) }) }, 1000, { 'leading': true, 'trailing': false }) }