From e4c0f9a8ee0dc3ddf1ba415b2329a0b9a4eee032 Mon Sep 17 00:00:00 2001 From: jinna Date: Tue, 5 Sep 2023 16:54:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=AF=E6=AF=94?= =?UTF-8?q?=E5=90=8C=E6=AF=94=E8=AE=A1=E7=AE=97=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=A1=AB=E6=8A=A5=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/roadTransport/dataSubmission/form.vue | 45 +++++++++----- pages/roadTransport/dataSubmission/list.vue | 2 +- pages/roadTransport/quantitySent/form.vue | 67 +++++++++++++++------ pages/roadTransport/quantitySent/list.vue | 2 +- pages/roadTransport/transportData/form.vue | 53 ++++++++++------ pages/roadTransport/transportData/list.vue | 2 +- 6 files changed, 115 insertions(+), 56 deletions(-) diff --git a/pages/roadTransport/dataSubmission/form.vue b/pages/roadTransport/dataSubmission/form.vue index 0a1c71e..46e62ef 100644 --- a/pages/roadTransport/dataSubmission/form.vue +++ b/pages/roadTransport/dataSubmission/form.vue @@ -18,10 +18,15 @@

统计日期

- + + + {{synthData.reportDatetime?synthData.reportDatetime:'请选择'}} + +
@@ -69,36 +74,44 @@ }, isShowTitle:false, timeName:'', - pageType:'' + pageType:'', + index:'' } }, onLoad(options) { - this.getRoadTime() - if(options.pageFrom == 'edit'){ + this.getRoadTime(); + if(options.type == 'edit'){ this.pageType = 'edit' let row = JSON.parse(options.item); - console.log(row) - this.synthData = row; - this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : '' - }else if(options.pageFrom == 'add'){ - this.pageType = 'add' + // this.synthData = row; + this.getDetail(row.id); + // this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : '' }else if(options.type == 'add'){ this.pageType = 'add' + let now = new Date(); + this.synthData.reportDatetime = getDateStr(now, -1);//默认前一天 } }, methods: { + getDetail(id){ + this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/operation/find/' + id,{},"GET").then(res=>{ + // console.log('综合运输详情===>',res) + this.synthData = res.data; + this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : '' + }) + }, + //选择统计日期 + bindDateChange(e) { + this.synthData.reportDatetime = e.detail.value; + }, // 获取时段 getRoadTime(){ this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{ this.roadTime = res.data; if(this.pageType == 'edit'){ - this.roadTime.map((item,index) =>{ - if(item.dictValue == this.synthData.reportPhase){ - this.index = index; - this.timeName = item.dictLabel - } - }) + this.index = this.roadTime.findIndex(item => item.dictValue == this.synthData.reportPhase) + this.timeName = this.roadTime.find(item => item.dictValue == this.synthData.reportPhase).dictLabel }else if(this.pageType == 'add'){ let now = new Date(); let dateStr = getDateStr(now,0); diff --git a/pages/roadTransport/dataSubmission/list.vue b/pages/roadTransport/dataSubmission/list.vue index b151a7a..e938609 100644 --- a/pages/roadTransport/dataSubmission/list.vue +++ b/pages/roadTransport/dataSubmission/list.vue @@ -128,7 +128,7 @@ // 点击编辑按钮 editItem(row){ uni.navigateTo({ - url:"/pages/roadTransport/dataSubmission/form?pageFrom=edit&item=" + JSON.stringify(row) + url:"/pages/roadTransport/dataSubmission/form?type=edit&item=" + JSON.stringify(row) }) }, // 点击查看详情按钮 diff --git a/pages/roadTransport/quantitySent/form.vue b/pages/roadTransport/quantitySent/form.vue index 571c68e..c715e14 100644 --- a/pages/roadTransport/quantitySent/form.vue +++ b/pages/roadTransport/quantitySent/form.vue @@ -12,10 +12,15 @@

填报日期

- + + + {{synthData.reportDate?synthData.reportDate:'请选择'}} + +
@@ -24,7 +29,7 @@

班次

- +
@@ -40,7 +45,7 @@

人数

- +
@@ -76,31 +81,59 @@ reportDate:'', //填报日期 people:'' //人数 }, - pageType:'' + pageType:'', + yoymom:{}, } }, onLoad(options) { // this.getRoadTime() - // this.getDetail() - if(options.pageFrom == 'edit'){ + if(options.type == 'edit'){ this.pageType = 'edit' let row = JSON.parse(options.item); this.synthData = row; - this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : '' - }else if(options.pageFrom == 'add'){ - this.pageType = 'add' + this.getYoYMoM(); + // this.synthData.reportDate = this.synthData.reportDate ? this.synthData.reportDate.substring(0,10) : '' }else if(options.type == 'add'){ this.pageType = 'add' + let now = new Date(); + this.synthData.reportDate = getDateStr(now, -1);//默认前一天 + this.getYoYMoM(); } }, methods: { - getDetail(){ - this.$request1(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/find/89D260E420000001F70FB937A7F7088C',{},"GET").then(res =>{ - console.log(res) + //选择统计日期 + bindDateChange(e) { + this.synthData.reportDate = e.detail.value; + this.getYoYMoM(); + }, + // 获取同比环比 + getYoYMoM(){ + this.$request(getApp().globalData.baseUrl + '/api/biz/bizTransportData/getYoyMom?statDate=' + this.synthData.reportDate + '&_t=' + Date.parse(new Date()),"GET").then(res =>{ + console.log('同比环比===>',res) + this.yoymom = res.data; + this.calcYoyMom(); //同步更新环比同比 }) }, + // 计算同比环比 + calcYoyMom(){ + 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 : '' + } + // 同比 + 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 : '' + } + }, // 获取时段 getRoadTime(){ this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{ @@ -124,6 +157,7 @@ // 点击确认按钮 confirmRoad(){ let params = this.synthData; + console.log(params) if(params.reportDate == ''){ uni.showToast({ title:"请选择填报日期", @@ -154,13 +188,6 @@ cancelEdit(){ uni.navigateBack() }, - - onchange(e){ - console.log('确定===》',e) - }, - onnodeclick(e){ - console.log('点击===》',e) - } } } diff --git a/pages/roadTransport/quantitySent/list.vue b/pages/roadTransport/quantitySent/list.vue index ea30aa3..6dfed0e 100644 --- a/pages/roadTransport/quantitySent/list.vue +++ b/pages/roadTransport/quantitySent/list.vue @@ -159,7 +159,7 @@ console.log(row) uni.navigateTo({ // url:'pages/roadTransport/transportData/detail?item=' + JSON.stringify(row) - url:"/pages/roadTransport/quantitySent/form?pageFrom=edit&item=" + JSON.stringify(row) + url:"/pages/roadTransport/quantitySent/form?type=edit&item=" + JSON.stringify(row) }) }, // 点击删除按钮 diff --git a/pages/roadTransport/transportData/form.vue b/pages/roadTransport/transportData/form.vue index c834f07..a9bb741 100644 --- a/pages/roadTransport/transportData/form.vue +++ b/pages/roadTransport/transportData/form.vue @@ -17,10 +17,15 @@

统计日期

- + + + {{roadData.statisticalDate?roadData.statisticalDate:'请选择'}} + +
@@ -272,7 +277,7 @@