This commit is contained in:
wangchengming 2025-12-11 21:29:07 +08:00
parent 23f8c938f2
commit e7802101fc
2 changed files with 49 additions and 51 deletions

View File

@ -99,7 +99,8 @@ export default {
chartData: {
datasetSource: []
},
outPath: ''
outPath: '',
output_path: ''
}
},
created() {
@ -119,12 +120,14 @@ export default {
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.chartData.dataset = res.echart_data
this.myChart.setOption({
dataset: {
source: res.echart_data
},
})
// this.chartData.dataset = res.echart_data
// this.myChart.setOption({
// dataset: {
// source: res.echart_data
// },
// })
console.log('Predict_output_path', res.output_path)
this.output_path = res?.output_path
}).finally(() => {
this.loading = false
})
@ -169,10 +172,10 @@ export default {
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, '/')
// 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.downloadFile(this.output_path, this.queryParams.case_no + '_' + item + '_ROC.json')
})
},
chart() {

View File

@ -12,55 +12,41 @@
</el-form-item>-->
<el-form-item label="Dataset">
<el-select v-model="datasetId" placeholder="请选择" class="dark-select" popper-class="dark-select-popper" style="width: 120px" @change="getCaseData">
<el-option
v-for="item in datasetIdOptions"
:key="item.id"
:label="item.id"
:value="item.id"
>
<el-select v-model="datasetId" placeholder="请选择" class="dark-select" popper-class="dark-select-popper"
style="width: 120px" @change="getCaseData">
<el-option v-for="item in datasetIdOptions" :key="item.id" :label="item.id" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="Case">
<el-select v-model="queryParams.case_no" :disabled="!datasetId" placeholder="请选择" class="dark-select" popper-class="dark-select-popper" style="width: 180px" @change="caseChange">
<el-option
v-for="item in caseOptions"
:key="item.case_no"
:label="item.case_no"
:value="item.case_no"
>
<el-select v-model="queryParams.case_no" :disabled="!datasetId" placeholder="请选择" class="dark-select"
popper-class="dark-select-popper" style="width: 180px" @change="caseChange">
<el-option v-for="item in caseOptions" :key="item.case_no" :label="item.case_no" :value="item.case_no">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="Classify">
<el-select v-model="modelTypes" multiple placeholder="请选择" class="dark-select" popper-class="dark-select-popper" style="width: 400px" @change="modelTypeChange">
<el-option
v-for="item in selectOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
<el-select v-model="modelTypes" multiple placeholder="请选择" class="dark-select"
popper-class="dark-select-popper" style="width: 400px" @change="modelTypeChange">
<el-option v-for="item in selectOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="">
<el-upload
ref="upload"
v-model:file-list="fileList"
class="upload-demo"
:auto-upload="false"
:limit="1"
:multiple="false"
:show-file-list="false"
:on-change="handleChange"
style="height: 32px; margin-left: 12px;">
<el-button type="primary" icon="upload" style="background-color: #7393b7; border-color: #7393b7; border-radius: 0;">Upload</el-button>
<el-upload ref="upload" v-model:file-list="fileList" class="upload-demo" :auto-upload="false" :limit="1"
:multiple="false" :show-file-list="false" :on-change="handleChange"
style="height: 32px; margin-left: 12px;">
<el-button type="primary" icon="upload"
style="background-color: #7393b7; border-color: #7393b7; border-radius: 0;">Upload</el-button>
</el-upload>
<el-button type="primary" icon="search" style="background-color: #7393b7; border-color: #7393b7; border-radius: 0; margin-left: 12px;" @click="onSearch">Select</el-button>
<el-button type="primary" icon="document" style="background-color: #7393b7; border-color: #7393b7; border-radius: 0; margin-left: 12px;" @click="onDownload">Download</el-button>
<el-button type="primary" icon="search"
style="background-color: #7393b7; border-color: #7393b7; border-radius: 0; margin-left: 12px;"
@click="onSearch">Select</el-button>
<el-button type="primary" icon="document"
style="background-color: #7393b7; border-color: #7393b7; border-radius: 0; margin-left: 12px;"
@click="onDownload">Download</el-button>
</el-form-item>
</el-form>
</div>
@ -115,10 +101,11 @@ export default {
chartData: {
datasetSource: []
},
outPath: ''
outPath: '',
output_path: ''
}
},
created () {
created() {
// color: ['#0A4072', '#683F14', '#0F605A', '#0F5A7A', '#5C5F25']
// this.onSearch()
this.getDataset()
@ -127,7 +114,7 @@ export default {
this.chart()
},
methods: {
onSearch () {
onSearch() {
this.loading = true
const formData = new FormData()
formData.append("file", this.currentFile)
@ -135,6 +122,8 @@ export default {
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) => {
console.log('Predict_output_path', res.output_path)
this.output_path = res?.output_path
this.chartData.dataset = res.echart_data
this.myChart.setOption({
dataset: {
@ -165,7 +154,7 @@ export default {
},
caseChange(id) {
const arr = this.caseOptions.filter(item => item.case_no === id)
if(arr.length) {
if (arr.length) {
this.outPath = arr[0].out_path
}
},
@ -183,10 +172,11 @@ export default {
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, '/')
// const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json'
// const path = url.replace(/\\/g, '/')
const path = this.output_path
// this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: path }})
this.downloadFile(path, this.queryParams.case_no + '_' + item + '_ROC.json')
this.downloadFile(path, this.queryParams.case_no + '_' + item + '_ROC.json')
})
},
chart() {
@ -284,6 +274,7 @@ export default {
color: #fff;
display: flex;
flex-direction: column;
.section-head {
height: 32px;
padding: 0 13px;
@ -293,18 +284,22 @@ export default {
font-size: 20px;
font-weight: bold;
}
.list-box {
flex: 1;
display: flex;
flex-direction: column;
.filter-wrap {
height: 50px;
margin-top: 16px;
::v-deep .el-form-item__label {
font-size: 16px;
color: #a7bacf;
}
}
.chart-wrap {
flex: 1;
}