|
@@ -13,6 +13,7 @@ import DataTableSlot from './DataTableSlot.vue';
|
|
|
import EditDrawer from '/src/views/product-manage/product-list/component/EditDrawer.vue';
|
|
|
import NoticeDialog from '/src/views/product-manage/product-list/component/NoticeDialog.vue';
|
|
|
import * as api from '../api';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
|
|
interface Parameter {
|
|
@@ -96,6 +97,31 @@ function handleRefresh() {
|
|
|
}
|
|
|
|
|
|
async function handleDownload() {
|
|
|
+ gridOptions.loading = true;
|
|
|
+ try {
|
|
|
+ const query = {
|
|
|
+ asin: queryParameter?.asin,
|
|
|
+ sku__startswith: queryParameter?.sku,
|
|
|
+ country_code: queryParameter?.country,
|
|
|
+ shop_id: queryParameter?.shop,
|
|
|
+ shop__region: queryParameter?.region,
|
|
|
+ fulfillment_channel: queryParameter?.delivery,
|
|
|
+ status: queryParameter?.status,
|
|
|
+ };
|
|
|
+ const response = await api.exportData(query);
|
|
|
+ const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = url;
|
|
|
+ link.setAttribute('download', '在线商品数据.xlsx');
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ ElMessage.success('数据导出成功!');
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error('数据导出失败,请重试!');
|
|
|
+ console.error(error);
|
|
|
+ } finally {
|
|
|
+ gridOptions.loading = false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
defineExpose({ fetchList });
|