|
|
@@ -45,10 +45,15 @@
|
|
|
<div v-if="scope.row.trainingState==='SUCCESS'" >
|
|
|
<el-button type="text" icon="el-icon-circle-check" class="yellow"
|
|
|
@click="handleTrainRes(scope.$index, scope.row)">查看训练结果</el-button>
|
|
|
+ <br/>
|
|
|
+ <el-button type="text" icon="el-icon-data-board" class="orange"
|
|
|
+ @click="handlePreList(scope.row.id)">查看预测结果</el-button>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<el-button type="text" icon="el-icon-video-play" class="green"
|
|
|
- @click="handleTrain(scope.row.modelId)">模型训练</el-button>
|
|
|
+ @click="handleTrain(scope.row.id)">模型训练</el-button>
|
|
|
+ <br/>
|
|
|
+ <el-button type="text" icon="el-icon-lock" style="color: gray">暂未成功训练</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -56,7 +61,7 @@
|
|
|
<template #default="scope">
|
|
|
<div v-if="scope.row.trainingState==='SUCCESS'">
|
|
|
<el-button type="text" icon="el-icon-mouse"
|
|
|
- @click="editUseModel(scope.$index, scope.row)">模型使用
|
|
|
+ @click="editUseModel(scope.row.id)">模型使用
|
|
|
</el-button>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
@@ -85,9 +90,9 @@
|
|
|
<el-select v-model="useform.file" :label-width="formLabelWidth" placeholder="请选择您要使用的文件">
|
|
|
<el-option
|
|
|
v-for="item in fileList.valueOf()"
|
|
|
- :key="item.fileId"
|
|
|
+ :key="item.id"
|
|
|
:label="item.fileName"
|
|
|
- :value="item.fileId"
|
|
|
+ :value="item.id"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -95,9 +100,9 @@
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
<el-button @click="useModelVisible = false">取消</el-button>
|
|
|
- <router-link :to="{path:'/charts',query:{fileId:useform.file,modelId:usemodelId}}">
|
|
|
- <el-button type="primary" @click="useModel()" style="margin-left: 10px"> 使用模型 </el-button>
|
|
|
- </router-link>
|
|
|
+<!-- <router-link :to="{path:'/charts',query:{fileId:useform.file,modelId:usemodelId}}">-->
|
|
|
+ <el-button type="primary" @click="useModel(useform.file)" style="margin-left: 10px"> 使用模型 </el-button>
|
|
|
+<!-- </router-link>-->
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
@@ -117,6 +122,7 @@ import {deleteModel} from "../../api/model";
|
|
|
export default {
|
|
|
name: "model",
|
|
|
setup() {
|
|
|
+ const router = useRouter();
|
|
|
const useModelVisible = ref(false)
|
|
|
const formLabelWidth='120px';
|
|
|
const featureSty = reactive({
|
|
|
@@ -158,7 +164,6 @@ export default {
|
|
|
}).then(res => {
|
|
|
tableData.value = res.result.modelVOList;
|
|
|
pageTotal.value=tableData.value.length
|
|
|
- console.log(tableData.value[0].trainParams)
|
|
|
for(let i=0;i<tableData.value.length;i++) {
|
|
|
const reg=new RegExp("\"","g");
|
|
|
tableData.value[i].trainParams = ((JSON.stringify(tableData.value[i].trainParams))+"")
|
|
|
@@ -181,6 +186,14 @@ export default {
|
|
|
query.pageIndex = val;
|
|
|
getData();
|
|
|
};
|
|
|
+ const handlePreList=(modelId)=>{
|
|
|
+ router.push({
|
|
|
+ path:'predictionList',
|
|
|
+ query:{
|
|
|
+ modelId:modelId,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
//todo模型训练
|
|
|
const handleTrain =(modelId) => {
|
|
|
ElMessageBox( {
|
|
|
@@ -247,33 +260,64 @@ export default {
|
|
|
|
|
|
const usemodelId=ref();
|
|
|
//todo模型使用
|
|
|
- const editUseModel = (index) => {
|
|
|
+ const editUseModel = (id) => {
|
|
|
useModelVisible.value=true;
|
|
|
- usemodelId.value=tableData.value[index].modelId
|
|
|
+ usemodelId.value=id
|
|
|
};
|
|
|
|
|
|
let useform = reactive({
|
|
|
file: "",
|
|
|
});
|
|
|
//todo模型使用
|
|
|
- const useModel = () => {
|
|
|
- console.log("模型使用")
|
|
|
+ const useModel = (fileId) => {
|
|
|
useModelVisible.value=false;
|
|
|
- //console.log(useform.file+" "+usemodelId.value)
|
|
|
- // use() todo
|
|
|
- var data={
|
|
|
+ let data={
|
|
|
modelId:usemodelId.value,
|
|
|
- fileId:useform.file
|
|
|
+ fileId:fileId
|
|
|
}
|
|
|
- console.log(data)
|
|
|
+ ElMessageBox( {
|
|
|
+ title: "确定要预测吗?",
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ beforeClose: (action, instance, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ instance.confirmButtonLoading = true
|
|
|
+ instance.confirmButtonText = '预测中...'
|
|
|
+ use(data).then(res=>{
|
|
|
+ instance.confirmButtonLoading = false
|
|
|
+ console.log("predic_res: ",res);
|
|
|
+ if (res.msg === '成功')
|
|
|
+ {
|
|
|
+ ElMessageBox({
|
|
|
+ title: '模型使用',
|
|
|
+ message: `模型使用成功`,
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
+ //location.reload();
|
|
|
+ getpage();
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ console.log(res);
|
|
|
+ ElMessage.error("预测失败!失败码:"+res.msg);
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log(err)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
// use(data).then(res=>{
|
|
|
// console.log(res.data);
|
|
|
// })
|
|
|
- const router=useRouter()
|
|
|
- const fileId=useform.file
|
|
|
-
|
|
|
- //ElMessageBox.alert("成功使用模型,快去查看结果吧",{type:"success"})
|
|
|
- };
|
|
|
+ // const router=useRouter()
|
|
|
+ // const fileId=useform.file
|
|
|
+ };
|
|
|
|
|
|
// 删除操作(单个)
|
|
|
const handleDelete = (index) => {
|
|
|
@@ -349,6 +393,7 @@ export default {
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
+ router,
|
|
|
usemodelId,
|
|
|
query,
|
|
|
tableData,
|
|
|
@@ -359,6 +404,7 @@ export default {
|
|
|
editVisible,
|
|
|
form,
|
|
|
useform,
|
|
|
+ handlePreList,
|
|
|
handleSearch,
|
|
|
handlePageChange,
|
|
|
handleTrain,
|
|
|
@@ -403,6 +449,9 @@ export default {
|
|
|
.yellow{
|
|
|
color:yellowgreen;
|
|
|
}
|
|
|
+.orange{
|
|
|
+ color: orange;
|
|
|
+}
|
|
|
.mr10 {
|
|
|
margin-right: 10px;
|
|
|
}
|