240 lines
6.1 KiB
Vue
Executable File
240 lines
6.1 KiB
Vue
Executable File
<template>
|
|
<view class="page">
|
|
<!-- <view class="title">应用参数</view> -->
|
|
<view v-for="(item,index) in allMenu">
|
|
<view class="title-switch">
|
|
<text>{{item.NAME}}</text>
|
|
<image src="../../../static/parameter/push.png" @click="showSubClick(item,index)" v-if="item.showSubItem"></image>
|
|
<image src="../../../static/parameter/pull.png" @click="showSubClick(item,index)" v-else></image>
|
|
<switch :checked="item.isOpenMenu" @change="parentMenuChange(item,index)" color="#4662FF"/>
|
|
|
|
</view>
|
|
<view v-for="(subItem,subIndex) in item.SubMenus" v-show="item.showSubItem && item.SubMenus.length>0">
|
|
<view class="sub-title-switch">
|
|
<text>{{subItem.NAME}}</text>
|
|
<switch :checked="subItem.isOpenMenu" @change="childrenMenuChange(subItem,subIndex)" color="#4662FF"/>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<opsoft-dialog-notice
|
|
:dialogNoticeShow="showDialog"
|
|
:dialogNoticeType="dialogNoticeType"
|
|
:dialogNoticeTitle="dialogNoticeTitle"
|
|
:dialogNoticeContent="dialogNoticeContent"
|
|
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
|
|
>
|
|
</opsoft-dialog-notice>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
|
|
import errorStrUntil from '@/common/errorStrUntil.js';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
allMenu:[],
|
|
storageSelAllMenu:[],
|
|
curParentIndex:0,
|
|
curChildrenIndex:0,
|
|
dialogNoticeContent:'',
|
|
dialogNoticeTitle:'',
|
|
dialogNoticeType:'',
|
|
showDialog:false,
|
|
|
|
showGrayLayer:false,
|
|
showOrgList:false,
|
|
organizationOpenSwitch:false,
|
|
orgList:[],
|
|
orgSelected:'',
|
|
organizationSwitch: false,
|
|
printSwitch: false,
|
|
bluetoothSwitch: false,
|
|
deviceSwitch: false,
|
|
systemParameter: {},
|
|
}
|
|
},
|
|
components: {opsoftDialogNotice},
|
|
computed: {},
|
|
onLoad() {},
|
|
onShow() {
|
|
this.getAllMenu();
|
|
},
|
|
methods: {
|
|
showSubClick(item,index){
|
|
this.curParentIndex = index;
|
|
item.showSubItem = !item.showSubItem
|
|
if(item.showSubItem){
|
|
this.allMenu.forEach((e,eindex) => {
|
|
if(index != eindex){
|
|
e.showSubItem = false;
|
|
}
|
|
})
|
|
}
|
|
},
|
|
parentMenuChange(item,index){
|
|
this.curParentIndex = index;
|
|
item.isOpenMenu = !item.isOpenMenu;
|
|
if(item.isOpenMenu){
|
|
item.SubMenus.forEach(e => {
|
|
e.isOpenMenu = true;
|
|
})
|
|
}
|
|
else {
|
|
item.SubMenus.forEach(e => {
|
|
e.isOpenMenu = false;
|
|
})
|
|
}
|
|
uni.setStorageSync('selMenus',this.allMenu)
|
|
},
|
|
childrenMenuChange(subItem,subIndex){
|
|
this.curChildrenIndex = subIndex;
|
|
subItem.isOpenMenu = !subItem.isOpenMenu;
|
|
let selSubLength = this.allMenu[this.curParentIndex].SubMenus.filter(e => {return e.isOpenMenu}).length;
|
|
if (selSubLength > 0) {
|
|
this.allMenu[this.curParentIndex].isOpenMenu = true;
|
|
}
|
|
else {
|
|
this.allMenu[this.curParentIndex].isOpenMenu = false;
|
|
}
|
|
|
|
uni.setStorageSync('selMenus',this.allMenu)
|
|
},
|
|
getAllMenu(){
|
|
let _self = this;
|
|
this.$request.post('/Service/GetAllMenu')
|
|
.then(res => {
|
|
let data = res.MainMenu;
|
|
if (data && data.length > 0) {
|
|
data = data.filter(e => {
|
|
return e.NAME != "生产汇报"
|
|
});
|
|
data = data.filter(e => {
|
|
return e.NAME != "生产检验"
|
|
});
|
|
data = data.filter(e => {
|
|
return e.NAME != "安灯预警"
|
|
});
|
|
data = data.filter(e => {
|
|
return e.NAME != "预警平台"
|
|
});
|
|
}
|
|
|
|
data.forEach((item,index) => {
|
|
item.isOpenMenu = true;
|
|
item.showSubItem = false;
|
|
item.SubMenus.forEach((el,elindex) => {
|
|
el.isOpenMenu = true;
|
|
el.src = '../../../static/icon/'+el.KEY+'.png';
|
|
});
|
|
});
|
|
|
|
this.allMenu = data;
|
|
this.storageSelAllMenu = uni.getStorageSync('selMenus');
|
|
if (this.storageSelAllMenu) {
|
|
let closeMenu = this.storageSelAllMenu.filter(e => { return !e.isOpenMenu });
|
|
this.storageSelAllMenu.forEach(function(item){
|
|
item.SubMenus.forEach(function(subItem){
|
|
if (!subItem.isOpenMenu) {
|
|
closeMenu.push(subItem);
|
|
}
|
|
});
|
|
});
|
|
let selAllMenus = this.storageSelAllMenu.filter(e => { return !e.isOpenMenu });
|
|
let selAllSubMenus = new Array();
|
|
|
|
closeMenu.forEach(e => {
|
|
allMenu.forEach(allMenu => {
|
|
if (e.ID == allMenu.ID) {
|
|
allMenu.isOpenMenu = e.isOpenMenu;
|
|
}
|
|
});
|
|
});
|
|
}
|
|
})
|
|
.catch(err => {
|
|
uni.hideLoading();
|
|
this.dialogProps(err)
|
|
});
|
|
},
|
|
dialogNoticeConfirmClick(){
|
|
this.showDialog = false;
|
|
},
|
|
dialogProps(err){
|
|
err = errorStrUntil.handle(err);
|
|
this.showDialog = true;
|
|
this.dialogNoticeType = 'error';
|
|
this.dialogNoticeTitle = '异常提示';
|
|
this.dialogNoticeContent = err;
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.page {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #F2F2F2;
|
|
}
|
|
.title{
|
|
height: 90.57upx;
|
|
line-height: 90.57upx;
|
|
font-size: 28.98upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #686868;
|
|
margin-left: 43.47upx;
|
|
}
|
|
.title-switch{
|
|
display: flex;
|
|
width: 100%;
|
|
flex-direction: row;
|
|
background: #FFFFFF;
|
|
margin-top: 3.62upx;
|
|
align-items: center;
|
|
}
|
|
|
|
.title-switch text{
|
|
width: 100%;
|
|
height: 108.69upx;
|
|
line-height: 108.69upx;
|
|
font-size: 32.6upx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #232323;
|
|
margin-left: 43.47upx;
|
|
}
|
|
switch{
|
|
width: 79.71upx;
|
|
transform: scale(0.7);
|
|
margin-right: 43.47upx;
|
|
}
|
|
image{
|
|
height: 40rpx;
|
|
width: 40rpx;
|
|
margin-right: 43.47upx;
|
|
}
|
|
.sub-title-switch{
|
|
display: flex;
|
|
width: 100%;
|
|
flex-direction: row;
|
|
background: #e5e5e5;
|
|
margin-top: 3.62upx;
|
|
align-items: center;
|
|
}
|
|
.sub-title-switch text{
|
|
width: 100%;
|
|
height: 60rpx;
|
|
line-height: 60rpx;
|
|
font-size: 24rpx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #232323;
|
|
margin-left: 43.47upx;
|
|
}
|
|
</style>
|