添加车辆表单页面,完善道路运输同比环比计算公式

main
jinna 2 years ago
parent 37b16b69a6
commit c6ae42e83b
  1. 30
      common/util.js
  2. 451
      pages/bus/busDataInfo/form.vue
  3. 2
      pages/bus/busDataInfo/list.vue
  4. 38
      pages/roadTransport/quantitySent/form.vue
  5. 23
      pages/roadTransport/transportData/form.vue

@ -91,11 +91,39 @@ function getDateStr(today, addDayCount) {
const checkNotEmpty = (str) => {
return typeof(str) !== 'undefined' && str !== null && str !== '' ? true : false
}
// 获取日期
function getDay(d, num) {
const date = new Date(new Date(d).setDate(new Date(d).getDate() + num))
const year = date.getFullYear()
const month = (date.getMonth() + 1 + "").padStart(2, "0")
const day = (date.getDate() + "").padStart(2, "0")
return `${year}-${month}-${day}`
}
// 是否是闰年
function isLeap(year){
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0
}
// 返回去年日期
function lastYearDate(d) {
const date = new Date(d)
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const lastYear = year - 1
const thisYearisLeap = isLeap(year)
const lastYearIsLeap = isLeap(lastYear)
// 特殊情况:去年是否是闰年 或 今年是闰年且为12月31日
if (lastYearIsLeap || (thisYearisLeap && month == 12 && day == 31)) return getDay(d, -366)
return getDay(d, -365)
}
export {
formatTime,
formatLocation,
getDateStr,
dateUtils,
checkNotEmpty
checkNotEmpty,
lastYearDate
}

@ -6,9 +6,9 @@
<view class="form_item">
<view class="form_item_label">统计日期</view>
<view class="form_item_input picker">
<picker mode="date" :value="form.statDate" @change="bindDateChange">
<picker mode="date" :value="form.reportDate" @change="bindDateChange">
<text class="picker_select"
:style="form.statDate?'color:#333;':''">{{form.statDate?form.statDate:'请选择统计日期'}}</text>
:style="form.reportDate?'color:#333;':''">{{form.reportDate?form.reportDate:'请选择统计日期'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
</view>
@ -16,26 +16,410 @@
<view class="form_item">
<view class="form_item_label">统计时段</view>
<view class="form_item_input picker">
<picker :value="index" :range="array" range-key="dictLabel" @change="queryYoYMom">
<picker :value="index" :range="timeArray" range-key="dictLabel" @change="bindtimeChange">
<text class="picker_select"
:style="index>-1?'color:#333;':''">{{index>-1?array[index].dictLabel:'请选择统计时段'}}</text>
:style="index>-1?'color:#333;':''">{{timeName ? timeName :'请选择统计时段'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
</view>
</view>
</view>
<view class="form_item_box bottom">
<view class="form_item_li" v-for="(item,index) in form.bizBusDataDetailVOList" :key="index">
<view class="form_item"
style="display:flex; justify-content: space-between; font-size: 30rpx;color:#333;font-weight: bold;margin-top: 30rpx;">
运行数据-{{index+1}}
<uni-icons type="trash" color="red" @click="delRow(index)" size="18"></uni-icons>
</view>
<view class="form_item">
<view class="form_item_label">名称</view>
<view class="form_item_input picker">
<picker :value="item.busIndex" :range="busArray" range-key="stationId"
@change="e => changeBusway(e, 'bizBusDataDetailVOList', index)">
<text class="picker_select"
:style="item.busUnit?'color:#333;':''">{{item.busUnit ? item.busUnit : '请选择'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
</view>
</view>
<view class="form_item">
<view class="form_item_label">投入车辆</view>
<view class="form_item_input form_input"><!-- digit -->
<uni-easyinput type="digit" v-model="item.vehicleInput" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('vehicleInput','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item_rate" v-if="item.vehicleInputMom || item.vehicleInputYoy" :class="item.vehicleInputMom == 0 ? 'danger' : '' ">
<view class="rate_item">
<view class="rate_item_label" :style="item.vehicleInputMom == 0 ? 'color: #EB4747' : ''">投入车辆环比(%)</view>
<view class="rate_item_input" :style="item.vehicleInputMom == 0 ? 'color: #EB4747' : ''">
{{item.vehicleInputMom === 0 ? item.vehicleInputMom : item.vehicleInputMom ? item.vehicleInputMom.toFixed(2) : ''}}
</view>
</view>
<view class="line"></view>
<view class="rate_item">
<view class="rate_item_label">投入车辆同比(%)</view>
<view class="rate_item_input">
{{item.vehicleInputYoy === 0 ? item.vehicleInputYoy : item.vehicleInputYoy ? item.vehicleInputYoy.toFixed(2) : ''}}
</view>
</view>
</view>
<view class="form_item">
<view class="form_item_label">运行班次</view>
<view class="form_item_input form_input"><!-- digit -->
<uni-easyinput type="number" v-model="item.operatingShifts" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('operatingShifts','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item_rate" v-if="item.operatingShiftsMom || item.operatingShiftsYoy" :class="item.operatingShiftsMom == 0 ? 'danger' : '' ">
<view class="rate_item">
<view class="rate_item_label" :style="item.operatingShiftsMom == 0 ? 'color: #EB4747' : ''">运行班次环比(%)</view>
<view class="rate_item_input" :style="item.operatingShiftsMom == 0 ? 'color: #EB4747' : ''">
{{item.operatingShiftsMom === 0 ? item.operatingShiftsMom : item.operatingShiftsMom ? item.operatingShiftsMom.toFixed(2) : ''}}
</view>
</view>
<view class="line"></view>
<view class="rate_item">
<view class="rate_item_label">运行班次同比(%)</view>
<view class="rate_item_input">
{{item.operatingShiftsYoy === 0 ? item.operatingShiftsYoy : item.operatingShiftsYoy ? item.operatingShiftsYoy.toFixed(2) : ''}}
</view>
</view>
</view>
<view class="form_item">
<view class="form_item_label">人数(万人)</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.passengerCount" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('passengerCount','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item_rate" v-if="item.passengerCountMom || item.passengerCountYoy" :class="item.passengerCountMom == 0 ? 'danger' : '' ">
<view class="rate_item">
<view class="rate_item_label" :style="item.passengerCountMom == 0 ? 'color: #EB4747' : ''">人数环比(%)</view>
<view class="rate_item_input" :style="item.passengerCountMom == 0 ? 'color: #EB4747' : ''">
{{item.passengerCountMom === 0 ? item.passengerCountMom : item.passengerCountMom ? item.passengerCountMom.toFixed(2) : ''}}
</view>
</view>
<view class="line"></view>
<view class="rate_item">
<view class="rate_item_label">人数同比(%)</view>
<view class="rate_item_input">
{{item.passengerCountYoy === 0 ? item.passengerCountYoy : item.passengerCountYoy ? item.passengerCountYoy.toFixed(2) : ''}}
</view>
</view>
</view>
<view class="form_item">
<view class="form_item_label">昨日投入车辆</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.yestVehicleInput" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('yestVehicleInput','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item">
<view class="form_item_label">昨日运行班次</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.yestOperatingShifts" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('yestOperatingShifts','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item">
<view class="form_item_label">昨日人数</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.yestPassengerCount" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('yestPassengerCount','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item">
<view class="form_item_label">去年投入车辆</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.lyVehicleInput" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('lyVehicleInput','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item">
<view class="form_item_label">去年运行班次</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.lyOperatingShifts" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('lyOperatingShifts','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="form_item">
<view class="form_item_label">去年人数</view>
<view class="form_item_input form_input">
<uni-easyinput type="digit" v-model="item.lyPassengerCount" placeholderStyle="color: #D4D4D4;font-size:28rpx;"
placeholder="请输入" @blur="checkNumber('lyPassengerCount','bizBusDataDetailVOList',index)"></uni-easyinput>
</view>
</view>
<view class="line"></view>
</view>
<view class="add_btn" @click="addRow()">增行</view>
</view>
<view class="foot_btn">
<view class="act_btn" @click="doCancel">取消</view>
<view class="act_btn blue" @click="doSubmit">确认</view>
</view>
</view>
</template>
<script>
import { getDateStr } from '../../../common/util'
export default {
data() {
return {
timeArray:[],
pageType:'',
form:{
reportDate:'',
bizBusDataDetailVOList:[
{
busUnit:'',
busIndex:'',
vehicleInput:'',
vehicleInputMom:0,
vehicleInputYoy:0,
operatingShiftsMom:0,
operatingShiftsYoy:0,
passengerCount:'',
passengerCountMom:0,
passengerCountYoy:0,
yestVehicleInput:'',
yestOperatingShifts:'',
yestPassengerCount:'',
lyVehicleInput:'',
lyOperatingShifts:'',
lyPassengerCount:''
}
],
bizBusDataBodySaveOrUpdateDTOList:[]
},
index:'',
timeName:'',
busArray:[],
yoyMom:{},
}
},
onLoad(options) {
console.log(options)
this.getRoadTime();
// this.getBusData();
this.getPermiss()
if(options.type == 'add'){
this.pageType = 'add';
let now = new Date();
this.form.reportDate = getDateStr(now,0)
}else if(options.type == 'edit'){
this.pageType == 'edit';
this.form = JSON.parse(options.item)
}
},
methods: {
//
getPermiss(){
this.$request(getApp().globalData.baseUrl + '/api/biz/bizBusAuthority/findList',{},"GET").then(res =>{
console.log('数据权限==>',res)
this.busArray = res.data
})
},
//
getRoadTime(){
this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=' + Date.parse(new Date()),"GET").then(res =>{
this.timeArray = res.data;
if(this.pageType == 'edit'){
this.index = this.timeArray.findIndex(item => item.dictValue == this.form.statPeriod)
this.timeName = this.timeArray.find(item => item.dictValue == this.form.statPeriod).dictLabel
}else if(this.pageType == 'add'){
let now = new Date();
let dateStr = getDateStr(now,0);
if(new Date(dateStr + ' 11:00').getTime() < new Date().getTime() && new Date().getTime() < new Date(dateStr + ' 13:30').getTime()) {
this.form.statPeriod = "0012";
this.index = this.timeArray.findIndex(item => item.dictValue == "0012")
this.timeName = this.timeArray.find(item => item.dictValue == "0012").dictLabel
}else{
this.form.statPeriod = "03";
this.index = this.timeArray.findIndex(item => item.dictValue == "03")
this.timeName = this.timeArray.find(item => item.dictValue == "03").dictLabel
}
}
})
},
//
getYoyMom(item,index){
let params = {
busUnit:item.busUnit,
statDate:this.form.reportDate
}
// console.log(params)
this.$request(getApp().globalData.baseUrl + '/api/biz/busdata/getYoyMom', params,"GET").then(res =>{
console.log('同比环比数据===>',res)
this.yoyMom = res.data;
this.checkYoyMom(index)
})
},
//
doSubmit(){
this.form.bizBusDataBodySaveOrUpdateDTOList = this.form.bizBusDataDetailVOList
console.log(this.form)
let params = this.form;
if(!this.form.reportDate){
uni.showToast({
title:"请选择统计日期",
icon:"none"
})
}else if(!this.form.statPeriod){
uni.showToast({
title:"请选择统计时段",
icon:"none"
})
}else{
uni.showModal({
title:'提示',
content:"确认保存当前报送数据吗?",
success: (res) => {
if(res.confirm){
uni.showLoading({
title: '提交中...',
mask: true
})
this.$request(getApp().globalData.baseUrl + '/api/biz/busdata/saveOrUpdate',params,"POST").then(res =>{
console.log(res)
if(res.code == 200){
uni.hideLoading();
uni.showToast({
title: '报送提交成功',
icon: 'none',
success: () => {
if(!this.form.id) {
uni.redirectTo({
url:"/pages/bus/busDataInfo/list"
})
}
else {
uni.navigateBack();
}
}
})
}
})
}
}
})
}
},
//
checkYoyMom(index){
//
if(this.yoyMom.yesterdayData){
// this.form.bizBusDataDetailVOList[index].operatingShiftsMom = this.form.bizBusDataDetailVOList[index].operatingShifts && this.yoyMom.yesterdayData.operatingShifts ?
// (this.form.bizBusDataDetailVOList[index].operatingShifts - this.yoyMom.yesterdayData.operatingShifts) / this.yoyMom.yesterdayData.operatingShifts * 100 : '';
this.form.bizBusDataDetailVOList[index].operatingShiftsMom = !checkNotEmpty(this.yoyMom.yesterdayData.operatingShifts) || this.yoyMom.yesterdayData.operatingShifts === 0 ? 100 : this.form.bizBusDataDetailVOList[index].operatingShifts ? (parseInt(this
.form.bizBusDataDetailVOList[index].operatingShifts) - this.yoyMom.yesterdayData.operatingShifts) / this.yoyMom.yesterdayData.operatingShifts *
100 : '';
// this.form.bizBusDataDetailVOList[index].passengerCountMom = this.form.bizBusDataDetailVOList[index].passengerCount && this.yoyMom.yesterdayData.passengerCount ?
// (this.form.bizBusDataDetailVOList[index].passengerCount - this.yoyMom.yesterdayData.passengerCount) / this.yoyMom.yesterdayData.passengerCount * 100 : '';
this.form.bizBusDataDetailVOList[index].passengerCountMom = !checkNotEmpty(this.yoyMom.yesterdayData.passengerCount) || this.yoyMom.yesterdayData.passengerCount === 0 ? 100 : this.form.bizBusDataDetailVOList[index].passengerCount ? (parseInt(this
.form.bizBusDataDetailVOList[index].passengerCount) - this.yoyMom.yesterdayData.passengerCount) / this.yoyMom.yesterdayData.passengerCount *
100 : '';
// this.form.bizBusDataDetailVOList[index].vehicleInputMom = this.form.bizBusDataDetailVOList[index].vehicleInput && this.yoyMom.yesterdayData.vehicleInput ?
// (this.form.bizBusDataDetailVOList[index].vehicleInput - this.yoyMom.yesterdayData.vehicleInput) / this.yoyMom.yesterdayData.vehicleInput * 100 : '';
this.form.bizBusDataDetailVOList[index].vehicleInputMom = !checkNotEmpty(this.yoyMom.yesterdayData.vehicleInput) || this.yoyMom.yesterdayData.vehicleInput === 0 ? 100 : this.form.bizBusDataDetailVOList[index].vehicleInput ? (parseInt(this
.form.bizBusDataDetailVOList[index].vehicleInput) - this.yoyMom.yesterdayData.vehicleInput) / this.yoyMom.yesterdayData.vehicleInput *
100 : '';
}
//
if(this.yoyMom.lastYearData){
// this.form.bizBusDataDetailVOList[index].operatingShiftsYoy = this.form.bizBusDataDetailVOList[index].operatingShifts && this.yoyMom.lastYearData.operatingShifts ?
// (this.form.bizBusDataDetailVOList[index].operatingShifts - this.yoyMom.lastYearData.operatingShifts) / this.yoyMom.lastYearData.operatingShifts * 100 : '';
this.form.bizBusDataDetailVOList[index].operatingShiftsYoy = !checkNotEmpty(this.yoyMom.lastYearData.operatingShifts) || this.yoyMom.lastYearData.operatingShifts === 0 ? 100 : this.form.bizBusDataDetailVOList[index].operatingShifts ? (parseInt(this
.form.bizBusDataDetailVOList[index].operatingShifts) - this.yoyMom.lastYearData.operatingShifts) / this.yoyMom.lastYearData.operatingShifts *
100 : '';
// this.form.bizBusDataDetailVOList[index].passengerCountYoy = this.form.bizBusDataDetailVOList[index].passengerCount && this.yoyMom.lastYearData.passengerCount ?
// (this.form.bizBusDataDetailVOList[index].passengerCount - this.yoyMom.lastYearData.passengerCount) / this.yoyMom.lastYearData.passengerCount * 100 : '';
this.form.bizBusDataDetailVOList[index].passengerCountYoy = !checkNotEmpty(this.yoyMom.lastYearData.passengerCount) || this.yoyMom.lastYearData.passengerCount === 0 ? 100 : this.form.bizBusDataDetailVOList[index].passengerCount ? (parseInt(this
.form.bizBusDataDetailVOList[index].passengerCount) - this.yoyMom.lastYearData.passengerCount) / this.yoyMom.lastYearData.passengerCount *
100 : '';
// this.form.bizBusDataDetailVOList[index].vehicleInputYoy = this.form.bizBusDataDetailVOList[index].vehicleInput && this.yoyMom.lastYearData.vehicleInput ?
// (this.form.bizBusDataDetailVOList[index].vehicleInput - this.yoyMom.lastYearData.vehicleInput) / this.yoyMom.lastYearData.vehicleInput * 100 : '';
this.form.bizBusDataDetailVOList[index].vehicleInputYoy = !checkNotEmpty(this.yoyMom.lastYearData.vehicleInput) || this.yoyMom.lastYearData.vehicleInput === 0 ? 100 : this.form.bizBusDataDetailVOList[index].vehicleInput ? (parseInt(this
.form.bizBusDataDetailVOList[index].vehicleInput) - this.yoyMom.lastYearData.vehicleInput) / this.yoyMom.lastYearData.vehicleInput *
100 : '';
}
},
//
// getBusData(){
// this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=bus_unit&_t=' + Date.parse(new Date()),{},"GET").then(res =>{
// this.busArray = res.data
// })
// },
//
bindDateChange(e) {
this.form.reportDate = e.detail.value;
},
//
bindtimeChange(e){
let index = e.target.value;
var selected = this.timeArray[index];
this.form.statPeriod = selected.dictValue;
this.timeName = selected.dictLabel
},
//
changeBusway(e,key,index){
this.form[key][index].busIndex = e.detail.value;
this.form[key][index].busUnit = this.busArray[e.detail.value].stationId;
this.getYoyMom(this.form[key][index],index)
},
//
checkNumber(val,key,index){ //
if(this.form[key][index][val]){
if(val == 'operatingShifts' || val == 'passengerCount' || val == 'vehicleInput'){
console.log(this.form[key][index])
this.getYoyMom(this.form[key][index])
}
this.form[key][index][val] = this.form[key][index][val].replace(/[^\d.]/g,""); //.
this.form[key][index][val] = this.form[key][index][val].replace(/^\./g,""); //.
this.form[key][index][val] = this.form[key][index][val].replace(/\.{2,}/g,"."); //..
this.form[key][index][val] = this.form[key][index][val].replace(".","$#$").replace(/\./g,"").replace("$#$","."); //.
}
},
//
addRow(){
this.form.bizBusDataDetailVOList.push(
{
busUnit:'',
busIndex:'',
vehicleInput:'',
vehicleInputMom:0,
vehicleInputYoy:0,
operatingShiftsMom:0,
operatingShiftsYoy:0,
passengerCount:'',
passengerCountMom:0,
passengerCountYoy:0,
yestVehicleInput:'',
yestOperatingShifts:'',
yestPassengerCount:'',
lyVehicleInput:'',
lyOperatingShifts:'',
lyPassengerCount:''
}
)
},
//
delRow(index){
this.form.bizBusDataDetailVOList.splice(index, 1);
},
}
}
</script>
@ -63,6 +447,10 @@
background-color: #fff;
border-radius: 30rpx;
&.bottom{
margin-top: 30rpx;
}
//
.form_item_rate{
background: #F6F6F6;
@ -173,6 +561,57 @@
}
}
}
}
}
//
.line {
height: 1px;
background-color: #E1E1E1;
}
.add_btn {
height: 90rpx;
line-height: 90rpx;
color: #2D8CF0;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
text-align: center;
background: #ECF5FF;
border-radius: 30rpx;
border: 2rpx solid #2D8CF0;
margin-top: 30rpx;
}
.foot_btn {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: space-between;
padding: 40rpx 30rpx;
background-color: #f5f5f5;
z-index: 11;
.act_btn {
width: 329rpx;
height: 90rpx;
color: #666666;
font-size: 28rpx;
line-height: 90rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
text-align: center;
background: #F6F6F6;
border-radius: 100rpx;
border: 1rpx solid #C1C1C1;
&.blue {
color: #fff;
background: #2D8CF0;
border-color: #2D8CF0;
}
}
}
</style>

@ -137,7 +137,7 @@
//
editItem(row){
uni.navigateTo({
url:"/pages/bus/busDataInfo/form?pageFrom=edit&item=" + JSON.stringify(row)
url:"/pages/bus/busDataInfo/form?type=edit&item=" + JSON.stringify(row)
})
},
}

@ -69,7 +69,7 @@
</template>
<script>
import { getDateStr } from '../../../common/util'
import { checkNotEmpty, getDateStr } from '../../../common/util'
export default {
data() {
return {
@ -121,17 +121,35 @@
console.log('计算同比环比')
//
if(this.yoymom.yesterdayData){
this.synthData.shiftMom = this.yoymom.yesterdayData.shifts && this.synthData.shifts ? (
parseInt(this.synthData.shifts) - this.yoymom.yesterdayData.shifts) / this.yoymom.yesterdayData.shifts * 100 : '';
this.synthData.peopleMom = this.yoymom.yesterdayData.people && this.synthData.people ? (
this.synthData.people - this.yoymom.yesterdayData.people) / this.yoymom.yesterdayData.people * 100 : ''
// this.synthData.shiftMom = this.yoymom.yesterdayData.shifts && this.synthData.shifts ? (
// parseInt(this.synthData.shifts) - this.yoymom.yesterdayData.shifts) / this.yoymom.yesterdayData.shifts * 100 : '';
this.synthData.shiftMom = !checkNotEmpty(this.yoymom.yesterdayData.shifts) || this.yoymom.yesterdayData.shifts === 0 ? 100 : this.synthData.shifts ? (parseInt(this
.synthData.shifts) - this.yoymom.yesterdayData.shifts) / this.yoymom.yesterdayData.shifts *
100 : '';
// this.synthData.peopleMom = this.yoymom.yesterdayData.people && this.synthData.people ? (
// this.synthData.people - this.yoymom.yesterdayData.people) / this.yoymom.yesterdayData.people * 100 : ''
this.synthData.peopleMom = !checkNotEmpty(this.yoymom.yesterdayData.people) || this.yoymom.yesterdayData.people === 0 ? 100 : this.synthData.people ? (parseInt(this
.synthData.people) - this.yoymom.yesterdayData.people) / this.yoymom.yesterdayData.people *
100 : '';
}
//
if(this.yoymom.lastYearData){
this.synthData.shiftYoy = this.yoymom.lastYearData.shifts && this.synthData.shifts ? (
parseInt(this.synthData.shifts) - this.yoymom.lastYearData.shifts) / this.yoymom.lastYearData.shifts * 100 : '';
this.synthData.peopleYoy = this.yoymom.lastYearData.people && this.synthData.people ? (
this.synthData.people - this.yoymom.lastYearData.people) / this.yoymom.lastYearData.people * 100 : ''
// this.synthData.shiftYoy = this.yoymom.lastYearData.shifts && this.synthData.shifts ? (
// parseInt(this.synthData.shifts) - this.yoymom.lastYearData.shifts) / this.yoymom.lastYearData.shifts * 100 : '';
this.synthData.shiftYoy = !checkNotEmpty(this.yoymom.lastYearData.shifts) || this.yoymom.lastYearData.shifts === 0 ? 100 : this.synthData.shifts ? (parseInt(this
.synthData.shifts) - this.yoymom.lastYearData.shifts) / this.yoymom.lastYearData.shifts *
100 : '';
// this.synthData.peopleYoy = this.yoymom.lastYearData.people && this.synthData.people ? (
// this.synthData.people - this.yoymom.lastYearData.people) / this.yoymom.lastYearData.people * 100 : ''
this.synthData.peopleYoy = !checkNotEmpty(this.yoymom.lastYearData.people) || this.yoymom.lastYearData.people === 0 ? 100 : this.synthData.people ? (parseInt(this
.synthData.people) - this.yoymom.lastYearData.people) / this.yoymom.lastYearData.people *
100 : '';
}
},
//
@ -356,7 +374,7 @@
bottom: 0;
display: flex;
justify-content: space-around;
// background-color: #F8F8F8;
background-color: #F8F8F8;
padding: 0rpx 0rpx 20px;
.btn_item{

@ -95,7 +95,7 @@
<view class="edit_item input">
<p class="left">投放运力总客车数</p>
<view class="right">
<uni-easyinput v-model="roadData.capacityTotalBus" placeholder="请输入" placeholderStyle="color:#d4d4d4;"></uni-easyinput>
<uni-easyinput @blur="calcRatio" v-model="roadData.capacityTotalBus" placeholder="请输入" placeholderStyle="color:#d4d4d4;"></uni-easyinput>
</view>
</view>
<view class="edit_item input">
@ -277,7 +277,7 @@
</template>
<script>
import { getDateStr, lastYearDate } from '../../../common/util'
import { checkNotEmpty, getDateStr, lastYearDate } from '../../../common/util'
export default {
data() {
return {
@ -329,7 +329,8 @@ import { getDateStr, lastYearDate } from '../../../common/util'
remarks:'', //
},
lastyearDay:'',
beforeDay:''
beforeDay:'',
lastData:{}
}
},
onLoad(options){
@ -352,7 +353,7 @@ import { getDateStr, lastYearDate } from '../../../common/util'
let now = new Date();
this.roadData.statisticalDate = getDateStr(now, -1);//
this.getRatio()
// console.log('lastyear ===>',lastYearDate(this.roadData.statisticalDate))
console.log('lastyear ===>',lastYearDate(this.roadData.statisticalDate))
}
},
@ -365,8 +366,10 @@ import { getDateStr, lastYearDate } from '../../../common/util'
})
},
getRatio(){
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/findByStatisticalDate/' + this.roadData.statisticalDate,{},"GET").then(res =>{
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/findByStatisticalDate/' + lastYearDate(this.roadData.statisticalDate),{},"GET").then(res =>{
console.log('比例数据===>',res)
this.lastData = res.data;
this.calcRatio()
})
},
//
@ -457,8 +460,14 @@ import { getDateStr, lastYearDate } from '../../../common/util'
},
//
calcRatio(){
//
// this.roadData.
// (%)
this.roadData.passengerVolumeRatio = !checkNotEmpty(this.lastData.otherPassengerVolume) || this.lastData.otherPassengerVolume === 0 ? 100 : this.roadData.otherPassengerVolume ? (parseInt(this
.roadData.otherPassengerVolume) - this.lastData.otherPassengerVolume) / this.lastData.otherPassengerVolume *
100 : '';
//
this.roadData.totalBusIncreaseRatio = !checkNotEmpty(this.lastData.otherCharter) || this.lastData.otherCharter === 0 ? 100 : this.roadData.otherCharter ? (parseInt(this
.roadData.otherCharter) - this.lastData.otherCharter) / this.lastData.otherCharter *
100 : '';
},
//
getPersonData(){

Loading…
Cancel
Save