|
@@ -53,9 +53,7 @@
|
|
|
:showSearch="true"
|
|
|
option-filter-prop="children"
|
|
|
:filter-option="filterOption"
|
|
|
- @focus="handleFocus"
|
|
|
- @blur="handleBlur"
|
|
|
- @change="handleChange">
|
|
|
+ >
|
|
|
<a-select-option v-for="item in optionData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
@@ -73,9 +71,9 @@
|
|
|
</div>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="20">
|
|
|
-
|
|
|
+ <a-col :span="4">
|
|
|
+ <a-button class="export-btn" id="releaseRecordList-export" v-hasPermission="'B_exportDeliveryLog'" :loading="loading" @click="handleExport">导出</a-button>
|
|
|
+ </a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
|
</div>
|
|
@@ -130,13 +128,14 @@
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { getDeliveryLogList, getDeliveryLogTotal, stationList } from '@/api/releaseRecord.js'
|
|
|
+import { getDeliveryLogList, getDeliveryLogTotal, stationList, exportDeliveryLog } from '@/api/releaseRecord.js'
|
|
|
import moment from 'moment'
|
|
|
import getDate from '@/libs/getDate.js'
|
|
|
export default {
|
|
|
components: { STable, VSelect },
|
|
|
data () {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
form: this.$form.createForm(this),
|
|
|
formItemLayout: {
|
|
|
labelCol: { span: 4 },
|
|
@@ -231,57 +230,78 @@ export default {
|
|
|
this.queryParam.endDate = dateStrings[1]
|
|
|
}
|
|
|
},
|
|
|
- handleChange (value) {
|
|
|
- console.log(`selected ${value}`)
|
|
|
- },
|
|
|
- handleBlur () {
|
|
|
- console.log('blur')
|
|
|
- },
|
|
|
- handleFocus () {
|
|
|
- console.log('focus')
|
|
|
- },
|
|
|
filterOption (input, option) {
|
|
|
return (
|
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
)
|
|
|
},
|
|
|
+ // 导出
|
|
|
+ handleExport () {
|
|
|
+ const params = this.queryParam
|
|
|
+ if (this.queryOrderDate && this.queryOrderDate.length) {
|
|
|
+ params.beginDate = moment(this.queryOrderDate[0]).format('YYYY-MM-DD')
|
|
|
+ params.endDate = moment(this.queryOrderDate[1]).format('YYYY-MM-DD')
|
|
|
+ } 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 => {
|
|
|
+ this.loading = false
|
|
|
+ this.download(res)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ download (data) {
|
|
|
+ if (!data) { return }
|
|
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = url
|
|
|
+ const a = moment().format('YYYYMMDDhhmmss')
|
|
|
+ const fname = '投放记录-' + a
|
|
|
+ link.setAttribute('download', fname + '.xlsx')
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ },
|
|
|
// 查询
|
|
|
refresh () {
|
|
|
- // const isONull = this.queryParam.goldNumStart === null
|
|
|
- // const isOEmpty = this.queryParam.goldNumStart === ''
|
|
|
- // const isOZero = this.queryParam.goldNumStart === 0
|
|
|
const isTNull = this.queryParam.goldNumEnd === null
|
|
|
const isTEmpty = this.queryParam.goldNumEnd === ''
|
|
|
- const isRNull = this.queryParam.rubbishWeightEnd === null
|
|
|
- const isREmpty = this.queryParam.rubbishWeightEnd === ''
|
|
|
- // const isTZero = this.queryParam.goldNumEnd === 0
|
|
|
- // // 第一个为空(可为null可为空字符)第二个不为空
|
|
|
- // // 第一个不为空第二个为空(可为null可为空字符)
|
|
|
- // // 第一个大于第二个
|
|
|
- if ((this.queryParam.goldNumStart > this.queryParam.goldNumEnd) && !(isTNull || isTEmpty)) {
|
|
|
- this.$message.error('请输入正确的查询范围!')
|
|
|
- return
|
|
|
- }
|
|
|
- if ((this.queryParam.rubbishWeightStart > this.queryParam.rubbishWeightEnd) && !(isRNull || isREmpty)) {
|
|
|
- this.$message.error('请输入正确的查询范围!')
|
|
|
- return
|
|
|
- }
|
|
|
- this.queryParam.goldNumStart = this.queryParam.goldNumStart > 999999999 ? 999999999 : this.queryParam.goldNumStart
|
|
|
- this.queryParam.goldNumEnd = this.queryParam.goldNumEnd > 999999999 ? 999999999 : this.queryParam.goldNumEnd
|
|
|
- this.queryParam.rubbishWeightStart = this.queryParam.rubbishWeightStart > 999999999 ? 999999999 : this.queryParam.rubbishWeightStart
|
|
|
- this.queryParam.rubbishWeightEnd = this.queryParam.rubbishWeightEnd > 999999999 ? 999999999 : this.queryParam.rubbishWeightEnd
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ const isRNull = this.queryParam.rubbishWeightEnd === null
|
|
|
+ const isREmpty = this.queryParam.rubbishWeightEnd === ''
|
|
|
+ // 第一个为空(可为null可为空字符)第二个不为空
|
|
|
+ // 第一个不为空第二个为空(可为null可为空字符)
|
|
|
+ // 第一个大于第二个
|
|
|
+ if ((this.queryParam.goldNumStart > this.queryParam.goldNumEnd) && !(isTNull || isTEmpty)) {
|
|
|
+ this.$message.error('请输入正确的查询范围!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if ((this.queryParam.rubbishWeightStart > this.queryParam.rubbishWeightEnd) && !(isRNull || isREmpty)) {
|
|
|
+ this.$message.error('请输入正确的查询范围!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.queryParam.goldNumStart = this.queryParam.goldNumStart > 999999999 ? 999999999 : this.queryParam.goldNumStart
|
|
|
+ this.queryParam.goldNumEnd = this.queryParam.goldNumEnd > 999999999 ? 999999999 : this.queryParam.goldNumEnd
|
|
|
+ this.queryParam.rubbishWeightStart = this.queryParam.rubbishWeightStart > 999999999 ? 999999999 : this.queryParam.rubbishWeightStart
|
|
|
+ this.queryParam.rubbishWeightEnd = this.queryParam.rubbishWeightEnd > 999999999 ? 999999999 : this.queryParam.rubbishWeightEnd
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
},
|
|
|
// 获取合作商数据
|
|
|
getStationList () {
|
|
|
- stationList().then(res => {
|
|
|
- console.log(res, '-----合作商')
|
|
|
- if (res.status == 200) {
|
|
|
- this.optionData = res.data || []
|
|
|
- }
|
|
|
- })
|
|
|
+ stationList().then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.optionData = res.data || []
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
// 合计
|
|
|
getListTotal () {
|
|
|
const params = {
|
|
@@ -310,28 +330,27 @@ export default {
|
|
|
this.orderTotal = res.data.totalNum || 0
|
|
|
this.amountTotal = res.data.goldNum || 0
|
|
|
} else {
|
|
|
- this.orderTotal = 0
|
|
|
- this.amountTotal = 0
|
|
|
- }
|
|
|
+ this.orderTotal = 0
|
|
|
+ this.amountTotal = 0
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 重置
|
|
|
handleReset () {
|
|
|
- // this.queryOrderDate = undefined
|
|
|
- this.queryOrderDate = [
|
|
|
- moment(getDate.getRecentday().starttime, this.dateFormat),
|
|
|
- moment(getDate.getRecentday().endtime, this.dateFormat)
|
|
|
- ],
|
|
|
+ this.queryOrderDate = [
|
|
|
+ moment(getDate.getRecentday().starttime, this.dateFormat),
|
|
|
+ moment(getDate.getRecentday().endtime, this.dateFormat)
|
|
|
+ ]
|
|
|
this.queryParam.customerMobile = ''
|
|
|
this.queryParam.srcDeviceCode = ''
|
|
|
this.queryParam.stationNo = undefined
|
|
|
- this.queryParam.rubbishType = '' // 投放类型
|
|
|
- this.queryParam.goldNumStart = '' // 兑换最小值
|
|
|
- this.queryParam.goldNumEnd = '' // 兑换最大值
|
|
|
+ this.queryParam.rubbishType = '' // 投放类型
|
|
|
+ this.queryParam.goldNumStart = '' // 兑换最小值
|
|
|
+ this.queryParam.goldNumEnd = '' // 兑换最大值
|
|
|
this.queryParam.rubbishWeightStart = ''// 投放重量最小值
|
|
|
- this.queryParam.rubbishWeightEnd = '' // 投放重量最大值
|
|
|
- this.queryParam.deliveryWay = '' // 投放方式
|
|
|
+ this.queryParam.rubbishWeightEnd = '' // 投放重量最大值
|
|
|
+ this.queryParam.deliveryWay = '' // 投放方式
|
|
|
this.$refs.table.refresh(true)
|
|
|
}
|
|
|
}
|