同比环比计算优化

main
张群 2 years ago
parent 12588f2d3a
commit d3368b8c51
  1. 18
      pages/highWay/runData/form.vue
  2. 4
      pages/highWay/runStatusData/form.vue
  3. 18
      pages/railway/railwayRunData/form.vue
  4. 2
      pages/railway/runStatus/form.vue
  5. 6
      pages/water/TransportData/form.vue
  6. 2
      pages/water/transportation/form.vue
  7. 95
      pages/water/waterWay/form.vue
  8. 2
      pages/water/waterWay/list.vue

@ -39,7 +39,7 @@
</view> </view>
</view> </view>
<!-- 同比环比 --> <!-- 同比环比 -->
<view class="form_item_rate" v-if="form.entranceVehicleCountMom || form.entranceVehicleCountYoy" :class="form.entranceVehicleCount == yoyMom.minusDaysEntranceVehicleSum ? 'danger' : ''"> <view class="form_item_rate" :class="form.entranceVehicleCount == yoyMom.minusDaysEntranceVehicleSum ? 'danger' : ''">
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label" :style="form.entranceVehicleCount == yoyMom.minusDaysEntranceVehicleSum ?'color: #EB4747':''">收费站入口车辆数汇总环比(%)</view> <view class="rate_item_label" :style="form.entranceVehicleCount == yoyMom.minusDaysEntranceVehicleSum ?'color: #EB4747':''">收费站入口车辆数汇总环比(%)</view>
<view class="rate_item_input" :style="form.entranceVehicleCount == yoyMom.minusDaysEntranceVehicleSum ?'color: #EB4747':''"> <view class="rate_item_input" :style="form.entranceVehicleCount == yoyMom.minusDaysEntranceVehicleSum ?'color: #EB4747':''">
@ -61,7 +61,7 @@
</view> </view>
</view> </view>
<!-- 同比环比 --> <!-- 同比环比 -->
<view class="form_item_rate" v-if="form.exitVehicleCountMom || form.exitVehicleCountYoy" :class="form.exitVehicleCount === yoyMom.minusDaysExitVehicleSum ? 'danger' : ''"> <view class="form_item_rate" :class="form.exitVehicleCount === yoyMom.minusDaysExitVehicleSum ? 'danger' : ''">
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label" :style="form.exitVehicleCount == yoyMom.minusDaysExitVehicleSum ?'color: #EB4747':''">收费站入口车辆数汇总环比(%)</view> <view class="rate_item_label" :style="form.exitVehicleCount == yoyMom.minusDaysExitVehicleSum ?'color: #EB4747':''">收费站入口车辆数汇总环比(%)</view>
<view class="rate_item_input" :style="form.exitVehicleCount == yoyMom.minusDaysExitVehicleSum ?'color: #EB4747':''"> <view class="rate_item_input" :style="form.exitVehicleCount == yoyMom.minusDaysExitVehicleSum ?'color: #EB4747':''">
@ -108,7 +108,7 @@
</view> </view>
</view> </view>
<!-- 同比环比 --> <!-- 同比环比 -->
<view class="form_item_rate" v-if="form.highwaySubDataList[stationIndex].entranceVehicleCountMom || form.highwaySubDataList[stationIndex].entranceVehicleCountYoy" :class="form.highwaySubDataList[stationIndex].entranceVehicleCountMom == 0 ? 'danger' : '' "> <view class="form_item_rate" :class="form.highwaySubDataList[stationIndex].entranceVehicleCountMom == 0 ? 'danger' : '' ">
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label" :style="form.highwaySubDataList[stationIndex].entranceVehicleCountMom == 0 ? 'color: #EB4747' : ''">收费站入口车辆数环比(%)</view> <view class="rate_item_label" :style="form.highwaySubDataList[stationIndex].entranceVehicleCountMom == 0 ? 'color: #EB4747' : ''">收费站入口车辆数环比(%)</view>
<view class="rate_item_input" :style="form.highwaySubDataList[stationIndex].entranceVehicleCountMom == 0 ? 'color: #EB4747' : ''"> <view class="rate_item_input" :style="form.highwaySubDataList[stationIndex].entranceVehicleCountMom == 0 ? 'color: #EB4747' : ''">
@ -130,7 +130,7 @@
</view> </view>
</view> </view>
<!-- 同比环比 --> <!-- 同比环比 -->
<view class="form_item_rate" v-if="form.highwaySubDataList[stationIndex].exitVehicleCountMom || form.highwaySubDataList[stationIndex].exitVehicleCountYoy" :class="form.highwaySubDataList[stationIndex].exitVehicleCountMom == 0 ? 'danger' : '' "> <view class="form_item_rate" :class="form.highwaySubDataList[stationIndex].exitVehicleCountMom == 0 ? 'danger' : '' ">
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label" :style="form.highwaySubDataList[stationIndex].exitVehicleCountMom == 0 ? 'color: #EB4747' : ''">收费站出口车辆数环比(%)</view> <view class="rate_item_label" :style="form.highwaySubDataList[stationIndex].exitVehicleCountMom == 0 ? 'color: #EB4747' : ''">收费站出口车辆数环比(%)</view>
<view class="rate_item_input" :style="form.highwaySubDataList[stationIndex].exitVehicleCountMom == 0 ? 'color: #EB4747' : ''"> <view class="rate_item_input" :style="form.highwaySubDataList[stationIndex].exitVehicleCountMom == 0 ? 'color: #EB4747' : ''">
@ -294,8 +294,8 @@
// //
let obj = this.yoyMom.minusDaysList[idx]; let obj = this.yoyMom.minusDaysList[idx];
console.log(obj) console.log(obj)
this.form.highwaySubDataList[index].entranceVehicleCountMom = obj.entranceVehicleCount ? (parseInt(this.form.highwaySubDataList[index].entranceVehicleCount) - obj.entranceVehicleCount) / obj.entranceVehicleCount * 100 : ''; this.form.highwaySubDataList[index].entranceVehicleCountMom = !checkNotEmpty(obj.entranceVehicleCount) || obj.entranceVehicleCount === 0 ? 100 : obj.entranceVehicleCount ? (parseInt(this.form.highwaySubDataList[index].entranceVehicleCount) - obj.entranceVehicleCount) / obj.entranceVehicleCount * 100 : '';
this.form.highwaySubDataList[index].exitVehicleCountMom = obj.exitVehicleCount ? (parseInt(this.form.highwaySubDataList[index].exitVehicleCount) - obj.exitVehicleCount) / obj.exitVehicleCount * 100 : ''; this.form.highwaySubDataList[index].exitVehicleCountMom = !checkNotEmpty(obj.exitVehicleCount) || obj.exitVehicleCount === 0 ? 100 : obj.exitVehicleCount ? (parseInt(this.form.highwaySubDataList[index].exitVehicleCount) - obj.exitVehicleCount) / obj.exitVehicleCount * 100 : '';
} }
else{ else{
this.form.highwaySubDataList[index].entranceVehicleCountMom = ''; this.form.highwaySubDataList[index].entranceVehicleCountMom = '';
@ -305,8 +305,8 @@
// //
let obj = this.yoyMom.minusYearsList[idx2]; let obj = this.yoyMom.minusYearsList[idx2];
console.log(obj) console.log(obj)
this.form.highwaySubDataList[index].entranceVehicleCountYoy = obj.entranceVehicleCount ? (parseInt(this.form.highwaySubDataList[index].entranceVehicleCount) - obj.entranceVehicleCount) / obj.entranceVehicleCount * 100 : ''; this.form.highwaySubDataList[index].entranceVehicleCountYoy = !checkNotEmpty(obj.entranceVehicleCount) || obj.entranceVehicleCount === 0 ? 100 : obj.entranceVehicleCount ? (parseInt(this.form.highwaySubDataList[index].entranceVehicleCount) - obj.entranceVehicleCount) / obj.entranceVehicleCount * 100 : '';
this.form.highwaySubDataList[index].exitVehicleCountYoy = obj.exitVehicleCount ? (parseInt(this.form.highwaySubDataList[index].exitVehicleCount) - obj.exitVehicleCount) / obj.exitVehicleCount * 100 : ''; this.form.highwaySubDataList[index].exitVehicleCountYoy = !checkNotEmpty(obj.exitVehicleCount) || obj.exitVehicleCount === 0 ? 100 : obj.exitVehicleCount ? (parseInt(this.form.highwaySubDataList[index].exitVehicleCount) - obj.exitVehicleCount) / obj.exitVehicleCount * 100 : '';
} }
else{ else{
this.form.highwaySubDataList[index].entranceVehicleCountYoy = ''; this.form.highwaySubDataList[index].entranceVehicleCountYoy = '';
@ -469,9 +469,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if(this.form.id == undefined) { if(this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/highway/runData/list' url: '/pages/highway/runData/list'
}) })
}, 300)
} }
else { else {
uni.navigateBack(); uni.navigateBack();

@ -389,7 +389,7 @@
changeHighway(e, key, index) { changeHighway(e, key, index) {
// //
let idx = this.form[key].findIndex(item => item.highwayNameIndex == e.detail.value ); let idx = this.form[key].findIndex(item => item.highwayNameIndex == e.detail.value );
if(idx > -1) { if(idx > -1 && this.form[key][index].highwayNameIndex == '') {
uni.showToast({ uni.showToast({
title: '高速公路不能重复选择', title: '高速公路不能重复选择',
icon: 'none' icon: 'none'
@ -580,9 +580,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if(this.form.id == undefined) { if(this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/highway/runStatusData/list' url: '/pages/highway/runStatusData/list'
}) })
}, 300)
} }
else { else {
uni.navigateBack(); uni.navigateBack();

@ -281,30 +281,30 @@
console.log('同比环比计算') console.log('同比环比计算')
if (this.yoyMom.yesterdayData) { if (this.yoyMom.yesterdayData) {
// //
this.form.inRailwayYomDo = this.yoyMom.yesterdayData.inboundRailwayDo && this.form.inboundRailwayDo ? ( this.form.inRailwayYomDo = !checkNotEmpty(this.yoyMom.yesterdayData.inboundRailwayDo) ||this.yoyMom.yesterdayData.inboundRailwayDo === 0 ? 100 : this.form.inboundRailwayDo ? (
parseInt(this.form.inboundRailwayDo) - this.yoyMom.yesterdayData.inboundRailwayDo) / this parseInt(this.form.inboundRailwayDo) - this.yoyMom.yesterdayData.inboundRailwayDo) / this
.yoyMom.yesterdayData.inboundRailwayDo * 100 : ''; .yoyMom.yesterdayData.inboundRailwayDo * 100 : '';
this.form.inPepoleYoyDo = this.yoyMom.yesterdayData.inPepole && this.form.inPepole ? (parseInt(this this.form.inPepoleYoyDo = !checkNotEmpty(this.yoyMom.yesterdayData.inPepole) || this.yoyMom.yesterdayData.inPepole === 0 ? 100 : this.form.inPepole ? (parseInt(this
.form.inPepole) - this.yoyMom.yesterdayData.inPepole) / this.yoyMom.yesterdayData.inPepole * .form.inPepole) - this.yoyMom.yesterdayData.inPepole) / this.yoyMom.yesterdayData.inPepole *
100 : ''; 100 : '';
this.form.outRailwayYomDo = this.yoyMom.yesterdayData.outboundRailwayDo && this.form this.form.outRailwayYomDo = !checkNotEmpty(this.yoyMom.yesterdayData.outboundRailwayDo) || this.yoyMom.yesterdayData.outboundRailwayDo === 0 ? 100 : this.form
.outboundRailwayDo ? (parseInt(this.form.outboundRailwayDo) - this.yoyMom.yesterdayData .outboundRailwayDo ? (parseInt(this.form.outboundRailwayDo) - this.yoyMom.yesterdayData
.outboundRailwayDo) / this.yoyMom.yesterdayData.outboundRailwayDo * 100 : ''; .outboundRailwayDo) / this.yoyMom.yesterdayData.outboundRailwayDo * 100 : '';
this.form.outPepoleYoyDo = this.yoyMom.yesterdayData.outPepole && this.form.outPepole ? (parseInt(this this.form.outPepoleYoyDo = !checkNotEmpty(this.yoyMom.yesterdayData.outPepole) || this.yoyMom.yesterdayData.outPepole === 0 ? 100 : this.form.outPepole ? (parseInt(this
.form.outPepole) - this.yoyMom.yesterdayData.outPepole) / this.yoyMom.yesterdayData.outPepole * .form.outPepole) - this.yoyMom.yesterdayData.outPepole) / this.yoyMom.yesterdayData.outPepole *
100 : ''; 100 : '';
} }
if (this.yoyMom.lastYearData) { if (this.yoyMom.lastYearData) {
// //
this.form.inRailwayMomDo = this.yoyMom.lastYearData.inboundRailwayDo && this.form.inboundRailwayDo ? ( this.form.inRailwayMomDo = !checkNotEmpty(this.yoyMom.lastYearData.inboundRailwayDo) || this.yoyMom.lastYearData.inboundRailwayDo === 0 ? 100 : this.form.inboundRailwayDo ? (
parseInt(this.form.inboundRailwayDo) - this.yoyMom.lastYearData.inboundRailwayDo) / this.yoyMom parseInt(this.form.inboundRailwayDo) - this.yoyMom.lastYearData.inboundRailwayDo) / this.yoyMom
.lastYearData.inboundRailwayDo * 100 : ''; .lastYearData.inboundRailwayDo * 100 : '';
this.form.inPepoleMomDo = this.yoyMom.lastYearData.inPepole && this.form.inPepole ? (parseInt(this.form this.form.inPepoleMomDo = !checkNotEmpty(this.yoyMom.lastYearData.inPepole) || this.yoyMom.lastYearData.inPepole === 0 ? 100 : this.form.inPepole ? (parseInt(this.form
.inPepole) - this.yoyMom.lastYearData.inPepole) / this.yoyMom.lastYearData.inPepole * 100 : ''; .inPepole) - this.yoyMom.lastYearData.inPepole) / this.yoyMom.lastYearData.inPepole * 100 : '';
this.form.outRailwayMomDo = this.yoyMom.lastYearData.outboundRailwayDo && this.form.outboundRailwayDo ? this.form.outRailwayMomDo = !checkNotEmpty(this.yoyMom.lastYearData.outboundRailwayDo) || this.yoyMom.lastYearData.outboundRailwayDo === 0 ? 100 : this.form.outboundRailwayDo ?
(parseInt(this.form.outboundRailwayDo) - this.yoyMom.lastYearData.outboundRailwayDo) / this.yoyMom (parseInt(this.form.outboundRailwayDo) - this.yoyMom.lastYearData.outboundRailwayDo) / this.yoyMom
.lastYearData.outboundRailwayDo * 100 : ''; .lastYearData.outboundRailwayDo * 100 : '';
this.form.outPepoleMomDo = this.yoyMom.lastYearData.outPepole && this.form.outPepole ? (parseInt(this this.form.outPepoleMomDo = !checkNotEmpty(this.yoyMom.lastYearData.outPepole) || this.yoyMom.lastYearData.outPepole ===0 ? 100 : this.form.outPepole ? (parseInt(this
.form.outPepole) - this.yoyMom.lastYearData.outPepole) / this.yoyMom.lastYearData.outPepole * .form.outPepole) - this.yoyMom.lastYearData.outPepole) / this.yoyMom.lastYearData.outPepole *
100 : ''; 100 : '';
} }
@ -434,9 +434,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if(this.form.id == undefined) { if(this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/railway/railwayRunData/list' url: '/pages/railway/railwayRunData/list'
}) })
}, 300)
} }
else { else {
uni.navigateBack(); uni.navigateBack();

@ -230,9 +230,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if(this.form.id == undefined) { if(this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/railway/runStatus/list' url: '/pages/railway/runStatus/list'
}) })
}, 300)
} }
else { else {
uni.navigateBack(); uni.navigateBack();

@ -176,10 +176,10 @@
console.log('同比计算') console.log('同比计算')
if (this.yoyMom.lastYearData) { if (this.yoyMom.lastYearData) {
// //
this.form.passengerWatertransportMomDo = this.yoyMom.lastYearData.passengerWatertransportMomDo && this.form.passengerWatertransportMomDo ? ( this.form.passengerWatertransportMomDo = !checkNotEmpty(this.yoyMom.lastYearData.passengerWatertransportMomDo) || this.yoyMom.lastYearData.passengerWatertransportMomDo === 0 ? 100 : this.form.passengerWatertransportMomDo ? (
parseInt(this.form.passengerWatertransportMomDo) - this.yoyMom.lastYearData.passengerWatertransportMomDo) / this.yoyMom parseInt(this.form.passengerWatertransportMomDo) - this.yoyMom.lastYearData.passengerWatertransportMomDo) / this.yoyMom
.lastYearData.passengerWatertransportMomDo * 100 : ''; .lastYearData.passengerWatertransportMomDo * 100 : '';
this.form.voyageWatertransportMomDo = this.yoyMom.lastYearData.voyageWatertransportMomDo && this.form.voyageWatertransportMomDo ? (parseInt(this.form this.form.voyageWatertransportMomDo = !checkNotEmpty(this.yoyMom.lastYearData.voyageWatertransportMomDo) || this.yoyMom.lastYearData.voyageWatertransportMomDo === 0 ? 100 : this.form.voyageWatertransportMomDo ? (parseInt(this.form
.voyageWatertransportMomDo) - this.yoyMom.lastYearData.voyageWatertransportMomDo) / this.yoyMom.lastYearData.voyageWatertransportMomDo * 100 : ''; .voyageWatertransportMomDo) - this.yoyMom.lastYearData.voyageWatertransportMomDo) / this.yoyMom.lastYearData.voyageWatertransportMomDo * 100 : '';
} }
}, },
@ -284,9 +284,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if(this.form.id == undefined) { if(this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/water/TransportData/list' url: '/pages/water/TransportData/list'
}) })
}, 300)
} }
else{ else{
uni.navigateBack(); uni.navigateBack();

@ -309,9 +309,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if(this.form.id == undefined) { if(this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/water/transportation/list' url: '/pages/water/transportation/list'
}) })
}, 300)
} }
else { else {
uni.navigateBack(); uni.navigateBack();

@ -6,12 +6,12 @@
</view> </view>
<view class="form_item_box"> <view class="form_item_box">
<view class="form_item_title">基本信息</view> <view class="form_item_title">基本信息</view>
<view class="form_item"> <!-- <view class="form_item">
<view class="form_item_label">管理单位名称</view> <view class="form_item_label">管理单位名称</view>
<view class="form_item_input select"> <view class="form_item_input select">
{{form.affiliatedUnit}} {{form.affiliatedUnit}}
</view> </view>
</view> </view> -->
<view class="form_item"> <view class="form_item">
<view class="form_item_label">统计日期</view> <view class="form_item_label">统计日期</view>
<view class="form_item_input picker"> <view class="form_item_input picker">
@ -47,7 +47,7 @@
<view class="form_item_input picker"> <view class="form_item_input picker">
<picker :value="item.landNameIndex" :range="landList" @change="e => changeLandName(e, index)"> <picker :value="item.landNameIndex" :range="landList" @change="e => changeLandName(e, index)">
<text class="picker_select" <text class="picker_select"
:style="item.landNameIndex?'color:#333;':''">{{item.landNameIndex ? landList[item.landNameIndex] : '请选择'}}</text> :style="item.landName?'color:#333;':''">{{item.landName ? item.landName : '请选择'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons> <uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker> </picker>
</view> </view>
@ -55,55 +55,55 @@
<view class="form_item"> <view class="form_item">
<view class="form_item_label">航次</view> <view class="form_item_label">航次</view>
<view class="form_item_input form_input"> <view class="form_item_input form_input">
<uni-easyinput type="number" v-model="item.voyage" <uni-easyinput @blur="calcYoyMom(index)" type="number" v-model="item.voyage"
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20">
</uni-easyinput> </uni-easyinput>
</view> </view>
</view> </view>
<!-- 同比环比 --> <!-- 同比环比 -->
<view class="form_item_rate" :class="form.voyage == form.yesterdayVoyage ? 'danger' : '' "> <view class="form_item_rate" :class="item.voyage == item.yesterdayVoyage ? 'danger' : '' ">
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label" <view class="rate_item_label"
:style="form.voyage == form.yesterdayVoyage ? 'color: #EB4747' : ''">航次环比(%) :style="item.voyage == item.yesterdayVoyage ? 'color: #EB4747' : ''">航次环比(%)
</view> </view>
<view class="rate_item_input" <view class="rate_item_input"
:style="form.voyage == form.yesterdayVoyage ? 'color: #EB4747' : ''"> :style="item.voyage == item.yesterdayVoyage ? 'color: #EB4747' : ''">
{{form.voyageRingRatio === 0 ? form.voyageRingRatio : form.voyageRingRatio ? form.voyageRingRatio.toFixed(2) : ''}} {{item.voyageRingRatio === 0 ? item.voyageRingRatio : item.voyageRingRatio ? item.voyageRingRatio.toFixed(2) : ''}}
</view> </view>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label">航次同比(%)</view> <view class="rate_item_label">航次同比(%)</view>
<view class="rate_item_input"> <view class="rate_item_input">
{{form.voyageYearOnYear === 0 ? form.voyageYearOnYear : form.voyageYearOnYear ? form.voyageYearOnYear.toFixed(2) : ''}} {{item.voyageYearOnYear === 0 ? item.voyageYearOnYear : item.voyageYearOnYear ? item.voyageYearOnYear.toFixed(2) : ''}}
</view> </view>
</view> </view>
</view> </view>
<view class="form_item"> <view class="form_item">
<view class="form_item_label">人数</view> <view class="form_item_label">人数</view>
<view class="form_item_input form_input"> <view class="form_item_input form_input">
<uni-easyinput type="number" v-model="item.numberOfPeople" <uni-easyinput @blur="calcYoyMom(index)" type="number" v-model="item.numberOfPeople"
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20">
</uni-easyinput> </uni-easyinput>
</view> </view>
</view> </view>
<!-- 同比环比 --> <!-- 同比环比 -->
<view class="form_item_rate" <view class="form_item_rate"
:class="form.numberOfPeople == form.yesterdayNumberOfPeople ? 'danger' : '' "> :class="item.numberOfPeople == item.yesterdayNumberOfPeople ? 'danger' : '' ">
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label" <view class="rate_item_label"
:style="form.numberOfPeople == form.yesterdayNumberOfPeople ? 'color: #EB4747' : ''">人数环比(%) :style="item.numberOfPeople == item.yesterdayNumberOfPeople ? 'color: #EB4747' : ''">人数环比(%)
</view> </view>
<view class="rate_item_input" <view class="rate_item_input"
:style="form.numberOfPeople == form.yesterdayNumberOfPeople ? 'color: #EB4747' : ''"> :style="item.numberOfPeople == item.yesterdayNumberOfPeople ? 'color: #EB4747' : ''">
{{form.peopleRingRatio === 0 ? form.peopleRingRatio : form.peopleRingRatio ? form.peopleRingRatio.toFixed(2) : ''}} {{item.peopleRingRatio === 0 ? item.peopleRingRatio : item.peopleRingRatio ? item.peopleRingRatio.toFixed(2) : ''}}
</view> </view>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="rate_item"> <view class="rate_item">
<view class="rate_item_label">人数同比(%)</view> <view class="rate_item_label">人数同比(%)</view>
<view class="rate_item_input"> <view class="rate_item_input">
{{form.peopleYearOnYear === 0 ? form.peopleYearOnYear : form.peopleYearOnYear ? form.peopleYearOnYear.toFixed(2) : ''}} {{item.peopleYearOnYear === 0 ? item.peopleYearOnYear : item.peopleYearOnYear ? item.peopleYearOnYear.toFixed(2) : ''}}
</view> </view>
</view> </view>
</view> </view>
@ -153,6 +153,7 @@
return { return {
form: { form: {
"bizWaterwayIslandDataSaveOrUpdateDTOList": [{ "bizWaterwayIslandDataSaveOrUpdateDTOList": [{
"landNameIndex":"",
"landName": "", "landName": "",
"lastYearNumberOfPeople": 0, "lastYearNumberOfPeople": 0,
"lastYearVoyage": 0, "lastYearVoyage": 0,
@ -179,14 +180,14 @@
if (options.type == 'add') { if (options.type == 'add') {
this.pageType = 'add'; this.pageType = 'add';
let now = new Date(); let now = new Date();
this.form.statDate = getDateStr(now, -1); // this.form.reportDate = getDateStr(now, -1); //
this.queryTime(); // this.queryTime(); //
} else if (options.item) { } else if (options.item) {
this.form = JSON.parse(options.item); this.form = JSON.parse(options.item);
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList = this.form.bizWaterwayIslandDataVOList; this.form.bizWaterwayIslandDataSaveOrUpdateDTOList = this.form.bizWaterwayIslandDataVOList;
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.map(item => { this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.map(item => {
let idx = this.landList.findIndex(item2 => item2 == item.landName); let idx = this.landList.findIndex(item2 => item2 == item.landName);
item.landIndex = idx > -1 ? idx : ''; item.landNameIndex = idx > -1 ? idx : '';
}) })
this.queryTime(); this.queryTime();
} else if (options.id) { } else if (options.id) {
@ -197,15 +198,46 @@
formatdate(date) { formatdate(date) {
return date.length < 12 ? date + ' 00:00:00' : date; return date.length < 12 ? date + ' 00:00:00' : date;
}, },
//
changeLandName(e, index) {
//
let idx = this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.findIndex(item => item.landNameIndex == e.detail
.value);
if (idx > -1 && this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landNameIndex == '') {
uni.showToast({
title: '水运(陆岛)不能重复选择',
icon: 'none'
});
}else{
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landNameIndex = e.detail.value;
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landName = this.landList[e.detail.value];
this.calcYoyMom(index);
}
},
// //
calcYoyMom(index) { calcYoyMom(index) {
if (this.form.reportDate == '' || this.form.statPeriod == '' || this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landName == '') { if (this.form.reportDate == '' || this.form.statPeriod == '' || this.form
.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landName == '') {
return; return;
} }
this.$request(getApp().globalData.baseUrl + '/api/biz/waterwayIslandData/getYoyMom?statDate=' + this.form this.$request(getApp().globalData.baseUrl + '/api/biz/waterwayIslandData/getYoyMom?statDate=' + this.form
.reportDate + '&statPeriod=' + this.form.statPeriod + '&landName='+this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landName+'&_t=' + Date.parse(new Date()), {}, 'GET') .reportDate + '&statPeriod=' + this.form.statPeriod + '&landName=' + this.form
.bizWaterwayIslandDataSaveOrUpdateDTOList[index].landName + '&_t=' + Date.parse(new Date()), {},
'GET')
.then(res => { .then(res => {
let yesterdayData = res.data.yesterdayData;
let lastYearData = res.data.lastYearData;
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].yesterdayVoyage = checkNotEmpty(yesterdayData.voyage) ? yesterdayData.voyage : 0;
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].lastYearVoyage = checkNotEmpty(lastYearData.voyage) ? lastYearData.voyage : 0;
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].yesterdayNumberOfPeople = checkNotEmpty(yesterdayData.numberOfPeople) ? yesterdayData.numberOfPeople : 0;
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].lastYearNumberOfPeople = checkNotEmpty(lastYearData.numberOfPeople) ? lastYearData.numberOfPeople : 0;
//-
let obj = this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index];
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].voyageRingRatio = !checkNotEmpty(yesterdayData.voyage) || yesterdayData.voyage === 0 ? 100 : obj.voyage ? (parseInt(obj.voyage) - yesterdayData.voyage) / yesterdayData.voyage * 100 : '';
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].voyageYearOnYear = !checkNotEmpty(lastYearData.voyage) || lastYearData.voyage === 0 ? 100 : obj.voyage ? (parseInt(obj.voyage) - lastYearData.voyage) / lastYearData.voyage * 100 : '';
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].peopleRingRatio = !checkNotEmpty(yesterdayData.numberOfPeople) || yesterdayData.numberOfPeople === 0 ? 100 : obj.numberOfPeople ? (parseInt(obj.numberOfPeople) - yesterdayData.numberOfPeople) / yesterdayData.numberOfPeople * 100 : '';
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index].peopleYearOnYear = !checkNotEmpty(lastYearData.numberOfPeople) || lastYearData.numberOfPeople === 0 ? 100 : obj.numberOfPeople ? (parseInt(obj.numberOfPeople) - lastYearData.numberOfPeople) / lastYearData.numberOfPeople * 100 : '';
console.log('环比同比', this.form.bizWaterwayIslandDataSaveOrUpdateDTOList[index])
}) })
}, },
//id //id
@ -221,6 +253,10 @@
this.index = e.detail.value; this.index = e.detail.value;
this.form.statPeriod = this.array[e.detail.value].dictValue; this.form.statPeriod = this.array[e.detail.value].dictValue;
console.log('change 时段', this.form) console.log('change 时段', this.form)
//
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.map((item, index) => {
this.calcYoyMom(index);
})
}, },
// //
doCancel() { doCancel() {
@ -228,7 +264,11 @@
}, },
// //
bindDateChange(e) { bindDateChange(e) {
this.form.statDate = e.detail.value; this.form.reportDate = e.detail.value;
//
this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.map((item, index) => {
this.calcYoyMom(index);
})
}, },
// //
queryTime() { queryTime() {
@ -259,7 +299,8 @@
}, },
// //
addRow() { addRow() {
this.form.listContion.push({ this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.push({
"landNameIndex": "",
"landName": "", "landName": "",
"lastYearNumberOfPeople": 0, "lastYearNumberOfPeople": 0,
"lastYearVoyage": 0, "lastYearVoyage": 0,
@ -275,7 +316,7 @@
}, },
// //
delRow(index) { delRow(index) {
this.form.listContion.splice(index, 1); this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.splice(index, 1);
}, },
// //
doSubmit() { doSubmit() {
@ -287,9 +328,9 @@
}) })
return; return;
} }
let checkCongestion = true; let checkAccident = true;
if (this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.length > 0) { if (this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.length > 0) {
checkCongestion = this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.every(item => { checkAccident = this.form.bizWaterwayIslandDataSaveOrUpdateDTOList.every(item => {
return checkNotEmpty(item.landName) && checkNotEmpty(item.numberOfPeople) && checkNotEmpty( return checkNotEmpty(item.landName) && checkNotEmpty(item.numberOfPeople) && checkNotEmpty(
item.voyage) item.voyage)
}) })
@ -327,9 +368,11 @@
icon: 'none', icon: 'none',
success: () => { success: () => {
if (this.form.id == undefined) { if (this.form.id == undefined) {
setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/water/transportation/list' url: '/pages/water/waterWay/list'
}) })
}, 300)
} else { } else {
uni.navigateBack(); uni.navigateBack();
} }

@ -1,6 +1,6 @@
<template> <template>
<view class="page"> <view class="page">
<view class="list_box" v-for="(item,index) in data" :key="index" @click="goPage('/pages/water/waterWay/form?id='+item.id)"> <view class="list_box" v-for="(item,index) in data" :key="index" @click="goPage('/pages/water/waterWay/form', item)">
<view class="list_top"> <view class="list_top">
<view class="unit_tags">报送时间</view> <view class="unit_tags">报送时间</view>
<view>{{item.reportDate || ''}}<text <view>{{item.reportDate || ''}}<text

Loading…
Cancel
Save