From dc3fc550fe292043cc452dc9aeb0c8a1eeab3b30 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 24 九月 2026 16:54:39 +0800
Subject: [PATCH] feat: 新增多模块导入导出入口
---
src/views/inventoryManagement/receiptManagement/Record.vue | 90 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index 344bf50..020b3ff 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -84,6 +84,10 @@
@click="handleBatchApprove">瀹℃壒</el-button>
<el-button :disabled="!canReverseApprove"
@click="handleReverseApprove">鍙嶅</el-button> -->
+ <el-button type="info"
+ plain
+ icon="Upload"
+ @click="handleImport">瀵煎叆</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
<el-button type="danger"
plain
@@ -173,6 +177,42 @@
:limit="page.size"
@pagination="pageProductChange"/>
</div>
+ <!-- 鍏ュ簱瀵煎叆瀵硅瘽妗� -->
+ <el-dialog :title="upload.title"
+ v-model="upload.open"
+ width="400px"
+ append-to-body>
+ <el-upload ref="uploadRef"
+ :limit="1"
+ accept=".xlsx, .xls"
+ :headers="upload.headers"
+ :action="upload.url"
+ :disabled="upload.isUploading"
+ :on-progress="handleFileUploadProgress"
+ :on-success="handleFileSuccess"
+ :on-error="handleFileError"
+ :auto-upload="false"
+ drag>
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+ <template #tip>
+ <div class="el-upload__tip text-center">
+ <span>浠呭厑璁稿鍏� xls銆亁lsx 鏍煎紡鏂囦欢銆�</span>
+ <el-link type="primary"
+ :underline="false"
+ style="font-size: 12px; vertical-align: baseline"
+ @click="importTemplate">涓嬭浇妯℃澘</el-link>
+ </div>
+ </template>
+ </el-upload>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitFileForm">纭� 瀹�</el-button>
+ <el-button @click="upload.open = false">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -198,6 +238,7 @@
// findAllUnQualifiedStockInRecordTypeOptions,
} from "@/api/basicData/enum.js";
import { parseTime } from "@/utils/ruoyi";
+import { getToken } from "@/utils/auth.js";
const {proxy} = getCurrentInstance();
@@ -454,6 +495,55 @@
});
};
+// 瀵煎叆
+const uploadRef = ref();
+const upload = reactive({
+ open: false,
+ title: "",
+ isUploading: false,
+ headers: { Authorization: "Bearer " + getToken() },
+ url: import.meta.env.VITE_APP_BASE_API + "/stockInRecord/import?type=" + props.type,
+});
+const handleImport = () => {
+ upload.title = "鍏ュ簱瀵煎叆";
+ upload.open = true;
+};
+const importTemplate = () => {
+ proxy.download("/stockInRecord/importTemplate", {}, "鍏ュ簱瀵煎叆妯℃澘.xlsx");
+};
+const submitFileForm = () => {
+ upload.isUploading = true;
+ uploadRef.value.submit();
+};
+const handleFileUploadProgress = () => {
+ upload.isUploading = true;
+};
+const handleFileSuccess = (response) => {
+ upload.isUploading = false;
+ upload.open = false;
+ uploadRef.value.clearFiles();
+ if (response.code === 200) {
+ const failCount = response.failCount || 0;
+ if (failCount > 0) {
+ const errors = Array.isArray(response.errors) ? response.errors : [];
+ proxy.$modal.alert(`${response.msg}\n\n${errors.join("\n")}`, "瀵煎叆缁撴灉", {
+ confirmButtonText: "鐭ラ亾浜�",
+ }).then(() => {
+ getList();
+ });
+ } else {
+ proxy.$modal.msgSuccess(response.msg || "瀵煎叆鎴愬姛");
+ getList();
+ }
+ } else {
+ proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
+ }
+};
+const handleFileError = () => {
+ upload.isUploading = false;
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+};
+
onMounted(() => {
getList();
fetchStockRecordTypeOptions();
--
Gitblit v1.9.3