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: { chartData: {
datasetSource: [] datasetSource: []
}, },
outPath: '' outPath: '',
output_path: ''
} }
}, },
created() { created() {
@ -119,12 +120,14 @@ export default {
formData.append("model_types", this.queryParams.model_types) 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, { 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.chartData.dataset = res.echart_data
this.myChart.setOption({ // this.myChart.setOption({
dataset: { // dataset: {
source: res.echart_data // source: res.echart_data
}, // },
}) // })
console.log('Predict_output_path', res.output_path)
this.output_path = res?.output_path
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
}) })
@ -169,10 +172,10 @@ export default {
onDownload() { onDownload() {
const arr = this.queryParams.model_types.split(',') const arr = this.queryParams.model_types.split(',')
arr.forEach(item => { arr.forEach(item => {
const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json' // const url = this.outPath + '\\' + this.queryParams.case_no + '_' + item + '_ROC.json'
const path = url.replace(/\\/g, '/') // const path = url.replace(/\\/g, '/')
// this.$axios.get(window.CONFIG.baseUrl + '/download', { params: { path: path }}) // 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() { chart() {

View File

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