From e1b04baf60478e3de9e41e1fc39e1e4346321817 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期五, 29 八月 2025 13:27:31 +0800
Subject: [PATCH] '一些改动'

---
 src/views/system/dept/utils/detail.tsx |   94 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 84 insertions(+), 10 deletions(-)

diff --git a/src/views/system/dept/utils/detail.tsx b/src/views/system/dept/utils/detail.tsx
index 6eded09..ac10c22 100644
--- a/src/views/system/dept/utils/detail.tsx
+++ b/src/views/system/dept/utils/detail.tsx
@@ -1,6 +1,6 @@
 import tenderForm from "../uploadform.vue";
 import { ref, h, reactive } from "vue";
-import { addDialog } from "@/components/ReDialog";
+import { addDialog, closeDialog } from "@/components/ReDialog";
 import type { TenderInfo } from "./types";
 import { message } from "@/utils/message";
 import { cloneDeep, deviceDetection } from "@pureadmin/utils";
@@ -10,27 +10,71 @@
   fabuzhaobiao,
   changezhaobiao,
   getTenderOrderDetail,
-  updateTittle
+  updateTittle,
+  changeDetail,
+  cHangeDelete
 } from "@/api/item/index";
 
 const formRef = ref();
+const convertFujianToObjects = (fujianStr, fujianNameStr) => {
+  // 鍒嗗壊瀛楃涓蹭负鏁扮粍骞惰繃婊ょ┖鍊�
+  const srcArray = fujianStr.split(",").filter(Boolean);
+  const nameArray = fujianNameStr.split(",").filter(Boolean);
 
+  // 鎻愬彇鏂囦欢鍚庣紑浣滀负valu
+  const getFileExtension = fileName => {
+    const lastDotIndex = fileName.lastIndexOf(".");
+    // 濡傛灉娌℃湁鍚庣紑鎴栨枃浠跺悕浠ョ偣缁撳熬锛岃繑鍥炵┖瀛楃涓�
+    if (lastDotIndex === -1 || lastDotIndex === fileName.length - 1) {
+      return "";
+    }
+    return fileName.slice(lastDotIndex + 1).toLowerCase();
+  };
+
+  // 鏄犲皠涓虹洰鏍囧璞℃暟缁�
+  return srcArray.map((src, index) => {
+    // 纭繚鍚嶇О鏁扮粍鏈夊搴旂储寮曠殑鍏冪礌
+    const name = nameArray[index]?.trim() || `鏈煡鏂囦欢${index + 1}`;
+
+    return {
+      name: name,
+      filePath: src.trim(),
+      fileType: getFileExtension(name)
+    };
+  });
+};
 export function useDetail() {
-  function openUploadDialog(title = "涓婁紶", row?: TenderInfo) {
+  async function getDetailList(id) {
+    const res = await getTenderOrderDetail({ id });
+    state.nowInfo = res.result;
+    if (state.nowInfo.fujian) {
+      state.nowInfo.fujianList = convertFujianToObjects(
+        state.nowInfo.fujian,
+        state.nowInfo.fujianName
+      );
+    }
+  }
+  async function openUploadDialog(title = "涓婁紶", row?: TenderInfo) {
+    const detail = await changeDetail({ id: row.id });
+    if (detail.result) {
+      row = detail.result;
+    }
     addDialog({
       title: `${title}鍏憡`,
       props: {
         formInline: {
           tenderId: title == "涓婁紶鍙樻洿" ? row?.id : "",
-          id: title == "涓婁紶" ? row?.id : "",
+          id: row?.id ?? "",
           projectName: row?.projectName ?? "",
           toubiaoStartDate: row?.toubiaoStartDate ?? "", //鎶曟爣鎶ュ悕寮�濮嬫椂闂�
           toubiaoEndDate: row?.toubiaoEndDate ?? "", //鎶曟爣鎶ュ悕缁撴潫鏃堕棿
           kaibiaoDate: row?.kaibiaoDate ?? "", //寮�鏍囨椂闂�
-          biangengwenjian: "", //鎷涙爣鏂囦欢
           fujian: row?.fujian ?? "", //闄勪欢
           fujianName: row?.fujianName ?? "", //闄勪欢
-          kaibiaodidian: row?.kaibiaodidian ?? "" //寮�鏍囧湴鐐�
+          kaibiaodidian: row?.kaibiaodidian ?? "", //寮�鏍囧湴鐐�
+          biangengwenjian: row?.biangengwenjian ?? "",
+          // 鍙樻洿鏂囦欢
+          biangengwenjianName: row?.biangengwenjianName ?? ""
         }
       },
       width: "30%",
@@ -45,6 +89,34 @@
           formInline: null,
           isChange: title == "涓婁紶" ? false : true
         }),
+      footerButtons: detail.result
+        ? [
+            {
+              label: "鍒犻櫎",
+              type: "danger",
+              text: true,
+              bg: true,
+              popconfirm: { title: "鏄惁纭鍒犻櫎褰撳墠鍙樻洿鍏憡" },
+              btnClick: ({ dialog: { options, index }, button }) => {
+                console.log(options, index, button);
+                cHangeDelete({ id: row?.id }).then(res => {
+                  if (res.code == "200") {
+                    getDetailList(row?.tenderId);
+                    // getTenderOrderDetail({ id: row?.tenderId }).then(res => {
+                    //   state.nowInfo = res.result;
+                    // });
+                    closeDialog(options, index); // 鍏抽棴寮规
+                  } else {
+                    // closeLoading();
+                    message(res.message, {
+                      type: "error"
+                    });
+                  }
+                });
+              }
+            }
+          ]
+        : [],
       beforeSure: (done, { options, closeLoading }) => {
         const FormRef = formRef.value.getRef();
         const curData = cloneDeep(options.props.formInline as TenderInfo);
@@ -61,9 +133,10 @@
             res = await changezhaobiao(curData);
           }
           if (res.code == "200") {
-            getTenderOrderDetail({ id: row?.id }).then(res => {
-              state.nowInfo = res.result;
-            });
+            getDetailList(row?.id);
+            // getTenderOrderDetail({ id: row?.id }).then(res => {
+            //   state.nowInfo = res.result;
+            // });
             done(); // 鍏抽棴寮规
           } else {
             closeLoading();
@@ -217,6 +290,7 @@
     openUploadDialog,
     state,
     generateTimestampWithRandom,
-    changeDialog
+    changeDialog,
+    getDetailList
   };
 }

--
Gitblit v1.9.1