535 lines
14 KiB
Vue
Executable File
535 lines
14 KiB
Vue
Executable File
<template>
|
|
<view class="page">
|
|
<view class="topBar">所有应用</view>
|
|
<scroll-view class="scroll-x" scroll-x="true" @scroll='_scrollX' scroll-with-animation :scroll-left="scrollLeft">
|
|
<view class="scroll-x-listcontent" :style="{width:scrollWidth}">
|
|
<view class="nav-list" v-for="(item,index) in navMenus">
|
|
<view :class="[currSelectIndex == index?'nav-item-select':'nav-item-unselect']"
|
|
@click="goAnchor('#anchor-'+index,index)">
|
|
{{item.NAME}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
<view class="take-postion" style="height: 110px;width: 100%;"></view>
|
|
|
|
<scroll-view class="scroll-y" scroll-y="true" @scroll="_scrollY" scroll-with-animation :scroll-top="scrollTop" :style="{height:scrollHeight}">
|
|
<view id="outside" class="list-content">
|
|
<view :id="'anchor-'+index" class="list-item" v-for="(item,index) in allMenu">
|
|
<view class="list-item-title" v-if="item.isOpenMenu">{{item.NAME}}</view>
|
|
<view class="example-body" v-if="item.isOpenMenu">
|
|
<uni-grid :column="4" :show-border="false" :square="false">
|
|
<uni-grid-item v-for="(subitem ,subindex) in item.SubMenus" :key="subindex" v-if="subitem.isOpenMenu">
|
|
<view class="grid-item-box" @click="NavigateApplyKanban(subitem)" v-if="subitem.FTYPE==4">
|
|
<image class="image" src="../../../static/icon/unchecked.png" />
|
|
<text class="text">{{subitem.NAME}}</text>
|
|
</view>
|
|
|
|
<view class="grid-item-box" @click="NavigateApply(subitem.KEY)" v-if="subitem.FTYPE==3">
|
|
<!-- <image class="image" :src="subitem.src" /> -->
|
|
<view class="image" :style="{backgroundImage:'url('+subitem.src+')'}"/>
|
|
<text class="text">{{subitem.NAME}}</text>
|
|
</view>
|
|
</uni-grid-item>
|
|
</uni-grid>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
<view class="tabBar">
|
|
<view class="tabBar-item" @click="mainSelectF">
|
|
<view v-show="mainSelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/main2x.png"></image>
|
|
<text class="tabBar-item-text" style="color:#007AFF">首页</text>
|
|
</view>
|
|
<view v-show="!mainSelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/main2x.png"></image>
|
|
<text class="tabBar-item-text" style="color: #666666;">首页</text>
|
|
</view>
|
|
</view>
|
|
<view class="tabBar-item" @click="applySelectF">
|
|
<view v-show="applySelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/apply2x.png"></image>
|
|
<text class="tabBar-item-text" style="color:#007AFF">应用</text>
|
|
</view>
|
|
<view v-show="!applySelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/apply2x.png"></image>
|
|
<text class="tabBar-item-text" style="color: #666666;">应用</text>
|
|
</view>
|
|
</view>
|
|
<view class="tabBar-item" @click="cleandarSelectF">
|
|
<view v-show="cleandarSelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/cleandar2x.png"></image>
|
|
<text class="tabBar-item-text" style="color:#007AFF">日程</text>
|
|
</view>
|
|
<view v-show="!cleandarSelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/cleandar2x.png"></image>
|
|
<text class="tabBar-item-text" style="color: #666666;">日程</text>
|
|
</view>
|
|
</view>
|
|
<view class="tabBar-item" @click="mySelectF">
|
|
<view v-show="mySelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/my2x.png"></image>
|
|
<text class="tabBar-item-text" style="color:#007AFF">我的</text>
|
|
</view>
|
|
<view v-show="!mySelect" class="tabBar-item-view">
|
|
<image class="tabBar-item-img" src="../../../static/tabbar/my2x.png"></image>
|
|
<text class="tabBar-item-text" style="color: #666666;">我的</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<opsoft-dialog-notice
|
|
:dialogNoticeShow="showDialog"
|
|
:dialogNoticeType="dialogNoticeType"
|
|
:dialogNoticeTitle="dialogNoticeTitle"
|
|
:dialogNoticeContent="dialogNoticeContent"
|
|
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
|
|
>
|
|
</opsoft-dialog-notice>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import uniGrid from '@/components/uni-grid/uni-grid.vue'
|
|
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue'
|
|
import faIcon from '@/components/fa-icon/fa-icon.vue'
|
|
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
|
|
import errorStrUntil from '@/common/errorStrUntil.js';
|
|
|
|
export default {
|
|
components: {
|
|
faIcon,
|
|
uniGrid,
|
|
uniGridItem,
|
|
opsoftDialogNotice
|
|
},
|
|
data() {
|
|
return {
|
|
allMenu: [],
|
|
navMenus: [],
|
|
storageSelAllMenu:[],
|
|
curParentIndex:0,
|
|
curChildrenIndex:0,
|
|
dialogNoticeContent:'',
|
|
dialogNoticeTitle:'',
|
|
dialogNoticeType:'',
|
|
showDialog:false,
|
|
|
|
scrollWidth:'',
|
|
scrollLeft:0,
|
|
scrollHeight:'',
|
|
scrollTop:0,
|
|
old: {
|
|
scrollTop: 0
|
|
},
|
|
currSelectIndex:0,
|
|
currScrollTop:0,
|
|
scrollToTopArray:[],
|
|
mainSelect:false,
|
|
applySelect:true,
|
|
cleandarSelect:false,
|
|
mySelect:false,
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getAllMenu();
|
|
this.scrollWidth = (this.allMenu.length * 120).toString() + 'px';
|
|
this.scrollHeight = (uni.getSystemInfoSync().windowHeight-170).toString()+'px';
|
|
},
|
|
methods: {
|
|
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});
|
|
this.navMenus = selAllMenus;
|
|
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;
|
|
}
|
|
})
|
|
})
|
|
}
|
|
})
|
|
|
|
})
|
|
this.scrollWidth = (selAllMenus.length * 120).toString() + 'px';
|
|
}else{
|
|
this.allMenu.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.navMenus = this.allMenu.filter(e => {return e.isOpenMenu});
|
|
this.scrollWidth = (this.navMenus.length * 120).toString() + 'px';
|
|
}
|
|
})
|
|
.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;
|
|
},
|
|
//横向偏移
|
|
_scrollX(e) {
|
|
let _self = this;
|
|
this.scrollLeft = (this.currSelectIndex) * 120;
|
|
},
|
|
//纵向偏移
|
|
_scrollY(e){
|
|
let _self = this;
|
|
if(!e){
|
|
this.scrollTop = this.currScrollTop;
|
|
}else{
|
|
console.log(e.detail.scrollTop);
|
|
this._scrollX()
|
|
}
|
|
|
|
|
|
},
|
|
//nav-item click纵向滚动
|
|
goAnchor(selector, index) {
|
|
let _self = this;
|
|
console.log('anchorIndex' + index);
|
|
this.currSelectIndex = index;
|
|
//#ifdef H5
|
|
document.querySelector(selector).scrollIntoView(true);
|
|
//#endif
|
|
|
|
//#ifdef APP
|
|
uni.createSelectorQuery().select(selector).boundingClientRect(data => {
|
|
console.log("in" + data.top);
|
|
|
|
uni.createSelectorQuery().select("#outside").boundingClientRect(res => {
|
|
console.log("out" + res.top);
|
|
_self.currScrollTop = data.top-res.top;
|
|
_self._scrollY()
|
|
}).exec()
|
|
|
|
}).exec();
|
|
//#endif
|
|
},
|
|
//获取初始状态所有节点距顶部滚动高度
|
|
initAllScrollToTop(){
|
|
let _self = this;
|
|
let scrollToTopArray = [];
|
|
//#ifdef APP
|
|
if(this.allMenu.length>0){
|
|
this.allMenu.forEach((e,index) => {
|
|
uni.createSelectorQuery().select('#anchor-' + index).boundingClientRect(data => {
|
|
console.log("scIndex"+data.top)
|
|
let arr = {
|
|
anchor:index,
|
|
scrollToTop:data.top
|
|
}
|
|
scrollToTopArray.push(arr);
|
|
}).exec()
|
|
})
|
|
}
|
|
//#endif
|
|
},
|
|
mainSelectF(){
|
|
this.mainSelect = true;
|
|
this.applySelect = false;
|
|
this.cleandarSelect = false;
|
|
this.mySelect = false;
|
|
uni.redirectTo({
|
|
url:'../home/home'
|
|
});
|
|
},
|
|
applySelectF(){
|
|
this.mainSelect = false;
|
|
this.applySelect = true;
|
|
this.cleandarSelect = false;
|
|
this.mySelect = false;
|
|
},
|
|
cleandarSelectF(){
|
|
this.mainSelect = false;
|
|
this.applySelect = false;
|
|
this.cleandarSelect = true;
|
|
this.mySelect = false;
|
|
uni.redirectTo({
|
|
url:'../calendar/calender'
|
|
});
|
|
},
|
|
mySelectF(){
|
|
this.mainSelect = false;
|
|
this.applySelect = false;
|
|
this.cleandarSelect = false;
|
|
this.mySelect = true;
|
|
uni.redirectTo({
|
|
url:'../myinfo/myinfo'
|
|
})
|
|
},
|
|
NavigateApply(page) {
|
|
console.log(page)
|
|
if (page) {
|
|
if(page=="STK_InventorySeach"){
|
|
uni.navigateTo({
|
|
url: '../../views/' + page + '/' + page + '?prepage=moreapply'
|
|
});
|
|
}
|
|
else {
|
|
uni.navigateTo({
|
|
url: '../../views/' + page + '/' + page
|
|
});
|
|
}
|
|
}
|
|
|
|
},
|
|
|
|
LongTap: function() {
|
|
uni.navigateTo({
|
|
url: '../applymanage/applymanage'
|
|
});
|
|
},
|
|
// 点击跳转
|
|
NavigateApplyKanban(subitem) {
|
|
let billNo = subitem.FWEBBILL;
|
|
if (billNo) {
|
|
let tempurl='../../kanban/kanban' + '?billNo=' + billNo + '&title=' + subitem.NAME;
|
|
uni.navigateTo({
|
|
url: tempurl
|
|
});
|
|
}
|
|
else {
|
|
uni.showToast({
|
|
title: '看板菜单表单配置有问题,请联系系统管理员!',
|
|
icon:'none',
|
|
});
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
@import url("../../../common/iconindex.css");
|
|
.page {
|
|
height: 100%;
|
|
/* overflow-x: hidden; */
|
|
}
|
|
.topBar{
|
|
height: 60px;
|
|
line-height: 60px;
|
|
width: 100%;
|
|
/* height: var(--status-bar-height);
|
|
width: 100%; */
|
|
position: fixed;
|
|
z-index: 999;
|
|
background: #2560C9;
|
|
/* padding-left: 43.47rpx; */
|
|
text-align: center;
|
|
|
|
font-size: 32.6rpx;
|
|
font-family: PingFangSC-Semibold, PingFang SC;
|
|
font-weight: 600;
|
|
color: #FFFFFF;
|
|
}
|
|
.scroll-x{
|
|
width: 100%;height: 40px;background: #FFFFFF;z-index: 9;
|
|
display: flex;flex-direction: row;position: fixed;top: 60px;
|
|
}
|
|
.scroll-x-listcontent{
|
|
align-items: center;justify-content: center;
|
|
display: flex;flex-direction: row;
|
|
}
|
|
.nav-list{
|
|
width: 120px;height: 40px;line-height: 40px;text-align: center;
|
|
}
|
|
.nav-item-select{
|
|
position: relative;
|
|
height: 38px;line-height: 38px;
|
|
font-size: 16px;font-weight: bold;color: #409EFF;
|
|
}
|
|
.nav-item-select::after{
|
|
position: absolute;
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -2px;
|
|
top: auto;
|
|
left: 45px;
|
|
height: 4px;
|
|
width: 30px;
|
|
background-color: #409EFF;
|
|
}
|
|
.nav-item-unselect{
|
|
height: 40px;line-height: 40px;
|
|
font-size: 16px;font-weight: normal;color: #000000;
|
|
}
|
|
.scroll-y{}
|
|
.list-content{
|
|
/* background: #FFFFFF;margin-top: 10px; */
|
|
}
|
|
.list-item{
|
|
background: #FFFFFF;margin-top: 10px;
|
|
}
|
|
.list-item-title{
|
|
padding: 10px 10px;font-size: 18px;color: #000000;font-weight: 300;
|
|
}
|
|
.main{
|
|
padding-top: 43.47rpx;
|
|
margin-top: 0;
|
|
margin-bottom: 117.75rpx;
|
|
}
|
|
.main-item{
|
|
padding-top: 43.47rpx;
|
|
}
|
|
.m-title{
|
|
margin-left: 43.47rpx;
|
|
|
|
font-size: 32.6rpx;
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
/* font-weight: 500; */
|
|
color: #000000;
|
|
}
|
|
.example-body {
|
|
flex-direction: row;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
padding: 0;
|
|
background-color: #ffffff;
|
|
|
|
font-size: 13px;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #000000;
|
|
}
|
|
|
|
.grid-item-box {
|
|
flex: 1;
|
|
/* position: relative;
|
|
*/
|
|
/* #ifndef APP-NVUE */
|
|
display: flex;
|
|
/* #endif */
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 15px 0;
|
|
}
|
|
|
|
.text {
|
|
padding: 10upx 0;
|
|
word-break: break-all;
|
|
text-align: center;
|
|
line-height: 16px;
|
|
width: 64px;
|
|
}
|
|
|
|
.m-bottom {
|
|
display: flex;
|
|
flex-direction: column;
|
|
/* margin: 2% 5%;
|
|
margin-bottom: 5%; */
|
|
border: 1upx dotted #CCCCCC;
|
|
justify-content: center;
|
|
align-items: center;
|
|
/* height: 160upx; */
|
|
}
|
|
.tabBar{
|
|
display: flex;
|
|
position: fixed;
|
|
flex-direction: row;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
height: 60px;
|
|
|
|
background: rgba(255, 255, 255, 1);
|
|
box-shadow:2px 2px 3px rgba(0, 0, 0, 1);
|
|
}
|
|
.tabBar-item{
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-shrink: 1;
|
|
flex-grow: 1;
|
|
align-items: center ;
|
|
width: 100%;
|
|
}
|
|
.tabBar-item-view{
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-shrink: 1;
|
|
flex-grow: 1;
|
|
align-items: center ;
|
|
}
|
|
.tabBar-item-img{
|
|
height: 54.34rpx;
|
|
width: 54.34rpx;
|
|
margin-top: 16.3rpx;
|
|
}
|
|
.tabBar-item-text{
|
|
text-align: center;
|
|
|
|
height: 28.98rpx;
|
|
font-size: 28.98rpx;
|
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #515151;
|
|
line-height: 28.98rpx;
|
|
}
|
|
.image{
|
|
height: 79.71rpx;
|
|
width: 79.71rpx;
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
}
|
|
</style>
|