diff --git a/src/api/customerService/product/index.ts b/src/api/customerService/product/index.ts index cdfa43d..5d1fe00 100644 --- a/src/api/customerService/product/index.ts +++ b/src/api/customerService/product/index.ts @@ -47,11 +47,14 @@ export function exportProduct(data: object) { } //导入产品 -export function importProduct(data: object) { +export function importProduct(data: FormData) { return newService({ url: '/customerService/product/import', - responseType: 'blob', method: 'post', data: data, + headers: { + 'Content-Type': 'multipart/form-data', // 文件上传需要使用form-data + }, + timeout: 60000, // 文件上传可能较慢 }); } diff --git a/src/api/customerService/report/index.ts b/src/api/customerService/report/index.ts index 43ce7ad..f36f9cf 100644 --- a/src/api/customerService/report/index.ts +++ b/src/api/customerService/report/index.ts @@ -8,3 +8,13 @@ export function getDataList(data: object) { params: data, }); } + +// 导出数据 +export function exportProduct(data: object) { + return newService({ + url: '/customerService/data/statistics/export', + responseType: 'blob', + method: 'get', + params: data, + }); +} diff --git a/src/views/customerService/product/component/importDialog.vue b/src/views/customerService/product/component/importDialog.vue index c3ae637..0c1acd4 100644 --- a/src/views/customerService/product/component/importDialog.vue +++ b/src/views/customerService/product/component/importDialog.vue @@ -1,7 +1,12 @@ @@ -333,7 +326,6 @@ onMounted(() => { width: 240px; } -// 表格操作按钮样式 :deep(.el-table) { .el-button { margin: 0 2px; @@ -344,7 +336,6 @@ onMounted(() => { } } -// 分页样式 :deep(.pagination-container) { margin-top: 15px; padding: 10px 0; diff --git a/src/views/customerService/report/component/exportDialog.vue b/src/views/customerService/report/component/exportDialog.vue new file mode 100644 index 0000000..28947ae --- /dev/null +++ b/src/views/customerService/report/component/exportDialog.vue @@ -0,0 +1,99 @@ + + + diff --git a/src/views/customerService/report/index.vue b/src/views/customerService/report/index.vue index 17a4881..7d40143 100644 --- a/src/views/customerService/report/index.vue +++ b/src/views/customerService/report/index.vue @@ -73,6 +73,7 @@ @pagination="dataList" /> + @@ -80,6 +81,7 @@ import { ref, reactive, onMounted, nextTick } from 'vue'; import { ElMessageBox, ElMessage, FormInstance } from 'element-plus'; import { getDataList } from '/@/api/customerService/report'; +import expotDialog from '/@/views/customerService/report/component/exportDialog.vue'; // 定义接口 interface TableDataRow { @@ -227,10 +229,11 @@ const resetQuery = (formEl: FormInstance | undefined) => { dataList(); }); }; - +const expotDialogRef = ref(); // 导出数据 const handleExport = () => { - ElMessage.info('导出功能开发中'); + // ElMessage.info('导出功能开发中'); + expotDialogRef.value?.openDialog(tableData.param); }; // 初始化表格数据 diff --git a/src/views/customerService/script/index.vue b/src/views/customerService/script/index.vue index e33ff41..cfbb26f 100644 --- a/src/views/customerService/script/index.vue +++ b/src/views/customerService/script/index.vue @@ -4,7 +4,22 @@