diff --git a/common/util.js b/common/util.js index 5531654..fc10555 100644 --- a/common/util.js +++ b/common/util.js @@ -102,11 +102,12 @@ function getDay(d, num) { // 计算环比 function calcMom(cur, data) { + console.log(cur,"环比==========",data); return !checkNotEmpty(cur) || !checkNotEmpty(data) ? '' : data === 0 && parseInt(cur) === 0 ? 0 : data === 0 && parseInt(cur) > 0 ? 100 : (parseInt(cur) - data) / data * 100; } // 计算同比 function calcYoy(cur, data) { - console.log(cur,"==========",data); + console.log(cur,"同比==========",data); return !checkNotEmpty(cur) || !checkNotEmpty(data) ? '' : data === 0 && parseInt(cur) === 0 ? 0 : data === 0 && parseInt(cur) > 0 ? 100 : (parseInt(cur) - data) / data * 100; } diff --git a/pages/highWay/runData/form.vue b/pages/highWay/runData/form.vue index a2d4beb..4f26b8e 100644 --- a/pages/highWay/runData/form.vue +++ b/pages/highWay/runData/form.vue @@ -402,7 +402,7 @@ if (idx > -1) { //环比 let obj = this.yoyMom.minusDaysList[idx]; - // console.log(obj) + // console.log(this.form.highwaySubDataList[index],obj) this.form.highwaySubDataList[index].entranceVehicleCountMom = this.$calcMom(this.form .highwaySubDataList[index].entranceVehicleCount, obj.entranceVehicleCount); this.form.highwaySubDataList[index].exitVehicleCountMom = this.$calcMom(this.form.highwaySubDataList[index].exitVehicleCount,obj.exitVehicleCount); @@ -414,7 +414,7 @@ if (idx2 > -1) { //同比 let obj = this.yoyMom.minusYearsList[idx2]; - console.log(obj) + // console.log(obj) this.form.highwaySubDataList[index].entranceVehicleCountYoy = this.$calcYoy(this.form .highwaySubDataList[index].entranceVehicleCount,obj.entranceVehicleCount); diff --git a/pages/portShipping/internationalTransport/form.vue b/pages/portShipping/internationalTransport/form.vue index 36b899a..b7407a8 100644 --- a/pages/portShipping/internationalTransport/form.vue +++ b/pages/portShipping/internationalTransport/form.vue @@ -9,11 +9,13 @@ 所属单位: - + {{form.railwayName?form.railwayName:'请选择'}} + :style="form.organizationName?'color:#333;':''">{{form.organizationName?form.organizationName:'请选择'}} + {{form.organizationName}} @@ -44,141 +46,140 @@ 国际邮轮 - + - 运输数据 - + 客班轮-{{ index+1 }} + 航线: - - - {{form.railwayName?form.railwayName:'请选择'}} - - + + + {{item.route?form.route:'请选择'}} + + 航次: - - - {{form.railwayName?form.railwayName:'请选择'}} - - + + + {{item.voyage?item.voyage:'请选择'}} + + - 入青旅客人数: + {{item.direction == 1 ? '入青' : item.direction == 2 ? '出青' : ''}}旅客人数: - + :class="item.passengerDod === 0 ? 'danger' : '' "> - 入青旅客人数环比 + :style="item.passengerDod === 0 ? 'color: #EB4747' : ''"> + {{item.direction == 1 ? '入青' : item.direction == 2 ? '出青' : ''}}旅客人数环比 - {{formatDigit(form.inRailwayYomDo)}}% + :style="item.passengerDod === 0 ? 'color: #EB4747' : ''"> + {{formatDigit(form.passengerDod)}}% - 入青旅客人数同比 + {{item.direction == 1 ? '入青' : item.direction == 2 ? '出青' : ''}}旅客人数同比 - {{formatDigit(form.inRailwayMomDo)}}% + {{formatDigit(item.passengerYoy)}}% 备注: - - - + + - - - 运输数据 - - - - 航线: - - - {{form.railwayName?form.railwayName:'请选择'}} - - - - - - 航次: - - - {{form.railwayName?form.railwayName:'请选择'}} - - - - - - 入青旅客人数: - - - - - - - - - - 入青旅客人数环比 - - {{formatDigit(form.inRailwayYomDo)}}% - - - - - 入青旅客人数同比 - - {{formatDigit(form.inRailwayMomDo)}}% - - + + + 国际邮轮-{{ index+1 }} + + + + 航线: + + + {{item.route?form.route:'请选择'}} + + + + + + 航次: + + + {{item.voyage?item.voyage:'请选择'}} + + + + + + {{item.direction == 1 ? '入青' : item.direction == 2 ? '出青' : ''}}旅客人数: + + + + + + + + + + {{item.direction == 1 ? '入青' : item.direction == 2 ? '出青' : ''}}旅客人数环比 + + {{formatDigit(form.passengerDod)}}% + + + + + {{item.direction == 1 ? '入青' : item.direction == 2 ? '出青' : ''}}旅客人数同比 + + {{formatDigit(item.passengerYoy)}}% + + 备注: - - - + + - 增行 + 增行 - {{btnText}} @@ -192,44 +193,54 @@ data() { return { form: { - "inMark": "", - "inPepole": '', - "inPepoleMomDo": '', - "inPepoleYoyDo": '', - "inRailwayMomDo": '', - "inRailwayYomDo": '', - "inboundPassengersDo": '', - "inboundRailwayDo": '', - "isHoliday": "", - "outMark": "", - "outPepole": '', - "outPepoleMomDo": '', - "outPepoleYoyDo": '', - "outRailwayMomDo": '', - "outRailwayYomDo": '', - "outboundPassengersDo": '', - "outboundRailwayDo": '', - "railwayName": "", + "internationalCruiseDTOList": [{ + "route": "", + "routeIndex": "", + "voyage": "", + "voyageIndex": "", + "direction": "", + "passengerCount": "", + "passengerDod": "",//环比 + "passengerYoy": "",//同比 + }],//国际客运 + "passengerShipDTOList":[{ + "route": "", + "routeIndex": "", + "voyage": "", + "voyageIndex": "", + "direction": "", + "passengerCount": "", + "passengerDod": "",//环比 + "passengerYoy": "",//同比 + }],//客班轮 + "organizationName": "", "statDate": "", "statPeriod": "" }, //登录form stationList: [], //车站列表 railwayNameIndex: '', - submitPerson: [], //报送人 - submitPersonIndex: -1, //报送人选择索引 + shipRouteList: [], //客班轮航线 + shipVoyageList: [],//客班轮航次 + internationalRouteList: [], //国际邮轮航线 + internationalVoyageList: [],//国际邮轮航次 array: [], //时段选择列表 index: 2, //时段选择,默认0-24 userInfo: {}, pageType: '', btnText: '保存', - tabType: 1, + tabType: 1, + deptNameList: [], //当前登录人所在单位 mobile: getApp().globalData.mobile } }, onLoad(options) { this.userInfo = uni.getStorageSync('userInfo'); this.queryStation(); //车展名称列表 + let arr = uni.getStorageSync('deptName'); + this.deptNameList = checkNotEmpty(arr) ? arr : []; if (options.type == 'add') { + this.form.organizationName = this.deptNameList.length > 0 ? this.deptNameList[0].deptName : ''; + this.form.organizationNameIndex = this.deptNameList.length > 0 ? 0 : ''; this.pageType = 'add'; let now = new Date(); this.form.statDate = getDateStr(now, -1); //默认前一天 @@ -239,20 +250,55 @@ this.$request(getApp().globalData.baseUrl + '/api/biz/railwayRunData/find/' + options.id, {}, "GET").then( res => { this.form = res.data; + if (checkNotEmpty(this.deptNameList)) { + let idx = this.deptNameList.findIndex(item => item.deptName = this.form.organizationName); + this.form.organizationNameIndex = idx > -1 ? idx : ''; + } this.queryTime(); //统计时段 }); } }, - methods: { - call(tel) { - uni.makePhoneCall({ - phoneNumber: tel - }); - }, - //增行 - addRow() {}, - //删除 - deleteRow(index) {}, + methods: { + //切换管理单位 + bindDeptChange(e) { + this.form.organizationNameIndex = e.detail.value; + this.form.organizationName = this.deptNameList[e.detail.value].deptName; + }, + call(tel) { + uni.makePhoneCall({ + phoneNumber: tel + }); + }, + //增行 + addRow() { + let obj = { + route: "", + routeIndex: "", + voyage: "", + voyageIndex: "", + direction: "", + passengerCount: "", + passengerDod: "",//环比 + passengerYoy: "",//同比 + }; + if(this.tabType == 1) { + //客班轮 + this.form.passengerShipDTOList.push(obj); + }else{ + //国际邮轮 + this.form.internationalCruiseDTOList.push(obj); + } + }, + //删除 + deleteRow(index) { + if(this.tabType == 1) { + //客班轮 + this.form.passengerShipDTOList.splice(index, 1); + }else{ + //国际邮轮 + this.form.internationalCruiseDTOList.splice(index, 1); + } + }, //只保留两位小数 formatDigit(data) { return !checkNotEmpty(data) ? '--' : (data+'').indexOf('.') > -1 && (data+'').substring((data+'').indexOf('.')).length > 2 ? data.toFixed(2) : data; @@ -281,87 +327,6 @@ this.form.inPepoleMomDo = this.$calcYoy(this.form.inPepole,this.yoyMom.lastYearData.inPepole); this.form.outRailwayMomDo = this.$calcYoy(this.form.outboundRailwayDo,this.yoyMom.lastYearData.outboundRailwayDo); this.form.outPepoleMomDo = this.$calcYoy(this.form.outPepole,this.yoyMom.lastYearData.outPepole); - return; - if (this.yoyMom.yesterdayData) { - //环比 - if (checkNotEmpty(this.form.inboundRailwayDo)) { - this.form.inRailwayYomDo = !checkNotEmpty(this.yoyMom.yesterdayData.inboundRailwayDo) || this - .yoyMom.yesterdayData.inboundRailwayDo === 0 ? 100 : ( - parseInt(this.form.inboundRailwayDo) - this.yoyMom.yesterdayData.inboundRailwayDo) / this - .yoyMom.yesterdayData.inboundRailwayDo * 100; - }else{ - this.form.inRailwayYomDo = ''; - } - if (this.form.inPepole) { - this.form.inPepoleYoyDo = !checkNotEmpty(this.yoyMom.yesterdayData.inPepole) || this.yoyMom - .yesterdayData.inPepole === 0 ? 100 : (parseInt(this - .form.inPepole) - this.yoyMom.yesterdayData.inPepole) / this.yoyMom.yesterdayData - .inPepole * - 100; - }else{ - this.form.inPepoleYoyDo = ''; - } - if (checkNotEmpty(this.form.outboundRailwayDo)) { - this.form.outRailwayYomDo = !checkNotEmpty(this.yoyMom.yesterdayData.outboundRailwayDo) || this - .yoyMom.yesterdayData.outboundRailwayDo === 0 ? 100 : (parseInt(this.form.outboundRailwayDo) - - this.yoyMom.yesterdayData - .outboundRailwayDo) / this.yoyMom.yesterdayData.outboundRailwayDo * 100; - }else{ - this.form.outRailwayYomDo = ''; - } - if (checkNotEmpty(this.form.outPepole)) { - this.form.outPepoleYoyDo = !checkNotEmpty(this.yoyMom.yesterdayData.outPepole) || this.yoyMom - .yesterdayData.outPepole === 0 ? 100 : (parseInt(this - .form.outPepole) - this.yoyMom.yesterdayData.outPepole) / this.yoyMom.yesterdayData - .outPepole * - 100; - }else{ - this.form.outPepoleYoyDo = ''; - } - } - if (this.yoyMom.lastYearData) { - //同比 - if (checkNotEmpty(this.form.inboundRailwayDo)) { - this.form.inRailwayMomDo = !checkNotEmpty(this.yoyMom.lastYearData.inboundRailwayDo) || this.yoyMom - .lastYearData.inboundRailwayDo === 0 ? 100 : ( - parseInt(this.form.inboundRailwayDo) - this.yoyMom.lastYearData.inboundRailwayDo) / this - .yoyMom - .lastYearData.inboundRailwayDo * 100; - }else{ - this.form.inRailwayMomDo = ''; - } - - if (checkNotEmpty(this.form.inPepole)) { - this.form.inPepoleMomDo = !checkNotEmpty(this.yoyMom.lastYearData.inPepole) || this.yoyMom - .lastYearData - .inPepole === 0 ? 100 : (parseInt(this.form - .inPepole) - this.yoyMom.lastYearData.inPepole) / this.yoyMom.lastYearData.inPepole * 100; - }else{ - this.form.inPepoleMomDo = ''; - } - - if (checkNotEmpty(this.form.outboundRailwayDo)) { - this.form.outRailwayMomDo = !checkNotEmpty(this.yoyMom.lastYearData.outboundRailwayDo) || this - .yoyMom - .lastYearData.outboundRailwayDo === 0 ? 100 : - (parseInt(this.form.outboundRailwayDo) - this.yoyMom.lastYearData.outboundRailwayDo) / this - .yoyMom - .lastYearData.outboundRailwayDo * 100; - }else{ - this.form.outRailwayMomDo = ''; - } - - if (checkNotEmpty(this.form.outPepole)) { - this.form.outPepoleMomDo = !checkNotEmpty(this.yoyMom.lastYearData.outPepole) || this.yoyMom - .lastYearData.outPepole === 0 ? 100 : (parseInt(this - .form.outPepole) - this.yoyMom.lastYearData.outPepole) / this.yoyMom.lastYearData - .outPepole * - 100; - }else{ - this.form.outPepoleMomDo = ''; - } - - } }, //车站权限列表 queryStation() { @@ -374,10 +339,29 @@ } }) }, - //车站选择 - changeRailway(e) { - this.railwayNameIndex = e.detail.value; - this.form.railwayName = this.stationList[e.detail.value]; + //航线选择 + changeRoute(e, index) { + if(this.tabType == 1) { + //客班轮 + this.form.passengerShipDTOList[index].routeIndex = e.detail.value; + this.form.passengerShipDTOList[index].route = this.shipRouteList[e.detail.value].name; + }else{ + //国际邮轮 + this.form.internationalCruiseDTOList[index].routeIndex = e.detail.value; + this.form.internationalCruiseDTOList[index].route = this.internationalRouteList[e.detail.value].name; + } + }, + //航次选择 + changeVoyage(e, index) { + if(this.tabType == 1) { + //客班轮 + this.form.passengerShipDTOList[index].voyageIndex = e.detail.value; + this.form.passengerShipDTOList[index].voyage = this.shipVoyageList[e.detail.value].name; + }else{ + //国际邮轮 + this.form.internationalCruiseDTOList[index].voyageIndex = e.detail.value; + this.form.internationalCruiseDTOList[index].voyage = this.internationalVoyageList[e.detail.value].name; + } }, //统计时段切换选择 changeStatPeriod(e) { @@ -386,10 +370,6 @@ console.log('change 时段', this.form); this.queryYoyMom(); }, - //取消 - doCancel() { - uni.navigateBack(); - }, //选择统计日期 bindDateChange(e) { this.form.statDate = e.detail.value; @@ -409,29 +389,22 @@ new Date(dateStr + ' 13:30').getTime()) { this.form.statPeriod = '0012'; - let idx = 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 - let idx = this.array.findIndex(item => item.dictValue == '03'); + let idx = this.array.findIndex(item => item.dictValue == '03'); this.index = idx > -1 ? idx : ''; } } else { - let idx = 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 : ''; - } + } 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: '报送日期和时段不能为空', @@ -439,36 +412,32 @@ }) return; } - if (!checkNotEmpty(this.form.inboundRailwayDo) || !checkNotEmpty(this.form.inboundPassengersDo) || ! - checkNotEmpty(this.form.inPepole)) { + let checkList = true; + if (this.form.passengerShipDTOList.length > 0) { + checkList = this.form.passengerShipDTOList.every(item => { + return checkNotEmpty(item.route) && checkNotEmpty(item.voyage) && checkNotEmpty(item.passengerCount) + }) + } + if (!checkList) { uni.showToast({ - title: '入青终到车次、过站车次、人数不能为空', + title: '客班轮信息请填写完整', icon: 'none' }) return; } - if (!checkNotEmpty(this.form.outboundRailwayDo) || !checkNotEmpty(this.form.outboundPassengersDo) || ! - checkNotEmpty(this.form.outPepole)) { + let checkList2 = true; + if (this.form.internationalCruiseDTOList.length > 0) { + checkList2 = this.form.internationalCruiseDTOList.every(item => { + return checkNotEmpty(item.route) && checkNotEmpty(item.voyage) && checkNotEmpty(item.passengerCount) + }) + } + if (!checkList2) { uni.showToast({ - title: '出青终到车次、过站车次、人数不能为空', + 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: this.form.id == undefined ? '您确认提交该条报送数据?' : '您确认将该条数据进行修改?', @@ -795,4 +764,4 @@ background-color: #007aff; color: #ffffff; } - +