From 94f06e38321658505d3a83057063082e2f837e87 Mon Sep 17 00:00:00 2001 From: monkeyhouyi Date: Wed, 4 Sep 2024 11:40:34 +0800 Subject: [PATCH] 优化 --- src/views/DisposalSuggestions/index.vue | 2 +- src/views/baseCaseHandling/Form.vue | 5 ++++- src/views/baseInspectionReport/Form.vue | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++----------- src/views/baseInspectionReport/index.vue | 28 ++++++++++++++++++++-------- src/views/baseSystemInfo/index.vue | 53 ++++++++++++++++++++++++++++++++--------------------- 5 files changed, 108 insertions(+), 42 deletions(-) diff --git a/src/views/DisposalSuggestions/index.vue b/src/views/DisposalSuggestions/index.vue index c2210d3..4f22aaa 100644 --- a/src/views/DisposalSuggestions/index.vue +++ b/src/views/DisposalSuggestions/index.vue @@ -46,7 +46,7 @@ - + - + - 导出 + 导出
@@ -206,6 +207,7 @@ import InspectionForm from "./InspectForm.vue"; import DetailForm from './DetailForm.vue'; import ChangeRecord from "./ChangeRecord.vue"; import ExportBox from "./ExportBox.vue"; +import define from '@/utils/define' export default { name: "SystemInfo", @@ -390,29 +392,38 @@ export default { this.initList(); }); }, - toExport() { - let _query = { - ...this.query, + exportData(type) { + let obj = {}; + if(type) { + obj = { + url: '/Extend/basesysteminfo/Actions/GenerateImportTemplate', + method: "GET", + } + } else { + obj ={ + url: '/Extend/basesysteminfo/Actions/Export', + method: "POST", + data: this.query, + } }; - let query = {}; - for (let key in _query) { - if (Array.isArray(_query[key])) { - query[key] = _query[key].join(); + request(obj).then((res) => { + if(type) { + const blob = new Blob([res], {type: 'application/json'}); + const url = window.URL.createObjectURL(blob); + let link = document.createElement('a'); + link.style.display = 'none'; + link.href = url; + link.download = '应用信息模板.xlsx'; + link.click(); } else { - query[key] = _query[key]; + if(res.code != 200) return; + const url = define.APIURl + res.data.url; + const link = document.createElement("a"); + link.href = url; + link.download = res.data.name; + link.click(); } - } - request({ - url: `/Extend/basesysteminfo/Actions/Export`, - method: "POST", - data: query, - }).then((res) => { - const url = process.env.VUE_APP_BASE_API + res.data.url; - const link = document.createElement("a"); - link.href = url; - link.download = res.data.name; - link.click(); - }); + }) }, download(data) { let query = { ...data, ...this.listQuery, ...this.query }; -- libgit2 0.21.4