diff --git a/pages/highWay/runData/form.vue b/pages/highWay/runData/form.vue index ab5f6db..1ed2ef2 100644 --- a/pages/highWay/runData/form.vue +++ b/pages/highWay/runData/form.vue @@ -9,8 +9,8 @@ 管理单位名称: - + {{form.organizationName?form.organizationName:'请选择'}} @@ -31,7 +31,7 @@ 统计时段: - + {{index>-1?array[index].dictLabel:'请选择时段'}} @@ -215,8 +215,8 @@ 备注: + placeholderStyle="color: #D4D4D4;font-size:28rpx;" placeholder="请输入备注信息" type="textarea" + maxlength="200" autoHeight> @@ -245,9 +245,7 @@ exitVehicleCount: '', exitVehicleCountMom: '', exitVehicleCountYoy: '', - highwaySubDataList: [ - {} - ], + highwaySubDataList: [{}], }, //登录form highwaySubDataList: [], //收费站列表 stationIndex: 0, //收费站选中索引 @@ -287,7 +285,8 @@ }, //只保留两位小数 formatDigit(data) { - return !checkNotEmpty(data) ? '--' : (data+'').indexOf('.') > -1 && (data+'').substring((data+'').indexOf('.')).length > 2 ? data.toFixed(2) : data; + return !checkNotEmpty(data) ? '--' : (data + '').indexOf('.') > -1 && (data + '').substring((data + '') + .indexOf('.')).length > 2 ? data.toFixed(2) : data; }, //id查询详情 queryDetailInfo(id) { @@ -318,11 +317,11 @@ } }) } - }, - //切换管理单位 - bindDeptChange(e) { - this.form.organizationNameIndex = e.detail.value; - this.form.organizationName = this.deptNameList[e.detail.value].deptName; + }, + //切换管理单位 + bindDeptChange(e) { + this.form.organizationNameIndex = e.detail.value; + this.form.organizationName = this.deptNameList[e.detail.value].deptName; }, //报送人 // queryPerson() { @@ -334,18 +333,19 @@ // }) // this.submitPerson = arr; // }) - // }, - queryPerson() { - this.$request(getApp().globalData.baseUrl + '/api/user/getByDeptId/' + this.deptNameList[this.form.organizationNameIndex].deptId, {}, "GET").then(res => { - let arr = []; - res.data.map(item => { - arr.push(item.username+(item.mobile?','+item.mobile:'')); - }) - this.submitPerson = arr; - }) + // }, + queryPerson() { + this.$request(getApp().globalData.baseUrl + '/api/user/getAllUserInDept', {}, "GET").then(res => { + let arr = []; + res.data.map(item => { + arr.push(item.username + (item.mobile ? ',' + item.mobile : '')); + }) + this.submitPerson = arr; + }) }, changeSubmitPerson(e, index) { this.form.highwaySubDataList[index].submitPersonnelContact = this.submitPerson[e.detail.value]; + console.log(this.form.highwaySubDataList[index]) }, //切换当前编辑收费站索引 changeStationIndex(index) { @@ -365,8 +365,9 @@ let entranceVehicleCount = 0, exitVehicleCount = 0; this.form.highwaySubDataList.map(item => { - entranceVehicleCount = entranceVehicleCount + (checkNotEmpty(item.entranceVehicleCount) ? parseInt(item - .entranceVehicleCount) : 0); + entranceVehicleCount = entranceVehicleCount + (checkNotEmpty(item.entranceVehicleCount) ? + parseInt(item + .entranceVehicleCount) : 0); exitVehicleCount = exitVehicleCount + (checkNotEmpty(item.exitVehicleCount) ? parseInt(item .exitVehicleCount) : 0); }) @@ -374,35 +375,14 @@ this.form.exitVehicleCount = exitVehicleCount; //环比计算规则 if今天没有值不计算,elseif昨天没有值不计算,elseif昨天===0并且今天===0百分比0,esleif昨天0今天大于0百分比100,else(今天-昨天)/昨天*100 //收费站驶入车辆数统计 - this.form.entranceVehicleCountMom = !checkNotEmpty(this.form.entranceVehicleCount) ? '' : !checkNotEmpty(this - .form.minusDaysEntranceVehicleSum) ? '' : this.form.minusDaysEntranceVehicleSum === 0 && parseInt(this - .form.entranceVehicleCount) === 0 ? 0 : this.form.minusDaysEntranceVehicleSum === 0 && parseInt(this - .form.entranceVehicleCount) > 0 ? 100 : (parseInt(this - .form.entranceVehicleCount) - this.yoyMom.minusDaysEntranceVehicleSum) / this.yoyMom - .minusDaysEntranceVehicleSum * 100; - this.form.entranceVehicleCountYoy = !checkNotEmpty(this.form - .entranceVehicleCount) ? '' : !checkNotEmpty(this - .form.minusYearsEntranceVehicleSum) ? '' : this.form.minusYearsEntranceVehicleSum === 0 && parseInt( - this.form.entranceVehicleCount) === 0 ? 0 : this.form.minusYearsEntranceVehicleSum === 0 && parseInt( - this.form.entranceVehicleCount) > 0 ? 100 : (parseInt( - this.form.entranceVehicleCount) - this.yoyMom.minusYearsEntranceVehicleSum) / this.yoyMom - .minusYearsEntranceVehicleSum * 100; + this.form.entranceVehicleCountMom = this.$calcMom(this.form.entranceVehicleCount,this.yoyMom.minusDaysEntranceVehicleSum); + this.form.entranceVehicleCountYoy = this.$calcYoy(this.form.entranceVehicleCount, this.yoyMom.minusYearsEntranceVehicleSum); //收费站驶出车辆数统计 - this.form.exitVehicleCountMom = !checkNotEmpty(this.form.exitVehicleCount) ? '' : !checkNotEmpty(this - .form - .minusDaysExitVehicleSum) ? '' : this.form.minusDaysExitVehicleSum === 0 && parseInt(this.form - .exitVehicleCount) === 0 ? 0 : this.form.minusDaysExitVehicleSum === 0 && parseInt(this.form - .exitVehicleCount) > 0 ? 100 : (parseInt(this.form - .exitVehicleCount) - this.yoyMom.minusDaysExitVehicleSum) / this.yoyMom.minusDaysExitVehicleSum * - 100; - this.form.exitVehicleCountYoy = !checkNotEmpty(this.form.exitVehicleCount) ? '' : !checkNotEmpty( - this.form - .minusYearsExitVehicleSum) ? '' : this.form.minusYearsExitVehicleSum === 0 && parseInt(this.form - .exitVehicleCount) === 0 ? 0 : this.form.minusYearsExitVehicleSum === 0 && parseInt(this.form - .exitVehicleCount) > 0 ? 100 : (parseInt(this.form - .exitVehicleCount) - this.yoyMom.minusYearsExitVehicleSum) / this.yoyMom.minusYearsExitVehicleSum * - 100; + this.form.exitVehicleCountMom = this.$calcMom(this.form.exitVehicleCount, this.yoyMom.minusDaysExitVehicleSum); + + this.form.exitVehicleCountYoy = this.$calcYoy(this.form.exitVehicleCount, this.yoyMom.minusYearsExitVehicleSum); + //收费站子表计算同比环比 // if(this.form.highwaySubDataList[index].entranceVehicleCount != '' || this.form.highwaySubDataList[index].exitVehicleCount != ''){ @@ -417,16 +397,10 @@ //环比 let obj = this.yoyMom.minusDaysList[idx]; // console.log(obj) - this.form.highwaySubDataList[index].entranceVehicleCountMom = !checkNotEmpty(this.form - .highwaySubDataList[index].entranceVehicleCount) ? '' : !checkNotEmpty(obj - .entranceVehicleCount) ? '' : obj.entranceVehicleCount === 0 ? 100 : (parseInt(this.form - .highwaySubDataList[index].entranceVehicleCount) - obj.entranceVehicleCount) / obj - .entranceVehicleCount * 100; - this.form.highwaySubDataList[index].exitVehicleCountMom = !checkNotEmpty(this.form - .highwaySubDataList[ - index].exitVehicleCount) ? '' : !checkNotEmpty(obj.exitVehicleCount) ? '' : obj - .exitVehicleCount === 0 ? 100 : (parseInt(this.form.highwaySubDataList[index].exitVehicleCount) - - obj.exitVehicleCount) / obj.exitVehicleCount * 100; + 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); + } else { this.form.highwaySubDataList[index].entranceVehicleCountMom = ''; this.form.highwaySubDataList[index].exitVehicleCountMom = ''; @@ -435,17 +409,11 @@ //同比 let obj = this.yoyMom.minusYearsList[idx2]; console.log(obj) - this.form.highwaySubDataList[index].entranceVehicleCountYoy = !checkNotEmpty(this.form - .highwaySubDataList[index].entranceVehicleCount) ? '' : !checkNotEmpty(obj - .entranceVehicleCount) ? '' : obj.entranceVehicleCount === 0 ? 100 : (parseInt(this.form - .highwaySubDataList[index].entranceVehicleCount) - obj.entranceVehicleCount) / obj - .entranceVehicleCount * 100; - this.form.highwaySubDataList[index].exitVehicleCountYoy = !checkNotEmpty(this.form - .highwaySubDataList[ - index].exitVehicleCount) ? '' : ! - checkNotEmpty(obj.exitVehicleCount) ? '' : obj.exitVehicleCount === 0 ? 100 : (parseInt(this.form - .highwaySubDataList[index].exitVehicleCount) - obj.exitVehicleCount) / obj.exitVehicleCount * - 100; + this.form.highwaySubDataList[index].entranceVehicleCountYoy = this.$calcYoy(this.form + .highwaySubDataList[index].entranceVehicleCount,obj.entranceVehicleCount); + + this.form.highwaySubDataList[index].exitVehicleCountYoy = this.$calcYoy(this.form + .highwaySubDataList[index].exitVehicleCount, obj.exitVehicleCount); } else { this.form.highwaySubDataList[index].entranceVehicleCountYoy = ''; this.form.highwaySubDataList[index].exitVehicleCountYoy = ''; @@ -457,7 +425,8 @@ this.$request(getApp().globalData.baseUrl + '/api/biz/HighSpeedPermissionsInfo/findList?_t=' + Date .parse( new Date()), {}, 'GET').then(res => { - this.highwaySubDataList = res.data; + this.highwaySubDataList = res.data; + this.form.highwaySubDataList = []; if (type == 'add') { this.highwaySubDataList.map(item => { item.isFinish = false; @@ -471,8 +440,9 @@ "exitVehicleCountYoy": '', "highwayId": "", "highwayName": item.managementUnitName, - "submitPersonnelContact": this.userInfo.realName + ',' + this - .userInfo.mobile, + "submitPersonnelContact": this.userInfo.username + (this + .userInfo.mobile ? ',' + this + .userInfo.mobile : ''), "tollExemptAmount": 0.0, "tollExemptVehicleCount": 0, "tollExemptVehicleCountMom": 0.0, @@ -505,8 +475,9 @@ "exitVehicleCountYoy": '', "highwayId": "", "highwayName": item.managementUnitName, - "submitPersonnelContact": this.userInfo.realName + ',' + this - .userInfo.mobile, + "submitPersonnelContact": this.userInfo.username + (this + .userInfo.mobile ? ',' + this + .userInfo.mobile : ''), "tollExemptAmount": 0.0, "tollExemptVehicleCount": 0, "tollExemptVehicleCountMom": 0.0, @@ -527,6 +498,13 @@ bindDateChange(e) { this.form.statDate = e.detail.value; this.queryYoYMom(); + }, + //统计时段切换 + changeStatPeriod(e) { + this.index = e.detail.value; + this.form.statPeriod = this.array[e.detail.value].dictValue; + console.log('change 时段') + this.queryYoYMom(); }, //时段 queryTime() { @@ -862,4 +840,4 @@ background-color: #007aff; color: #ffffff; } - \ No newline at end of file +