|
@@ -40,6 +40,21 @@
|
|
|
icon="el-icon-edit">添加
|
|
|
</el-button>
|
|
|
</template>
|
|
|
+ <template slot="dsScopeForm" slot-scope="scope">
|
|
|
+ <div v-if="form.dsType == 1">
|
|
|
+ <el-tree class="filter-tree"
|
|
|
+ :data="dsScopeData"
|
|
|
+ :check-strictly="true"
|
|
|
+ node-key="id"
|
|
|
+ highlight-current
|
|
|
+ :props="defaultProps"
|
|
|
+ ref="scopeTree"
|
|
|
+ :default-checked-keys="checkedDsScope"
|
|
|
+ show-checkbox>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template slot="menu"
|
|
|
slot-scope="scope">
|
|
|
<el-button size="mini"
|
|
@@ -90,17 +105,20 @@
|
|
|
|
|
|
<script>
|
|
|
import {addObj, delObj, fetchList, fetchRoleTree, getObj, permissionUpd, putObj} from '@/api/admin/role'
|
|
|
- import {fetchTree} from '@/api/admin/menu'
|
|
|
- import {mapGetters} from 'vuex'
|
|
|
import {tableOption} from '@/const/crud/admin/role'
|
|
|
+ import {fetchTree} from '@/api/admin/dept'
|
|
|
+ import {fetchMenuTree} from '@/api/admin/menu'
|
|
|
+ import {mapGetters} from 'vuex'
|
|
|
|
|
|
export default {
|
|
|
name: 'table_role',
|
|
|
data() {
|
|
|
return {
|
|
|
tableOption: tableOption,
|
|
|
+ dsScopeData: [],
|
|
|
treeData: [],
|
|
|
checkedKeys: [],
|
|
|
+ checkedDsScope: [],
|
|
|
defaultProps: {
|
|
|
label: "name",
|
|
|
value: 'id'
|
|
@@ -156,6 +174,14 @@
|
|
|
this.$refs.crud.rowAdd();
|
|
|
},
|
|
|
handleOpenBefore(show, type) {
|
|
|
+ fetchTree().then(response => {
|
|
|
+ this.dsScopeData = response.data.data;
|
|
|
+ if (this.form.dsScope) {
|
|
|
+ this.checkedDsScope = (this.form.dsScope).split(",")
|
|
|
+ } else {
|
|
|
+ this.checkedDsScope = []
|
|
|
+ }
|
|
|
+ });
|
|
|
show();
|
|
|
},
|
|
|
handleUpdate(row, index) {
|
|
@@ -165,7 +191,7 @@
|
|
|
fetchRoleTree(row.roleId)
|
|
|
.then(response => {
|
|
|
this.checkedKeys = response.data
|
|
|
- return fetchTree()
|
|
|
+ return fetchMenuTree()
|
|
|
})
|
|
|
.then(response => {
|
|
|
this.treeData = response.data.data
|
|
@@ -215,6 +241,9 @@
|
|
|
})
|
|
|
},
|
|
|
create(row, done, loading) {
|
|
|
+ if (this.form.dsType === 1){
|
|
|
+ this.form.dsScope = this.$refs.scopeTree.getCheckedKeys().join(',')
|
|
|
+ }
|
|
|
addObj(this.form).then(() => {
|
|
|
this.getList(this.page)
|
|
|
done();
|
|
@@ -229,6 +258,9 @@
|
|
|
});
|
|
|
},
|
|
|
update(row, index, done, loading) {
|
|
|
+ if (this.form.dsType === 1){
|
|
|
+ this.form.dsScope = this.$refs.scopeTree.getCheckedKeys().join(',')
|
|
|
+ }
|
|
|
putObj(this.form).then(() => {
|
|
|
this.getList(this.page)
|
|
|
done();
|
|
@@ -247,7 +279,7 @@
|
|
|
this.menuIds = this.$refs.menuTree.getCheckedKeys().join(',').concat(',').concat(this.$refs.menuTree.getHalfCheckedKeys().join(','))
|
|
|
permissionUpd(roleId, this.menuIds).then(() => {
|
|
|
this.dialogPermissionVisible = false
|
|
|
- fetchTree()
|
|
|
+ fetchMenuTree()
|
|
|
.then(response => {
|
|
|
this.form = response.data.data
|
|
|
return fetchRoleTree(roleId)
|