完善数组判断处理
This commit is contained in:
parent
9ca2c0e905
commit
78121f6093
19
src/directives/authSetup.js
Normal file
19
src/directives/authSetup.js
Normal file
@ -0,0 +1,19 @@
|
||||
import { permissionAll } from '@/utils/permission'
|
||||
import tool from '@/utils/tool';
|
||||
|
||||
/**
|
||||
* 用户权限指令
|
||||
* @directive 单个权限验证(v-auth="xxx")
|
||||
*/
|
||||
export default {
|
||||
mounted (el, binding) {
|
||||
if(permissionAll()){
|
||||
return
|
||||
}
|
||||
let permissions = tool.data.get("PERMISSIONS");
|
||||
// if(permissions.auth.some((v)=> v === binding.value)){
|
||||
// console.log(binding.value,800)
|
||||
// }
|
||||
if (!permissions.auth.some((v) => v === binding.value)) el.parentNode.removeChild(el);
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,7 @@ import scImport from "./components/scImport";
|
||||
import scStatusIndicator from './components/scMini/scStatusIndicator'
|
||||
import scTrend from './components/scMini/scTrend'
|
||||
|
||||
import authSetup from './directives/authSetup'
|
||||
import auth from './directives/auth'
|
||||
import auths from './directives/auths'
|
||||
import authsAll from './directives/authsAll'
|
||||
@ -86,6 +87,7 @@ export default {
|
||||
app.component('scImport', scImport);
|
||||
|
||||
//注册全局指令
|
||||
app.directive('authSetup', authSetup)
|
||||
app.directive('auth', auth)
|
||||
app.directive('auths', auths)
|
||||
app.directive('auths-all', authsAll)
|
||||
|
||||
@ -281,6 +281,7 @@ export default {
|
||||
async getData() {
|
||||
this.listLoading = true;
|
||||
const res = await this.$API.orders.order.mail.list.get(this.listParams);
|
||||
this.listLoading = false;
|
||||
if(res.code == 200){
|
||||
if(res.data.rows && res.data.rows.length>0){
|
||||
res.data.rows.forEach(item=>{
|
||||
@ -299,7 +300,6 @@ export default {
|
||||
this.confirmList = this.confirmList.concat(res.data.rows);
|
||||
}
|
||||
}
|
||||
this.listLoading = false;
|
||||
},
|
||||
stripHtmlTags(html) {
|
||||
const div = document.createElement('div');
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
<div class="reviewBox">
|
||||
<el-input type="textarea" v-model="opinion" min="4" placeholder="请填写具体原因"></el-input>
|
||||
<div class="btnView">
|
||||
<el-button type="primary" :size="size" @click="save(1)" :loading="confirmLoading">审核通过</el-button>
|
||||
<el-button type="danger" :size="size" @click="save(2)" :loading="cancelLoading">审核拒绝</el-button>
|
||||
<el-button type="primary" size="default" @click="save(1)" :loading="confirmLoading">审核通过</el-button>
|
||||
<el-button type="danger" size="default" @click="save(2)" :loading="cancelLoading">审核拒绝</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -99,6 +99,6 @@ export default {
|
||||
<style scoped lang="scss">
|
||||
.btnView{
|
||||
margin-top: 15px;
|
||||
display: flex;justify-content: flex-end;
|
||||
display: flex;justify-content: flex-start;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-container class="mainHeaderNoBorderPadding" v-loading="loading" element-loading-text="加载中...">
|
||||
<el-container class="mainHeaderNoBorderPadding" v-loading="listLoading" element-loading-text="加载中...">
|
||||
<el-main class="nopadding emailMiddle">
|
||||
<div class="emailContent">
|
||||
<div class="title">【邮件名称】{{emailParams.subject}}</div>
|
||||
@ -52,6 +52,7 @@ export default {
|
||||
params:{
|
||||
id: this.$route.query.id,
|
||||
},
|
||||
listLoading:false,
|
||||
emailParams:[]
|
||||
}
|
||||
},
|
||||
@ -65,6 +66,7 @@ export default {
|
||||
async getData() {
|
||||
this.listLoading = true;
|
||||
const res = await this.$API.orders.order.mail.info.post(this.params);
|
||||
this.listLoading = false;
|
||||
if(res.code == 200){
|
||||
if(res.data && res.data.length>0){
|
||||
res.data.forEach(item=>{
|
||||
@ -73,7 +75,7 @@ export default {
|
||||
}
|
||||
this.emailParams = res.data[0];
|
||||
}
|
||||
this.listLoading = false;
|
||||
|
||||
},
|
||||
stripHtmlTags(html) {
|
||||
const div = document.createElement('div');
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user