From a24c34af0c00a59c94e1a6ebc2cbbc0814215f21 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 17 三月 2026 14:39:27 +0800
Subject: [PATCH] fix: 新增库存(半成品)时,没有库存数量输入框

---
 src/views/equipmentManagement/repair/index.vue |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/src/views/equipmentManagement/repair/index.vue b/src/views/equipmentManagement/repair/index.vue
index 40a3c39..a278a5c 100644
--- a/src/views/equipmentManagement/repair/index.vue
+++ b/src/views/equipmentManagement/repair/index.vue
@@ -112,6 +112,13 @@
             缂栬緫
           </el-button>
           <el-button
+            type="info"
+            link
+            @click="viewAttachments(row)"
+          >
+            鏌ョ湅闄勪欢
+          </el-button>
+          <el-button
             type="success"
             link
             :disabled="row.status === 1"
@@ -132,18 +139,26 @@
     </div>
     <RepairModal ref="repairModalRef" @ok="getTableData"/>
     <MaintainModal ref="maintainModalRef" @ok="getTableData"/>
+    <FileListDialog
+      ref="fileListDialogRef"
+      v-model="fileDialogVisible"
+      title="鏌ョ湅闄勪欢"
+      :show-upload-button="false"
+      :show-delete-button="false"
+      name-column-label="闄勪欢鍚嶇О"
+    />
   </div>
 </template>
 
 <script setup>
-import { usePaginationApi } from "@/hooks/usePaginationApi";
 import { onMounted, getCurrentInstance, computed } from "vue";
 import {usePaginationApi} from "@/hooks/usePaginationApi";
-import {getRepairPage, delRepair} from "@/api/equipmentManagement/repair";
+import {getRepairPage, delRepair, getRepairById} from "@/api/equipmentManagement/repair";
 import RepairModal from "./Modal/RepairModal.vue";
 import {ElMessageBox, ElMessage} from "element-plus";
 import dayjs from "dayjs";
 import MaintainModal from "./Modal/MaintainModal.vue";
+import FileListDialog from "@/components/Dialog/FileListDialog.vue";
 
 defineOptions({
   name: "璁惧鎶ヤ慨",
@@ -154,6 +169,40 @@
 // 妯℃�佹瀹炰緥
 const repairModalRef = ref();
 const maintainModalRef = ref();
+const fileListDialogRef = ref();
+const fileDialogVisible = ref(false);
+
+const baseApi = import.meta.env.VITE_APP_BASE_API || "";
+const formatFileUrl = (url) => {
+  if (!url) return "";
+  if (url.startsWith("http://") || url.startsWith("https://")) return url;
+  if (url.includes(":") || url.startsWith("/")) {
+    return url;
+  }
+  const path = String(url).replace(/^\/+/, "");
+  return path ? baseApi + "/" + path : baseApi;
+};
+
+// 鏌ョ湅闄勪欢锛堜笌 APP 瀛楁涓�鑷达細fileList / commonFileList锛�
+const viewAttachments = async (row) => {
+  try {
+    const { code, data } = await getRepairById(row.id);
+    if (code === 200 && data) {
+      const list = data.fileList || data.commonFileList || [];
+      const mapped = (Array.isArray(list) ? list : []).map((f) => ({
+        id: f.id,
+        name: f.originalFilename || f.bucketFilename || f.name || "闄勪欢",
+        url: formatFileUrl(f.url || f.downloadUrl),
+        raw: f,
+      }));
+      fileListDialogRef.value?.open(mapped);
+    } else {
+      ElMessage.warning("鑾峰彇闄勪欢澶辫触");
+    }
+  } catch (e) {
+    ElMessage.error("鑾峰彇闄勪欢澶辫触");
+  }
+};
 
 // 琛ㄦ牸澶氶�夋閫変腑椤�
 const multipleList = ref([]);
@@ -233,7 +282,7 @@
         dataType: "slot",
         slot: "operation",
         align: "center",
-        width: "300px",
+        width: "360px",
       },
     ]
 );

--
Gitblit v1.9.3