添加环比同比计算,修改填报日期格式组件

main
jinna 2 years ago
parent 48ed9f160a
commit e4c0f9a8ee
  1. 45
      pages/roadTransport/dataSubmission/form.vue
  2. 2
      pages/roadTransport/dataSubmission/list.vue
  3. 67
      pages/roadTransport/quantitySent/form.vue
  4. 2
      pages/roadTransport/quantitySent/list.vue
  5. 53
      pages/roadTransport/transportData/form.vue
  6. 2
      pages/roadTransport/transportData/list.vue

@ -18,10 +18,15 @@
<view class="edit_item"> <view class="edit_item">
<p class="left">统计日期</p> <p class="left">统计日期</p>
<view class="right"> <view class="right">
<uni-datetime-picker type="date" v-model="synthData.reportDatetime"> <!-- <uni-datetime-picker type="date" v-model="synthData.reportDatetime">
<p class="right_txt">{{synthData.reportDatetime ? synthData.reportDatetime : '请选择日期'}}</p> <p class="right_txt">{{synthData.reportDatetime ? synthData.reportDatetime : '请选择日期'}}</p>
<uni-icons type="right" size="16"></uni-icons> <uni-icons type="right" size="16"></uni-icons>
</uni-datetime-picker> </uni-datetime-picker> -->
<picker mode="date" :value="synthData.reportDatetime" @change="bindDateChange">
<text class="picker_select"
:style="synthData.reportDatetime?'color:#333;':''">{{synthData.reportDatetime?synthData.reportDatetime:'请选择'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
</view> </view>
</view> </view>
<view class="edit_item"> <view class="edit_item">
@ -69,36 +74,44 @@
}, },
isShowTitle:false, isShowTitle:false,
timeName:'', timeName:'',
pageType:'' pageType:'',
index:''
} }
}, },
onLoad(options) { onLoad(options) {
this.getRoadTime() this.getRoadTime();
if(options.pageFrom == 'edit'){ if(options.type == 'edit'){
this.pageType = 'edit' this.pageType = 'edit'
let row = JSON.parse(options.item); let row = JSON.parse(options.item);
console.log(row) // this.synthData = row;
this.synthData = row; this.getDetail(row.id);
this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : '' // this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : ''
}else if(options.pageFrom == 'add'){
this.pageType = 'add'
}else if(options.type == 'add'){ }else if(options.type == 'add'){
this.pageType = 'add' this.pageType = 'add'
let now = new Date();
this.synthData.reportDatetime = getDateStr(now, -1);//
} }
}, },
methods: { 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(){ getRoadTime(){
this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{ this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{
this.roadTime = res.data; this.roadTime = res.data;
if(this.pageType == 'edit'){ if(this.pageType == 'edit'){
this.roadTime.map((item,index) =>{ this.index = this.roadTime.findIndex(item => item.dictValue == this.synthData.reportPhase)
if(item.dictValue == this.synthData.reportPhase){ this.timeName = this.roadTime.find(item => item.dictValue == this.synthData.reportPhase).dictLabel
this.index = index;
this.timeName = item.dictLabel
}
})
}else if(this.pageType == 'add'){ }else if(this.pageType == 'add'){
let now = new Date(); let now = new Date();
let dateStr = getDateStr(now,0); let dateStr = getDateStr(now,0);

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

@ -12,10 +12,15 @@
<view class="edit_item"> <view class="edit_item">
<p class="left">填报日期</p> <p class="left">填报日期</p>
<view class="right"> <view class="right">
<uni-datetime-picker type="date" v-model="synthData.reportDate"> <!-- <uni-datetime-picker type="date" v-model="synthData.reportDate">
<p class="right_txt">{{synthData.reportDate ? synthData.reportDate : '请选择日期'}}</p> <p class="right_txt">{{synthData.reportDate ? synthData.reportDate : '请选择日期'}}</p>
<uni-icons type="right" size="16"></uni-icons> <uni-icons type="right" size="16"></uni-icons>
</uni-datetime-picker> </uni-datetime-picker> -->
<picker mode="date" :value="synthData.reportDate" @change="bindDateChange">
<text class="picker_select"
:style="synthData.reportDate?'color:#333;':''">{{synthData.reportDate?synthData.reportDate:'请选择'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
</view> </view>
</view> </view>
</view> </view>
@ -24,7 +29,7 @@
<view class="edit_item input"> <view class="edit_item input">
<p class="left">班次</p> <p class="left">班次</p>
<view class="right"> <view class="right">
<uni-easyinput v-model="synthData.shifts" placeholder="请输入" placeholderStyle="color:#d4d4d4;"></uni-easyinput> <uni-easyinput @blur="calcYoyMom" v-model="synthData.shifts" placeholder="请输入" placeholderStyle="color:#d4d4d4;"></uni-easyinput>
</view> </view>
</view> </view>
<view class="per_con" v-if="pageType == 'edit'"> <view class="per_con" v-if="pageType == 'edit'">
@ -40,7 +45,7 @@
<view class="edit_item input"> <view class="edit_item input">
<p class="left">人数</p> <p class="left">人数</p>
<view class="right"> <view class="right">
<uni-easyinput v-model="synthData.people" placeholder="请输入" placeholderStyle="color:#d4d4d4;"></uni-easyinput> <uni-easyinput @blur="calcYoyMom" v-model="synthData.people" placeholder="请输入" placeholderStyle="color:#d4d4d4;"></uni-easyinput>
</view> </view>
</view> </view>
<view class="per_con" v-if="pageType == 'edit'"> <view class="per_con" v-if="pageType == 'edit'">
@ -76,31 +81,59 @@
reportDate:'', // reportDate:'', //
people:'' // people:'' //
}, },
pageType:'' pageType:'',
yoymom:{},
} }
}, },
onLoad(options) { onLoad(options) {
// this.getRoadTime() // this.getRoadTime()
// this.getDetail() if(options.type == 'edit'){
if(options.pageFrom == 'edit'){
this.pageType = 'edit' this.pageType = 'edit'
let row = JSON.parse(options.item); let row = JSON.parse(options.item);
this.synthData = row; this.synthData = row;
this.synthData.reportDatetime = this.synthData.reportDatetime ? this.synthData.reportDatetime.substring(0,10) : '' this.getYoYMoM();
}else if(options.pageFrom == 'add'){ // this.synthData.reportDate = this.synthData.reportDate ? this.synthData.reportDate.substring(0,10) : ''
this.pageType = 'add'
}else if(options.type == 'add'){ }else if(options.type == 'add'){
this.pageType = 'add' this.pageType = 'add'
let now = new Date();
this.synthData.reportDate = getDateStr(now, -1);//
this.getYoYMoM();
} }
}, },
methods: { methods: {
getDetail(){ //
this.$request1(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/find/89D260E420000001F70FB937A7F7088C',{},"GET").then(res =>{ bindDateChange(e) {
console.log(res) 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(){ getRoadTime(){
this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{ this.$request(getApp().globalData.baseUrl + '/api/dict/dictList?dictType=airport_time&_t=1693372307694',"GET").then(res =>{
@ -124,6 +157,7 @@
// //
confirmRoad(){ confirmRoad(){
let params = this.synthData; let params = this.synthData;
console.log(params)
if(params.reportDate == ''){ if(params.reportDate == ''){
uni.showToast({ uni.showToast({
title:"请选择填报日期", title:"请选择填报日期",
@ -154,13 +188,6 @@
cancelEdit(){ cancelEdit(){
uni.navigateBack() uni.navigateBack()
}, },
onchange(e){
console.log('确定===》',e)
},
onnodeclick(e){
console.log('点击===》',e)
}
} }
} }
</script> </script>

@ -159,7 +159,7 @@
console.log(row) console.log(row)
uni.navigateTo({ uni.navigateTo({
// url:'pages/roadTransport/transportData/detail?item=' + JSON.stringify(row) // 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)
}) })
}, },
// //

@ -17,10 +17,15 @@
<view class="edit_item"> <view class="edit_item">
<p class="left">统计日期</p> <p class="left">统计日期</p>
<view class="right"> <view class="right">
<uni-datetime-picker type="date" v-model="roadData.statisticalDate"> <!-- <uni-datetime-picker type="date" v-model="roadData.statisticalDate">
<p class="right_txt">{{roadData.statisticalDate ? roadData.statisticalDate : '请选择日期'}}</p> <p class="right_txt">{{roadData.statisticalDate ? roadData.statisticalDate : '请选择日期'}}</p>
<uni-icons type="right" size="16"></uni-icons> <uni-icons type="right" size="16"></uni-icons>
</uni-datetime-picker> </uni-datetime-picker> -->
<picker mode="date" :value="roadData.statisticalDate" @change="bindDateChange">
<text class="picker_select"
:style="roadData.statisticalDate?'color:#333;':''">{{roadData.statisticalDate?roadData.statisticalDate:'请选择'}}</text>
<uni-icons type="right" size="16" color="#D4D4D4"></uni-icons>
</picker>
</view> </view>
</view> </view>
<view class="edit_item"> <view class="edit_item">
@ -272,7 +277,7 @@
</template> </template>
<script> <script>
import { getDateStr } from '../../../common/util' import { getDateStr, lastYearDate } from '../../../common/util'
export default { export default {
data() { data() {
return { return {
@ -322,37 +327,47 @@ import { getDateStr } from '../../../common/util'
dailyFatalities:"", //() dailyFatalities:"", //()
emergencySituationReport:'', // emergencySituationReport:'', //
remarks:'', // remarks:'', //
} },
lastyearDay:'',
beforeDay:''
} }
}, },
onLoad(options){ onLoad(options){
this.getUnitData() this.getUnitData()
this.getRoadTime() this.getRoadTime()
this.getPersonData() this.getPersonData();
if(options.pageFrom == 'edit'){ if(options.item){
const item = JSON.parse(options.item); const item = JSON.parse(options.item);
this.roadData = item; // this.roadData = item;
this.pageType = 'edit' this.pageType = 'edit'
console.log(this.index) this.getDetail(item.id)
// uni.setNavigationBarTitle({ // uni.setNavigationBarTitle({
// title:"" // title:""
// }) // })
}else if(options.pageFrom == 'add'){ }else if(options.id){
this.pageType = 'add' this.getDetail(options.id)
this.roadData.reportingUnitId = '522'
// uni.setNavigationBarTitle({
// title:""
// })
}else if(options.type == 'add'){ }else if(options.type == 'add'){
this.pageType = 'add' this.pageType = 'add';
// this.roadData.reportingUnitId = '522'
let now = new Date();
this.roadData.statisticalDate = getDateStr(now, -1);//
console.log('lastyear ===>',lastYearDate(this.roadData.statisticalDate))
} }
}, },
methods: { methods: {
getDetail(id){
this.$request(getApp().globalData.baseUrl + '/api/biz/roadtransport/road/find/' + id,{},"GET").then(res =>{
this.roadData = res.data;
console.log('last==>',lastYearDate(this.roadData.statisticalDate))
})
},
//
bindDateChange(e) {
this.roadData.statisticalDate = e.detail.value;
},
// //
confirmRoad(){ confirmRoad(){
console.log('点击按钮')
let params = this.roadData; let params = this.roadData;
if(params.statisticalDate == ''){ if(params.statisticalDate == ''){
uni.showToast({ uni.showToast({
@ -432,6 +447,10 @@ import { getDateStr } from '../../../common/util'
} }
}) })
},
//
calcRatio(){
}, },
// //
getPersonData(){ getPersonData(){

@ -264,7 +264,7 @@
console.log(row) console.log(row)
uni.navigateTo({ uni.navigateTo({
// url:'pages/roadTransport/transportData/detail?item=' + JSON.stringify(row) // url:'pages/roadTransport/transportData/detail?item=' + JSON.stringify(row)
url:"/pages/roadTransport/transportData/form?item=" + JSON.stringify(row) + '&pageFrom=edit' url:"/pages/roadTransport/transportData/form?item=" + JSON.stringify(row) + '&type=edit'
}) })
}, },
// //

Loading…
Cancel
Save