From a09f984cbe2369e13d8694e91c4f8165ec6c2ba9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 20 八月 2025 14:05:10 +0800
Subject: [PATCH] 动态溯源模块优化

---
 src/api/missionApi.js |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/api/missionApi.js b/src/api/missionApi.js
index e07e9fe..5d881ba 100644
--- a/src/api/missionApi.js
+++ b/src/api/missionApi.js
@@ -1,12 +1,43 @@
 import { $http } from './index';
+import { Base64 } from 'js-base64';
 
 /**
- *
+ * 璧拌埅浠诲姟鐩稿叧鎺ュ彛API
  */
 export default {
   fethchMission({ type, page, pageSize }) {
     let params = `page=${page}&perPage=${pageSize}`;
     params += type ? `&type=${type}` : '';
     return $http.get(`air/mission/type?${params}`).then((res) => res.data);
+  },
+
+  putNewMission(mission) {
+    return $http.post(`air/mission/create`, mission).then((res) => res.data);
+  },
+
+  updateMission(mission) {
+    return $http.post(`air/mission/update`, mission).then((res) => res.data);
+  },
+
+  deleteMission(missionCode) {
+    let params = `missionCode=${missionCode}`;
+    return $http.post(`air/mission/delete?${params}`).then((res) => res.data);
+  },
+
+  downloadReport(missionCode) {
+    let params = `missionCode=${missionCode}`;
+    return $http
+      .get(`air/mission/report?${params}`, { responseType: 'blob' })
+      .then((res) => {
+        const name = Base64.decode(res.headers.get('fileName'));
+        const url = window.URL.createObjectURL(res.data);
+        const link = document.createElement('a');
+        link.href = url;
+        link.setAttribute('download', name);
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+        window.URL.revokeObjectURL(url);
+      });
   }
 };

--
Gitblit v1.9.3