From 2a8996130ca1c7be50a0eda48294aed01005de4b Mon Sep 17 00:00:00 2001 From: jingna <1264204245@qq.com> Date: Thu, 30 Oct 2025 16:29:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/testtask/index.ts | 24 +++- web/src/assets/MenuIcon/lbcz_dc.png | Bin 0 -> 472 bytes web/src/views/testdata/testtask/index.vue | 143 +++++++++++++++++++++- 3 files changed, 164 insertions(+), 3 deletions(-) create mode 100644 web/src/assets/MenuIcon/lbcz_dc.png diff --git a/web/src/api/testtask/index.ts b/web/src/api/testtask/index.ts index 5f42a39..6b90488 100644 --- a/web/src/api/testtask/index.ts +++ b/web/src/api/testtask/index.ts @@ -55,4 +55,26 @@ export function selectTsNodesById(queryParams: any) { method: 'post', params: queryParams }); -} \ No newline at end of file +} +export function exportTaskSql(queryParams: any) { + return request({ + url: '/experimentalData/tstask/exportTaskSql', + method: 'post', + params: queryParams, + responseType: 'blob' + }); +} +export function getMaxTaskCode() { + return request({ + url: '/experimentalData/tstask/getMaxTaskCode', + method: 'get', + }); +} +export function importTaskSql(queryParams: any) { + return request({ + url: '/experimentalData/tstask/importTaskSql', + method: 'post', + data: queryParams, + headers: { 'Content-Type': 'multipart/form-data' } + }); +} diff --git a/web/src/assets/MenuIcon/lbcz_dc.png b/web/src/assets/MenuIcon/lbcz_dc.png new file mode 100644 index 0000000000000000000000000000000000000000..ee96b615644434cd67d132781a9b8b08a01019bc GIT binary patch literal 472 zcmV;}0Vn>6P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0c}Y{K~y+TrIRsB z13?gl=dCFMHYpS=Qp8e7VWIU}D%c99GlpoR;6G4*fY@uIc4_h>yiSN<3Jbv|g++=$ zEJPwXZ+v@MBPxj=`QYwm=VspR?!AQ&TaDHMDKX58O3LL%0(s%RslZ84L=(0WZNi`? zsy)8E8B~oyCC$2}I0TllauGF{%&Nfx6`$jxKd_gYgX$y0x?yvkidX+_cCfa^zFUTK zMu4;`-UhD{0O`4hi3bxfiGW*jm`K1LYKj}U=wj`otf3T>%^)XvsNC_-od&z;1Uu#_ znLtbK`RzJ)@W6?<)OgnsThT4 { + exportTaskSql({ taskId: row.id }).then((res: any) => { + console.log(res) + console.log('响应头:', res.headers); + if (res) { + // 正确访问响应头 + //const disposition = res.headers['Content-Disposition']; + + const fileName = `${row.id}_data.sql.zip`; // 或从响应头中获取文件名 + + // if (disposition) { + // const filenameMatch = disposition.match(/filename="?([^"]+)"?/); + // if (filenameMatch && filenameMatch[1]) { + // fileName = decodeURIComponent(filenameMatch[1]); + // } + // } + + // 处理响应数据 + const blob = new Blob([res.data], { type: 'application/zip' }); + + // 创建临时链接并触发下载 + const url = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = `${row.id}_data.sql.zip`; + link.style.display = 'none'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + window.URL.revokeObjectURL(url); + ElMessage({ + type: 'success', + message: '导出成功', + }) + } else { + ElMessage.error("导出失败") + return + } + }) + }) +} //表格多选 const tableIdarr = ref([]) function handleSelectionChange(val: any) { @@ -406,6 +469,47 @@ function reset() { visible.vlaue = false getdata() } +function importproject() { + getMaxTaskCode().then((res: any) => { + if (res.data) { + importForm.value.taskCode = res.data + importDialog.value = true + } else { + ElMessage.warning('查询编号失败') + return + } + }) +} +function fileChange(uploadFile, uploadFiles) { + console.log(uploadFile, uploadFiles) + importForm.value.fileName = uploadFile.name + fileList.value = [] + fileList.value = [uploadFile.raw] + console.log(fileList.value, 999) +} +function importSubmit(formEl: any) { + if (!formEl) return + formEl.validate((valid: any, fields: any) => { + if (valid) { + if (fileList.value.length == 0) { + return ElMessage.warning('请选择导入的文件!') + } + const formData = new FormData() + formData.append('file', fileList.value[0]) + formData.append('taskCode', importForm.value.taskCode) + formData.append('localStorageId', importForm.value.localStorageId) + formData.append('backupStorageId', importForm.value.backupStorageId) + importTaskSql(formData).then((res: any) => { + if (res) { + ElMessage.success('上传成功') + } + }) + } + }) +} +function importClose() { + importDialog.value = false +} - + @@ -654,6 +761,38 @@ function reset() { + + + + +
{{ importForm.taskCode }}
+
+ + + + + + + + + + + +
+ + + 导入 + +
+
+
+
+ 确定 +
+