<template>
|
<default-header-page-layout ref="page" title="产量维护">
|
<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">
|
<u-subsection activeColor="#F18201" @change="sectionChange" :fontSize="20" class='subsection'
|
mode="subsection" :list="list" :current="current"></u-subsection>
|
|
<view class="content">
|
<view class="card" v-for="(item,index) in data" :key="index">
|
<view class="card-title">计划id:{{item.id}}</view>
|
<u-row style="width:100%;flex-wrap: wrap;border-bottom: 2rpx solid #eee;padding-bottom:10rpx;">
|
<u-col span="12">
|
<u-row>
|
<u-col span="4">计划类型:</u-col>
|
<u-col span="8">{{item.planType==1?'班组计划':'月份计划'}}</u-col>
|
</u-row>
|
</u-col>
|
<u-col span="12">
|
<u-row>
|
<u-col span="4">计划时间:</u-col>
|
<u-col span="8">
|
<view v-if="current==0" >
|
{{moment(moment(item.planTime,'YYYY-MM-DD')).format('YYYY-MM-DD')}}</view>
|
<view v-if="current==1">
|
{{moment(moment(item.planTime,'YYYY-MM')).format('YYYY-MM')}}</view>
|
</u-col>
|
</u-row>
|
</u-col>
|
<u-col span="12" v-if="current==0">
|
<u-row>
|
<u-col span="4">班组类型:</u-col>
|
<u-col span="8">{{item.teamType}}</u-col>
|
</u-row>
|
</u-col>
|
<u-col span="12">
|
<u-row>
|
<u-col span="4">计划产量:</u-col>
|
<u-col span="8">{{item.planProductionNum}}</u-col>
|
</u-row>
|
</u-col>
|
<u-col span="12">
|
<u-row>
|
<u-col span="4" >备注:</u-col>
|
<u-col span="8">{{item.remarks}}</u-col>
|
</u-row>
|
</u-col>
|
</u-row>
|
<view class="card-action">
|
<u-button @click="toAddOrEditProd('edit',current,item)"
|
style="width:150rpx;height:60rpx;margin: 10rpx 0 0;" text="修改"
|
type="primary"></u-button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 新增计划产量 -->
|
<template v-slot:footer>
|
<view class="bottom-btns-row">
|
<template>
|
<div class="btn-frame">
|
<u-button size="large" :text="`新增${list[current]}`"
|
:custom-style="{backgroundColor:'#F18201',color:'#fff'}"
|
@click="toAddOrEditProd('add',current)"></u-button>
|
</div>
|
</template>
|
</view>
|
</template>
|
</default-header-page-layout>
|
</template>
|
|
<script>
|
import DefaultHeaderPageLayout from '@/components/DefaultHeaderPageLayout.vue'
|
import ActionUserRow from '@/components/ActionUserRow.vue'
|
import {
|
getProductionplaninfo
|
} from '@/api/production/index.js'
|
import qs from 'qs'
|
import moment from 'moment'
|
export default {
|
name: 'production',
|
components: {
|
DefaultHeaderPageLayout,
|
ActionUserRow
|
},
|
data() {
|
return {
|
pageBodyHeight: 0,
|
list: ['班组产量', '月份产量'],
|
current: 0,
|
data: []
|
}
|
},
|
created() {
|
this.sectionChange(this.current)
|
},
|
methods: {
|
moment,
|
// 分段器改变
|
sectionChange(index) {
|
this.current = index
|
this.data=[]
|
if (index == 0) {
|
this.getPlanData(1)
|
} else if (index == 1) {
|
this.getPlanData(2)
|
}
|
|
},
|
|
|
// 获取计划产量数据
|
async getPlanData(planType) {
|
try {
|
let {
|
data
|
} = await getProductionplaninfo({
|
planType
|
})
|
this.data = data.rows
|
|
} catch (e) {
|
//TODO handle the exception
|
console.log(e);
|
}
|
|
},
|
// 跳转到创建巡检任务页面
|
toAddOrEditProd(type, current, item = {}) {
|
item.planType = parseInt(current) + 1
|
item.type = type
|
uni.navigateTo({
|
url: `/pages/production/addOrEditProd?${qs.stringify(item)}`
|
})
|
},
|
/* 页面初始化获取页面body高度的定时器 */
|
startInitInterval(callback) {
|
this.initInterVal = setInterval(() => {
|
if (this.pageBodyHeight) {
|
this.clearInitInterval()
|
callback && callback()
|
} else {
|
this.pageBodyHeight = this.$refs.page.getBodyHeight()
|
}
|
}, 200)
|
},
|
/* 清除定时器 */
|
clearInitInterval() {
|
try {
|
clearInterval(this.initInterVal)
|
this.initInterVal = null
|
} catch (e) {
|
//TODO handle the exception
|
}
|
}
|
},
|
onReady() {
|
this.startInitInterval(() => {
|
/* 页面初始化后需要执行的代码在这边调用 */
|
})
|
},
|
onLoad(item) {
|
if(item.current) {
|
this.current=item.current
|
}else {
|
this.current=0
|
}
|
|
},
|
onUnload() {
|
this.clearInitInterval()
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.subsection {
|
// width: 100%;
|
height: 50rpx;
|
margin-bottom: 20rpx;
|
}
|
|
.content {
|
// width:100%;
|
height: auto;
|
margin: 0 20rpx;
|
|
.card {
|
// width: 100%;
|
height: auto;
|
background-color: #fff;
|
border-radius: 10rpx;
|
padding: 10rpx 20rpx;
|
margin-bottom: 20rpx;
|
font-size: 40rpx;
|
|
.card-title {
|
font-size: 45rpx;
|
font-weight: 700;
|
padding-bottom: 5rpx;
|
border-bottom: 2rpx solid #eee;
|
}
|
|
.card-item {
|
padding: 10rpx 0 0;
|
}
|
|
.card-action {
|
width: 100%;
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
}
|
}
|
|
|
}
|
|
::v-deep .u-button__text {
|
font-size: 40rpx !important;
|
}
|
|
.bottom-btns-row {
|
display: flex;
|
padding: 10rpx 0;
|
background-color: #fff;
|
|
.btn-frame {
|
width: 90%;
|
box-sizing: border-box;
|
margin: 10rpx auto;
|
font-weight: bold;
|
border-radius: 5px;
|
}
|
}
|
</style>
|