|
@@ -127,7 +127,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import moment from 'moment'
|
|
|
import getDate from '@/libs/getDate.js'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import rangeDate from '@/views/common/rangeDate.vue'
|
|
@@ -137,6 +136,7 @@ import reportModal from '@/views/common/reportModal.vue'
|
|
|
import { getArea } from '@/api/data'
|
|
|
import ProductBrand from '@/views/common/productBrand.js'
|
|
|
import ProductType from '@/views/common/productType.js'
|
|
|
+import { hdExportExcel } from '@/libs/exportExcel'
|
|
|
import { headRebateDetailReportList, headRebateDetailReportCount, headRebateDetailReportExport } from '@/api/reportData'
|
|
|
export default {
|
|
|
components: { STable, VSelect, custList, subarea, rangeDate, ProductBrand, ProductType, reportModal },
|
|
@@ -245,40 +245,21 @@ export default {
|
|
|
// 导出
|
|
|
handleExport () {
|
|
|
const _this = this
|
|
|
- const params = this.queryParam
|
|
|
- this.exportLoading = true
|
|
|
- _this.spinning = true
|
|
|
- headRebateDetailReportExport(params).then(res => {
|
|
|
- this.exportLoading = false
|
|
|
- _this.showExport = true
|
|
|
- _this.spinning = false
|
|
|
- if (res.type == 'application/json') {
|
|
|
- var reader = new FileReader()
|
|
|
- reader.addEventListener('loadend', function () {
|
|
|
- const obj = JSON.parse(reader.result)
|
|
|
- _this.$notification.error({
|
|
|
- message: '提示',
|
|
|
- description: obj.message
|
|
|
- })
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ const params = _this.queryParam
|
|
|
+ _this.showExport = true
|
|
|
+ _this.exportLoading = true
|
|
|
+ _this.spinning = true
|
|
|
+ hdExportExcel(headRebateDetailReportExport, params, '总部差价明细报表', function () {
|
|
|
+ _this.exportLoading = false
|
|
|
+ _this.spinning = false
|
|
|
})
|
|
|
- reader.readAsText(res)
|
|
|
} else {
|
|
|
- this.download(res)
|
|
|
+ return false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- 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()
|
|
|
- },
|
|
|
// 盘点库存日期
|
|
|
handleStock () {
|
|
|
this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
|