From ccedc2e714c01d51f8eb986c6549ea701811f4bb Mon Sep 17 00:00:00 2001 From: “dzb” <2632970487@qq.com> Date: 星期六, 08 十月 2022 18:07:44 +0800 Subject: [PATCH] 新增运营管理中基础设置的违规违建类型添加,添加一些取消按钮的实现 --- src/views/systemSetting/baseSetting/role/updateUser/index.vue | 65 ++++++++++++++++++++++---------- 1 files changed, 44 insertions(+), 21 deletions(-) diff --git a/src/views/systemSetting/baseSetting/role/updateUser/index.vue b/src/views/systemSetting/baseSetting/role/updateUser/index.vue index d0d18e1..b697ddf 100644 --- a/src/views/systemSetting/baseSetting/role/updateUser/index.vue +++ b/src/views/systemSetting/baseSetting/role/updateUser/index.vue @@ -4,8 +4,8 @@ <div class="mainContent"> <div class="my-tree"> <div class="my-tree__wrap"> - <el-tree :data="roleList" :props="defaultProps" @node-click="handleNodeClick" show-checkbox - @check-change="handleCheckChange" default-expand-all node-key="id"> + <el-tree ref="tree" :data="roleList" :props="defaultProps" show-checkbox + @check="handleCheck" :default-checked-keys="checkedIds" default-expand-all node-key="id"> </el-tree> </div> <div class="my-tree__bottom"></div> @@ -41,6 +41,7 @@ }, created() { const that = this; + this.getRoleMenus(this.userInfo.id); this.getMenuList(); }, methods: { @@ -72,7 +73,6 @@ }) .then(res => { this.roleList = res.data; - console.log(res); }) }, // 鐐瑰嚮鏍戣妭鐐� @@ -83,31 +83,54 @@ this.treeId = id; }, - // 鏍戝舰鎺т欢閫変腑鏇存敼 - handleCheckChange(data, checked, indeterminate) { - // console.log(data,checked,indeterminate); - if (checked) { - this.checkedIds.push(data.id); - } else { - let index = 0; - this.checkedIds.forEach((item, idx) => { - if (item.id === data.id) { - index = idx; - } - }) - this.checkedIds.splice(index, 1); - } + // 鏍戝舰鎺т欢澶嶉�夋鐐瑰嚮浜嬩欢 + handleCheck(data, checked) { + console.log(checked.checkedKeys); + this.checkedIds = checked.checkedKeys; console.log(this.checkedIds); }, // 淇濆瓨role saveRole() { this.resCheckedIds = []; + const {userInfo} = this; this.resCheckedIds = this.checkedIds; - this.$emit('changeDialog',{dialogUpdate:false}); + this.$axios({ + method:'post', + url:'sccg/role/allocMenu?roleId='+userInfo.id + '&menuIds=' + this.checkedIds, + }) + .then(res=>{ + if(res.code === 200){ + this.$message({ + type:'success', + message:'淇敼瑙掕壊鏉冮檺鎴愬姛', + }) + this.getRoleMenus(userInfo.id); + }else{ + this.$message({ + type:'warning', + message:res.message + }) + } + }) + // this.$emit('changeDialog',{dialogUpdate:false}); }, // 娑堥櫎role resetRole() { - this.resCheckedIds = [] + this.resCheckedIds = []; + this.$emit('changeDialog',{dialogUpdate:false}); + }, + // 鑾峰彇瑙掕壊鑿滃崟 + getRoleMenus(roleId){ + this.$axios({ + method:'get', + url:`sccg/role/listMenu/${roleId}` + }) + .then(res=>{ + this.checkedIds = []; + res.data.forEach(item=>{ + this.checkedIds.push(item.id); + }) + }) } }, props: ['userInfo', 'updateFlag', 'getUserList', 'changeDialog'] @@ -136,7 +159,7 @@ position: absolute; left: 0px; bottom: 0px; - background-color: #17324c; + background-color: #09152f; width: 100%; height: 20px; border-bottom-left-radius: 4px; @@ -145,7 +168,7 @@ position: absolute; right: 0px; top: 0px; - background-color: #17324c; + background-color: #09152f; width: 20px; height: 100%; } -- Gitblit v1.8.0