From 22727c90bb84f2a2dc0631ec0e967839bf076291 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Mon, 7 Mar 2022 16:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=BF=A1=E6=81=AF=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/basic/invWarehouse.js | 10 ++++ src/views/basic/BussinessTypeModify.vue | 5 +- src/views/basic/invWarehouse.vue | 65 +++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 6 deletions(-) diff --git a/src/api/basic/invWarehouse.js b/src/api/basic/invWarehouse.js index 79766ec..32875ed 100644 --- a/src/api/basic/invWarehouse.js +++ b/src/api/basic/invWarehouse.js @@ -41,3 +41,13 @@ export function deleteWarehouse(data) { data: data }); } + +export function exportJson(query){ + return axios({ + url: "/spms/inv/warehouse/exportJson", + method: "post", + data: query, + headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}, + responseType: 'arraybuffer', //一定要设置响应类型,否则页面会是空白pdf + }); +} diff --git a/src/views/basic/BussinessTypeModify.vue b/src/views/basic/BussinessTypeModify.vue index 4bb3a65..ce292e6 100644 --- a/src/views/basic/BussinessTypeModify.vue +++ b/src/views/basic/BussinessTypeModify.vue @@ -161,7 +161,7 @@
启用单据类型 - +
@@ -196,9 +196,10 @@ +
- 需要选择业务单据校验的来源类型(一次复核) + 需要选择业务单据校验的来源类型(一次复核)
diff --git a/src/views/basic/invWarehouse.vue b/src/views/basic/invWarehouse.vue index 5e9dfa4..ff035ac 100644 --- a/src/views/basic/invWarehouse.vue +++ b/src/views/basic/invWarehouse.vue @@ -18,13 +18,26 @@ - + 查询 添加仓库 + + 导入仓库信息 + + 导出仓库信息 + @@ -259,8 +272,10 @@ import { filterList, saveWarehouse, - deleteWarehouse + deleteWarehouse, exportJson } from "../../api/basic/invWarehouse"; +import {formatDate} from "@/utils/date"; +import axios from "axios"; const formJson = { id: null, @@ -290,6 +305,8 @@ export default { label: "name" }, treeList: [], + fileList: [], + uploadData: {}, loading: true, index: null, formName: null, @@ -316,7 +333,8 @@ export default { }, pidData: {} , - deleteLoading: false + deleteLoading: false, + uploadFileUrl: null, } ; }, @@ -538,7 +556,45 @@ export default { CurrentDate += '0' + Day } return CurrentDate - } + }, + exportInvwarehouse() { + let tquery = {}; + exportJson(tquery).then((response) => { + const binaryData = []; + binaryData.push(response); + let url = window.URL.createObjectURL( + new Blob(binaryData, {type: "application/json"}) + ); + this.loading = false; + const eleLink = document.createElement('a'); + var timestamp = formatDate(new Date(), "yyyy-MM-dd_hh:mm") + eleLink.download = "仓库信息导出" + timestamp + ".json"; + eleLink.style.display = 'none'; + eleLink.href = url; + document.body.appendChild(eleLink) + eleLink.click() + document.body.removeChild(eleLink) + }).catch(() => { + this.loading = false; + }); + + }, + handleChange(response, files, fileList) { + if (response.code != 20000) { + this.$message.error(response.message); + } else { + // console.log(files[0] + "\n" + this.fileList[0] + "\n" + fileList[0]); + this.$message.success(response.data); + this.getList(); + } + }, + init() { + axios.get("./config.json").then(res => { + // 基础地址 + let response = res.data.BASE_URL; + this.uploadFileUrl = response + "/spms/inv/warehouse/uploadJson"; + }); + }, }, filters: { statusFilterType(status) { @@ -560,6 +616,7 @@ export default { }, created() { // 加载表格数据 + this.init(); this.getList(); }, };