|
|
|
|
@ -26,6 +26,7 @@
|
|
|
|
|
<el-table-column fixed="right" label="操作" width="300">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<Button ghost size="small" @click="edit(scope.row)" type="primary">编辑</Button>
|
|
|
|
|
<Button ghost size="small" style="margin-left: 10px;" @click="set(scope.row)" type="primary">设置权限</Button>
|
|
|
|
|
<Button @click="del(scope.row)" type="error" ghost size="small" style="margin-left: 10px;">删除</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -47,6 +48,26 @@
|
|
|
|
|
<el-button type="primary" @click="submitForm('form')">确 定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-dialog title="权限设置" :visible.sync="dialogSetVisible" width="60%">
|
|
|
|
|
<el-form label-position="right" :label-width="formLabelWidth">
|
|
|
|
|
|
|
|
|
|
<el-form-item label="角色名称" prop="name">
|
|
|
|
|
{{setForm.name}}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="角色人员">
|
|
|
|
|
<el-transfer filterable :titles="['待选择', '已选择']" :props="{key: 'id',label: 'name'}"
|
|
|
|
|
:filter-method="filterMethod" :format="{ noChecked: '${total}',hasChecked: '${checked}/${total}' }"
|
|
|
|
|
filter-placeholder="请选择人员" v-model="setForm.ids" :data="userdata">
|
|
|
|
|
</el-transfer>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="dialogSetVisible=false">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitSet()">确 定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
@ -56,18 +77,27 @@
|
|
|
|
|
import {
|
|
|
|
|
save,
|
|
|
|
|
list,
|
|
|
|
|
del
|
|
|
|
|
del,
|
|
|
|
|
set
|
|
|
|
|
} from "../../api/system/role.js";
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
listCommondepartment,
|
|
|
|
|
listCommonuser
|
|
|
|
|
} from "../../api/common.js"
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
LxHeader
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.load();
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
mounted() {},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
dialogSetVisible: false,
|
|
|
|
|
dialogFormVisible: false,
|
|
|
|
|
formLabelWidth: "120px",
|
|
|
|
|
form: {
|
|
|
|
|
@ -75,6 +105,10 @@
|
|
|
|
|
id: "",
|
|
|
|
|
sortnumber: "0"
|
|
|
|
|
},
|
|
|
|
|
userdata: [],
|
|
|
|
|
filterMethod(query, item) {
|
|
|
|
|
return item.name.indexOf(query) > -1;
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
name: [{
|
|
|
|
|
required: true,
|
|
|
|
|
@ -87,7 +121,12 @@
|
|
|
|
|
searchFields: {
|
|
|
|
|
KeyWord: ""
|
|
|
|
|
},
|
|
|
|
|
tableData: []
|
|
|
|
|
tableData: [],
|
|
|
|
|
setForm: {
|
|
|
|
|
name: "",
|
|
|
|
|
ids: [],
|
|
|
|
|
role_id:""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
@ -99,6 +138,16 @@
|
|
|
|
|
//reject(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
loadUser() {
|
|
|
|
|
listCommonuser({
|
|
|
|
|
page_size: 999
|
|
|
|
|
}).
|
|
|
|
|
then((res) => {
|
|
|
|
|
this.userdata = res.data;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
edit(obj) {
|
|
|
|
|
if (obj) {
|
|
|
|
|
this.form.id = obj.id;
|
|
|
|
|
@ -106,6 +155,35 @@
|
|
|
|
|
}
|
|
|
|
|
this.dialogFormVisible = true;
|
|
|
|
|
},
|
|
|
|
|
set(obj) {
|
|
|
|
|
var that = this;
|
|
|
|
|
this.setForm.role_id = "";
|
|
|
|
|
this.setForm.ids = [];
|
|
|
|
|
this.setForm.name = obj.name;
|
|
|
|
|
this.setForm.role_id=obj.id;
|
|
|
|
|
if (obj.admin) {
|
|
|
|
|
for (var m of obj.admin) {
|
|
|
|
|
this.setForm.ids.push(m.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.dialogSetVisible = true;
|
|
|
|
|
this.loadUser();
|
|
|
|
|
},
|
|
|
|
|
submitSet() {
|
|
|
|
|
let that = this;
|
|
|
|
|
if (that.setForm.ids.length == 0) {
|
|
|
|
|
this.$Message.error("请选择人员");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set(that.setForm).then(response => {
|
|
|
|
|
this.$Message.success('操作成功');
|
|
|
|
|
that.load();
|
|
|
|
|
that.dialogSetVisible = false;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
this.$Message.error(error);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
del(obj) {
|
|
|
|
|
var that = this;
|
|
|
|
|
if (obj) {
|
|
|
|
|
|