完善数组判断处理
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 scStatusIndicator from './components/scMini/scStatusIndicator'
|
||||||
import scTrend from './components/scMini/scTrend'
|
import scTrend from './components/scMini/scTrend'
|
||||||
|
|
||||||
|
import authSetup from './directives/authSetup'
|
||||||
import auth from './directives/auth'
|
import auth from './directives/auth'
|
||||||
import auths from './directives/auths'
|
import auths from './directives/auths'
|
||||||
import authsAll from './directives/authsAll'
|
import authsAll from './directives/authsAll'
|
||||||
@ -86,6 +87,7 @@ export default {
|
|||||||
app.component('scImport', scImport);
|
app.component('scImport', scImport);
|
||||||
|
|
||||||
//注册全局指令
|
//注册全局指令
|
||||||
|
app.directive('authSetup', authSetup)
|
||||||
app.directive('auth', auth)
|
app.directive('auth', auth)
|
||||||
app.directive('auths', auths)
|
app.directive('auths', auths)
|
||||||
app.directive('auths-all', authsAll)
|
app.directive('auths-all', authsAll)
|
||||||
|
|||||||
@ -281,6 +281,7 @@ export default {
|
|||||||
async getData() {
|
async getData() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
const res = await this.$API.orders.order.mail.list.get(this.listParams);
|
const res = await this.$API.orders.order.mail.list.get(this.listParams);
|
||||||
|
this.listLoading = false;
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
if(res.data.rows && res.data.rows.length>0){
|
if(res.data.rows && res.data.rows.length>0){
|
||||||
res.data.rows.forEach(item=>{
|
res.data.rows.forEach(item=>{
|
||||||
@ -299,7 +300,6 @@ export default {
|
|||||||
this.confirmList = this.confirmList.concat(res.data.rows);
|
this.confirmList = this.confirmList.concat(res.data.rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.listLoading = false;
|
|
||||||
},
|
},
|
||||||
stripHtmlTags(html) {
|
stripHtmlTags(html) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
|
|||||||
@ -7,8 +7,8 @@
|
|||||||
<div class="reviewBox">
|
<div class="reviewBox">
|
||||||
<el-input type="textarea" v-model="opinion" min="4" placeholder="请填写具体原因"></el-input>
|
<el-input type="textarea" v-model="opinion" min="4" placeholder="请填写具体原因"></el-input>
|
||||||
<div class="btnView">
|
<div class="btnView">
|
||||||
<el-button type="primary" :size="size" @click="save(1)" :loading="confirmLoading">审核通过</el-button>
|
<el-button type="primary" size="default" @click="save(1)" :loading="confirmLoading">审核通过</el-button>
|
||||||
<el-button type="danger" :size="size" @click="save(2)" :loading="cancelLoading">审核拒绝</el-button>
|
<el-button type="danger" size="default" @click="save(2)" :loading="cancelLoading">审核拒绝</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -99,6 +99,6 @@ export default {
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.btnView{
|
.btnView{
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
display: flex;justify-content: flex-end;
|
display: flex;justify-content: flex-start;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<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">
|
<el-main class="nopadding emailMiddle">
|
||||||
<div class="emailContent">
|
<div class="emailContent">
|
||||||
<div class="title">【邮件名称】{{emailParams.subject}}</div>
|
<div class="title">【邮件名称】{{emailParams.subject}}</div>
|
||||||
@ -52,6 +52,7 @@ export default {
|
|||||||
params:{
|
params:{
|
||||||
id: this.$route.query.id,
|
id: this.$route.query.id,
|
||||||
},
|
},
|
||||||
|
listLoading:false,
|
||||||
emailParams:[]
|
emailParams:[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -65,6 +66,7 @@ export default {
|
|||||||
async getData() {
|
async getData() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
const res = await this.$API.orders.order.mail.info.post(this.params);
|
const res = await this.$API.orders.order.mail.info.post(this.params);
|
||||||
|
this.listLoading = false;
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
if(res.data && res.data.length>0){
|
if(res.data && res.data.length>0){
|
||||||
res.data.forEach(item=>{
|
res.data.forEach(item=>{
|
||||||
@ -73,7 +75,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.emailParams = res.data[0];
|
this.emailParams = res.data[0];
|
||||||
}
|
}
|
||||||
this.listLoading = false;
|
|
||||||
},
|
},
|
||||||
stripHtmlTags(html) {
|
stripHtmlTags(html) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
|
|||||||
@ -5,12 +5,14 @@
|
|||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<el-menu class="menu mainMenu" :default-active="page">
|
<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-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">
|
<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>
|
<el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>{{item.title}}</span>
|
<span>{{item.title}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
</div>
|
||||||
</el-menu-item-group>
|
</el-menu-item-group>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-main>
|
</el-main>
|
||||||
@ -53,12 +55,14 @@ export default {
|
|||||||
{
|
{
|
||||||
icon: "sc-icon-MachineRoom",
|
icon: "sc-icon-MachineRoom",
|
||||||
title: "机房配置",
|
title: "机房配置",
|
||||||
component: "account"
|
component: "account",
|
||||||
|
actions:'roomConfig'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "sc-icon-CostAllocation",
|
icon: "sc-icon-CostAllocation",
|
||||||
title: "费用配置",
|
title: "费用配置",
|
||||||
component: "password"
|
component: "password",
|
||||||
|
actions:'costConfig'
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -68,12 +72,14 @@ export default {
|
|||||||
{
|
{
|
||||||
icon: "sc-icon-DataSource",
|
icon: "sc-icon-DataSource",
|
||||||
title: "数据源邮件设置",
|
title: "数据源邮件设置",
|
||||||
component: "mail"
|
component: "mail",
|
||||||
|
actions:'mailConfigSet'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "sc-icon-AgentMaintenance",
|
icon: "sc-icon-AgentMaintenance",
|
||||||
title: "K3接口配置",
|
title: "K3接口配置",
|
||||||
component: "interface"
|
component: "interface",
|
||||||
|
actions:'k3ApiConfigSet'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -52,11 +52,12 @@ export default {
|
|||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
data(val){
|
data(val){
|
||||||
|
if(val && val.length>0){
|
||||||
val.forEach(item=>{
|
val.forEach(item=>{
|
||||||
item.show = true;
|
item.show = true;
|
||||||
if(item.children){
|
if(item.children){
|
||||||
item.children.forEach(em=>{
|
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 check = em.meta.data_permission.filter((li)=>li.checked).length;
|
||||||
let ed = em.meta.data_permission.length;
|
let ed = em.meta.data_permission.length;
|
||||||
em.isCheck = check>0 && check != ed?true:false;
|
em.isCheck = check>0 && check != ed?true:false;
|
||||||
@ -76,6 +77,7 @@ export default {
|
|||||||
|
|
||||||
this.list = JSON.parse(JSON.stringify(val));
|
this.list = JSON.parse(JSON.stringify(val));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
|
|
||||||
|
|||||||
@ -164,6 +164,7 @@
|
|||||||
async getGroup(flag = false){
|
async getGroup(flag = false){
|
||||||
this.showGroupLoading = true;
|
this.showGroupLoading = true;
|
||||||
const res = await this.$API.system.role.list.get();
|
const res = await this.$API.system.role.list.get();
|
||||||
|
this.showGroupLoading = false;
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
this.group = res.data.rows;
|
this.group = res.data.rows;
|
||||||
this.role_id = res.data.rows && res.data.rows.length>0?res.data.rows[0].id:"";
|
this.role_id = res.data.rows && res.data.rows.length>0?res.data.rows[0].id:"";
|
||||||
@ -172,7 +173,6 @@
|
|||||||
await this.getRoleList();
|
await this.getRoleList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.showGroupLoading = false;
|
|
||||||
},
|
},
|
||||||
//添加
|
//添加
|
||||||
add(){
|
add(){
|
||||||
@ -337,20 +337,26 @@
|
|||||||
this.activeNum = e;
|
this.activeNum = e;
|
||||||
},
|
},
|
||||||
async getMenu() {
|
async getMenu() {
|
||||||
|
if(this.role_id!=""){
|
||||||
let params = {
|
let params = {
|
||||||
role_id: this.role_id,
|
role_id: this.role_id,
|
||||||
};
|
};
|
||||||
const res = await this.$API.system.role.roleMenu.post(params);
|
const res = await this.$API.system.role.roleMenu.post(params);
|
||||||
this.menu.list = res.data;
|
this.menu.list = res.data;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getRoleList() {
|
async getRoleList() {
|
||||||
|
if(this.role_id!=""){
|
||||||
let params = {
|
let params = {
|
||||||
role_id: this.role_id,
|
role_id: this.role_id,
|
||||||
};
|
};
|
||||||
const res = await this.$API.system.role.roleUser.post(params);
|
const res = await this.$API.system.role.roleUser.post(params);
|
||||||
this.roleUser.list = res.data;
|
this.roleUser.list = res.data;
|
||||||
this.userCheckList = res.data;
|
this.userCheckList = res.data;
|
||||||
|
if(res.data && res.data.length>0){
|
||||||
this.userIds = res.data.map(item=>item.id);
|
this.userIds = res.data.map(item=>item.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async getDeptTree() {
|
async getDeptTree() {
|
||||||
|
|||||||
@ -45,10 +45,12 @@ export default {
|
|||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
data(val){
|
data(val){
|
||||||
|
if(val && val.length>0){
|
||||||
val.forEach(item=>{
|
val.forEach(item=>{
|
||||||
item.checked = false;
|
item.checked = false;
|
||||||
})
|
})
|
||||||
this.list = JSON.parse(JSON.stringify(val));
|
this.list = JSON.parse(JSON.stringify(val));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
|
|||||||
@ -177,7 +177,9 @@ export default {
|
|||||||
const res = await this.$API.system.role.roleUser.post(params);
|
const res = await this.$API.system.role.roleUser.post(params);
|
||||||
this.roleUser.list = res.data;
|
this.roleUser.list = res.data;
|
||||||
this.userCheckList = res.data;
|
this.userCheckList = res.data;
|
||||||
|
if(res.data && res.data.length>0){
|
||||||
this.userIds = res.data.map(item=>item.id);
|
this.userIds = res.data.map(item=>item.id);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getDeptTree() {
|
async getDeptTree() {
|
||||||
this.memberShow = true;
|
this.memberShow = true;
|
||||||
|
|||||||
@ -87,7 +87,6 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
</scTable>
|
</scTable>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export default {
|
|||||||
res.data.menu.forEach(item=>{
|
res.data.menu.forEach(item=>{
|
||||||
if(item.children){
|
if(item.children){
|
||||||
item.children.forEach(em=>{
|
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 check = em.meta.data_permission.filter((li)=>li.checked).length;
|
||||||
let ed = em.meta.data_permission.length;
|
let ed = em.meta.data_permission.length;
|
||||||
em.isCheck = check>0 && check != ed?true:false;
|
em.isCheck = check>0 && check != ed?true:false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user