From 73be6f0dc3a8f58667677665f269d92e03bb2e1d Mon Sep 17 00:00:00 2001 From: renxiangke Date: Tue, 28 Jul 2026 11:05:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/yxcj/index.vue | 25 ++++++------------------ src/utils/axios/yxcj/index.ts | 36 +++++++++++++++-------------------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/src/pages/yxcj/index.vue b/src/pages/yxcj/index.vue index ebac4517..12a98a01 100644 --- a/src/pages/yxcj/index.vue +++ b/src/pages/yxcj/index.vue @@ -684,25 +684,12 @@ function exporChartText() { } }); - if (paramForm.value.layer === '3') { - exportUnivariateTxt({ taskId: curRow.value.id }) - .then(resp => { - // resp.data 才是二进制文本流 - downloadTextFile(resp.data, '单变量后验分布结果数据.txt') - }) - .catch(err => { - console.error('导出异常', err) - }) - } - - - // // 单变量后验分布结果数据 - // paramForm.value.layer === '3' && exportUnivariateTxt({ taskId: curRow.value.id }).then((respor: any) => { - // console.log(respor,222222222) - // if (respor) { - // downloadTextFile(respor, '单变量后验分布结果数据'); - // } - // }); + // 单变量后验分布结果数据 + paramForm.value.layer === '3' && exportUnivariateTxt({ taskId: curRow.value.id }).then((respor: any) => { + if (respor) { + downloadTextFile(respor, '单变量后验分布结果数据'); + } + }); } // 导出图表图片 function exporChartImg() { diff --git a/src/utils/axios/yxcj/index.ts b/src/utils/axios/yxcj/index.ts index 96437c15..ab70d7a7 100644 --- a/src/utils/axios/yxcj/index.ts +++ b/src/utils/axios/yxcj/index.ts @@ -440,16 +440,14 @@ export async function getAcTimeSeries(params: { * @param {number} [params.taskId] - id * @returns {Promise} */ -export async function exportAcTimeSeriesTxt(params: { - taskId: number; -}, callback?: (data: any) => void): Promise { - const response = await request({ +export function exportAcTimeSeriesTxt(params: { taskId: string }) { + return request({ url: `${serverIp}${baseURL}/source/exportBayesAcTimeSeriesTxt`, - method: 'GET', + method: 'GET', // POST自行修改 params, - }); - // 执行回调(如果存在) - callback?.(response); + // 关键配置,必须加! + responseType: 'blob', + }) } /** @@ -476,15 +474,12 @@ export async function getUnivariate(params: { * @returns {Promise} */ export function exportUnivariateTxt(params: { taskId: string }) { - return axios({ - url: '${serverIp}${baseURL}/source/exportBayesMonovarPosterior', + return request({ + url: `${serverIp}${baseURL}/source/exportBayesMonovarPosterior`, method: 'GET', // POST自行修改 params, // 关键配置,必须加! responseType: 'blob', - headers: { - token: localStorage.getItem('token') - } }) } @@ -511,17 +506,16 @@ export async function getBivariate(params: { * @param {number} [params.taskId] - id * @returns {Promise} */ -export async function exportBivariateTxt(params: { - taskId: number; -}, callback?: (data: any) => void): Promise { - const response = await request({ +export function exportBivariateTxt(params: { taskId: string }) { + return request({ url: `${serverIp}${baseURL}/source/exportBayesBivarPosterior`, - method: 'GET', + method: 'GET', // POST自行修改 params, - }); - // 执行回调(如果存在) - callback?.(response); + // 关键配置,必须加! + responseType: 'blob', + }) } + /** * @method 导出模板 * @returns {Promise} 返回数据