Commit 8fdb5bd82fec2963ebeee81450b858e2ce6da961

Authored by Dunfa Jiang
1 parent a5669655

feat:增加导出功能

... ... @@ -123,14 +123,15 @@ service.interceptors.response.use(res => {
123 123 )
124 124
125 125 // 通用下载方法
126   -export function download(url, params = {}, filename, config) {
127   - downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)", })
128   - return service.post(url, params, {
129   - transformRequest: [(params) => { return tansParams(params) }],
  126 +export function download(url, params = {}, filename, config,isTransFormParams = true) {
  127 + downloadLoadingInstance = ElLoading.service({ text: "正在下载数据,请稍候", backgviround: "rgba(0, 0, 0, 0.7)", })
  128 + const serviceConfig = {
130 129 headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
131 130 responseType: 'blob',
132 131 ...config
133   - }).then(async (data) => {
  132 + }
  133 + isTransFormParams && (serviceConfig.transformRequest = [(params) => { return tansParams(params) }])
  134 + return service.post(url, params, serviceConfig).then(async (data) => {
134 135 const isBlob = blobValidate(data)
135 136 if (isBlob) {
136 137 const blob = new Blob([data])
... ...
... ... @@ -395,21 +395,31 @@ function submitForm() {
395 395
396 396 const handleExportDiff = () => {
397 397 proxy.download(
398   - "monitor/jobLog/export",
  398 + "/scanSpec/difference/export",
399 399 {
400   - ...queryParams.value,
  400 + scanTaskId:route.query.scanTaskId,
  401 + status:'COMPLETED'
401 402 },
402   - `回收差异表.xlsx`
  403 + `回收差异表.xlsx`,
  404 + {
  405 + headers: {}
  406 + },
  407 + false
403 408 );
404 409 };
405 410
406 411 const handleExportResult = () => {
407 412 proxy.download(
408   - "monitor/jobLog/export",
  413 + "/scanItem/result/export",
  414 + {
  415 + scanTaskId:route.query.scanTaskId,
  416 + status:'COMPLETED'
  417 + },
  418 + `分拣结果表.xlsx`,
409 419 {
410   - ...queryParams.value,
  420 + headers: {}
411 421 },
412   - `分拣结果表.xlsx`
  422 + false
413 423 );
414 424 };
415 425 // Reset operation form
... ...
Please register or login to post a comment