From 0c116b0f5624786bd06990b86c467be25e2411fd Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 26 一月 2026 17:51:38 +0800
Subject: [PATCH] feat: BOM导入模板下载,导入导出接口添加菜单权限

---
 src/views/inventoryManagement/stockManagement/Import.vue |   86 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 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..1dbce95
--- /dev/null
+++ b/src/views/inventoryManagement/stockManagement/Import.vue
@@ -0,0 +1,86 @@
+<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="false"
+      @success="handleFileSuccess"
+    />
+    <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, reactive} from "vue";
+import { getToken } from "@/utils/auth.js";
+import { FileUpload } from "@/components/Upload";
+import { ElMessage } from "element-plus";
+
+defineOptions({
+  name: "瀵煎叆搴撳瓨",
+});
+
+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 closeModal = () => {
+  isShow.value = false;
+};
+</script>

--
Gitblit v1.9.3