From b70e4dc2594da74ef5088e008f577179badf16ee Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期一, 23 十二月 2024 11:44:52 +0800 Subject: [PATCH] 1. 新增网格数据模板下载和excel数据上传 api 2. 新增网格数据导入页面 --- src/api/gridApi.js | 31 +++++++++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/api/gridApi.js b/src/api/gridApi.js index 6eb09f2..595c170 100644 --- a/src/api/gridApi.js +++ b/src/api/gridApi.js @@ -1,5 +1,7 @@ import { $http } from './index'; - +import { + Base64 +} from 'js-base64'; /** * 鍗槦閬ユ祴缃戞牸鐩稿叧鎺ュ彛API */ @@ -54,5 +56,30 @@ } }) .then((res) => res.data); + }, + downloadTemplate() { + return $http + .get(`air/satellite/import/grid/data/download/template`, { + responseType: 'blob' + }) + .then((res) => { + const name = Base64.decode(res.headers.get('fileName')); + const blob = new Blob([res.data], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }); + const url = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = name; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + window.URL.revokeObjectURL(url); + }); + }, + importData(dataForm) { + return $http + .post(`air/satellite/import/grid/data`, dataForm) + .then((res) => res.data); } -}; +}; \ No newline at end of file -- Gitblit v1.9.3