|
|
|
@ -90,13 +90,11 @@
|
|
|
|
|
width="120"
|
|
|
|
|
label="操作">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])" @command="onCommand">
|
|
|
|
|
<i class="el-icon-edit">编辑</i>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
<el-dropdown-item :command="['resourceEdit',scope.row]" icon="el-icon-edit">分配资源</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
<wb-dropdown>
|
|
|
|
|
<wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit(scope.row)"></wb-dropdown-item>
|
|
|
|
|
<wb-dropdown-item value="授权" icon="el-icon-edit" @click="onResEdit(scope.row)"></wb-dropdown-item>
|
|
|
|
|
<wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete(scope.row)"></wb-dropdown-item>
|
|
|
|
|
</wb-dropdown>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
@ -214,48 +212,58 @@
|
|
|
|
|
this.form.name = "";
|
|
|
|
|
this.form.comment = "";
|
|
|
|
|
},
|
|
|
|
|
onCommand: function (arg) {
|
|
|
|
|
const cmd = arg[0];
|
|
|
|
|
const item = arg[1];
|
|
|
|
|
switch (cmd) {
|
|
|
|
|
case "edit":
|
|
|
|
|
this.form.title = "角色编辑";
|
|
|
|
|
this.form.dialog = true;
|
|
|
|
|
this.form.id = item.id;
|
|
|
|
|
this.form.code = item.code;
|
|
|
|
|
this.form.name = item.name;
|
|
|
|
|
this.form.comment = item.comment;
|
|
|
|
|
this.form.rowVersion = item.rowVersion;
|
|
|
|
|
break;
|
|
|
|
|
case "resourceEdit":
|
|
|
|
|
this.formResource.title = "分配资源";
|
|
|
|
|
this.formResource.dialog = true;
|
|
|
|
|
this.formResource.roleId = item.id;
|
|
|
|
|
this.formResource.roleCode = item.code;
|
|
|
|
|
new Ajax()
|
|
|
|
|
.module("system")
|
|
|
|
|
.target("roleRes")
|
|
|
|
|
.data({roleId: item.id, pageSize: 0})
|
|
|
|
|
.find(function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs.tree.setCheckedKeys([]);
|
|
|
|
|
var ids = [];
|
|
|
|
|
for (var i = 0; i < response.result.length; i++) {
|
|
|
|
|
ids.push(response.result[i].resId);
|
|
|
|
|
}
|
|
|
|
|
this.$refs.tree.setCheckedKeys(ids);
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
break;
|
|
|
|
|
case "delete":
|
|
|
|
|
this.onDelete(item);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
nav.w("未找到对应的命令");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
onEdit: function (item) {
|
|
|
|
|
this.form.title = "角色编辑";
|
|
|
|
|
this.form.dialog = true;
|
|
|
|
|
this.form.id = item.id;
|
|
|
|
|
this.form.code = item.code;
|
|
|
|
|
this.form.name = item.name;
|
|
|
|
|
this.form.comment = item.comment;
|
|
|
|
|
this.form.rowVersion = item.rowVersion;
|
|
|
|
|
},
|
|
|
|
|
onDelete: function (item) {
|
|
|
|
|
this.$confirm('将删除该项, 是否继续?', '提示', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(function () {
|
|
|
|
|
new Ajax()
|
|
|
|
|
.module(this.module)
|
|
|
|
|
.target(this.target)
|
|
|
|
|
.data({id: item.id})
|
|
|
|
|
.delete(function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
nav.s("删除成功");
|
|
|
|
|
this.onFind();
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
}.bind(this)).catch(function (action) {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onResEdit: function (item) {
|
|
|
|
|
this.formResource.title = "分配资源";
|
|
|
|
|
this.formResource.dialog = true;
|
|
|
|
|
this.formResource.roleId = item.id;
|
|
|
|
|
this.formResource.roleCode = item.code;
|
|
|
|
|
new Ajax()
|
|
|
|
|
.module("system")
|
|
|
|
|
.target("roleRes")
|
|
|
|
|
.data({roleId: item.id, pageSize: 0})
|
|
|
|
|
.find(function (response) {
|
|
|
|
|
if (response.errors.length > 0) {
|
|
|
|
|
nav.e(response.errors[0].message);
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs.tree.setCheckedKeys([]);
|
|
|
|
|
var ids = [];
|
|
|
|
|
for (var i = 0; i < response.result.length; i++) {
|
|
|
|
|
ids.push(response.result[i].resId);
|
|
|
|
|
}
|
|
|
|
|
this.$refs.tree.setCheckedKeys(ids);
|
|
|
|
|
}
|
|
|
|
|
}.bind(this))
|
|
|
|
|
},
|
|
|
|
|
onCheck: function (item, status) {
|
|
|
|
|
new Ajax()
|
|
|
|
|