|
@@ -4,10 +4,11 @@
|
|
|
<a-form layout="inline" @keyup.enter.native="refresh">
|
|
|
<a-row :gutter="20">
|
|
|
<a-col :span="8">
|
|
|
- <a-form-item label="投递时间:" :label-col="{ span: 7 }" :wrapper-col="{ span: 17}">
|
|
|
+ <a-form-item label="投递时间:" :label-col="{ span: 5 }" :wrapper-col="{ span: 19}">
|
|
|
<a-range-picker
|
|
|
id="network-time"
|
|
|
v-model="time"
|
|
|
+ style="width: 100%;"
|
|
|
:format="dateFormat"
|
|
|
:showTime="{ format: 'HH'}"
|
|
|
:placeholder="['开始时间','结束时间']"
|
|
@@ -46,7 +47,7 @@
|
|
|
</div>
|
|
|
<!-- 合计 -->
|
|
|
<a-alert type="info" showIcon style="margin-bottom:15px">
|
|
|
- <div class="ftext" slot="message">总计<span> {{ orderTotal }} </span>条,可回收垃圾总计<span> {{ amountTotal }} </span>千克,有害垃圾总计<span> {{ amountTotal }} </span>千克</div>
|
|
|
+ <div class="ftext" slot="message">总计<span> {{ totalNum }} </span>条,可回收垃圾总计<span> {{ recyclTotal }} </span>千克,有害垃圾总计<span> {{ harmTotal }} </span>千克</div>
|
|
|
</a-alert>
|
|
|
<s-table
|
|
|
ref="table"
|
|
@@ -55,39 +56,6 @@
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
bordered>
|
|
|
- <!-- 订单状态 -->
|
|
|
- <template slot="one" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='CLOTHES'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
- <template slot="two" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='PAPER'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </span></template>
|
|
|
- <template slot="three" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='PLASTIC'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
- <template slot="four" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='METAL'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
- <template slot="five" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='HARM'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
- <template slot="six" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='MET_PLA'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
- <template slot="seven" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='GLASS'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
- <template slot="eight" slot-scope="text, record">
|
|
|
- <span v-if="record.rubbishType=='RECYCLING'">{{ record.rubbishWeight }}</span>
|
|
|
- <span v-else>0</span>
|
|
|
- </template>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
|
|
|
@@ -95,8 +63,12 @@
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { getDeliveryLogList, getDeliveryLogTotal, stationList, exportDeliveryLog } from '@/api/releaseRecord.js'
|
|
|
+import {
|
|
|
+ stationList
|
|
|
+} from '@/api/releaseRecord.js'
|
|
|
+import { getPutInTimeList, exportTnTimeForm, getDetailTotal } from '@/api/reportForm.js'
|
|
|
import moment from 'moment'
|
|
|
+import getDate from '@/libs/getDate.js'
|
|
|
export default {
|
|
|
components: { STable, VSelect },
|
|
|
data () {
|
|
@@ -107,8 +79,11 @@ export default {
|
|
|
labelCol: { span: 4 },
|
|
|
wrapperCol: { span: 16 }
|
|
|
},
|
|
|
- // 将默认当天时间日期回显在时间选择框中
|
|
|
- time: [],
|
|
|
+ // 将默认近七天时间日期回显在时间选择框中
|
|
|
+ time: [
|
|
|
+ moment(getDate.getRecentday().starttime, 'YYYY-MM-DD HH'),
|
|
|
+ moment(getDate.getRecentday().endtime, 'YYYY-MM-DD HH')
|
|
|
+ ],
|
|
|
dateFormat: 'YYYY-MM-DD HH',
|
|
|
// 查询参数
|
|
|
queryParam: {
|
|
@@ -117,58 +92,65 @@ export default {
|
|
|
stationNo: undefined // 网点名称
|
|
|
},
|
|
|
optionData: [],
|
|
|
- orderTotal: 0, // 总单数
|
|
|
- amountTotal: 0, // 总金额
|
|
|
+ totalNum: 0, // 总条数
|
|
|
+ recyclTotal: 0, // 可回收总计
|
|
|
+ harmTotal: 0, // 有害垃圾总计
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
|
|
|
- { title: '投放时间', dataIndex: 'deliveryTime', width: 100, align: 'center' },
|
|
|
+ { title: '投递时间', dataIndex: 'putInDate', width: 100, align: 'center' },
|
|
|
{ title: '可回收垃圾投递量(kg)',
|
|
|
children: [
|
|
|
- { title: '废旧衣物', width: 100, align: 'center', scopedSlots: { customRender: 'one' } },
|
|
|
- { title: '废旧纸张', width: 100, align: 'center', scopedSlots: { customRender: 'two' } },
|
|
|
- { title: '废旧塑料', width: 100, align: 'center', scopedSlots: { customRender: 'three' } },
|
|
|
- { title: '废旧金属', width: 100, align: 'center', scopedSlots: { customRender: 'four' } },
|
|
|
- // { title: '有害垃圾', width: 100, align: 'center', scopedSlots: { customRender: 'five' } },
|
|
|
- { title: '废旧金属/塑料', width: 100, align: 'center', scopedSlots: { customRender: 'six' } },
|
|
|
- { title: '废旧玻璃', width: 100, align: 'center', scopedSlots: { customRender: 'seven' } },
|
|
|
- { title: '可回收物', width: 100, align: 'center', scopedSlots: { customRender: 'eight' } }
|
|
|
+ { title: '废旧衣物', width: 100, align: 'center', dataIndex: 'clothesWeight', customRender: (text) => { return text || 0 } },
|
|
|
+ { title: '废旧纸张', width: 100, align: 'center', dataIndex: 'paperWeight', customRender: (text) => { return text || 0 } },
|
|
|
+ { title: '废旧塑料', width: 100, align: 'center', dataIndex: 'plasticWeight', customRender: (text) => { return text || 0 } },
|
|
|
+ { title: '废旧金属', width: 100, align: 'center', dataIndex: 'metalWeight', customRender: (text) => { return text || 0 } },
|
|
|
+ { title: '废旧金属/塑料', width: 100, align: 'center', dataIndex: 'plasticOrMetalWeight', customRender: (text) => { return text || 0 } },
|
|
|
+ { title: '废旧玻璃', width: 100, align: 'center', dataIndex: 'glassWeight', customRender: (text) => { return text || 0 } },
|
|
|
+ { title: '可回收物', width: 100, align: 'center', dataIndex: 'recyclingWeight', customRender: (text) => { return text || 0 } }
|
|
|
]
|
|
|
},
|
|
|
- { title: '有害垃圾(kg)', dataIndex: '', width: 100, align: 'center' }
|
|
|
+ { title: '可回收垃圾小计(kg)', dataIndex: 'recyclTotalWeight', width: 100, align: 'center' },
|
|
|
+ { title: '有害垃圾(kg)', dataIndex: 'harmWeight', width: 100, align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
const searchData = Object.assign(parameter, this.queryParam)
|
|
|
if (this.time && this.time.length) {
|
|
|
- searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD HH')
|
|
|
- searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD HH')
|
|
|
+ searchData.beginDate = moment(this.time[0])
|
|
|
+ searchData.endDate = moment(this.time[1])
|
|
|
} else {
|
|
|
searchData.beginDate = ''
|
|
|
searchData.endDate = ''
|
|
|
}
|
|
|
- return getDeliveryLogList(searchData).then(res => {
|
|
|
+ return getPutInTimeList(searchData).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
const no = (res.data.pageNo - 1) * res.data.pageSize
|
|
|
for (let i = 0; i < res.data.list.length; i++) {
|
|
|
const _item = res.data.list[i]
|
|
|
_item.no = no + i + 1
|
|
|
}
|
|
|
+ this.totalNum = res.data.count
|
|
|
this.getListTotal()
|
|
|
return res.data
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ this.totalNum = 0
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|
|
|
- vm.handleReset()
|
|
|
+ vm.time = [
|
|
|
+ moment(getDate.getRecentday().starttime, 'YYYY-MM-DD HH'),
|
|
|
+ moment(getDate.getRecentday().endtime, 'YYYY-MM-DD HH')
|
|
|
+ ]
|
|
|
+ vm.queryParam.stationNo = undefined
|
|
|
vm.getStationList()
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- moment,
|
|
|
// 不可选日期
|
|
|
disabledDate (date, dateStrings) {
|
|
|
return date && date.valueOf() > Date.now()
|
|
@@ -189,22 +171,21 @@ export default {
|
|
|
handleExport () {
|
|
|
const params = this.queryParam
|
|
|
if (this.time && this.time.length) {
|
|
|
- params.beginDate = moment(this.time[0]).format('YYYY-MM-DD HH')
|
|
|
- params.endDate = moment(this.time[1]).format('YYYY-MM-DD HH')
|
|
|
+ params.beginDate = moment(this.time[0])
|
|
|
+ params.endDate = moment(this.time[1])
|
|
|
} else {
|
|
|
params.beginDate = ''
|
|
|
params.endDate = ''
|
|
|
}
|
|
|
if (!params.beginDate && !params.endDate) {
|
|
|
this.$message.error('请先选择需要导出的投放时间区间再进行导出!')
|
|
|
- return
|
|
|
}
|
|
|
// 判断两个时间段是否相差m个月 第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
|
|
|
if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 3) {
|
|
|
this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
|
|
|
}
|
|
|
this.loading = true
|
|
|
- exportDeliveryLog(params).then(res => {
|
|
|
+ exportTnTimeForm(params).then(res => {
|
|
|
this.loading = false
|
|
|
this.download(res)
|
|
|
})
|
|
@@ -215,8 +196,10 @@ export default {
|
|
|
const link = document.createElement('a')
|
|
|
link.style.display = 'none'
|
|
|
link.href = url
|
|
|
- const a = moment().format('YYYY-MM-DD-HH')
|
|
|
- const fname = a + '分时投递统计'
|
|
|
+ const a = moment(this.queryParam.beginDate).format('LL') + '-' + moment(this.queryParam.endDate).format('LL')
|
|
|
+ console.log(a)
|
|
|
+ const name = this.queryParam.stationNo ? this.optionData.find(item => item.stationNo == this.queryParam.stationNo).name : ''
|
|
|
+ const fname = a + '分时投递统计表' + (name ? '(' + name + ')' : '')
|
|
|
link.setAttribute('download', fname + '.xlsx')
|
|
|
document.body.appendChild(link)
|
|
|
link.click()
|
|
@@ -241,27 +224,30 @@ export default {
|
|
|
stationNo: this.queryParam.stationNo // 网点名称
|
|
|
}
|
|
|
if (this.time && this.time.length) {
|
|
|
- params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
|
|
|
- params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
|
|
|
+ params.beginDate = moment(this.time[0])
|
|
|
+ params.endDate = moment(this.time[1])
|
|
|
} else {
|
|
|
params.beginDate = ''
|
|
|
params.endDate = ''
|
|
|
}
|
|
|
- getDeliveryLogTotal(params).then(res => {
|
|
|
+ getDetailTotal(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
if (res.data) {
|
|
|
- this.orderTotal = res.data.totalNum || 0
|
|
|
- this.amountTotal = res.data.goldNum || 0
|
|
|
+ this.recyclTotal = res.data.recyclAll || 0
|
|
|
+ this.harmTotal = res.data.harmAll || 0
|
|
|
} else {
|
|
|
- this.orderTotal = 0
|
|
|
- this.amountTotal = 0
|
|
|
+ this.recyclTotal = 0
|
|
|
+ this.harmTotal = 0
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 重置
|
|
|
handleReset () {
|
|
|
- this.time = [],
|
|
|
+ this.time = [
|
|
|
+ moment(getDate.getRecentday().starttime, 'YYYY-MM-DD HH'),
|
|
|
+ moment(getDate.getRecentday().endtime, 'YYYY-MM-DD HH')
|
|
|
+ ]
|
|
|
this.queryParam.stationNo = undefined
|
|
|
this.$refs.table.refresh(true)
|
|
|
}
|