You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
586 lines
16 KiB
586 lines
16 KiB
<template> |
|
<view class="form_warp"> |
|
<view class="form_intro"> |
|
<view>如有填报问题,请咨询公共服务中心</view> |
|
<view>中心值班电话:<text class="tel">66007587</text></view> |
|
</view> |
|
<view class="form_item_box"> |
|
<view class="form_item_title">基本信息</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">管理单位名称:</view> |
|
<view class="form_item_input select"> |
|
{{form.affiliatedUnit}} |
|
</view> |
|
</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">统计日期:</view> |
|
<view class="form_item_input picker"> |
|
<picker mode="date" :value="form.statDate" @change="bindDateChange"> |
|
<text class="picker_select" |
|
:style="form.statDate?'color:#333;':''">{{form.statDate?form.statDate:'请选择'}}</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 picker"> |
|
<picker :value="index" :range="array" range-key="dictLabel" @change="changeStatPeriod"> |
|
<text class="picker_select" |
|
:style="index>-1?'color:#333;':''">{{index>-1?array[index].dictLabel:'请选择'}}</text> |
|
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons> |
|
</picker> |
|
</view> |
|
</view> |
|
</view> |
|
<view class="form_item_box" style="margin-top: 30rpx;"> |
|
<view class="form_item_li"> |
|
<view class="form_item"> |
|
<view class="form_item_label">航次:</view> |
|
<view class="form_item_input form_input"> |
|
<uni-easyinput @blur="calcYoyMom" v-model="form.inboundWatertransportDo" type="number" |
|
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> |
|
</uni-easyinput> |
|
</view> |
|
</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">去年航次:</view> |
|
<view class="form_item_input form_input"> |
|
<uni-easyinput @blur="calcYoyMom" v-model="form.lastPassengersDo" type="number" |
|
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> |
|
</uni-easyinput> |
|
</view> |
|
</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">客运量:</view> |
|
<view class="form_item_input form_input"> |
|
<uni-easyinput @blur="calcYoyMom" v-model="form.outboundWatertransportDo" type="number" |
|
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> |
|
</uni-easyinput> |
|
</view> |
|
</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">去年客运量:</view> |
|
<view class="form_item_input form_input"> |
|
<uni-easyinput @blur="calcYoyMom" v-model="form.lastWatertransportDo" type="number" |
|
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> |
|
</uni-easyinput> |
|
</view> |
|
</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">船舶数:</view> |
|
<view class="form_item_input form_input"> |
|
<uni-easyinput v-model="form.inboundWatertransportIn" type="number" |
|
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> |
|
</uni-easyinput> |
|
</view> |
|
</view> |
|
<view class="form_item"> |
|
<view class="form_item_label">客位数:</view> |
|
<view class="form_item_input form_input"> |
|
<uni-easyinput v-model="form.watertransportPassengersDo" type="number" |
|
placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入" maxlength="20"> |
|
</uni-easyinput> |
|
</view> |
|
</view> |
|
<!-- 同比 --> |
|
<view class="form_item_rate"> |
|
<view class="rate_item"> |
|
<view class="rate_item_label"> |
|
客运量同比(%)</view> |
|
<view class="rate_item_input"> |
|
{{form.passengerWatertransportMomDo === 0 ? form.passengerWatertransportMomDo : form.passengerWatertransportMomDo ? form.passengerWatertransportMomDo.toFixed(2) : ''}} |
|
</view> |
|
</view> |
|
<view class="line"></view> |
|
<view class="rate_item"> |
|
<view class="rate_item_label">航次同比(%)</view> |
|
<view class="rate_item_input"> |
|
{{form.voyageWatertransportMomDo === 0 ? form.voyageWatertransportMomDo : form.voyageWatertransportMomDo ? form.voyageWatertransportMomDo.toFixed(2) : ''}} |
|
</view> |
|
</view> |
|
</view> |
|
</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, |
|
checkNotEmpty |
|
} from "../../../common/util.js" |
|
export default { |
|
data() { |
|
return { |
|
form: { |
|
"affiliatedUnit" : "", |
|
"inboundWatertransportDo" : 0, |
|
"inboundWatertransportIn" : 0, |
|
"isHoliday" : "", |
|
"lastPassengersDo" : 0, |
|
"lastWatertransportDo" : 0, |
|
"outboundWatertransportDo" : 0, |
|
"passengerWatertransportMomDo" : 0.0, |
|
"statDate" : "", |
|
"statPeriod" : "", |
|
"voyageWatertransportMomDo" : 0.0, |
|
"watertransportPassengersDo" : 0 |
|
}, //登录form |
|
array: [], //时段选择列表 |
|
index: 2, //时段选择,默认0-24 |
|
userInfo: {}, |
|
pageType: '' |
|
} |
|
}, |
|
onLoad(options) { |
|
this.userInfo = uni.getStorageSync('userInfo'); |
|
if (options.type == 'add') { |
|
this.pageType = 'add'; |
|
let now = new Date(); |
|
this.form.affiliatedUnit = this.userInfo.organizationName ? this.userInfo.organizationName : ''; |
|
this.form.statDate = getDateStr(now, -1); //默认前一天 |
|
this.queryTime(); //统计时段 |
|
} else if (options.id) { |
|
this.$request(getApp().globalData.baseUrl + '/api/biz/watertransportRunData/find/' + options.id, {}, "GET").then( |
|
res => { |
|
this.form = res.data; |
|
this.queryTime(); //统计时段 |
|
}); |
|
} |
|
}, |
|
methods: { |
|
//环比同比 |
|
queryYoyMom() { |
|
if (this.form.statDate == '' || this.form.statPeriod == '') { |
|
return; |
|
} |
|
this.$request(getApp().globalData.baseUrl + '/api/biz/watertransportRunData/getYoYMoM?statDate=' + this.form |
|
.statDate + '&statPeriod=' + this.form.statPeriod + '&_t=' + Date.parse(new Date()), {}, 'GET') |
|
.then(res => { |
|
this.yoyMom = res.data; |
|
this.calcYoyMom(); //同步更新同比 |
|
}) |
|
}, |
|
//环比同比计算 |
|
calcYoyMom() { |
|
console.log('同比计算') |
|
if (this.yoyMom.lastYearData) { |
|
//同比 |
|
this.form.passengerWatertransportMomDo = this.yoyMom.lastYearData.passengerWatertransportMomDo && this.form.passengerWatertransportMomDo ? ( |
|
parseInt(this.form.passengerWatertransportMomDo) - this.yoyMom.lastYearData.passengerWatertransportMomDo) / this.yoyMom |
|
.lastYearData.passengerWatertransportMomDo * 100 : ''; |
|
this.form.voyageWatertransportMomDo = this.yoyMom.lastYearData.voyageWatertransportMomDo && this.form.voyageWatertransportMomDo ? (parseInt(this.form |
|
.voyageWatertransportMomDo) - this.yoyMom.lastYearData.voyageWatertransportMomDo) / this.yoyMom.lastYearData.voyageWatertransportMomDo * 100 : ''; |
|
} |
|
}, |
|
//统计时段切换选择 |
|
changeStatPeriod(e) { |
|
this.index = e.detail.value; |
|
this.form.statPeriod = this.array[e.detail.value].dictValue; |
|
console.log('change 时段', this.form); |
|
this.queryYoyMom(); |
|
}, |
|
//取消 |
|
doCancel() { |
|
uni.navigateBack(); |
|
}, |
|
//选择统计日期 |
|
bindDateChange(e) { |
|
this.form.statDate = e.detail.value; |
|
this.queryYoyMom(); |
|
}, |
|
//时段 |
|
queryTime() { |
|
this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time' + '&_t=' + Date |
|
.parse( |
|
new Date()), {}, 'GET').then(res => { |
|
this.array = res.data; |
|
if (this.pageType == 'add') { |
|
let now = new Date(); |
|
//11:00-13:30 默认选择0-12 |
|
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.array.findIndex(item => item.dictValue == '0012'); |
|
} else { |
|
this.form.statPeriod = '03'; //默认0-24 |
|
this.index = this.array.findIndex(item => item.dictValue == '03'); |
|
} |
|
}else{ |
|
this.index = this.array.findIndex(item => item.dictValue == this.form.statPeriod); |
|
} |
|
this.queryYoyMom(); |
|
}) |
|
}, |
|
//确认提交 |
|
doSubmit() { |
|
if (!checkNotEmpty(this.form.railwayName)) { |
|
uni.showToast({ |
|
title: '车站名称不能为空', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
if (!checkNotEmpty(this.form.statDate) || !checkNotEmpty(this.form.statPeriod)) { |
|
uni.showToast({ |
|
title: '报送日期和时段不能为空', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
if (!checkNotEmpty(this.form.inboundRailwayDo) || !checkNotEmpty(this.form.inboundPassengersDo) || ! |
|
checkNotEmpty(this.form.inPepole)) { |
|
uni.showToast({ |
|
title: '入青终到车次、过站车次、人数不能为空', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
if (!checkNotEmpty(this.form.outboundRailwayDo) || !checkNotEmpty(this.form.outboundPassengersDo) || ! |
|
checkNotEmpty(this.form.outPepole)) { |
|
uni.showToast({ |
|
title: '出青终到车次、过站车次、人数不能为空', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
if (this.form.inPepole == this.yoyMom.yesterdayData.inPepole && this.form.inMark) { |
|
uni.showToast({ |
|
title: '入青备注不能为空', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
if (this.form.outPepole == this.yoyMom.yesterdayData.outPepole && this.form.outRemark) { |
|
uni.showToast({ |
|
title: '出青备注不能为空', |
|
icon: 'none' |
|
}) |
|
return; |
|
} |
|
uni.showModal({ |
|
title: '提示', |
|
content: '确认保存当前报送数据吗?', |
|
success: (res) => { |
|
if (res.confirm) { |
|
this.submitForm(); |
|
} |
|
} |
|
}) |
|
}, |
|
submitForm() { |
|
uni.showLoading({ |
|
title: '提交中...', |
|
mask: true |
|
}) |
|
this.$request(getApp().globalData.baseUrl + '/api/biz/watertransportRunData/saveOrUpdate', this.form, |
|
'POST').then(res => { |
|
uni.hideLoading(); |
|
if (res.code == 200) { |
|
uni.showToast({ |
|
title: '报送提交成功', |
|
icon: 'none', |
|
success: () => { |
|
uni.navigateBack(); |
|
} |
|
}) |
|
} |
|
}).catch(() => { |
|
uni.hideLoading(); |
|
}) |
|
}, |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.form_warp { |
|
padding: 30rpx 30rpx 195rpx; |
|
|
|
.form_intro { |
|
color: #666; |
|
font-size: 26rpx; |
|
font-family: PingFang SC-Bold, PingFang SC; |
|
line-height: 48rpx; |
|
text-align: center; |
|
margin-bottom: 20rpx; |
|
|
|
.tel { |
|
color: #2D8CF0; |
|
font-weight: bold; |
|
} |
|
} |
|
|
|
.form_item_box { |
|
padding: 30rpx 20rpx 30rpx 30rpx; |
|
background-color: #fff; |
|
border-radius: 30rpx; |
|
|
|
//环比同比 |
|
.form_item_rate { |
|
background: #F6F6F6; |
|
border: 1px solid #F6F6F6; |
|
padding: 30rpx; |
|
margin-bottom: 30rpx; |
|
border-radius: 30rpx; |
|
|
|
.line { |
|
height: 1px; |
|
background-color: #dfdfdf; |
|
margin: 30rpx 0; |
|
} |
|
|
|
.rate_item { |
|
display: flex; |
|
justify-content: space-between; |
|
font-size: 24rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
|
|
.rate_item_label { |
|
color: #666; |
|
font-size: 24rpx; |
|
} |
|
|
|
.rate_item_input { |
|
color: #333; |
|
font-size: 28rpx; |
|
} |
|
} |
|
|
|
&.danger { |
|
background-color: #FEF6F3; |
|
border-color: #F0622D; |
|
} |
|
} |
|
|
|
.form_item_title { |
|
color: #333; |
|
line-height: 42rpx; |
|
font-size: 30rpx; |
|
font-family: PingFang SC-Bold, PingFang SC; |
|
font-weight: bold; |
|
margin-bottom: 30rpx; |
|
} |
|
|
|
.form_item_remark { |
|
margin-bottom: 30rpx; |
|
|
|
.form_item_label { |
|
color: #333333; |
|
line-height: 42rpx; |
|
font-size: 30rpx; |
|
font-family: PingFang SC-Bold, PingFang SC; |
|
font-weight: bold; |
|
margin-bottom: 30rpx; |
|
} |
|
} |
|
|
|
.form_item { |
|
display: flex; |
|
align-items: center; |
|
justify-content: space-between; |
|
line-height: 37rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
margin-bottom: 30rpx; |
|
|
|
.form_item_label { |
|
width: 260rpx; |
|
color: #666666; |
|
font-size: 26rpx; |
|
word-break: break-all; |
|
} |
|
|
|
.form_item_input { |
|
color: #333; |
|
text-align: right; |
|
word-break: break-all; |
|
|
|
&.picker { |
|
flex: 1; |
|
// display: flex; |
|
// justify-content: space-between; |
|
|
|
// /deep/ picker { |
|
// flex: 1; |
|
// } |
|
|
|
.picker_select { |
|
color: #D4D4D4; |
|
font-size: 28rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
text-align: right; |
|
} |
|
} |
|
|
|
//纯展示 |
|
&.text { |
|
color: #333333; |
|
line-height: 40rpx; |
|
font-size: 28rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
} |
|
|
|
//输入框 |
|
&.form_input { |
|
/deep/ .is-input-border { |
|
border: 0 !important; |
|
|
|
.uni-easyinput__content-input { |
|
height: 35rpx !important; |
|
text-align: right; |
|
} |
|
} |
|
|
|
/deep/ .uni-date-x--border { |
|
border: 0 !important; |
|
|
|
.uni-date__x-input { |
|
// height: 35rpx !important; |
|
text-align: right; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
//收费站 |
|
.station_box { |
|
display: flex; |
|
flex-wrap: wrap; |
|
margin-top: 40rpx; |
|
|
|
.station_item { |
|
height: 60rpx; |
|
color: #666666; |
|
line-height: 60rpx; |
|
font-size: 26rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
border-radius: 20rpx; |
|
border: 1rpx solid #C1C1C1; |
|
padding: 0 20rpx; |
|
margin-bottom: 40rpx; |
|
margin-right: 20rpx; |
|
|
|
&.active { |
|
position: relative; |
|
color: #1ECE5F; |
|
border-color: #1ECE5F; |
|
background: #EBFAF2; |
|
|
|
.tag { |
|
position: absolute; |
|
top: 0; |
|
right: 0; |
|
width: 34rpx; |
|
height: 23rpx; |
|
background: #1ECE5F; |
|
border-radius: 0rpx 20rpx 0rpx 5rpx; |
|
text-align: center; |
|
} |
|
} |
|
} |
|
} |
|
|
|
.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; |
|
} |
|
} |
|
} |
|
|
|
//增行 |
|
.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; |
|
} |
|
|
|
.tab_box { |
|
display: flex; |
|
justify-content: space-around; |
|
|
|
.tab_nav { |
|
color: #999999; |
|
line-height: 42rpx; |
|
font-size: 30rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
padding-bottom: 25rpx; |
|
|
|
&.active { |
|
position: relative; |
|
color: #2D8CF0; |
|
font-weight: bold; |
|
|
|
&::after { |
|
position: absolute; |
|
content: ''; |
|
left: 50%; |
|
bottom: 0; |
|
width: 74rpx; |
|
height: 6rpx; |
|
background: #2D8CF0; |
|
border-radius: 100rpx; |
|
margin-left: -37rpx; |
|
} |
|
} |
|
} |
|
} |
|
|
|
button { |
|
background-color: #007aff; |
|
color: #ffffff; |
|
} |
|
</style>
|
|
|