Commit 55202e4a authored by dragondean@qq.com's avatar dragondean@qq.com

订单导出改异步下载

parent 77558614
......@@ -632,7 +632,6 @@ export function orderExportSearch(params){
url: '/ecw/order/export/search',
method: 'GET',
timeout: 5 * 60000,
responseType: 'arraybuffer',
params
})
}
......@@ -641,7 +640,6 @@ export function orderExportSearch(params){
export function orderExportMySearch(params){
return request({
url: '/ecw/order/export/my/search',
responseType: 'arraybuffer',
method: 'GET',
timeout: 5 * 60000,
params
......@@ -653,7 +651,6 @@ export function orderExportDeptSearch(params){
return request({
url: '/ecw/order/export/dept/search',
method: 'GET',
responseType: 'arraybuffer',
timeout: 5 * 60000,
params
})
......@@ -666,7 +663,6 @@ export function exportAbnormal(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -678,7 +674,6 @@ export function exportHeavyOrder(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -689,7 +684,6 @@ export function exportReturnOrder(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -700,7 +694,6 @@ export function exportSaleRepay(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -712,7 +705,6 @@ export function exportCustomsDatas(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -724,7 +716,6 @@ export function exportShippingDatas(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -736,7 +727,6 @@ export function exportShipFee(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......@@ -748,7 +738,6 @@ export function exportUnload(params){
method: 'get',
params: params,
timeout: 5 * 60000,
responseType: 'blob'
})
}
......
import request from '@/utils/request'
import axios from "axios";
// 下载日志分页
export function downloadPage(params) {
......@@ -8,3 +9,15 @@ export function downloadPage(params) {
params
})
}
// 下载
export function download(id){
return request({
url: 'system/download-log/down/' + id
})
}
// 获取文件二进制
export function downloadFileResponse(url){
return axios.get(url)
}
......@@ -123,6 +123,8 @@ export const DICT_TYPE = {
STOCK_UP_EXCEPTION_TYPE: 'stock_up_exception_type', // 备货异常类型,
ORDER_ITEM_PACK_STATUS: 'order_item_pack_status', // 空运备货打包状态
RECEIPT_FEE_TYPE:'receipt_fee_type',
DOWNLOAD_LOG_STATUS: 'download_log_status', // 下载日志状态
DOWNLOAD_TYPE: 'download_type', // 下载类型
//--------ecw---------
CUSTOMER_STATUS: 'customer_status',
CUSTOMER_SOURCE: 'customer_source',
......
......@@ -792,7 +792,8 @@ export default {
if(!fileName){
fileName = this.$t('订单')
}
this.$download.excel(res, fileName + '.xls');
this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
// this.$download.excel(res, fileName + '.xls');
}).finally(() => {
this.exportLoading = false
})
......
<template>
<div class="app-container">
<div class="mb-10">
<h2 class="page-title mb-5">下载队列</h2>
<div>*{{$t('文件生成成功后,保留12小时,12小时后自动删除')}}</div>
<div class="mb-10 flex items-center">
<div class="flex-1">
<h2 class="page-title mb-5">下载队列</h2>
<div>*{{$t('文件生成成功后,保留12小时,12小时后自动删除')}}</div>
</div>
<el-button class="" @click="handleQuery" type="primary">刷新</el-button>
</div>
<!--el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item :label="$t('文件名称')" prop="fileName">
......@@ -16,20 +19,27 @@
<el-table v-loading="loading" :data="list">
<el-table-column :label="$t('下载编号')" align="center" prop="id" width="100" />
<el-table-column :label="$t('分类')" align="center" prop="type" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('分类')" align="center" prop="type" width="100" >
<template v-slot:default="{row}">
<dict-tag :type="DICT_TYPE.DOWNLOAD_TYPE" :value="row.type"/>
</template>
</el-table-column>
<!--<el-table-column :label="$t('业务编号')" align="center" prop="type" width="100" /-->
<el-table-column :label="$t('下载内容')" align="center" prop="fileName" width="100" />
<el-table-column :label="$t('开始下载时间')" align="center" prop="createTime" width="150">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('下载内容')" align="center" prop="name" />
<el-table-column :label="$t('开始下载时间')" align="center" prop="createTime" width="150">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('下载状态')" align="center" prop="createBy" width="150">
<template v-slot:default="{row}">
{{statusMap[row.status]}}
<!--status ==2 表示已处理,配合downNum来判断是否已下载-->
<template v-if="row.status == 2 && row.downNum > 0">{{$t('已下载')}}</template>
<template v-else-if="row.status == 2">{{$t('待下载')}}</template>
<dict-tag v-else :type="DICT_TYPE.DOWNLOAD_LOG_STATUS" :value="row.status"/>
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="200">
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width" width="100">
<template slot-scope="scope" >
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleDownload(scope.row)"
v-hasPermi="['system:notice:update']">{{$t('下载')}}</el-button>
......@@ -44,7 +54,7 @@
</template>
<script>
import {downloadPage} from "@/api/system/download";
import {download, downloadFileArrayBuffer, downloadFileResponse, downloadPage} from "@/api/system/download";
import {parseTime} from "../../../utils/ruoyi";
import Template from "@/views/cms/template/index.vue";
......@@ -61,13 +71,7 @@ export default {
queryParams: {
pageNo: 1,
pageSize: 10
},
statusMap: {
0: "待处理",
1:"处理中",
2: "处理成功",
3: "处理失败"
}
}
};
},
created() {
......@@ -76,13 +80,20 @@ export default {
methods: {
parseTime,
handleDownload(row){
console.log('下载', row)
const loading = this.$loading()
download(row.id).then(res => {
return downloadFileResponse(res.data)
}).then(res => {
this.$download.download0(res.data, row.name + row.fileSuffix, res.headers['content-type'])
}).finally(() => {
loading.close()
})
},
/** 查询公告列表 */
getList() {
this.loading = true;
downloadPage(this.queryParams).then(response => {
this.noticeList = response.data.list;
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
}).finally(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment