Ver código fonte

feat: 模型配置优化,增加list条数显示

icenaked 3 anos atrás
pai
commit
931c55cb20

+ 12 - 0
src/views/analysis/Analysis.vue

@@ -36,6 +36,10 @@
       </el-table-column>
 
     </el-table>
+    <div class="pagination">
+      <el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex"
+                     :page-size="query.pageSize" :total="pageTotal" @current-change="handlePageChange"></el-pagination>
+    </div>
 
     <el-dialog title="新建统计分析配置" v-model="analysisVisible" width="50%">
       <el-form label-width="150px">
@@ -118,6 +122,12 @@ import {addAnalysisPipeline} from "../../api/analysisPipeline";
 export default {
   name: "Analysis",
   setup(){
+    const query = reactive({
+      file: "",
+      name: "",
+      pageIndex: 1,
+      pageSize: 10,
+    });
     const tableData = ref([]);
     const pageTotal = ref(0);
     let analysisVisible = ref(false);
@@ -188,6 +198,7 @@ export default {
         uid: 1
       }).then(res => {
         tableData.value = res.result.configVOList;
+        pageTotal.value = tableData.value.length
       })
     };
     getPage();
@@ -273,6 +284,7 @@ export default {
     }
 
     return{
+      query,
       tableData,
       pageTotal,
       analysisVisible,

+ 13 - 3
src/views/analysis/AnalysisConfig.vue

@@ -28,7 +28,10 @@
           </template>
         </el-table-column>
       </el-table>
-
+      <div class="pagination">
+        <el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex"
+                       :page-size="query.pageSize" :total="pageTotal" @current-change="handlePageChange"></el-pagination>
+      </div>
 
     </div>
 
@@ -36,13 +39,19 @@
 </template>
 
 <script>
-import {ref} from "vue";
+import {reactive, ref} from "vue";
 import {deleteAnalysisConfig, getAnalysisConfig} from "../../api/analysisConfig";
 import {ElMessage, ElMessageBox} from "element-plus";
 
 export default {
   name: "AnalysisConfig",
   setup(){
+    const query = reactive({
+      file: "",
+      name: "",
+      pageIndex: 1,
+      pageSize: 10,
+    });
     const tableData = ref([]);
     const pageTotal = ref(0);
 
@@ -50,8 +59,8 @@ export default {
       getAnalysisConfig({
         uid: 1
       }).then(res => {
-        console.log("res",res);
         tableData.value = res.result.configVOList;
+        pageTotal.value = tableData.value.length
       })
     };
     getPage();
@@ -75,6 +84,7 @@ export default {
 
 
     return{
+      query,
       tableData,
       pageTotal,
       getPage,

+ 14 - 0
src/views/analysis/AnalysisPipeline.vue

@@ -27,6 +27,10 @@
           </template>
         </el-table-column>
       </el-table>
+      <div class="pagination">
+        <el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex"
+                       :page-size="query.pageSize" :total="pageTotal" @current-change="handlePageChange"></el-pagination>
+      </div>
     </div>
     <el-dialog
         v-model="usePipelineVisible"
@@ -84,6 +88,13 @@ export default {
   name: "AnalysisPipeline",
 
   setup(){
+    const query = reactive({
+      file: "",
+      name: "",
+      pageIndex: 1,
+      pageSize: 10,
+    });
+    const pageTotal = ref(0);
     const tableData = ref();
     let usePipelineVisible = ref(false)
     let useForm = reactive({
@@ -111,6 +122,7 @@ export default {
       })
       getAllAnalysisPipeline({uid}).then(res =>{
         tableData.value = res.result.analysisPipelineVOList
+        pageTotal.value = tableData.value.length
       })
     }
     getPage()
@@ -338,6 +350,8 @@ export default {
     }
 
     return{
+      query,
+      pageTotal,
       tableData,
       usePipelineVisible,
       useForm,

+ 1 - 0
src/views/file/FileDetail.vue

@@ -151,6 +151,7 @@ export default {
         }
         getFileDetail(payload).then(res => {
           tableData.value = res.result.fileFields;
+          pageTotal.value = tableData.value.length
           fileId=route.query.fileId
         })
         // getFileDescribe(payload).then(res=>{

+ 6 - 1
src/views/ml/ConfigDetail.vue

@@ -13,7 +13,12 @@
         <div class="form-box" >
           <el-form ref="formRef" label-width="120px">
             <el-form-item label="学习类型:" >
-              {{config.learningType}}
+              <div v-if="config.learningType === 'SUPERVISED_LEARNING'">
+                监督学习
+              </div>
+              <div v-else-if="config.learningType === 'UNSUPERVISED_LEARNING'">
+                非监督学习
+              </div>
             </el-form-item>
             <el-form-item label="特征字段:" >
               {{config.features}}

+ 93 - 220
src/views/ml/ConfigList.vue

@@ -23,12 +23,6 @@
                 </el-select>
                 <el-input v-model="query.name" placeholder="配置名" class="handle-input mr10"></el-input>
                 <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
-<!--              <router-link to="modelList">-->
-<!--              <el-button type="success" icon="el-icon-plus"  style="position: absolute;right: 25em">所有配置</el-button>-->
-<!--              </router-link>-->
-<!--                <el-button type="success" icon="el-icon-plus" @click="handleEdit(tableData.length,0)" style="position: absolute;right: 15em">添加配置</el-button>-->
-<!--                <el-button type="danger" icon="el-icon-minus" @click="handleBatchDelete" style="position: absolute;right: 5em">批量删除</el-button>-->
-<!--            </div>-->
             </div>
             <el-table
                 :data="tableData" border class="table" ref="multipleTable"
@@ -38,9 +32,16 @@
             >
                 <el-table-column prop="configName" label="配置名"></el-table-column>
                 <el-table-column label="学习类型">
-                    <template #default="scope">{{ scope.row.learningType }}</template>
+                    <template #default="scope">
+                      <div v-if="scope.row.learningType === 'SUPERVISED_LEARNING'">
+                        监督学习
+                      </div>
+                      <div v-else-if="scope.row.learningType === 'UNSUPERVISED_LEARNING'">
+                        非监督学习
+                      </div>
+                    </template>
                 </el-table-column>
-              <el-table-column prop="fileInfoId" label="文件id"></el-table-column>
+              <el-table-column prop="fileName" label="文件名"></el-table-column>
                 <el-table-column label="特征字段">
                     <template #default="scope">{{ scope.row.features }}</template>
                 </el-table-column>
@@ -49,7 +50,6 @@
               </el-table-column>
                 <el-table-column label="操作" width="180" align="center">
                     <template #default="scope">
-
                       <router-link :to="{path:'/ConfigDetail',query:{configId:scope.row.id}}">
                         <el-button type="text" icon="el-icon-view" >查看详情
                         </el-button>
@@ -65,52 +65,6 @@
             </div>
         </div>
 
-        <!-- 编辑弹出框 -->
-        <el-dialog title="编辑" v-model="editVisible" min-width="30%">
-            <el-form label-width="150px">
-                <el-form-item label="配置名称" required>
-                    <el-input v-model="form.name"></el-input>
-                </el-form-item>
-                <el-form-item label="训练文件" required>
-                    <el-input v-model="form.file"></el-input>
-                </el-form-item>
-                <el-form-item label="选择模型类别" required>
-                  <el-radio-group v-model="modelSty.resource">
-                  <el-radio label="分类"></el-radio>
-                  <el-radio label="聚类"></el-radio>
-                  <el-radio label="回归"></el-radio>
-                  <el-radio label="自动化分类器"></el-radio>
-                  </el-radio-group>
-                </el-form-item>
-
-                <el-form-item label="特征选择方式" required>
-<!--                    <el-checkbox v-for="f in featureList" :key="f" :label="f"></el-checkbox>-->
-                  <el-radio-group v-model="featureSty.resource">
-                    <el-radio label="手动选择"></el-radio>
-                    <el-radio label="自动选择"></el-radio>
-                  </el-radio-group>
-                </el-form-item>
-
-<!--              <el-form-item label="单选框" prop="resource">-->
-<!--                <el-radio-group v-model="form.resource">-->
-<!--                  <el-radio label="步步高"></el-radio>-->
-<!--                  <el-radio label="小天才"></el-radio>-->
-<!--                  <el-radio label="imoo"></el-radio>-->
-<!--                </el-radio-group>-->
-<!--              </el-form-item>-->
-
-                <el-form-item label="选择特征字段" required>
-                  <el-alert type="info" description="您下列选择的第一个字段为分类模型的目标字段"
-                            show-icon style="height: 40px;"></el-alert>
-                </el-form-item>
-            </el-form>
-            <template #footer>
-                <span class="dialog-footer">
-                    <el-button @click="editVisible = false">取 消</el-button>
-                    <el-button type="primary" @click="saveEdit">确 定</el-button>
-                </span>
-            </template>
-        </el-dialog>
     </div>
 </template>
 
@@ -120,192 +74,111 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import { fetchData } from "../../api";
 import {addConfig, deleteConfig, getAllConfig} from "../../api/config";
 import {useRouter} from "vue-router";
+import {getFileDetail} from "../../api/file";
 
 export default {
-    name: "config",
-    //训练特征
-  // data(){
-  //     return{
-  //       form:{
-  //         name:"",
-  //         file:"",
-  //       }
-  //     }
-  // },
+  name: "config",
   setup() {
-    const featureSty = reactive({
-
-      resource: "小天才",
-
-    });
-    const modelSty = reactive({
-
-      resource: "小天才",
-
+    const query = reactive({
+        file: "",
+        name: "",
+        pageIndex: 1,
+        pageSize: 10,
     });
-        const query = reactive({
-            file: "",
-            name: "",
-            pageIndex: 1,
-            pageSize: 10,
-        });
 
-        //new TODO
-        const typeList=["所有","分类","聚类","回归","自动分类器"];
-        const featureList=["所有","手动选择","自动选择"];
-        const multipleSelection =ref([]);
+    const multipleSelection =ref([]);
 
-        // const tableData = ref([]);
-    const tableData = ref([
-      ]);
+    const tableData = ref([]);
 
-        const pageTotal = ref(0);
-        // 获取表格数据
+    const pageTotal = ref(0);
 
     const getpage=()=> {
-      getAllConfig({
+      const payload ={
         userId: 1
-      }).then(res => {
+      }
+      getAllConfig(payload).then(res => {
         tableData.value = res.result;
+        pageTotal.value = tableData.value.length
+        for (let i in tableData.value){
+          const filePayload={
+            userId: 1,
+            fileInfoId: tableData.value[i].fileInfoId
+          }
+          getFileDetail(filePayload).then(fileRes=>{
+            tableData.value[i].fileName = fileRes.result.fileName
+          })
+        }
       })
     };
      getpage();
 
-
-
     // 查询操作
-        const handleSearch = () => {
-            query.pageIndex = 1;
-            getData();
-        };
-        // 分页导航
-        const handlePageChange = (val) => {
-            query.pageIndex = val;
-            getData();
-        };
-
-        // 删除操作(单个)
-        const handleDelete = (index) => {
-            // 二次确认删除
-            ElMessageBox.confirm("确定要删除吗?", "提示", {
-                type: "warning",
-            })
-                .then(() => {
-                    // ElMessage.success("删除成功");
-                    // tableData.value.splice(index, 1);
-                  let idx=tableData.value[index].id;
-                  console.log(idx);
-                  const payload ={
-                    configId: idx,
-                    userId: 1
-                  }
-                  deleteConfig(payload
-                  ).then(res=>{
-                    if(res.msg === '成功'){
-                      ElMessage.success("删除成功!")
-                      //location.reload();
-                      getpage();
-                    }
-                  });
-
-                })
-                .catch(() => {});
-        };
-
-        //TODO
-        const handleSelectionChange = (val) => {
-          multipleSelection.value = val
-        };
-
-        //TODO 批量删除
-        const handleBatchDelete =()=>{
-          // 二次确认
-          if(multipleSelection.value.length<=0){
-            ElMessageBox.alert("请先勾选要删除的模型", '提示', {
-              confirmButtonText: '好的'
-            })
-          }
-          else{
-            ElMessageBox.confirm("确定要删除这些模型吗?", "提示", {
+      const handleSearch = () => {
+          query.pageIndex = 1;
+          getpage();
+      };
+      // 分页导航
+      const handlePageChange = (val) => {
+          query.pageIndex = val;
+          getpage();
+      };
+
+      // 删除操作(单个)
+      const handleDelete = (index) => {
+          // 二次确认删除
+          ElMessageBox.confirm("确定要删除吗?", "提示", {
               type: "warning",
-            })
-                .then(() => {
-                  let idList=[];
-                  for(let i=0;i<multipleSelection.value.length;i++){
-                    let id=multipleSelection.value[i]['id'];
-                    idList.push(id);
+          })
+              .then(() => {
+                let idx=tableData.value[index].id;
+                console.log(idx);
+                const payload ={
+                  configId: idx,
+                  userId: 1
+                }
+                deleteConfig(payload
+                ).then(res=>{
+                  if(res.msg === '成功'){
+                    ElMessage.success("删除成功!")
+                    //location.reload();
+                    getpage();
                   }
-                  idList.sort();
-                  console.log(idList);
-                  for (let i = idList[idList.length-1]; i >=0 ; i--) {
-                    tableData.value.splice(i,1);
-                  }
-                  ElMessage.success("删除成功");
-                })
-                .catch(() => {});
-          }
-        };
-
-        const getConfigDetail=(row,column,event)=>{
-          var configId=row.configId;
-         let router=useRouter()
-          router.push(`/ConfigDetail?configId=${configId}`)
-        }
-        // 表格编辑时弹窗和保存
-        const editVisible = ref(false);
-        let form = reactive({
-            name: "",
-            file: "",
-          // classification:"",
-          // feature:"",
-        });
-        let idx = -1;
-        const handleEdit = (index, row) => {
-            idx = index;
-            Object.keys(form).forEach((item) => {
-                form[item] = row[item];
-            });
-            editVisible.value = true;
-        };
-
-        const saveEdit = () => {
-            editVisible.value = false;
-            // ElMessage.success(`修改第 ${idx + 1} 行成功`);
-            // Object.keys(form).forEach((item) => {
-            //     tableData.value[idx][item] = form[item];
-            // });
-          // console.log("here",featureSty.resource);
-          // const { , ,confName , fieldIds} = payload;
-
-          addConfig({
-            fileInfoId:form.file,
-            userId:0,
-            modelTypeId:modelSty.resource,
-            confName:form.name,
-            fieldIds:featureSty.resource
-            }).then(res=>{
-              console.log(res);
-            });
-        };
-
-        return {
-            query,
-            tableData,
-            pageTotal,
-            editVisible,
-            form,
-            handleSearch,
-            handlePageChange,
-            handleDelete,
+                });
+
+              })
+              .catch(() => {});
+      };
+
+      //TODO
+      const handleSelectionChange = (val) => {
+        multipleSelection.value = val
+      };
+
+      const getConfigDetail=(row,column,event)=>{
+        var configId=row.configId;
+       let router=useRouter()
+        router.push(`/ConfigDetail?configId=${configId}`)
+      }
+      // 表格编辑时弹窗和保存
+      const editVisible = ref(false);
+      let form = reactive({
+          name: "",
+          file: "",
+      });
+
+      return {
+          query,
+          tableData,
+          pageTotal,
+          editVisible,
+          form,
+          handleSearch,
+          handlePageChange,
+          handleDelete,
           handleSelectionChange,
-            handleBatchDelete,
-            handleEdit,
-            saveEdit,
           getConfigDetail,
-            featureSty,
-          modelSty,
           getpage,
-        };
+      };
     },
 };
 </script>

+ 14 - 0
src/views/ml/MLPipeline.vue

@@ -34,6 +34,10 @@
         </template>
       </el-table-column>
     </el-table>
+    <div class="pagination">
+      <el-pagination background layout="total, prev, pager, next" :current-page="query.pageIndex"
+                     :page-size="query.pageSize" :total="pageTotal" @current-change="handlePageChange"></el-pagination>
+    </div>
   </div>
 
   <el-dialog
@@ -74,6 +78,13 @@ import {GetAllFile} from "../../api/file";
 export default {
   name: "MLPipeline",
   setup(){
+    const query = reactive({
+      file: "",
+      name: "",
+      pageIndex: 1,
+      pageSize: 10,
+    });
+    const pageTotal = ref(0);
     const tableData = ref();
     let usePipelineVisible = ref(false)
     let useForm = reactive({
@@ -90,6 +101,7 @@ export default {
       })
       getAllPipeline({uid}).then(res =>{
         tableData.value = res.result.pipeLineVOList
+        pageTotal.value = tableData.value.length
       })
     }
     getPage()
@@ -167,6 +179,8 @@ export default {
     }
 
     return{
+      query,
+      pageTotal,
       tableData,
       usePipelineVisible,
       useForm,