From 2cd25f52504d4644078e0d8e6e03b72c95d7aff9 Mon Sep 17 00:00:00 2001 From: linfso Date: Wed, 2 Apr 2025 08:19:28 +0800 Subject: [PATCH] md --- src/main.js | 3 ++- src/utils/request.js | 16 ++++++++++++++++ .../emis/emisSettleBill/panel/MonthPanel.vue | 18 ------------------ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/main.js b/src/main.js index ab1b2440..5d336585 100644 --- a/src/main.js +++ b/src/main.js @@ -17,7 +17,7 @@ import directive from './directive' // directive import plugins from './plugins' // plugins // const ElectronStore = require('electron-store'); // const electronStore = new ElectronStore({encryptionKey: '123456'}); -import { download } from '@/utils/request' +import { download,getRemoteFile } from '@/utils/request' import { triggerTrans } from '@/utils/custom' import TanexPrinterSdk from '@/utils/TanexPrinterSdk' import XDNoticeSdk from '@/utils/XDNoticeSdk' @@ -92,6 +92,7 @@ Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.addExportAuditRecord = addExportAuditRecord Vue.prototype.download = download +Vue.prototype.download = getRemoteFile Vue.prototype.handleTree = handleTree Vue.prototype.handleOptions = handleOptions Vue.prototype.Base64 = Base64 diff --git a/src/utils/request.js b/src/utils/request.js index 958feada..3634adff 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -175,5 +175,21 @@ export function download(url, params, filename) { }) } +// 通用下载方法 +export function getRemoteFile(url, params) { + return new Promise((resolve, reject) => { + service.post(url, params, { + transformRequest: [(params) => { return tansParams(params) }], + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + responseType: 'arraybuffer' + }).then(async (data) => { + resolve(data.data) + }).catch((r) => { + reject(error.toString()) + }) +}) + +} + export default service diff --git a/src/views/emis/emisSettleBill/panel/MonthPanel.vue b/src/views/emis/emisSettleBill/panel/MonthPanel.vue index e70050be..064f41a6 100644 --- a/src/views/emis/emisSettleBill/panel/MonthPanel.vue +++ b/src/views/emis/emisSettleBill/panel/MonthPanel.vue @@ -518,24 +518,6 @@ export default { } }, - getRemoteFile(url,params){ - return new Promise((resolve, reject) => { - axios({ - method:'post', - url, - transformRequest: [(params) => { return tansParams(params) }], - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'X-Token':getToken() - }, - responseType: 'arraybuffer' - }).then(data => { - resolve(data.data) - }).catch(error => { - reject(error.toString()) - }) - }) - }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1;