390 lines
12 KiB
Vue
Executable File
390 lines
12 KiB
Vue
Executable File
<template>
|
|
<view class="page">
|
|
<view class="title">打印参数</view>
|
|
<view class="title-switch"><text>启用设备号</text><switch :checked="deviceSwitch" @change="deviceSwitchChange"/></view>
|
|
<view class="title-switch"><text>启用普通打印</text><switch :checked="printSwitch" @change="printSwitchChange"/></view>
|
|
<view class="title-switch"><text>启用蓝牙打印</text><switch :checked="bluetoothSwitch" @change="bluetoothSwitchChange"/></view>
|
|
<view class="title">组织参数</view>
|
|
<view class="title-switch"><text>启用组织隔离</text><switch :checked="organizationSwitch" @change="organizationSwitchChange"/></view>
|
|
<view class="title-switch"><text>启用默认组织</text><switch :checked="organizationOpenSwitch" @change="organizationOpenSwitchChange"/></view>
|
|
<view class="org-content" v-if="organizationOpenSwitch" @click="selectOrgClick">
|
|
<text class="org-text">选择默认组织</text>
|
|
<text class="org-text" style="margin-left: 40rpx;">{{orgSelected}}</text>
|
|
</view>
|
|
|
|
<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>
|
|
|
|
<view class="gray-layer" v-if="showGrayLayer" @click="hideGrayLayer"></view>
|
|
<view class="bottom-select" v-if="showOrgList">
|
|
<view class="bottom-select-head">
|
|
<view class="bottom_select-head-cancel">请选择组织</view>
|
|
</view>
|
|
<view>
|
|
<scroll-view scroll-y="true" style="height: 150px;">
|
|
<view class="bottom-select-list" v-for="(item,index) in orgList">
|
|
<view class="bottom-select-list-item" @click="orgSelectChange(item,index)">{{item.FNAME}}
|
|
</view>
|
|
</view>
|
|
</scroll-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() {
|
|
this.systemParameter = uni.getStorageSync('systemParameter');
|
|
if (!this.systemParameter) {
|
|
this.systemParameter = {};
|
|
this.printSwitch = true;
|
|
this.systemParameter.printSwitch = true;
|
|
uni.setStorageSync('systemParameter', this.systemParameter);
|
|
}
|
|
else {
|
|
this.organizationSwitch = this.systemParameter.organizationSwitch;
|
|
this.printSwitch = this.systemParameter.printSwitch;
|
|
if (typeof(this.printSwitch) == "undefined") {
|
|
this.printSwitch = true;
|
|
this.systemParameter.printSwitch = true;
|
|
uni.setStorageSync('systemParameter', this.systemParameter);
|
|
}
|
|
this.bluetoothSwitch = this.systemParameter.bluetoothSwitch;
|
|
this.deviceSwitch = this.systemParameter.deviceSwitch;
|
|
}
|
|
this.orgList = uni.getStorageSync('orgInfo');
|
|
|
|
this.organizationOpenSwitch = uni.getStorageSync('isOpenDefaultOrg')
|
|
if(this.organizationOpenSwitch){
|
|
let defaultOrgInfo = uni.getStorageSync('defaultOrgInfo');
|
|
this.orgSelected = defaultOrgInfo.FNAME;
|
|
}
|
|
},
|
|
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 = false;
|
|
item.showSubItem = false;
|
|
item.SubMenus.forEach((el,elindex) => {
|
|
el.isOpenMenu = false;
|
|
el.src = '../../../static/icon/'+el.KEY+'.png';
|
|
});
|
|
|
|
});
|
|
this.allMenu = data;
|
|
this.storageSelAllMenu = uni.getStorageSync('selMenus');
|
|
if(this.storageSelAllMenu){
|
|
let selAllMenus = this.storageSelAllMenu.filter(e => {return e.isOpenMenu});
|
|
let selAllSubMenus = new Array();
|
|
|
|
selAllMenus.forEach(e => {
|
|
|
|
e.SubMenus.forEach(eSub => {
|
|
if(eSub.isOpenMenu){
|
|
selAllSubMenus.push(eSub)
|
|
}
|
|
})
|
|
|
|
_self.allMenu.forEach((allMenu,allMenuIndex) => {
|
|
if(e.ID == allMenu.ID){
|
|
allMenu.isOpenMenu = true;
|
|
allMenu.SubMenus.forEach(allSub => {
|
|
selAllSubMenus.forEach(selAllSub => {
|
|
if(selAllSub.ID == allSub.ID){
|
|
allSub.isOpenMenu = true;
|
|
}
|
|
})
|
|
})
|
|
}
|
|
})
|
|
|
|
})
|
|
}
|
|
})
|
|
.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;
|
|
},
|
|
hideGrayLayer(){
|
|
this.showGrayLayer = false;
|
|
this.showOrgList = false;
|
|
},
|
|
selectOrgClick(){
|
|
this.showGrayLayer = true;
|
|
this.showOrgList = true;
|
|
},
|
|
orgSelectChange(item,index){
|
|
this.orgSelected = item.FNAME;
|
|
uni.setStorageSync('defaultOrgInfo',item)
|
|
|
|
this.showGrayLayer = false;
|
|
this.showOrgList = false;
|
|
},
|
|
|
|
organizationOpenSwitchChange: function (e) {
|
|
this.organizationOpenSwitch = e.target.value;
|
|
|
|
uni.setStorageSync('isOpenDefaultOrg',this.organizationOpenSwitch)
|
|
if(!this.organizationOpenSwitch){
|
|
this.orgSelected = '';
|
|
uni.removeStorageSync('defaultOrgInfo');
|
|
}
|
|
},
|
|
organizationSwitchChange: function (e) {
|
|
this.organizationSwitch = e.target.value;
|
|
this.systemParameter.organizationSwitch = this.organizationSwitch;
|
|
uni.setStorageSync('systemParameter', this.systemParameter);
|
|
},
|
|
deviceSwitchChange: function (e) {
|
|
this.deviceSwitch = e.target.value;
|
|
this.systemParameter.deviceSwitch = this.deviceSwitch;
|
|
uni.setStorageSync('systemParameter', this.systemParameter);
|
|
},
|
|
printSwitchChange: function (e) {
|
|
this.printSwitch = e.target.value;
|
|
this.systemParameter.printSwitch = this.printSwitch;
|
|
uni.setStorageSync('systemParameter', this.systemParameter);
|
|
},
|
|
bluetoothSwitchChange: function (e) {
|
|
this.bluetoothSwitch = e.target.value;
|
|
this.systemParameter.bluetoothSwitch = this.bluetoothSwitch;
|
|
uni.setStorageSync('systemParameter', this.systemParameter);
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.org-content{
|
|
display: flex;flex-direction: row;height: 100rpx;width: 100%;line-height: 100rpx;
|
|
background-color: #FFFFFF;border-bottom: solid 1px #c8c7cc;padding: 0 30rpx;
|
|
}
|
|
.org-text{
|
|
height: 100rpx;line-height: 100rpx;font-size: 32rpx;
|
|
}
|
|
.gray-layer {
|
|
position: fixed;left: 0;right: 0;top: 0;bottom: 0;
|
|
background-color: #333333;opacity: 0.5;z-index: 4;
|
|
}
|
|
.bottom-select {
|
|
position: fixed;left: 0rpx;right: 0rpx;bottom: 0rpx;background-color: #FFFFFF;opacity: 1;z-index: 5;
|
|
}
|
|
.bottom-select-head {
|
|
display: flex;flex-wrap: nowrap;border-bottom: 1px solid #f9f9f9;justify-content: space-around;
|
|
}
|
|
.bottom_select-head-cancel {
|
|
height: 80rpx;line-height: 80rpx;font-size: 32rpx;text-align: left;margin-left: 32rpx;color: #666666;
|
|
}
|
|
.bottom-select-list {
|
|
display: flex;width: 100%;align-items: center;
|
|
}
|
|
.bottom-select-list-item {
|
|
height: 72rpx;line-height: 72rpx;width: 100%;text-align: center;font-size: 16px;
|
|
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;
|
|
}
|
|
.page {
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #F2F2F2;
|
|
}
|
|
/* .title-switch {
|
|
display: flex;
|
|
width: 100%;
|
|
flex-direction: row;
|
|
background: #FFFFFF;
|
|
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;
|
|
} */
|
|
.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>
|