From 4238c7409ce484ba20c79d33268c46218973dd59 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 07 十一月 2025 13:16:19 +0800
Subject: [PATCH] 合同管理加下载合同功能
---
src/api/personnelManagement/employeeRecord.js | 9 +++++++++
src/views/personnelManagement/contractManagement/index.vue | 28 +++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/src/api/personnelManagement/employeeRecord.js b/src/api/personnelManagement/employeeRecord.js
index 378756a..a4ad34b 100644
--- a/src/api/personnelManagement/employeeRecord.js
+++ b/src/api/personnelManagement/employeeRecord.js
@@ -15,4 +15,13 @@
method: 'get',
params: query,
})
+}
+
+// 瀵煎嚭鍚堝悓鍓湰
+export function staffOnJobExportCopy(data) {
+ return request({
+ url: '/staff/staffOnJob/exportCopy',
+ method: 'post',
+ data: data,
+ })
}
\ No newline at end of file
diff --git a/src/views/personnelManagement/contractManagement/index.vue b/src/views/personnelManagement/contractManagement/index.vue
index 700ace1..47f3c21 100644
--- a/src/views/personnelManagement/contractManagement/index.vue
+++ b/src/views/personnelManagement/contractManagement/index.vue
@@ -74,7 +74,7 @@
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";
@@ -287,8 +287,30 @@
};
// 涓嬭浇鍚堝悓
const handleDownloadContract = (row) => {
- const fileName = `${row.staffName}鍔冲姩鍚堝悓.xlsx`;
- proxy.download("/staff/staffOnJob/exportCopy", { ...row }, fileName);
+ const fileName = `${row.staffName || "鍚堝悓"}鍔冲姩鍚堝悓.xlsx`;
+ 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({
// 鏄惁鏄剧ず寮瑰嚭灞傦紙鍚堝悓瀵煎叆锛�
--
Gitblit v1.9.3