riku
2025-05-13 6c75516f1ba668873807cef33aa996d25cdf16c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);
      });
  }
};