Просмотр исходного кода

feat: 配置列表,删除配置,配置详情

icenaked 3 лет назад
Родитель
Сommit
aaac9a8979
3 измененных файлов с 63 добавлено и 108 удалено
  1. 13 18
      src/api/config.js
  2. 28 67
      src/views/ml/ConfigDetail.vue
  3. 22 23
      src/views/ml/ConfigList.vue

+ 13 - 18
src/api/config.js

@@ -31,13 +31,11 @@ export const addConfig = payload => {
  * @returns
  */
 export const getAllConfig = payload => {
-  // console.log("getAllConfig",payload);
   const {uid} = payload;
-  console.log("payload",payload);
-  console.log("uid",uid);
-  return axios.get(`${CONFIG_MODULE}/get/all?userId=${uid}`).then(res => {
-
-    return res;
+  // return axios.get(`${CONFIG_MODULE}/get/all?userId=${uid}`).then(res => {
+  //   return res;
+    return axios.get(`${MOCK}/ml/configs:useId=1`).then(res => {
+      return res;
   });
 }
 
@@ -64,12 +62,10 @@ export const getAllNew = payload => {
  */
 export const getOneConfig = payload => {
   const { configId } = payload;
-  console.log("configId",configId);
-  console.log("payload",payload);
-  return axios.get(`${CONFIG_MODULE}/get/one/config?configId=${configId}`).then(res => {
-
+  // return axios.get(`${CONFIG_MODULE}/get/one/config?configId=${configId}`).then(res => {
+  //   return res;});
+  return axios.get(`${MOCK}/ml/configs/:configId`).then(res => {
     return res;});
-
 }
 
 /**
@@ -89,16 +85,15 @@ export const changeConfig = payload => {
 
 
 /**
- * 删除模型 GET /delete/{configId}
+ * 删除配置 GET /delete/{configId}
  * @param {*} payload
  * @returns
  */
-export const deleteModelByModelId = configId => {
-  //console.log("deletepara",payload);
-  //const { configId } = payload;
-  return axios.get(`${CONFIG_MODULE}/delete?configId=${configId}`).then(res => {
-
-    return res;
+export const deleteConfig = configId => {
+  // return axios.get(`${CONFIG_MODULE}/delete?configId=${configId}`).then(res => {
+  //   return res;
+    return axios.delete(`${MOCK}/ml/configs/${configId}`).then(res => {
+      return res;
   });
 }
 

+ 28 - 67
src/views/ml/ConfigDetail.vue

@@ -8,50 +8,18 @@
       </el-breadcrumb>
     </div>
 
-      <div class="handle-box">
-
-
-
-      </div>
-
 <!--  <el-tab-pane :label="featureList"> </el-tab-pane>-->
       <div class="container">
         <div class="form-box" >
           <el-form ref="formRef" label-width="120px">
-            <el-form-item label="模型类型名:" >
-              {{config.modelTypeName}}
-            </el-form-item>
-            <el-form-item label="模型描述:" >
-              {{config.modelDes}}
-            </el-form-item>
-            <el-form-item label="模型详情:" >
-              {{config.modelDetileDes}}
+            <el-form-item label="学习类型:" >
+              {{config.learningType}}
             </el-form-item>
             <el-form-item label="特征字段:" >
-              <el-table :data="tableData" border class="table"  ref="fieldTable" header-cell-class-name="table-header" @selection-change="handleSelectChange">
-                <el-table-column label="字段名" width="120%">
-                  <template #default="scope"><span>{{ scope.row.fieldName }}</span></template>
-                </el-table-column>
-                <el-table-column label="别名">
-                  <template #default="scope">{{ scope.row.aliasName }}</template>
-                </el-table-column>
-                <el-table-column label="描述">
-                  <template #default="scope">{{ scope.row.fieldDes }}</template>
-                </el-table-column>
-                <el-table-column label="取值类型">
-                  <template #default="scope">{{ scope.row.fieldType }}</template>
-                </el-table-column>
-                <el-table-column label="分布类型">
-                  <template #default="scope">{{ scope.row.conOrDis }}</template>
-                </el-table-column>
-                <el-table-column label="空值率">
-                  <template #default="scope">{{ scope.row.nullsRatio }}</template>
-                </el-table-column>
-
-                <el-table-column label="值域" width="150%">
-                  <template #default="scope">{{ scope.row.valueInfo }}</template>
-                </el-table-column>
-              </el-table>
+              {{config.features}}
+            </el-form-item>
+            <el-form-item label="目标字段:" >
+              {{config.label}}
             </el-form-item>
 
             <el-form-item label="模型列表:" >
@@ -208,39 +176,32 @@ export default {
     // 获取表格数据
 
     const getData = () => {
-
-      //todo:调用获取文件具体信息获取字段列表
       // console.log("queryId",route.query.configId);
-
       if(route.query.configId!=null) {
         getOneConfig({configId:route.query.configId}).then(res => {
           // console.log("configdetail",route.query.configId);
-
-          config.value=res.data;
-          form.modelTypeId=config.value.modelTypeId;
-          if (form.modelTypeId==='1') {
-            showMaxIter.value = true;
-            showRegParam.value = true;
-            showElasticNetParam.value = true;
-          }else if (form.modelTypeId==='5') {
-            showNumOfCluster.value=true;
-            showSeed.value=true;
-          }else {
-            showCategory.value=true;
-            showTrainingDataSetOccupy.value=true;
-          }
-          console.log("form",form);
-          //console.log("config",config.value.modelTypeId);
-          tableData.value = res.data.featureList;
-          for (var i = 0; i < tableData.value.length; i++) {
-            if (tableData.value[i].conOrDis === 1) {
-              tableData.value[i].conOrDis = "连续值"
-            } else {
-              tableData.value[i].conOrDis = "离散值"
-            }
-          }
-          //console.log(tableData)
-
+          config.value=res.result;
+          // form.modelTypeId=config.value.learningType;
+          // if (form.modelTypeId==='1') {
+          //   showMaxIter.value = true;
+          //   showRegParam.value = true;
+          //   showElasticNetParam.value = true;
+          // }else if (form.modelTypeId==='5') {
+          //   showNumOfCluster.value=true;
+          //   showSeed.value=true;
+          // }else {
+          //   showCategory.value=true;
+          //   showTrainingDataSetOccupy.value=true;
+          // }
+          // console.log("form",form);
+          tableData.value = res.result.features;
+          // for (var i = 0; i < tableData.value.length; i++) {
+          //   if (tableData.value[i].conOrDis === 1) {
+          //     tableData.value[i].conOrDis = "连续值"
+          //   } else {
+          //     tableData.value[i].conOrDis = "离散值"
+          //   }
+          // }
           modelData.value=res.data.modelInfos;
           console.log("tableData",tableData);
           fileId.value=tableData.value[0].fileInfoId;

+ 22 - 23
src/views/ml/ConfigList.vue

@@ -36,21 +36,21 @@
                 @selection-change="handleSelectionChange"
                 @row-dblclick="getConfigDetail"
             >
-                <el-table-column prop="confName" label="配置名"></el-table-column>
-                <el-table-column label="模型类别">
-                    <template #default="scope">{{ scope.row.modelTypeName }}</template>
+                <el-table-column prop="configName" label="配置名"></el-table-column>
+                <el-table-column label="学习类型">
+                    <template #default="scope">{{ scope.row.learningType }}</template>
                 </el-table-column>
-              <el-table-column prop="fileName" label="文件名"></el-table-column>
+              <el-table-column prop="fileInfoId" label="文件id"></el-table-column>
                 <el-table-column label="特征字段">
-                    <template #default="scope">{{ scope.row.name }}</template>
+                    <template #default="scope">{{ scope.row.features }}</template>
                 </el-table-column>
               <el-table-column label="目标字段">
-                <template #default="scope">{{ scope.row.target }}</template>
+                <template #default="scope">{{ scope.row.label }}</template>
               </el-table-column>
                 <el-table-column label="操作" width="180" align="center">
                     <template #default="scope">
 
-                      <router-link :to="{path:'/ConfigDetail',query:{configId:scope.row.configId}}">
+                      <router-link :to="{path:'/ConfigDetail',query:{configId:scope.row.id}}">
                         <el-button type="text" icon="el-icon-view" >查看详情
                         </el-button>
                       </router-link>
@@ -118,7 +118,7 @@
 import { ref, reactive } from "vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import { fetchData } from "../../api";
-import {addConfig, deleteModelByModelId, getAllConfig} from "../../api/config";
+import {addConfig, deleteConfig, getAllConfig} from "../../api/config";
 import {useRouter} from "vue-router";
 
 export default {
@@ -163,19 +163,17 @@ export default {
         // 获取表格数据
 
     const getpage=()=> {
-      // console.log("getpage");
       getAllConfig({
         uid: 1
       }).then(res => {
-        console.log("res",res);
-        tableData.value = res.data;
-        for (let i=0;i<tableData.value.length;i++){
-          tableData.value[i].name=[];
-          for (let j=0;j<tableData.value[i].featureList.length-1;j++){
-            tableData.value[i].name.push(tableData.value[i].featureList[j].fieldName);
-          }
-          tableData.value[i].target=tableData.value[i].featureList[tableData.value[i].featureList.length-1].fieldName;
-        }
+        tableData.value = res.result.configVOList;
+        // for (let i=0;i<tableData.value.length;i++){
+        //   tableData.value[i].name=[];
+        //   for (let j=0;j<tableData.value[i].featureList.length-1;j++){
+        //     tableData.value[i].name.push(tableData.value[i].featureList[j].fieldName);
+        //   }
+        //   tableData.value[i].target=tableData.value[i].featureList[tableData.value[i].featureList.length-1].fieldName;
+        // }
       })
     };
      getpage();
@@ -202,14 +200,15 @@ export default {
                 .then(() => {
                     // ElMessage.success("删除成功");
                     // tableData.value.splice(index, 1);
-                  console.log("删除");
-                  let idx=tableData.value[index].configId;
+                  let idx=tableData.value[index].id;
                   console.log(idx);
-                  deleteModelByModelId(idx
+                  deleteConfig(idx
                   ).then(res=>{
                     //console.log("deleteres",res);
-                    if(res.status===200){
-                      location.reload();
+                    if(res.msg === '成功'){
+                      ElMessage.success("删除成功!")
+                      //location.reload();
+                      getpage();
                     }
                   });