|
|
|
@ -6,6 +6,9 @@
|
|
|
|
|
<!-- 角色列表 -->
|
|
|
|
|
<a-col :span="5">
|
|
|
|
|
<div class="cardTitle">所有角色</div>
|
|
|
|
|
<a-button class="add-btn" style="margin: 10px" @click="add.show = true"
|
|
|
|
|
>新增角色</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-collapse accordion @change="rolechange">
|
|
|
|
|
<a-collapse-panel
|
|
|
|
|
v-for="(item, index) in roleList"
|
|
|
|
@ -81,7 +84,6 @@
|
|
|
|
|
@cancel="sendClose"
|
|
|
|
|
>
|
|
|
|
|
请选择角色:
|
|
|
|
|
<!-- <a-cascader :options="roleList" mode="multiple" :field-names="{ label: 'name', value: 'id', children: 'childrenList' }" placeholder="请选择" @change="onChange" style="width: 90%"/> -->
|
|
|
|
|
<el-cascader
|
|
|
|
|
:options="roleList"
|
|
|
|
|
:show-all-levels="false"
|
|
|
|
@ -90,22 +92,37 @@
|
|
|
|
|
@change="multiRole"
|
|
|
|
|
></el-cascader>
|
|
|
|
|
</a-modal>
|
|
|
|
|
<add-form
|
|
|
|
|
:show="add.show"
|
|
|
|
|
:title="add.title"
|
|
|
|
|
:list="roleList"
|
|
|
|
|
@close="addClose"
|
|
|
|
|
@success='success'
|
|
|
|
|
:id='add.editId'
|
|
|
|
|
></add-form>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { columns, pagination, searchForm } from "./depend/config.js";
|
|
|
|
|
import { rolelist, listByRole, assignRoles} from "@/api/basic/role";
|
|
|
|
|
import { rolelist, listByRole, assignRoles, roleDel} from "@/api/basic/role";
|
|
|
|
|
import rolePermissions from "./depend/permissions.vue";
|
|
|
|
|
import addForm from "./depend/form.vue";
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
rolePermissions,
|
|
|
|
|
addForm,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
pagination,
|
|
|
|
|
columns,
|
|
|
|
|
searchForm,
|
|
|
|
|
add: {
|
|
|
|
|
show: false,
|
|
|
|
|
title: "新增角色",
|
|
|
|
|
editId:null
|
|
|
|
|
},
|
|
|
|
|
tableChoosed: [],
|
|
|
|
|
roleList: [],
|
|
|
|
|
tableData: [], // 数据
|
|
|
|
@ -151,7 +168,38 @@ export default {
|
|
|
|
|
this.tableData = res.data.rows;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onChange(){},
|
|
|
|
|
success(){
|
|
|
|
|
this.getData()
|
|
|
|
|
},
|
|
|
|
|
addClose() {
|
|
|
|
|
this.add.show = false;
|
|
|
|
|
this.add.editId = undefined;
|
|
|
|
|
},
|
|
|
|
|
// 编辑角色
|
|
|
|
|
editRole(id){
|
|
|
|
|
this.add.editId = id
|
|
|
|
|
this.add.title = '修改角色'
|
|
|
|
|
this.add.show= true;
|
|
|
|
|
},
|
|
|
|
|
// 删除角色
|
|
|
|
|
delRole(id) {
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: "是否删除",
|
|
|
|
|
// okText:'删除',
|
|
|
|
|
// cancelText:'取消',
|
|
|
|
|
icon: "",
|
|
|
|
|
onOk:()=> {
|
|
|
|
|
roleDel({roleId:id}).then(res=>{
|
|
|
|
|
if(res.code === 200){
|
|
|
|
|
this.$message.success(res.msg)
|
|
|
|
|
this.getData()
|
|
|
|
|
}else{
|
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
rolechange(data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
this.searchForm.roleId = this.roleList[data].id;
|
|
|
|
@ -209,23 +257,6 @@ export default {
|
|
|
|
|
this.form.manageUserId = undefined
|
|
|
|
|
this.send.show = false
|
|
|
|
|
},
|
|
|
|
|
// 编辑角色
|
|
|
|
|
editRole(id){
|
|
|
|
|
this.add.editId = id
|
|
|
|
|
this.add.show= true;
|
|
|
|
|
},
|
|
|
|
|
// 删除角色
|
|
|
|
|
delRole(data) {
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: "是否删除",
|
|
|
|
|
// okText:'删除',
|
|
|
|
|
// cancelText:'取消',
|
|
|
|
|
icon: "",
|
|
|
|
|
onOk: function () {
|
|
|
|
|
console.log(data);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
Actions(data) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
},
|
|
|
|
|