From 076bb96b437258f0e8cdbe184040e1e302b60d4b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 22 十二月 2025 14:10:12 +0800
Subject: [PATCH] 1.军泰伟业代码初始化

---
 src/views/personnelManagement/contractManagement/index.vue |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/views/personnelManagement/contractManagement/index.vue b/src/views/personnelManagement/contractManagement/index.vue
index 9fcd73a..f691bf3 100644
--- a/src/views/personnelManagement/contractManagement/index.vue
+++ b/src/views/personnelManagement/contractManagement/index.vue
@@ -70,11 +70,11 @@
 </template>
 
 <script setup>
-import { Search } from "@element-plus/icons-vue";
-import { onMounted, ref } from "vue";
+import { Search, UploadFilled } from "@element-plus/icons-vue";
+import { onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
 import FormDia from "@/views/personnelManagement/contractManagement/components/formDia.vue";
 import { ElMessageBox } from "element-plus";
-import { staffOnJobListPage } from "@/api/personnelManagement/employeeRecord.js";
+import { staffOnJobListPage, staffOnJobExportCopy } from "@/api/personnelManagement/employeeRecord.js";
 import dayjs from "dayjs";
 import { getToken } from "@/utils/auth.js";
 import FilesDia from "./filesDia.vue";
@@ -183,7 +183,7 @@
     label: "鎿嶄綔",
     align: "center",
     fixed: 'right',
-    width: 120,
+    width: 180,
     operation: [
       {
         name: "璇︽儏",
@@ -197,6 +197,13 @@
         type: "text",
         clickFun: (row) => {
           openFilesFormDia(row);
+        },
+      },
+      {
+        name: "涓嬭浇鍚堝悓",
+        type: "text",
+        clickFun: (row) => {
+          handleDownloadContract(row);
         },
       },
     ],
@@ -278,6 +285,33 @@
       proxy.$modal.msg("宸插彇娑�");
     });
 };
+// 涓嬭浇鍚堝悓
+const handleDownloadContract = (row) => {
+  const fileName = `${row.staffName || "鍚堝悓"}鍔冲姩鍚堝悓.docx`;
+  proxy.$modal?.loading?.("姝e湪鐢熸垚鍚堝悓锛岃绋嶅��...");
+  staffOnJobExportCopy({ ...row })
+    .then((res) => {
+      proxy.$modal?.closeLoading?.();
+      if (res?.code === 200 && res?.msg) {
+        const javaApi = proxy.javaApi || import.meta.env.VITE_JAVA_API || "";
+        const downloadPath = res.msg.startsWith("/") ? res.msg : `/${res.msg}`;
+        const downloadUrl = `${javaApi}${downloadPath}`;
+        const link = document.createElement("a");
+        link.href = downloadUrl;
+        link.download = fileName;
+        link.target = "_blank";
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      } else {
+        proxy.$modal.msgError(res?.msg || "鍚堝悓鐢熸垚澶辫触");
+      }
+    })
+    .catch(() => {
+      proxy.$modal?.closeLoading?.();
+      proxy.$modal.msgError("鍚堝悓鐢熸垚澶辫触锛岃绋嶅悗閲嶈瘯");
+    });
+};
 const upload = reactive({
   // 鏄惁鏄剧ず寮瑰嚭灞傦紙鍚堝悓瀵煎叆锛�
   open: false,

--
Gitblit v1.9.3