From f2485e01843a569549bef74aa65ac44df3cfaa3b Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 03 二月 2026 17:58:21 +0800
Subject: [PATCH] 库存管理-合格库存 增加条形码和二维码
---
src/views/basicData/product/ImportExcel/index.vue | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/src/views/basicData/product/ImportExcel/index.vue b/src/views/basicData/product/ImportExcel/index.vue
index c25d254..68b6913 100644
--- a/src/views/basicData/product/ImportExcel/index.vue
+++ b/src/views/basicData/product/ImportExcel/index.vue
@@ -3,15 +3,36 @@
瀵煎叆
</el-button>
<el-dialog v-model="upload.open" :title="upload.title">
- <FileUpload
- ref="fileUploadRef"
+ <el-upload
+ ref="uploadRef"
+ :limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
- :showTip="false"
- @success="handleFileSuccess"
- />
+ :before-upload="upload.beforeUpload"
+ :on-progress="upload.onProgress"
+ :on-success="upload.onSuccess"
+ :on-error="upload.onError"
+ :on-change="upload.onChange"
+ :auto-upload="false"
+ drag
+ >
+ <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+ <template #tip>
+ <div class="el-upload__tip text-center">
+ <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+ <el-link
+ type="primary"
+ :underline="false"
+ style="font-size: 12px; vertical-align: baseline"
+ @click="handleDownloadTemplate"
+ >涓嬭浇妯℃澘</el-link
+ >
+ </div>
+ </template>
+ </el-upload>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
@@ -22,17 +43,18 @@
</template>
<script setup>
-import { reactive } from "vue";
+import { reactive, ref, getCurrentInstance } from "vue";
import { getToken } from "@/utils/auth.js";
-import { FileUpload } from "@/components/Upload";
import { ElMessage } from "element-plus";
+import { UploadFilled } from "@element-plus/icons-vue";
defineOptions({
name: "浜у搧缁存姢瀵煎叆",
});
const emits = defineEmits(["uploadSuccess"]);
-const fileUploadRef = ref();
+const uploadRef = ref();
+const { proxy } = getCurrentInstance();
const upload = reactive({
// 鏄惁鏄剧ず寮瑰嚭灞傦紙渚涘簲鍟嗗鍏ワ級
open: false,
@@ -44,6 +66,20 @@
headers: { Authorization: "Bearer " + getToken() },
// 涓婁紶鐨勫湴鍧�
url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import",
+ updateSupport: false,
+ beforeUpload: () => {
+ upload.isUploading = true;
+ },
+ onProgress: () => {},
+ onChange: () => {},
+ onError: () => {
+ upload.isUploading = false;
+ ElMessage({ message: "涓婁紶澶辫触", type: "error" });
+ },
+ onSuccess: (response) => {
+ upload.isUploading = false;
+ handleFileSuccess(response);
+ },
});
// 鐐瑰嚮瀵煎叆
const handleImport = () => {
@@ -51,8 +87,13 @@
upload.title = "浜у搧瀵煎叆";
};
+// 涓嬭浇瀵煎叆妯℃澘
+const handleDownloadTemplate = () => {
+ proxy.download("/basic/product/downloadTemplate", {}, "浜у搧瀵煎叆妯℃澘.xlsx");
+};
+
const submitFileForm = () => {
- fileUploadRef.value.uploadApi();
+ uploadRef.value.submit();
};
const handleFileSuccess = (response) => {
--
Gitblit v1.9.3