角色管理

This commit is contained in:
2023-10-21 19:53:37 +08:00
parent 788e748ab3
commit 8311b65139
5 changed files with 29 additions and 36 deletions

View File

@@ -15,13 +15,13 @@
<th>创建日期</th>
<th width="330px">操作</th>
</tr>
<tr v-for="(e, i) in datalist" :key="i" :class="{'tr_selected': pkId === e.roleId}" @click="toCheck(e)">
<tr v-for="(e, i) in datalist" :key="i" :class="{'tr_selected': pkId === e.roleId}">
<!-- <td>
<div class="radio__input icon_radio_checked"><i class="icon_radio"></i></div>
</td> -->
<td>{{ e.name }}</td>
<td>{{ e.remark }}</td>
<td>{{ e.createTime }}</td>
<td @click="toCheck(e)">{{ e.name }}</td>
<td @click="toCheck(e)">{{ e.remark }}</td>
<td @click="toCheck(e)">{{ e.createTime }}</td>
<td width="330px">
<div class="row">
<button class="button button--primary grid_button" @click="showDialog('2', e)">修改</button>
@@ -67,14 +67,10 @@
<div v-show="active1" class="dialog_wrapper">
<div class="dialog dialog_1">
<div class="dialog_header">
<span class="dialog_title">角色名称</span>
<span class="dialog_title">{{ pkObj.name }}</span>
</div>
<div class="dialog_body dialog_body_1">
<div class="tree_wrapper">
<!-- <div class="tree_header">
<span>角色名称</span>
<button class="button button--primary grid_button button1" :class="{'button--info': pkId === '' || $refs.tree.getCheckedKeys().length === 0}" :disabled="disabled" @click="toSave">保存</button>
</div> -->
<div class="tree_body_container">
<el-tree
:data="tree"
@@ -280,16 +276,17 @@ export default {
this.toast(res.desc)
this.pkId = ''
this.checkedKeys = []
this.tree.map(e => {
this.$refs.tree.setChecked(e, false, true)
})
this._sysRoleQuery()
} else {
this.toast(res.desc)
this.pkId = ''
this.checkedKeys = []
}
this.disabled = false
} catch (e) {
this.disabled = false
this.pkId = ''
this.checkedKeys = []
}
},
toSave () {
@@ -297,7 +294,6 @@ export default {
return
}
this.active1 = false
this.pkId = ''
let arr1 = this.$refs.tree.getCheckedKeys()
let arr2 = this.$refs.tree.getHalfCheckedKeys()
arr2.map((e, i) => {
@@ -317,20 +313,17 @@ export default {
},
toCheck (e) {
this.pkId = this.pkId === e.roleId ? '' : e.roleId
this.pkObj = this.pkId === e.roleId ? e : []
this.active1 = this.pkId === e.roleId
this.checkedKeys = this.pkId === e.roleId ? e.menus1 : []
this.tree.map(e => {
this.$refs.tree.setChecked(e, false, true)
this.checkedKeys = [...e.menus1]
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys(this.checkedKeys)
})
if (this.pkId === e.roleId) {
this.checkedKeys = e.menus1
} else {
this.checkedKeys = []
}
},
toCancle1 () {
this.active1 = false
this.pkId = ''
this.checkedKeys = []
},
show (e) {
this.input = e.target