|
|
|
@ -8,15 +8,28 @@
|
|
|
|
|
@close="hide"
|
|
|
|
|
>
|
|
|
|
|
<div class="treeBoxList" v-loading="treeLoading">
|
|
|
|
|
<el-checkbox-group v-model="checkedMenu">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-for="item in menuCheckOption"
|
|
|
|
|
:label="item.id"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:disabled="item.key == '/stritl'"
|
|
|
|
|
>{{ item.desc }}</el-checkbox
|
|
|
|
|
>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
<div class="menuBox">
|
|
|
|
|
<h3>菜单选项</h3>
|
|
|
|
|
<el-checkbox-group v-model="checkedMenu">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-for="item in menuCheckOption"
|
|
|
|
|
:label="item.id"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
>{{ item.desc }}</el-checkbox
|
|
|
|
|
>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="btnBox">
|
|
|
|
|
<h3>功能选项</h3>
|
|
|
|
|
<el-checkbox-group v-model="checkedBtn">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-for="item in btnCheckOption"
|
|
|
|
|
:label="item.id"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
>{{ item.desc }}</el-checkbox
|
|
|
|
|
>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="isShow = false">取 消</el-button>
|
|
|
|
@ -38,10 +51,13 @@ export default {
|
|
|
|
|
isShow: false,
|
|
|
|
|
treeLoading: false,
|
|
|
|
|
rowData: "",
|
|
|
|
|
allCheckList: [], //全部的内容
|
|
|
|
|
menuList: [],
|
|
|
|
|
checkedMenu: [], //选中的checkbox
|
|
|
|
|
checkedMenu: [], //选中的菜单checkbox
|
|
|
|
|
menuCheckOption: [], //checkbox列表
|
|
|
|
|
checkedIds: [], //权限返回的内容id
|
|
|
|
|
checkedBtn: [], //选中的按钮
|
|
|
|
|
btnCheckOption: [],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
@ -56,7 +72,13 @@ export default {
|
|
|
|
|
.then((res) => {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.menuCheckOption = res.data;
|
|
|
|
|
this.allCheckList = res.data;
|
|
|
|
|
this.menuCheckOption = res.data.filter((item) =>
|
|
|
|
|
item.key.includes("/")
|
|
|
|
|
);
|
|
|
|
|
this.btnCheckOption = res.data.filter((item) =>
|
|
|
|
|
item.key.includes("Btn")
|
|
|
|
|
);
|
|
|
|
|
this.getRolePermission();
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
@ -72,12 +94,11 @@ export default {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.checkedIds = res.data;
|
|
|
|
|
|
|
|
|
|
console.log(this.checkedIds);
|
|
|
|
|
|
|
|
|
|
this.checkedMenu = this.checkedIds.map((obj) => obj.resourceId);
|
|
|
|
|
console.log("我时查询到的选中的值", this.checkedMenu);
|
|
|
|
|
this.checkedMenu.push(this.menuCheckOption[0].id);
|
|
|
|
|
this.checkedBtn = this.checkedIds.map((obj) => obj.resourceId);
|
|
|
|
|
console.log("我时查询到的选中的值", this.checkedIds);
|
|
|
|
|
|
|
|
|
|
this.treeLoading = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
@ -88,10 +109,20 @@ export default {
|
|
|
|
|
// 保存确定操作
|
|
|
|
|
submitForm() {
|
|
|
|
|
console.log(this.checkedMenu);
|
|
|
|
|
console.log(this.checkedBtn);
|
|
|
|
|
let paramsList = [];
|
|
|
|
|
this.checkedMenu.map((id) => {
|
|
|
|
|
paramsList.push({ resourceId: id });
|
|
|
|
|
});
|
|
|
|
|
this.checkedBtn.map((id) => {
|
|
|
|
|
paramsList.push({ resourceId: id });
|
|
|
|
|
});
|
|
|
|
|
paramsList = paramsList.filter((item, index, self) => {
|
|
|
|
|
return (
|
|
|
|
|
self.findIndex((t) => t.resourceId === item.resourceId) === index
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
console.log(paramsList);
|
|
|
|
|
//设置权限
|
|
|
|
|
getRolechangePermissionApi({
|
|
|
|
|
list: paramsList,
|
|
|
|
@ -120,7 +151,9 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
hide() {
|
|
|
|
|
this.isShow = false;
|
|
|
|
|
this.allCheckList = [];
|
|
|
|
|
this.checkedMenu = [];
|
|
|
|
|
this.checkedBtn = [];
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mounted() {},
|
|
|
|
@ -131,6 +164,16 @@ export default {
|
|
|
|
|
.treeBoxList {
|
|
|
|
|
height: 600px;
|
|
|
|
|
overflow: auto;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
.menuBox,
|
|
|
|
|
.btnBox {
|
|
|
|
|
h3 {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.el-checkbox-group {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|