From e547dfb950a19b2d54e2f06aadff7e2be15d6ced Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 09 八月 2023 17:17:23 +0800
Subject: [PATCH] 1.角色新增、修改、删除功能
---
src/views/basicSettings/roleList.vue | 56 +++++++++++++++++++++++++++++---------------------------
1 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/src/views/basicSettings/roleList.vue b/src/views/basicSettings/roleList.vue
index 1af65de..ed294ec 100644
--- a/src/views/basicSettings/roleList.vue
+++ b/src/views/basicSettings/roleList.vue
@@ -42,7 +42,7 @@
<input
v-if="data.isEdit"
:ref="data.code"
- v-model="node.label"
+ v-model="data.name"
type="text"
@click.stop
@blur="roleSave(data)"
@@ -222,7 +222,7 @@
<script>
import waves from '@/directive/waves'
import {
- DataPermissions,
+ DataPermissions, RoleAddUpdateSava, RoleDeleteSava,
RolePermissionSava,
RolePermissionSearchRole,
RolePermissionSearchRoleMenu,
@@ -345,16 +345,6 @@
it.buttoncodelist.includes(j.buttoncode)
)
- // let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : []
- // temp = temp.length > 0 ? temp.split(',') : []
-
- // it.buttonChecked = [] // 鏁版嵁鍥炴樉
- // it.buttoncodelist.forEach(j => {
- // if (temp.includes(j.buttoncode)) {
- // it.buttonChecked.push(j.buttonname)
- // }
- // })
-
it.buttoncodelist = it.buttoncodelist.map(j => j.buttonname)
}
@@ -364,8 +354,6 @@
it.datacodelist.includes(j.datacode)
).map(j => j.dataname)
}
- // const datacode = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].datacode : ''
- // it.dataChecked = datacode ? this.dataKeyValue.find(j => j.datacode === datacode).dataname : '' // 鏁版嵁鍥炴樉
})
item.expanded = true
@@ -588,7 +576,7 @@
},
// 瑙掕壊鍚嶇О鏂板
rolePlusClick() {
- this.treeLeft[0].roles.push({ code: 1234, name: '', isEdit: true })
+ this.treeLeft[0].roles.push({ code: '', name: '', isEdit: true })
},
// 瑙掕壊鍚嶇О淇敼
roleEditClick(self, node, data) {
@@ -601,16 +589,33 @@
// 瑙掕壊鍚嶇О鍒犻櫎
roleDeleteClick(self, node, data) {
// console.log(self, node, data)
- // this.treeLeft[0].roles.forEach((item, index) => {
- // if (item.code === data.code) {
- // this.treeLeft[0].roles.splice(index, 1) // 鏆傛椂鍏堝啓鎴愬墠绔垹闄わ紝鍚庢湡璋冪敤鎺ュ彛鍒犻櫎
- // }
- // })
+ const D = {
+ rolecode: data.code,
+ rolename: data.name,
+ type: this.activeName
+ }
+ RoleDeleteSava(D).then(res => {
+ if (res.code === '200') {
+ this.$notify.success('瑙掕壊鍒犻櫎鎴愬姛锛�')
+ }
+ this.getRolePermissionSearchRole()
+ })
},
// 瑙掕壊鍚嶇О淇濆瓨 閲囩敤闃叉姈褰㈠紡
- roleSave: throttle(function(data) {
- data.isEdit = false
- console.log('鎵ц浜嗭紒')
+ roleSave: throttle(function(val) {
+ val.isEdit = false
+ const data = {
+ rolecode: val.code,
+ rolename: val.name,
+ type: val.code === '' ? 'Add' : 'Update'
+ }
+ console.log(data, '鎵ц浜嗭紒')
+ RoleAddUpdateSava(data).then(res => {
+ if (res.code === '200') {
+ this.$notify.success(val.code === '' ? '瑙掕壊鏂板鎴愬姛锛�' : '瑙掕壊淇敼鎴愬姛锛�')
+ }
+ })
+ this.getRolePermissionSearchRole()
}, 1000, true),
// 椤甸潰鍕鹃�夊ソ淇濆瓨浜嬩欢
@@ -640,16 +645,13 @@
}
})
- // console.log(arr, 'arr')
const rolecode = this.$refs.treeLeftRef.getCurrentKey()
const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName)
if (res.code === '200') {
const rolename = this.treeLeft[0].roles.find(i => i.code === rolecode).name
this.$notify.success(rolename + '鐨勮鑹叉潈闄愭彁浜ゆ垚鍔燂紒')
await this.getRolePermissionSearchRoleMenuButton(rolecode)
- // await this.getRolePermissionSearchRoleMenu(rolecode)
}
- // this.$forceUpdate()
},
// 鑾峰彇椤甸潰楂樺害
getHeight() {
@@ -687,7 +689,7 @@
width: 55px;
}
-.el-icon-plus:hover,.el-icon-edit:hover,.el-icon-delete:hover{
+.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover {
color: #000 !important;
}
</style>
--
Gitblit v1.9.3