完善数组判断处理
This commit is contained in:
@@ -5,12 +5,14 @@
|
||||
<el-main class="nopadding">
|
||||
<el-menu class="menu mainMenu" :default-active="page">
|
||||
<el-menu-item-group v-for="group in menu" :key="group.groupName" :title="group.groupName">
|
||||
<el-menu-item v-for="item in group.list" :key="item.component" :index="item.component" @click="openPage">
|
||||
<el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
|
||||
<template #title>
|
||||
<span>{{item.title}}</span>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
<div v-for="item in group.list" :key="item.component">
|
||||
<el-menu-item v-authSetup="item.actions" :index="item.component" @click="openPage">
|
||||
<el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
|
||||
<template #title>
|
||||
<span>{{item.title}}</span>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</div>
|
||||
</el-menu-item-group>
|
||||
</el-menu>
|
||||
</el-main>
|
||||
@@ -53,12 +55,14 @@ export default {
|
||||
{
|
||||
icon: "sc-icon-MachineRoom",
|
||||
title: "机房配置",
|
||||
component: "account"
|
||||
component: "account",
|
||||
actions:'roomConfig'
|
||||
},
|
||||
{
|
||||
icon: "sc-icon-CostAllocation",
|
||||
title: "费用配置",
|
||||
component: "password"
|
||||
component: "password",
|
||||
actions:'costConfig'
|
||||
},
|
||||
]
|
||||
},
|
||||
@@ -68,12 +72,14 @@ export default {
|
||||
{
|
||||
icon: "sc-icon-DataSource",
|
||||
title: "数据源邮件设置",
|
||||
component: "mail"
|
||||
component: "mail",
|
||||
actions:'mailConfigSet'
|
||||
},
|
||||
{
|
||||
icon: "sc-icon-AgentMaintenance",
|
||||
title: "K3接口配置",
|
||||
component: "interface"
|
||||
component: "interface",
|
||||
actions:'k3ApiConfigSet'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -52,29 +52,31 @@ export default {
|
||||
},
|
||||
watch:{
|
||||
data(val){
|
||||
val.forEach(item=>{
|
||||
item.show = true;
|
||||
if(item.children){
|
||||
item.children.forEach(em=>{
|
||||
if(em.meta.data_permission){
|
||||
let check = em.meta.data_permission.filter((li)=>li.checked).length;
|
||||
let ed = em.meta.data_permission.length;
|
||||
em.isCheck = check>0 && check != ed?true:false;
|
||||
if(ed>0){
|
||||
em.checked = check>0 && check== ed?true:false;
|
||||
if(val && val.length>0){
|
||||
val.forEach(item=>{
|
||||
item.show = true;
|
||||
if(item.children){
|
||||
item.children.forEach(em=>{
|
||||
if(em.meta.data_permission && em.meta.data_permission.length>0){
|
||||
let check = em.meta.data_permission.filter((li)=>li.checked).length;
|
||||
let ed = em.meta.data_permission.length;
|
||||
em.isCheck = check>0 && check != ed?true:false;
|
||||
if(ed>0){
|
||||
em.checked = check>0 && check== ed?true:false;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
let check = item.children.filter((em)=>em.checked).length;
|
||||
let isCheck = item.children.filter((em)=>em.isCheck).length;
|
||||
let ed = item.children.length;
|
||||
})
|
||||
let check = item.children.filter((em)=>em.checked).length;
|
||||
let isCheck = item.children.filter((em)=>em.isCheck).length;
|
||||
let ed = item.children.length;
|
||||
|
||||
item.isCheck = (check>0 && check != ed) || (isCheck>0 && check != ed)?true:false;
|
||||
item.checked = check>0 && check== ed?true:false;
|
||||
}
|
||||
})
|
||||
item.isCheck = (check>0 && check != ed) || (isCheck>0 && check != ed)?true:false;
|
||||
item.checked = check>0 && check== ed?true:false;
|
||||
}
|
||||
})
|
||||
|
||||
this.list = JSON.parse(JSON.stringify(val));
|
||||
this.list = JSON.parse(JSON.stringify(val));
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
async getGroup(flag = false){
|
||||
this.showGroupLoading = true;
|
||||
const res = await this.$API.system.role.list.get();
|
||||
this.showGroupLoading = false;
|
||||
if(res.code == 200){
|
||||
this.group = res.data.rows;
|
||||
this.role_id = res.data.rows && res.data.rows.length>0?res.data.rows[0].id:"";
|
||||
@@ -172,7 +173,6 @@
|
||||
await this.getRoleList();
|
||||
}
|
||||
}
|
||||
this.showGroupLoading = false;
|
||||
},
|
||||
//添加
|
||||
add(){
|
||||
@@ -337,20 +337,26 @@
|
||||
this.activeNum = e;
|
||||
},
|
||||
async getMenu() {
|
||||
let params = {
|
||||
role_id: this.role_id,
|
||||
};
|
||||
const res = await this.$API.system.role.roleMenu.post(params);
|
||||
this.menu.list = res.data;
|
||||
if(this.role_id!=""){
|
||||
let params = {
|
||||
role_id: this.role_id,
|
||||
};
|
||||
const res = await this.$API.system.role.roleMenu.post(params);
|
||||
this.menu.list = res.data;
|
||||
}
|
||||
},
|
||||
async getRoleList() {
|
||||
let params = {
|
||||
role_id: this.role_id,
|
||||
};
|
||||
const res = await this.$API.system.role.roleUser.post(params);
|
||||
this.roleUser.list = res.data;
|
||||
this.userCheckList = res.data;
|
||||
this.userIds = res.data.map(item=>item.id);
|
||||
if(this.role_id!=""){
|
||||
let params = {
|
||||
role_id: this.role_id,
|
||||
};
|
||||
const res = await this.$API.system.role.roleUser.post(params);
|
||||
this.roleUser.list = res.data;
|
||||
this.userCheckList = res.data;
|
||||
if(res.data && res.data.length>0){
|
||||
this.userIds = res.data.map(item=>item.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async getDeptTree() {
|
||||
|
||||
@@ -45,10 +45,12 @@ export default {
|
||||
},
|
||||
watch:{
|
||||
data(val){
|
||||
val.forEach(item=>{
|
||||
item.checked = false;
|
||||
})
|
||||
this.list = JSON.parse(JSON.stringify(val));
|
||||
if(val && val.length>0){
|
||||
val.forEach(item=>{
|
||||
item.checked = false;
|
||||
})
|
||||
this.list = JSON.parse(JSON.stringify(val));
|
||||
}
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
|
||||
@@ -177,7 +177,9 @@ export default {
|
||||
const res = await this.$API.system.role.roleUser.post(params);
|
||||
this.roleUser.list = res.data;
|
||||
this.userCheckList = res.data;
|
||||
this.userIds = res.data.map(item=>item.id);
|
||||
if(res.data && res.data.length>0){
|
||||
this.userIds = res.data.map(item=>item.id);
|
||||
}
|
||||
},
|
||||
async getDeptTree() {
|
||||
this.memberShow = true;
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
@@ -96,7 +96,7 @@ export default {
|
||||
res.data.menu.forEach(item=>{
|
||||
if(item.children){
|
||||
item.children.forEach(em=>{
|
||||
if(em.meta.data_permission){
|
||||
if(em.meta.data_permission && em.meta.data_permission.length>0){
|
||||
let check = em.meta.data_permission.filter((li)=>li.checked).length;
|
||||
let ed = em.meta.data_permission.length;
|
||||
em.isCheck = check>0 && check != ed?true:false;
|
||||
|
||||
Reference in New Issue
Block a user