APP菜单权限及租户权限
This commit is contained in:
parent
a16c5a44f3
commit
af585ecb17
0
imt-ui/src/api/system/appMenu.js
Normal file
0
imt-ui/src/api/system/appMenu.js
Normal file
0
imt-ui/src/views/system/appMenu/index.vue
Normal file
0
imt-ui/src/views/system/appMenu/index.vue
Normal file
@ -71,6 +71,12 @@
|
||||
<el-tree class="tree-border" :data="menuOptions" show-checkbox ref="menu" node-key="id"
|
||||
:check-strictly="menuCheckStrictly" empty-text="加载中,请稍后" :props="defaultProps"></el-tree>
|
||||
</el-form-item>
|
||||
<el-form-item label="APP菜单权限">
|
||||
<el-checkbox v-model="APPmenuExpand" @change="handleCheckedAPPTreeExpand($event)">展开/折叠</el-checkbox>
|
||||
<el-checkbox v-model="APPmenuNodeAll" @change="handleCheckedAPPTreeNodeAll($event)">全选/全不选</el-checkbox>
|
||||
<el-tree class="tree-border" :data="APPmenuOptions" show-checkbox ref="APPmenu" node-key="id"
|
||||
:check-strictly="APPmenuCheckStrictly" empty-text="加载中,请稍后" :props="APPdefaultProps"></el-tree>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||
@ -93,6 +99,7 @@
|
||||
import { createTenantPackage, updateTenantPackage, deleteTenantPackage, getTenantPackage, getTenantPackagePage} from "@/api/system/tenantPackage";
|
||||
import {CommonStatusEnum} from "@/utils/constants";
|
||||
import {listSimpleMenus} from "@/api/system/menu";
|
||||
import {listSimpleAPPMenus} from "@/api/system/appMenu";
|
||||
|
||||
export default {
|
||||
name: "SystemTenantPackage",
|
||||
@ -124,13 +131,21 @@ export default {
|
||||
// 表单参数
|
||||
form: {},
|
||||
menuExpand: false,
|
||||
APPmenuExpand: false,
|
||||
menuNodeAll: false,
|
||||
APPmenuNodeAll: false,
|
||||
menuCheckStrictly: true,
|
||||
APPmenuCheckStrictly: true,
|
||||
defaultProps: {
|
||||
label: "name",
|
||||
children: "children"
|
||||
},
|
||||
APPdefaultProps: {
|
||||
label: "name",
|
||||
children: "children"
|
||||
},
|
||||
menuOptions: [], // 菜单列表
|
||||
APPmenuOptions: [], // 菜单列表
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "套餐名不能为空", trigger: "blur" }],
|
||||
@ -165,9 +180,15 @@ export default {
|
||||
if (this.$refs.menu !== undefined) {
|
||||
this.$refs.menu.setCheckedKeys([]);
|
||||
}
|
||||
if (this.$refs.APPmenu !== undefined) {
|
||||
this.$refs.APPmenu.setCheckedKeys([]);
|
||||
}
|
||||
this.menuExpand = false;
|
||||
this.APPmenuExpand = false;
|
||||
this.menuNodeAll = false;
|
||||
this.APPmenuNodeAll = false;
|
||||
this.menuCheckStrictly = true;
|
||||
this.APPmenuCheckStrictly = true;
|
||||
// 表单重置
|
||||
this.form = {
|
||||
id: undefined,
|
||||
@ -175,6 +196,7 @@ export default {
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
remark: undefined,
|
||||
menuIds: undefined,
|
||||
appMenuIds: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -196,6 +218,7 @@ export default {
|
||||
this.title = "添加租户套餐";
|
||||
// 设置为非严格,继续使用半选中
|
||||
this.menuCheckStrictly = false;
|
||||
this.APPmenuCheckStrictly = false;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
@ -209,10 +232,13 @@ export default {
|
||||
// 设置菜单项
|
||||
// 设置为严格,避免设置父节点自动选中子节点,解决半选中问题
|
||||
this.menuCheckStrictly = true
|
||||
this.APPmenuCheckStrictly = true
|
||||
// 设置选中
|
||||
this.$refs.menu.setCheckedKeys(response.data.menuIds);
|
||||
this.$refs.APPmenu.setCheckedKeys(response.data.appMenuIds);
|
||||
// 设置为非严格,继续使用半选中
|
||||
this.menuCheckStrictly = false
|
||||
this.APPmenuCheckStrictly = false
|
||||
});
|
||||
},
|
||||
/** 获得菜单 */
|
||||
@ -223,6 +249,12 @@ export default {
|
||||
// 只需要配置
|
||||
this.menuOptions.push(...this.handleTree(response.data, "id"));
|
||||
});
|
||||
listSimpleAPPMenus().then(response => {
|
||||
// 处理 APPmenuOptions 参数
|
||||
this.APPmenuOptions = [];
|
||||
// 只需要配置
|
||||
this.APPmenuOptions.push(...this.handleTree(response.data, "id"));
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
@ -234,7 +266,8 @@ export default {
|
||||
if (this.form.id != null) {
|
||||
updateTenantPackage({
|
||||
...this.form,
|
||||
menuIds: [...this.$refs.menu.getCheckedKeys(), ...this.$refs.menu.getHalfCheckedKeys()]
|
||||
menuIds: [...this.$refs.menu.getCheckedKeys(), ...this.$refs.menu.getHalfCheckedKeys()],
|
||||
appMenuIds: [...this.$refs.APPmenu.getCheckedKeys(), ...this.$refs.APPmenu.getHalfCheckedKeys()]
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
@ -245,7 +278,8 @@ export default {
|
||||
// 添加的提交
|
||||
createTenantPackage({
|
||||
...this.form,
|
||||
menuIds: [...this.$refs.menu.getCheckedKeys(), ...this.$refs.menu.getHalfCheckedKeys()]
|
||||
menuIds: [...this.$refs.menu.getCheckedKeys(), ...this.$refs.menu.getHalfCheckedKeys()],
|
||||
appMenuIds: [...this.$refs.APPmenu.getCheckedKeys(), ...this.$refs.APPmenu.getHalfCheckedKeys()]
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
@ -274,6 +308,17 @@ export default {
|
||||
handleCheckedTreeNodeAll(value) {
|
||||
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
|
||||
},
|
||||
// 树权限(展开/折叠)
|
||||
handleCheckedAPPTreeExpand(value, type) {
|
||||
let treeList = this.APPmenuOptions;
|
||||
for (let i = 0; i < treeList.length; i++) {
|
||||
this.$refs.APPmenu.store.nodesMap[treeList[i].id].expanded = value;
|
||||
}
|
||||
},
|
||||
// 树权限(全选/全不选)
|
||||
handleCheckedAPPTreeNodeAll(value) {
|
||||
this.$refs.APPmenu.setCheckedNodes(value ? this.APPmenuOptions: []);
|
||||
},
|
||||
// 树权限(父子联动)
|
||||
handleCheckedTreeConnect(value) {
|
||||
this.form.menuCheckStrictly = value;
|
||||
|
Loading…
Reference in New Issue
Block a user