From f02160e1f583f063dc01499634311ef981cfe894 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 27 一月 2026 16:40:05 +0800
Subject: [PATCH] 库存管理: 新增库存增加预警数量
---
src/views/inventoryManagement/stockManagement/Import.vue | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/src/views/inventoryManagement/stockManagement/Import.vue b/src/views/inventoryManagement/stockManagement/Import.vue
new file mode 100644
index 0000000..2f3ff00
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/Import.vue
@@ -0,0 +1,93 @@
+<template>
+ <el-dialog v-model="isShow" title="瀵煎叆搴撳瓨" @close="closeModal">
+ <FileUpload
+ ref="fileUploadRef"
+ accept=".xlsx, .xls"
+ :headers="upload.headers"
+ :action="upload.url"
+ :disabled="upload.isUploading"
+ :showTip="true"
+ @success="handleFileSuccess"
+ :downloadTemplate="downloadTemplate"
+ />
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+ <el-button @click="closeModal">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+</template>
+
+<script setup>
+import {computed, getCurrentInstance, reactive} from "vue";
+import { getToken } from "@/utils/auth.js";
+import { FileUpload } from "@/components/Upload";
+import { ElMessage } from "element-plus";
+
+defineOptions({
+ name: "瀵煎叆搴撳瓨",
+});
+
+const { proxy } = getCurrentInstance()
+
+const props = defineProps({
+ visible: {
+ type: Boolean,
+ required: true,
+ },
+
+ type: {
+ type: String,
+ required: true,
+ default: 'qualified',
+ },
+});
+
+const emit = defineEmits(['update:visible', 'uploadSuccess']);
+
+
+const isShow = computed({
+ get() {
+ return props.visible;
+ },
+ set(val) {
+ emit('update:visible', val);
+ },
+});
+
+const fileUploadRef = ref();
+const upload = reactive({
+ // 鏄惁鏄剧ず寮瑰嚭灞傦紙搴撳瓨瀵煎叆锛�
+ open: false,
+ // 鏄惁绂佺敤涓婁紶
+ isUploading: false,
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/stockInventory/importStockInventory",
+});
+
+const submitFileForm = () => {
+ fileUploadRef.value.uploadApi();
+};
+
+const handleFileSuccess = (response) => {
+ const { code, msg } = response;
+ if (code == 200) {
+ ElMessage({ message: "瀵煎叆鎴愬姛", type: "success" });
+ emit('uploadSuccess');
+ closeModal();
+ } else {
+ ElMessage({ message: msg, type: "error" });
+ }
+};
+
+const downloadTemplate = () => {
+ proxy.download("/stockInventory/downloadStockInventory", {}, "搴撳瓨瀵煎叆妯℃澘.xlsx");
+}
+
+const closeModal = () => {
+ isShow.value = false;
+};
+</script>
--
Gitblit v1.9.3