This commit is contained in:
linfso 2025-04-02 08:19:28 +08:00
parent 218d027ddc
commit 2cd25f5250
3 changed files with 18 additions and 19 deletions

View File

@ -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

View File

@ -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

View File

@ -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;