<template>
|
<default-header-page-layout ref="page" title="盘点作业" :back-custom="true" @back="onPageBack">
|
<view class="page-frame with-action-user-row" :style="{height:pageBodyHeight+'px'}" v-if="pageBodyHeight">
|
<action-user-row />
|
<view class="with-action-user-row-page-content">
|
<page-main-list v-show="pageType==='mainlist'" :resetflag.sync="resetflag" ref="mainlist" @query="onListQuery" @action="onListAction" />
|
<page-main-search v-show="pageType==='mainsearch'" :resetflag="resetflag" @callback="onSearchCallBack" />
|
<page-detail-list v-show="pageType==='detaillist'" ref="detaillist" :main-obj="mainActionRow" @action="onDeatilAction" />
|
<page-check-action v-show="pageType==='checkaction'" ref="checkaction" :main-obj="mainActionRow" />
|
</view>
|
</view>
|
</default-header-page-layout>
|
</template>
|
|
<script>
|
import DefaultHeaderPageLayout from '@/components/DefaultHeaderPageLayout.vue'
|
import ActionUserRow from '@/components/ActionUserRow.vue'
|
import PageMainList from './modules/MainList.vue'
|
import PageMainSearch from './modules/MainSearch.vue'
|
import PageDetailList from './modules/DetailList.vue'
|
import PageCheckAction from './modules/CheckAction.vue'
|
let initInterVal = null;
|
export default {
|
name:'demoPage',
|
components:{DefaultHeaderPageLayout,ActionUserRow,PageMainList,PageMainSearch,PageDetailList,PageCheckAction},
|
data(){
|
return {
|
pageBodyHeight:0,
|
pageType:'mainlist',
|
resetflag:0,
|
query:null,
|
mainActionRow:{}
|
}
|
},
|
watch:{
|
pageType(newVal, oldVal){
|
if (newVal !== oldVal) {
|
if (newVal) {
|
this.switchPage();
|
}
|
}
|
},
|
resetflag(newVal, oldVal){
|
if (newVal !== oldVal) {
|
this.query = null
|
this.$refs.list.newList(this.query)
|
}
|
}
|
},
|
methods:{
|
onPageBack(){
|
if (this.pageType==='mainlist') {
|
uni.redirectTo({url:this.$config.path.home});
|
} else {
|
if (this.pageType === 'mainsearch' || this.pageType === 'detaillist') {
|
this.pageType = 'mainlist'
|
} else {
|
this.pageType = 'detaillist'
|
}
|
}
|
},
|
onListQuery(){
|
this.pageType = 'mainsearch'
|
},
|
onListAction(obj){
|
this.mainActionRow = obj
|
this.pageType = 'detaillist'
|
},
|
onDeatilAction(){
|
this.pageType = 'checkaction'
|
},
|
onSearchCallBack(params){
|
this.query = params;
|
this.pageType = 'mainlist'
|
},
|
switchPage(){
|
this.$nextTick(()=>{
|
switch (this.pageType){
|
case 'mainlist':
|
this.$refs.mainlist.newList(this.query)
|
break;
|
case 'detaillist':
|
this.$refs.detaillist.init()
|
this.$refs.checkaction.clear()
|
break;
|
default:
|
break;
|
}
|
})
|
},
|
/* 页面初始化获取页面body高度的定时器 */
|
startInitInterval(callback){
|
initInterVal = setInterval(()=>{
|
if (this.pageBodyHeight) {
|
this.clearInitInterval()
|
callback && callback()
|
} else {
|
this.pageBodyHeight = this.$refs.page.getBodyHeight()
|
}
|
},200)
|
},
|
/* 清除定时器 */
|
clearInitInterval(){
|
try{
|
clearInterval(initInterVal)
|
initInterVal = null
|
}catch(e){
|
//TODO handle the exception
|
}
|
}
|
},
|
onReady(){
|
this.startInitInterval(()=>{
|
/* 页面初始化后需要执行的代码在这边调用 */
|
this.switchPage()
|
})
|
},
|
onUnload(){
|
this.clearInitInterval()
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
</style>
|