|
|
|
@ -166,23 +166,39 @@
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-dialog class="form-dialog" :title="formResource.title" :visible.sync="formResource.dialog">
|
|
|
|
|
<el-dialog class="form-dialog" :title="formRes.title" :visible.sync="formRes.dialog">
|
|
|
|
|
<el-row style="padding: 0 10px 10px 10px;">
|
|
|
|
|
<el-checkbox label="父子关联" v-model="config.strictly" name="strictly"></el-checkbox>
|
|
|
|
|
<el-checkbox label="创建权限" v-model="config.create"></el-checkbox>
|
|
|
|
|
<el-checkbox label="删除权限" v-model="config.delete"></el-checkbox>
|
|
|
|
|
<el-checkbox label="修改权限" v-model="config.update"></el-checkbox>
|
|
|
|
|
<el-checkbox label="查询权限" v-model="config.find"></el-checkbox>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-input
|
|
|
|
|
clearable
|
|
|
|
|
size="mini"
|
|
|
|
|
v-model="formRes.treeFilter"
|
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
|
placeholder="输入过滤关键字"
|
|
|
|
|
@keyup.enter.native="$refs.tree.filter(formRes.treeFilter)"/>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="11" offset="1">
|
|
|
|
|
<el-button-group>
|
|
|
|
|
<el-tooltip effect="dark" content="关键字过滤资源" placement="bottom">
|
|
|
|
|
<el-button size="mini" type="primary" icon="el-icon-search" @click="$refs.tree.filter(formRes.treeFilter)">查询</el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
<el-tooltip effect="dark" content="勾选父节点时是否关联勾选所有子节点" placement="bottom">
|
|
|
|
|
<el-button v-if="!formRes.strictly" @click="formRes.strictly = !formRes.strictly" size="mini" type="primary" icon="el-icon-share">关联</el-button>
|
|
|
|
|
<el-button v-if="formRes.strictly" @click="formRes.strictly = !formRes.strictly" size="mini" icon="el-icon-share">关联</el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-tree
|
|
|
|
|
:data="treeData"
|
|
|
|
|
show-checkbox
|
|
|
|
|
node-key="id"
|
|
|
|
|
ref="tree"
|
|
|
|
|
node-key="id"
|
|
|
|
|
show-checkbox
|
|
|
|
|
:data="treeData"
|
|
|
|
|
@check="onCheck"
|
|
|
|
|
:check-strictly="true"
|
|
|
|
|
:expand-on-click-node="false">
|
|
|
|
|
:expand-on-click-node="false"
|
|
|
|
|
:filter-node-method="onTreeFilter">
|
|
|
|
|
<div class="tree" slot-scope="{ node, data }">
|
|
|
|
|
<el-tooltip class="item" effect="dark" :content="data.resValue" placement="right">
|
|
|
|
|
<span>{{ data.resName }}<span style="color: #409EFF">[{{data.resCode}}]</span></span>
|
|
|
|
@ -191,7 +207,7 @@
|
|
|
|
|
</el-tree>
|
|
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button size="mini" @click="formResource.dialog = false">关 闭</el-button>
|
|
|
|
|
<el-button size="mini" @click="formRes.dialog = false">关 闭</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
@ -202,13 +218,6 @@
|
|
|
|
|
data: {
|
|
|
|
|
module: 'wsys',
|
|
|
|
|
target: 'role',
|
|
|
|
|
config:{
|
|
|
|
|
strictly:false,
|
|
|
|
|
create:false,
|
|
|
|
|
delete:false,
|
|
|
|
|
update:false,
|
|
|
|
|
find:false,
|
|
|
|
|
},
|
|
|
|
|
vm: {//条件及分页参数
|
|
|
|
|
code: null,
|
|
|
|
|
name: null,
|
|
|
|
@ -230,12 +239,6 @@
|
|
|
|
|
comment: null,
|
|
|
|
|
rowVersion: null
|
|
|
|
|
},
|
|
|
|
|
formResource: {
|
|
|
|
|
title: null,
|
|
|
|
|
dialog: false,
|
|
|
|
|
roleId: null,
|
|
|
|
|
roleCode: null
|
|
|
|
|
},
|
|
|
|
|
formRules: {
|
|
|
|
|
code: [
|
|
|
|
|
{required: true, message: '角色代码不能为空', trigger: 'blur'},
|
|
|
|
@ -249,6 +252,14 @@
|
|
|
|
|
{min: 1, max: 50, message: '角色描述长度在 1 到 50 个字符', trigger: 'blur'}
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
formRes: {
|
|
|
|
|
title: null,
|
|
|
|
|
dialog: false,
|
|
|
|
|
roleId: null,
|
|
|
|
|
roleCode: null,
|
|
|
|
|
treeFilter: '',
|
|
|
|
|
strictly:true//是否严格遵循复制不关联
|
|
|
|
|
},
|
|
|
|
|
treeData: []
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
@ -288,10 +299,10 @@
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onResEdit: function (item) {
|
|
|
|
|
this.formResource.title = "分配资源";
|
|
|
|
|
this.formResource.dialog = true;
|
|
|
|
|
this.formResource.roleId = item.id;
|
|
|
|
|
this.formResource.roleCode = item.code;
|
|
|
|
|
this.formRes.title = "分配资源";
|
|
|
|
|
this.formRes.dialog = true;
|
|
|
|
|
this.formRes.roleId = item.id;
|
|
|
|
|
this.formRes.roleCode = item.code;
|
|
|
|
|
new Ajax("wsys", "roleRes").find({
|
|
|
|
|
roleId: item.id,
|
|
|
|
|
pageSize: 0
|
|
|
|
@ -309,18 +320,20 @@
|
|
|
|
|
}.bind(this))
|
|
|
|
|
},
|
|
|
|
|
onCheck: function (item, status) {
|
|
|
|
|
var roleId = this.formResource.roleId;
|
|
|
|
|
var roleCode = this.formResource.roleCode;
|
|
|
|
|
var roleId = this.formRes.roleId;
|
|
|
|
|
var roleCode = this.formRes.roleCode;
|
|
|
|
|
var isChecked = status.checkedKeys.indexOf(item.id) !== -1;
|
|
|
|
|
|
|
|
|
|
var list = [];
|
|
|
|
|
if(!this.config.strictly){
|
|
|
|
|
if(this.formRes.strictly) {
|
|
|
|
|
list.push(item)
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
[item].forTree(function (item) {
|
|
|
|
|
list.push(item);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(this.formRes.strictly)
|
|
|
|
|
nav.tipShow("更新中");
|
|
|
|
|
list.forAsync(function (item_, next) {
|
|
|
|
|
if (isChecked === (status.checkedKeys.indexOf(item_.id) !== -1) && item_.id !== item.id) {
|
|
|
|
@ -345,6 +358,12 @@
|
|
|
|
|
nav.tipClose()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onTreeFilter: function (value, data) {
|
|
|
|
|
if (!value) return true;
|
|
|
|
|
return data.resName.indexOf(value) !== -1
|
|
|
|
|
|| data.resCode.indexOf(value) !== -1
|
|
|
|
|
|| data.resValue.indexOf(value) !== -1;
|
|
|
|
|
},
|
|
|
|
|
onLoadTree: function () {
|
|
|
|
|
new Ajax("wsys", "res", "tree").post({}, function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|