From ec3f9edf04a3b45ba6155156b2d3096ac1db530f Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Mon, 31 Mar 2025 13:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product/index.js | 9 + src/utils/downloadRequest.js | 2 +- src/views/component/imports.vue | 11 +- src/views/customer/components/addMessage.vue | 21 ++ src/views/order/index.vue | 10 +- src/views/product/components/addPhase.vue | 198 +++++++++++++++++-- src/views/product/components/addProduct.vue | 4 +- src/views/product/components/imports.vue | 154 +++++++++++++++ src/views/product/index.vue | 21 +- 9 files changed, 396 insertions(+), 34 deletions(-) create mode 100644 src/views/product/components/imports.vue diff --git a/src/api/product/index.js b/src/api/product/index.js index b8ae70c..800ddbf 100644 --- a/src/api/product/index.js +++ b/src/api/product/index.js @@ -55,6 +55,15 @@ export function destroy(params) { }) } +export function imports(params) { + return request({ + method: "get", + url: "​/api​/admin​/product​/import", + params + }) +} + + diff --git a/src/utils/downloadRequest.js b/src/utils/downloadRequest.js index d3d86ef..90294df 100644 --- a/src/utils/downloadRequest.js +++ b/src/utils/downloadRequest.js @@ -48,7 +48,7 @@ export async function download(url, method = "get", info, filename) { url, method, responseType: "blob", - timeout: 10000, + timeout: 30000, headers: { Accept: "application/json", "Content-Type": "application/json; charset=utf-8", diff --git a/src/views/component/imports.vue b/src/views/component/imports.vue index fd62748..4138906 100644 --- a/src/views/component/imports.vue +++ b/src/views/component/imports.vue @@ -17,9 +17,6 @@ style="margin-top: 10px" drag :action="action" - :data="{ - table_name: tableName, - }" :headers="{ Authorization: `Bearer ${getToken()}`, }" @@ -44,6 +41,8 @@ import * as XLSX from "xlsx"; import { saveAs } from "file-saver"; import { getToken } from "@/utils/auth"; import { imports } from "@/api/system/baseForm"; +import { imports as importProduct } from "@/api/product/index"; + export default { props: { formInfo: { @@ -54,10 +53,9 @@ export default { }, data() { return { - action: `${process.env.VUE_APP_BASE_API}/api/admin/base-form/excel-show`, + action: `${process.env.VUE_APP_BASE_API}/api/admin/product/import`, dialogVisible: false, headers: [], - tableList: [], table: [], }; @@ -104,8 +102,7 @@ export default { }, imports() { - imports({ - table_name: this.tableName, + importProduct({ data: this.tableList }).then(res => { console.log(res) diff --git a/src/views/customer/components/addMessage.vue b/src/views/customer/components/addMessage.vue index 8329c13..9211155 100644 --- a/src/views/customer/components/addMessage.vue +++ b/src/views/customer/components/addMessage.vue @@ -59,6 +59,18 @@ + + + + + + + + +