From 24e6c485e9451d7389da2544b20adea89a45cccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BE=A4?= Date: Tue, 5 Sep 2023 16:57:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=86=B2=E7=AA=81=E4=BF=AE=E6=AD=A3=EF=BC=8Cbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/highWay/runData/form.vue | 33 +++++----- pages/highWay/runStatusData/form.vue | 94 +++++++++++++++------------ pages/railway/railwayRunData/form.vue | 13 ++-- pages/railway/runStatus/form.vue | 20 +++--- pages/water/TransportData/form.vue | 30 ++++----- 5 files changed, 100 insertions(+), 90 deletions(-) diff --git a/pages/highWay/runData/form.vue b/pages/highWay/runData/form.vue index 97fbdd0..ae14fc5 100644 --- a/pages/highWay/runData/form.vue +++ b/pages/highWay/runData/form.vue @@ -212,22 +212,17 @@ onLoad(options) { this.userInfo = uni.getStorageSync('userInfo'); if (options.type == 'add') { + this.form.organizationName = this.userInfo.organizationName ? this.userInfo.organizationName : ''; this.pageType = 'add'; let now = new Date(); this.form.statDate = getDateStr(now, -1);//默认前一天 this.queryYoYMom(); this.queryStation('add'); - } else if (options.item) { - this.form = JSON.parse(options.item); - console.log('edit', this.form) + this.queryTime();//统计时段 + } if(options.id) { this.queryYoYMom(); - this.queryStation(); - } else if(options.id) { - this.queryYoYMom(); - this.queryStation(); this.queryDetailInfo(options.id); } - this.queryTime();//统计时段 this.queryPerson(); }, methods: { @@ -235,6 +230,8 @@ queryDetailInfo(id) { this.$request(getApp().globalData.baseUrl + '/api/biz/highwayParentDataController/selectById/' + id, {}, 'GET').then(res => { this.form = res.data; + this.queryTime(); + this.queryStation(); }) }, //同比环比查询 @@ -401,13 +398,16 @@ 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'); + let idx = this.array.findIndex(item => item.dictValue == '0012'); + this.index = idx > -1 ? idx : ''; }else{ this.form.statPeriod = '03'; //默认0-24 - this.index = this.array.findIndex(item => item.dictValue == '03'); + let idx = this.array.findIndex(item => item.dictValue == '03'); + this.index = idx > -1 ? idx : ''; } }else{ - this.index = this.array.findIndex(item => item.dictValue == this.form.statPeriod); + let idx = this.array.findIndex(item => item.dictValue == this.form.statPeriod); + this.index = idx > -1 ? idx : ''; } }) }, @@ -579,14 +579,15 @@ &.picker { flex: 1; - display: flex; - justify-content: space-between; + // display: flex; + // justify-content: space-between; - /deep/ picker { - flex: 1; - } + // /deep/ picker { + // flex: 1; + // } .picker_select { + flex: 1; color: #D4D4D4; font-size: 28rpx; font-family: PingFang SC-Regular, PingFang SC; diff --git a/pages/highWay/runStatusData/form.vue b/pages/highWay/runStatusData/form.vue index 704de81..742829d 100644 --- a/pages/highWay/runStatusData/form.vue +++ b/pages/highWay/runStatusData/form.vue @@ -34,7 +34,7 @@ 高速开闭情况: - + {{form.isOpen == 1 ? '开放' : form.isOpen === 0 ? '关闭' : '请选择'}} @@ -111,9 +111,9 @@ 拥堵发生时间: - + {{item.congestionStartTime?item.congestionStartTime:'请选择'}} + :style="item.congestionStartTime?'color:#333;':''">{{item.congestionStartTime?formatdate(item.congestionStartTime):'请选择'}} @@ -121,9 +121,9 @@ 拥堵处理结束时间: - + {{item.congestionEndTime?item.congestionEndTime:'请选择'}} + :style="item.congestionEndTime?'color:#333;':''">{{item.congestionEndTime?formatdate(item.congestionEndTime):'请选择'}} @@ -196,9 +196,9 @@ 事故发生时间: - + {{item.accidentStartTime?item.accidentStartTime:'请选择'}} + :style="item.accidentStartTime?'color:#333;':''">{{item.accidentStartTime?formatdate(item.accidentStartTime):'请选择'}} @@ -206,9 +206,9 @@ 事故处理结束时间: - + {{item.accidentEndTime?item.accidentEndTime:'请选择'}} + :style="item.accidentEndTime?'color:#333;':''">{{item.accidentEndTime?formatdate(item.accidentEndTime):'请选择'}} @@ -232,7 +232,7 @@ 事故等级: + @change="e => changeAccidentLevel(e, 'highwayAccidentDetailDTOS', index)"> {{item.accidentLevelIndex ? accidentLevel[item.accidentLevelIndex].dictLabel : '请选择'}} @@ -343,26 +343,21 @@ onLoad(options) { this.userInfo = uni.getStorageSync('userInfo'); if (options.type == 'add') { - this.pageType = 'add'; + this.pageType = 'add'; + this.form.organizationName = this.userInfo.organizationName ? this.userInfo.organizationName : ''; let now = new Date(); this.form.statDate = getDateStr(now, -1); //默认前一天 this.queryHighway(); //高速公路列表 - this.queryAccidentLevel(); //事故等级 - } else if (options.item) { - this.form = JSON.parse(options.item); - this.form.highwayCongestionDetailDTOS = this.form.highwayCongestionDetailVOS; - this.form.highwayAccidentDetailDTOS = this.form.highwayAccidentDetailVOS; - console.log(this.form) - this.queryAccidentLevel(); //事故等级 - this.queryHighway(); //高速公路列表 + this.queryAccidentLevel(); //事故等级 + this.queryTime(); //统计时段 } else if (options.id) { this.queryDetailInfo(options.id); - this.queryAccidentLevel(); //事故等级 - this.queryHighway(); //高速公路列表 } - this.queryTime(); //统计时段 }, - methods: { + methods: { + formatdate(date) { + return date.length < 12 ? date + '00:00:00' : date; + }, //id查询详情 queryDetailInfo(id) { this.$request(getApp().globalData.baseUrl + '/api/biz/highSpeedOperationController/selectById/' + id, {}, @@ -371,6 +366,8 @@ this.form.highwayCongestionDetailDTOS = this.form.highwayCongestionDetailVOS; this.form.highwayAccidentDetailDTOS = this.form.highwayAccidentDetailVOS; this.queryAccidentLevel(); //事故等级 + this.queryHighway(); //高速公路列表 + this.queryTime(); //统计时段 }) }, //高速公路权限列表 @@ -393,7 +390,8 @@ console.log(this.form) }, //事故等级切换选择 - changeAccidentLevel(e, key, index) { + changeAccidentLevel(e, key, index) { + console.log(key,e.detail.value); this.form[key][index].accidentLevelIndex = e.detail.value; this.form[key][index].accidentLevel = this.accidentLevel[e.detail.value].dictValue; }, @@ -507,23 +505,29 @@ icon: 'none' }) return; - } - let checkCongestion = this.form.highwayCongestionDetailDTOS.every(item => { - return !item.highwayName || !item.congestionStartTime || !item.congestionEndTime || !item - .duration || !item.location - }) - let checkAccident = this.form.highwayAccidentDetailDTOS.every(item => { - return !item.highwayName || !item.accidentStartTime || !item.accidentEndTime || !item - .duration || !item.location - }) - if (this.form.highwayCongestionDetailDTOS.length > 0 && checkCongestion) { + } + let checkCongestion = true; + if(this.form.highwayCongestionDetailDTOS.length > 0){ + checkCongestion = this.form.highwayCongestionDetailDTOS.every(item => { + return item.highwayName && item.congestionStartTime && item.congestionEndTime && item + .duration && item.location + }) + } + let checkAccident = true; + if(this.form.highwayAccidentDetailDTOS.length > 0) { + checkAccident = this.form.highwayAccidentDetailDTOS.every(item => { + return item.highwayName && item.accidentStartTime && item.accidentEndTime && item + .duration && item.location && item.accidentLevel + }) + } + if (!checkCongestion) { uni.showToast({ title: '拥堵信息详情不能为空', icon: 'none' }) return; } - if (this.form.highwayAccidentDetailDTOS.length > 0 && checkAccident) { + if (!checkAccident) { uni.showToast({ title: '事故信息详情不能为空', icon: 'none' @@ -540,7 +544,15 @@ } }) }, - submitForm() { + submitForm() { + this.form.highwayAccidentDetailDTOS.map(item => { + item.accidentStartTime = this.formatdate(item.accidentStartTime); + item.accidentEndTime = this.formatdate(item.accidentEndTime); + }) + this.form.highwayCongestionDetailDTOS.map(item => { + item.congestionStartTime = this.formatdate(item.congestionStartTime); + item.congestionEndTime = this.formatdate(item.congestionEndTime); + }) uni.showLoading({ title: '提交中...', mask: true @@ -672,12 +684,12 @@ &.picker { flex: 1; - display: flex; - justify-content: space-between; + // display: flex; + // justify-content: space-between; - /deep/ picker { - flex: 1; - } + // /deep/ picker { + // flex: 1; + // } .picker_select { color: #D4D4D4; diff --git a/pages/railway/railwayRunData/form.vue b/pages/railway/railwayRunData/form.vue index 9811cb3..95e6629 100644 --- a/pages/railway/railwayRunData/form.vue +++ b/pages/railway/railwayRunData/form.vue @@ -252,14 +252,15 @@ let now = new Date(); this.form.statDate = getDateStr(now, -1); //默认前一天 this.queryYoyMom(); //同比环比 + this.queryTime(); //统计时段 } else if (options.id) { this.$request(getApp().globalData.baseUrl + '/api/biz/railwayRunData/find/' + options.id, {}, "GET").then( res => { this.form = res.data; this.queryYoyMom(); + this.queryTime(); //统计时段 }); } - this.queryTime(); //统计时段 }, methods: { //环比同比 @@ -550,12 +551,12 @@ &.picker { flex: 1; - display: flex; - justify-content: space-between; + // display: flex; + // justify-content: space-between; - /deep/ picker { - flex: 1; - } + // /deep/ picker { + // flex: 1; + // } .picker_select { color: #D4D4D4; diff --git a/pages/railway/runStatus/form.vue b/pages/railway/runStatus/form.vue index 1f1d297..08d75db 100644 --- a/pages/railway/runStatus/form.vue +++ b/pages/railway/runStatus/form.vue @@ -98,16 +98,14 @@ this.pageType = 'add'; let now = new Date(); this.form.statDate = getDateStr(now, -1); //默认前一天 - } else if (options.item) { - this.form = JSON.parse(options.item); - console.log(this.form); - }else if (options.id) { + this.queryTime(); //统计时段 + } if (options.id) { this.$request(getApp().globalData.baseUrl+'/api/biz/railwayRunSituation/find//'+options.id,{},"GET").then(res => { this.form = res.data; - this.queryYoyMom(); + this.queryYoyMom(); + this.queryTime(); //统计时段 }); } - this.queryTime(); //统计时段 }, methods: { //增行 @@ -346,12 +344,12 @@ &.picker { flex: 1; - display: flex; - justify-content: space-between; + // display: flex; + // justify-content: space-between; - /deep/ picker { - flex: 1; - } + // /deep/ picker { + // flex: 1; + // } .picker_select { color: #D4D4D4; diff --git a/pages/water/TransportData/form.vue b/pages/water/TransportData/form.vue index 6e025f5..54cf7f0 100644 --- a/pages/water/TransportData/form.vue +++ b/pages/water/TransportData/form.vue @@ -6,15 +6,11 @@ 基本信息 - - 车站名称: - - - {{form.railwayName?form.railwayName:'请选择'}} - - - + + 管理单位名称: + + {{form.affiliatedUnit}} + 统计日期: @@ -146,17 +142,19 @@ this.userInfo = uni.getStorageSync('userInfo'); if (options.type == 'add') { this.pageType = 'add'; - let now = new Date(); + let now = new Date(); + this.form.affiliatedUnit = this.userInfo.organizationName ? this.userInfo.organizationName : ''; this.form.statDate = getDateStr(now, -1); //默认前一天 this.queryYoyMom(); //同比环比 + 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.queryYoyMom(); + this.queryTime(); //统计时段 }); } - this.queryTime(); //统计时段 }, methods: { //环比同比 @@ -426,12 +424,12 @@ &.picker { flex: 1; - display: flex; - justify-content: space-between; + // display: flex; + // justify-content: space-between; - /deep/ picker { - flex: 1; - } + // /deep/ picker { + // flex: 1; + // } .picker_select { color: #D4D4D4;