From 3c47855f3fd7c7fd5bb21c5ead8405d69e57e2cd Mon Sep 17 00:00:00 2001
From: wangchengming <15110151257@163.com>
Date: Fri, 12 Dec 2025 10:06:09 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Test=20Predict=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E8=B6=85=E6=97=B6=E5=92=8C=E4=B8=8B=E8=BD=BD=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/chart/pages/Predict.vue | 37 +++++++++++++-------------
src/views/chart/pages/Test.vue | 44 +++++++++++++++++--------------
2 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/src/views/chart/pages/Predict.vue b/src/views/chart/pages/Predict.vue
index e9ca085..11750f4 100644
--- a/src/views/chart/pages/Predict.vue
+++ b/src/views/chart/pages/Predict.vue
@@ -119,7 +119,7 @@ export default {
formData.append("case_no", this.queryParams.case_no)
formData.append("model_types", this.queryParams.model_types)
// this.$axios.post(window.CONFIG.baseUrl + '/train-oneday/predict', formData, { headers: { "Content-Type": "multipart/form-data" } }).then((res) => {
- this.$axios.post(window.CONFIG.baseUrl + '/train-oneday/predict', formData, { headers: { "Content-Type": "multipart/form-data" } }).then((res) => {
+ this.$axios.post(window.CONFIG.baseUrl + '/train-oneday/predict', formData, { timeout: 1800000, headers: { "Content-Type": "multipart/form-data" } }).then((res) => {
// this.chartData.dataset = res.echart_data
// this.myChart.setOption({
// dataset: {
@@ -170,23 +170,24 @@ export default {
this.queryParams.model_types = data.join(',')
},
onDownload() {
- const arr = this.queryParams.model_types.split(',')
- arr.forEach(item => {
- // const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json'
- // const path = url.replace(/\\/g, '/')
- // this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: path }})
- // this.downloadFile(this.output_path, this.queryParams.case_no + '_' + item + '_ROC.json')
- this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: this.output_path }, responseType: 'blob', }).then(res => {
- const downLoadName = 'pred.xlsx'
- // 通过a标签打开新页面下载文件
- const a = document.createElement('a')
- a.href = URL.createObjectURL(res)
- // a标签里有download属性可以自定义文件名
- a.setAttribute('download', downLoadName)
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
- })
+ // const arr = this.queryParams.model_types.split(',')
+ // arr.forEach(item => {
+ // // const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json'
+ // // const path = url.replace(/\\/g, '/')
+ // // this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: path }})
+ // // this.downloadFile(this.output_path, this.queryParams.case_no + '_' + item + '_ROC.json')
+
+ // })
+ this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: this.output_path }, responseType: 'blob', }).then(res => {
+ const downLoadName = 'pred.xlsx'
+ // 通过a标签打开新页面下载文件
+ const a = document.createElement('a')
+ a.href = URL.createObjectURL(res)
+ // a标签里有download属性可以自定义文件名
+ a.setAttribute('download', downLoadName)
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
})
},
chart() {
diff --git a/src/views/chart/pages/Test.vue b/src/views/chart/pages/Test.vue
index 49de3d8..e74a9fe 100644
--- a/src/views/chart/pages/Test.vue
+++ b/src/views/chart/pages/Test.vue
@@ -43,7 +43,10 @@
Select
+ @click="onSearch">
+ Select
+ 识别中...
+
Download
@@ -121,7 +124,7 @@ export default {
formData.append("case_no", this.queryParams.case_no)
formData.append("model_types", this.queryParams.model_types)
// this.$axios.post(window.CONFIG.baseUrl + '/train-oneday/predict', formData, { headers: { "Content-Type": "multipart/form-data" } }).then((res) => {
- this.$axios.post(window.CONFIG.baseUrl + '/train-oneday/predict_with_label', formData, { headers: { "Content-Type": "multipart/form-data" } }).then((res) => {
+ this.$axios.post(window.CONFIG.baseUrl + '/train-oneday/predict_with_label', formData, { timeout: 1800000, headers: { "Content-Type": "multipart/form-data" } }).then((res) => {
console.log('Predict_output_path', res.output_path)
this.output_path = res?.output_path
this.chartData.dataset = res.echart_data
@@ -170,25 +173,26 @@ export default {
this.queryParams.model_types = data.join(',')
},
onDownload() {
- const arr = this.queryParams.model_types.split(',')
- arr.forEach(item => {
- // const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json'
- // const path = url.replace(/\\/g, '/')
- // this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: path }})
- // this.downloadFile(path, this.queryParams.case_no + '_' + item + '_ROC.json')
- this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: this.output_path }, responseType: 'blob', }).then(res => {
- const downLoadName = 'test.xlsx'
- // 通过a标签打开新页面下载文件
- const a = document.createElement('a')
- a.href = URL.createObjectURL(res)
- // a标签里有download属性可以自定义文件名
- a.setAttribute('download', downLoadName)
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
- })
+ // const arr = this.queryParams.model_types.split(',')
+ // arr.forEach(item => {
+ // // const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json'
+ // // const path = url.replace(/\\/g, '/')
+ // // this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: path }})
+ // // this.downloadFile(path, this.queryParams.case_no + '_' + item + '_ROC.json')
+ // })
+ if(this.loading) return false
+ this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: this.output_path }, responseType: 'blob', }).then(res => {
+ const downLoadName = 'test.xlsx'
+ // 通过a标签打开新页面下载文件
+ const a = document.createElement('a')
+ a.href = URL.createObjectURL(res)
+ // a标签里有download属性可以自定义文件名
+ a.setAttribute('download', downLoadName)
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
})
- },
+ },
chart() {
this.myChart = this.$echarts.init(this.$refs.chartDom)
const option = {