diff --git a/common/util.js b/common/util.js index 2e6f35e..32b4740 100644 --- a/common/util.js +++ b/common/util.js @@ -91,11 +91,39 @@ function getDateStr(today, addDayCount) { const checkNotEmpty = (str) => { return typeof(str) !== 'undefined' && str !== null && str !== '' ? true : false } +// 获取日期 +function getDay(d, num) { + const date = new Date(new Date(d).setDate(new Date(d).getDate() + num)) + const year = date.getFullYear() + const month = (date.getMonth() + 1 + "").padStart(2, "0") + const day = (date.getDate() + "").padStart(2, "0") + return `${year}-${month}-${day}` +} + +// 是否是闰年 +function isLeap(year){ +return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0 +} + +// 返回去年日期 +function lastYearDate(d) { + const date = new Date(d) + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const lastYear = year - 1 + const thisYearisLeap = isLeap(year) + const lastYearIsLeap = isLeap(lastYear) + // 特殊情况:去年是否是闰年 或 今年是闰年且为12月31日 + if (lastYearIsLeap || (thisYearisLeap && month == 12 && day == 31)) return getDay(d, -366) + return getDay(d, -365) +} export { formatTime, formatLocation, getDateStr, dateUtils, - checkNotEmpty + checkNotEmpty, + lastYearDate } \ No newline at end of file diff --git a/pages/bus/busDataInfo/form.vue b/pages/bus/busDataInfo/form.vue index 70bfd12..2e95c02 100644 --- a/pages/bus/busDataInfo/form.vue +++ b/pages/bus/busDataInfo/form.vue @@ -6,9 +6,9 @@ 统计日期: - + {{form.statDate?form.statDate:'请选择统计日期'}} + :style="form.reportDate?'color:#333;':''">{{form.reportDate?form.reportDate:'请选择统计日期'}} @@ -16,26 +16,410 @@ 统计时段: - + {{index>-1?array[index].dictLabel:'请选择统计时段'}} + :style="index>-1?'color:#333;':''">{{timeName ? timeName :'请选择统计时段'}} + + + + 运行数据-{{index+1}} + + + + 名称: + + + {{item.busUnit ? item.busUnit : '请选择'}} + + + + + + 投入车辆: + + + + + + + 投入车辆环比(%) + + {{item.vehicleInputMom === 0 ? item.vehicleInputMom : item.vehicleInputMom ? item.vehicleInputMom.toFixed(2) : ''}} + + + + + 投入车辆同比(%) + + {{item.vehicleInputYoy === 0 ? item.vehicleInputYoy : item.vehicleInputYoy ? item.vehicleInputYoy.toFixed(2) : ''}} + + + + + 运行班次: + + + + + + + 运行班次环比(%) + + {{item.operatingShiftsMom === 0 ? item.operatingShiftsMom : item.operatingShiftsMom ? item.operatingShiftsMom.toFixed(2) : ''}} + + + + + 运行班次同比(%) + + {{item.operatingShiftsYoy === 0 ? item.operatingShiftsYoy : item.operatingShiftsYoy ? item.operatingShiftsYoy.toFixed(2) : ''}} + + + + + 人数(万人): + + + + + + + 人数环比(%) + + {{item.passengerCountMom === 0 ? item.passengerCountMom : item.passengerCountMom ? item.passengerCountMom.toFixed(2) : ''}} + + + + + 人数同比(%) + + {{item.passengerCountYoy === 0 ? item.passengerCountYoy : item.passengerCountYoy ? item.passengerCountYoy.toFixed(2) : ''}} + + + + + 昨日投入车辆: + + + + + + 昨日运行班次: + + + + + + 昨日人数: + + + + + + 去年投入车辆: + + + + + + 去年运行班次: + + + + + + 去年人数: + + + + + + + 增行 + + + 取消 + 确认 + @@ -63,6 +447,10 @@ background-color: #fff; border-radius: 30rpx; + &.bottom{ + margin-top: 30rpx; + } + //环比同比 .form_item_rate{ background: #F6F6F6; @@ -173,6 +561,57 @@ } } } + + } + } + //增行 + .line { + height: 1px; + background-color: #E1E1E1; + } + + .add_btn { + height: 90rpx; + line-height: 90rpx; + color: #2D8CF0; + font-size: 28rpx; + font-family: PingFang SC-Regular, PingFang SC; + font-weight: 400; + text-align: center; + background: #ECF5FF; + border-radius: 30rpx; + border: 2rpx solid #2D8CF0; + margin-top: 30rpx; + } + .foot_btn { + position: fixed; + left: 0; + right: 0; + bottom: 0; + display: flex; + justify-content: space-between; + padding: 40rpx 30rpx; + background-color: #f5f5f5; + z-index: 11; + + .act_btn { + width: 329rpx; + height: 90rpx; + color: #666666; + font-size: 28rpx; + line-height: 90rpx; + font-family: PingFang SC-Regular, PingFang SC; + font-weight: 400; + text-align: center; + background: #F6F6F6; + border-radius: 100rpx; + border: 1rpx solid #C1C1C1; + + &.blue { + color: #fff; + background: #2D8CF0; + border-color: #2D8CF0; + } } } diff --git a/pages/bus/busDataInfo/list.vue b/pages/bus/busDataInfo/list.vue index fcbc70b..87bf93f 100644 --- a/pages/bus/busDataInfo/list.vue +++ b/pages/bus/busDataInfo/list.vue @@ -137,7 +137,7 @@ // 跳转编辑页面 editItem(row){ uni.navigateTo({ - url:"/pages/bus/busDataInfo/form?pageFrom=edit&item=" + JSON.stringify(row) + url:"/pages/bus/busDataInfo/form?type=edit&item=" + JSON.stringify(row) }) }, } diff --git a/pages/roadTransport/quantitySent/form.vue b/pages/roadTransport/quantitySent/form.vue index c715e14..2ee890d 100644 --- a/pages/roadTransport/quantitySent/form.vue +++ b/pages/roadTransport/quantitySent/form.vue @@ -69,7 +69,7 @@