Przeglądaj źródła

完善文件界面

chillqi 3 lat temu
rodzic
commit
e6a6cff2ec

+ 1 - 1
src/api/config.js

@@ -118,4 +118,4 @@ export const getFeatureSelection = payload => {
 
     return res;
   });
-}
+}

+ 3 - 4
src/api/file.js

@@ -61,7 +61,6 @@ export const GetAllFile = userId => {
  * @returns
  */
 export const getFileDetail = payload => {
-    console.log(payload)
     const {fileInfoId, userId} = payload;
     return axios.get(`${FILE_MODULE}/${fileInfoId}`,{
         params:{
@@ -74,11 +73,11 @@ export const getFileDetail = payload => {
 
 /**
  *  删除文件 GET /delete
- * @param {*} fileId
  * @returns
+ * @param fileInfoId
  */
-export const deleteFile = fileId => {
-    return axios.delete(`${FILE_MODULE}/${fileId}`).then( res => {
+export const deleteFile = fileInfoId => {
+    return axios.delete(`${FILE_MODULE}/$fileInfoId}`).then( res => {
         return res;
     });
 }

+ 3 - 4
src/api/square.js

@@ -31,10 +31,9 @@ export const shareFile = payload => {
     });
 }
 
-export const shareModel = (userId,modelId) => {
-    return axios.post(`${SQUARE_MODULE}/shareModel`, {
-        userId, modelId
-    }).then( res => {
+export const shareModel = payload => {
+    const {userId, modelId} = payload;
+    return axios.post(`${SQUARE_MODULE}/shareFile?userId=${userId}&fileId=${modelId}`).then( res => {
         return res;
     });
 }

+ 4 - 4
src/components/Sidebar.vue

@@ -58,14 +58,14 @@ export default {
                 title: "配置",
                 index: 1,
                 subs: [
-                    {
-                        index: "/config",
-                        title: "模型配置"
-                    },
                     {
                         index: "/analysisConfig",
                         title: "数据统计配置",
                     },
+                    {
+                        index: "/config",
+                        title: "AI模型配置"
+                    },
                 ]
             },
 

+ 1 - 0
src/views/Square.vue

@@ -193,6 +193,7 @@
                                 id: 1,
                                 fieldName: '1',
                                 nullRate: '2%',
+                                majority: '1',
                                 dataType: 'Number',
                             }
                         ]

+ 92 - 51
src/views/file/FileDetail.vue

@@ -12,13 +12,11 @@
     </div>
     <div class="container">
       <div class="handle-box">
-        <el-button type="success" size="small" icon="el-icon-plus" @click="handleAnalysis">统计分析配置</el-button>
+        <el-button type="success" size="medium" icon="el-icon-plus" @click="handleAnalysis">数据统计配置</el-button>
 
-        <el-button type="primary" size="small" icon="el-icon-plus" @click="createConfig">AI模型配置</el-button>
+        <el-button type="primary" size="medium" icon="el-icon-plus" @click="createConfig">AI模型配置</el-button>
 
-        <el-button type="primary" size="small" @click="getFeature">自动特征选择</el-button>
-
-        <el-button type="primary" size="small" @click="handleAnalysisByHand">文件分析</el-button>
+        <el-button type="primary" size="medium" @click="handleAnalysisByHand">重新分析</el-button>
       </div>
 
       <el-table :data="tableData"
@@ -26,6 +24,7 @@
                 ref="fieldTable"
                 header-cell-class-name="table-header"
                 @selection-change="handleSelectChange"
+                :row-style="tableRowStyle"
       >
         <el-table-column width="50" type="selection"></el-table-column>
         <el-table-column label="序号">
@@ -50,34 +49,33 @@
       </div>
     </div>
 
-    <el-dialog title="新建统计分析配置" v-model="analysisVisible" width="50%">
-      <el-form label-width="120px">
+    <el-dialog title="新建数据统计配置" v-model="analysisVisible" width="50%">
+      <el-form label-position="left">
         <el-form-item label="配置名" required>
           <el-input v-model="analysisConfName"></el-input>
         </el-form-item>
         <el-alert type="info"
-                  show-icon style="height: 40px;">{{methodMsg.valueOf()}}</el-alert>
-        <el-form-item label="方法和字段要求" required>
-          <text>皮尔森相关系数需要2个int/double字段,散点图可以传入2个字段,其他的方法只需一个字段。除了数据分布可以传入string字段,其他方法请传入int/double字段</text>
-        </el-form-item>
-        <el-form-item label="已选择字段" required>
-          <el-table :data="selectData" border class="table"  header-cell-class-name="table-header" >
-            <el-table-column label="字段名">
-              <template #default="scope"><span>{{ scope.row.fieldName }}</span></template>
-            </el-table-column>
-          </el-table>
-        </el-form-item>
+                  show-icon style="line-height: 20px; margin-bottom: 20px">不同方法仅适用于特定特征字段。<br>
+                  皮尔森相关系数需要2个int/double字段,散点图可以传入2个字段,其他的方法只需一个字段。<br>除了数据分布可以传入string字段,其他方法请传入int/double字段。</el-alert>
       </el-form>
+      <el-table :data="selectData" border class="table" size="small" header-cell-class-name="table-header">
+        <el-table-column label="已选字段名">
+          <template #default="scope"><span>{{ scope.row.fieldName }}</span></template>
+        </el-table-column>
+        <el-table-column label="字段类型">
+          <template #default="scope"><span>{{ scope.row.dataType }}</span></template>
+        </el-table-column>
+      </el-table>
       <template #footer>
                 <span class="dialog-footer">
-                    <el-button @click="analysisVisible = false">取 消</el-button>
-                    <el-button type="primary" @click="createAnalysisConfig()">确 定</el-button>
+                    <el-button @click="analysisVisible = false" size="medium">再想想</el-button>
+                    <el-button type="primary" @click="createAnalysisConfig()" size="medium">确定</el-button>
                 </span>
       </template>
     </el-dialog>
 
     <el-dialog title="新建AI模型配置" v-model="configCreate" width="50%">
-      <el-form label-width="120px">
+      <el-form label-width="90px" label-position="left">
         <el-form-item label="配置名" required>
           <el-input v-model="form.name"></el-input>
         </el-form-item>
@@ -93,19 +91,30 @@
                     show-icon style="height: 40px; margin-top: 10px"></el-alert>
         </el-form-item>
 
-        <el-form-item label="选中字段" >
-          <el-table :data="selectData" border class="table" header-cell-class-name="table-header" >
-            <el-table-column label="字段名">
-              <template #default="scope"><span>{{ scope.row.fieldName }}</span></template>
-            </el-table-column>
-          </el-table>
-        </el-form-item>
+        <el-table :data="selectData" border class="table" header-cell-class-name="table-header" size="small"
+                  v-if="form.type !== 'SUPERVISED_LEARNING'">
+          <el-table-column label="已选字段名">
+            <template #default="scope"><span>{{ scope.row.fieldName }}</span></template>
+          </el-table-column>
+          <el-table-column label="字段类型">
+            <template #default="scope"><span>{{ scope.row.dataType }}</span></template>
+          </el-table-column>
+        </el-table>
 
+        <el-table :data="selectData" border class="table" header-cell-class-name="table-header" size="small"
+                  :row-style="AITableRowStyle" v-if="form.type === 'SUPERVISED_LEARNING'">
+          <el-table-column label="已选字段名">
+            <template #default="scope"><span>{{ scope.row.fieldName }}</span></template>
+          </el-table-column>
+          <el-table-column label="字段类型">
+            <template #default="scope"><span>{{ scope.row.dataType }}</span></template>
+          </el-table-column>
+        </el-table>
       </el-form>
       <template #footer>
                 <span class="dialog-footer">
-                    <el-button @click="configCreate = false">取 消</el-button>
-                    <el-button type="primary" @click="saveConfig">确 定</el-button>
+                    <el-button @click="configCreate = false" size="medium">再想想</el-button>
+                    <el-button type="primary" @click="saveConfig" size="medium">确定</el-button>
                 </span>
       </template>
     </el-dialog>
@@ -118,7 +127,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import {getFileDescribe, getFileDetail} from "../../api/file";
 import {useRoute}from "vue-router";
 import {useRouter}from "vue-router";
-import {addConfig,getFeatureSelection} from "../../api/config";
+import {addConfig} from "../../api/config";
 import {addAnalysisConfig} from "../../api/analysisConfig";
 
 export default {
@@ -126,14 +135,13 @@ export default {
   //训练特征
   setup() {
     const router=useRouter();
-    const methodMsg=ref("不同方法仅适用于特定特征字段")
     const query = reactive({
       address: "",
       name: "",
       pageIndex: 1,
       pageSize: 10,
     });
-    let fileId;
+    let fileInfoId;
     let AnalysisMethodName=["数据分布","散点图","数据统计","偏度-峰度","皮尔森相关系数"];
 
     const tableData = ref([]);
@@ -144,6 +152,7 @@ export default {
     // 获取表格数据
     const getData = () => {
       const route=useRoute()
+      console.log(route.query)
       if(route.query.fileId!=null) {
         const payload ={
           fileInfoId: route.query.fileId,
@@ -152,13 +161,9 @@ export default {
         getFileDetail(payload).then(res => {
           tableData.value = res.result.fileFields;
           pageTotal.value = tableData.value.length
-          fileId=route.query.fileId
+          fileInfoId=route.query.fileId
         })
-        // getFileDescribe(payload).then(res=>{
-        //   console.log("describe: "+JSON.stringify(res.result))
-        // })
       }
-
     };
     getData();
 
@@ -184,7 +189,7 @@ export default {
 
     const handleAnalysis = () => {
       if (selectData.value.length<1){
-        ElMessage.warning("至少选择一个字段!");
+        ElMessage.warning("请选择需要的字段!");
         return ;
       }
       analysisVisible.value = true;
@@ -197,7 +202,7 @@ export default {
         chosenColumns:[],
       }
       if(payload.configName === undefined){
-        ElMessage.error("请输入必要信息!")
+        ElMessage.warning("请输入配置名!")
         return
       }
         for(let i=0;i<selectData.value.length;i++){
@@ -207,10 +212,10 @@ export default {
       addAnalysisConfig(payload).then(res=>{
         console.log("r"+JSON.stringify(res))
         if(res.msg === '成功') {
-          ElMessage.success(`已成功生成配置`);
+          ElMessage.success(`已成功生成数据统计配置`);
           analysisVisible.value = false;
         }
-        else ElMessage.error(`生成配置失败:`+res.msg);
+        else ElMessage.error(`生成数据统计配置失败:`+res.msg);
       })
     };
 
@@ -221,7 +226,7 @@ export default {
     const configCreate = ref(false);
     const createConfig =() => {
       if (selectData.value.length<=1){
-        ElMessage.warning("至少选择两个字段!");
+        ElMessage.warning("请选择至少两个字段!若为监督学习,最后选择的字段将作为标签");
         return ;
       }
       configCreate.value = true;
@@ -236,7 +241,7 @@ export default {
         label: ''
       }
       if(payload.configName === "" || payload.learningType === "" ){
-        ElMessage.error("请输入必要信息!")
+        ElMessage.warning("请输入必要信息!")
         return
       }
       if (form.type === 'UNSUPERVISED_LEARNING'){
@@ -252,21 +257,34 @@ export default {
       }
       addConfig(payload).then(res=>{
         if(res.msg === '成功') {
-          ElMessage.success(`已成功生成配置`);
+          ElMessage.success(`已成功生成AI模型配置`);
           configCreate.value = false;
         }
-        else ElMessage.error(`生成配置失败`+res.msg);
+        else ElMessage.error(`生成AI模型配置失败`+res.msg);
       })
     }
 
+    let ids=ref([]);
+
     const handleSelectChange=val=>{
       selectData.value=val;
+      ids = val.map(item => item.id);
+      //console.log(ids)
     };
 
     const handleAnalysisByHand=()=>{
-      getFileDescribe(fileId, localStorage.getItem("ms_userId"))
+      const payload ={
+        fileInfoId: fileInfoId,
+        userId: localStorage.getItem("ms_userId")
+      }
+      getFileDescribe(payload)
         .then(res=>{
-          getData();
+          ElMessage.success(`已成功重新分析文件`);
+          setTimeout(() => {
+            // 方法区
+            location.reload();
+          }, 2000);
+
         })
     };
 
@@ -274,6 +292,25 @@ export default {
       return val + "%";
     };
 
+    const AITableRowStyle=(row)=> {
+      let rowFont = {};
+      if (row.rowIndex === selectData.value.length - 1) {
+        rowFont.color = "red";
+        return rowFont;
+      } else {
+        return '';
+      }
+    };
+
+    const tableRowStyle=(row)=>{
+      let arr = ids;
+      let rowFont = {};
+      if(row.row.id === arr[arr.length - 1]){
+        rowFont.color = "red";
+        return rowFont;
+      }
+    };
+
     return {
       query,
       AnalysisMethodName,
@@ -290,7 +327,6 @@ export default {
       analysisData,
       featureTip,
       labelTip,
-      methodMsg,
       getData,
       createAnalysisConfig,
       handleSelectChange,
@@ -298,7 +334,11 @@ export default {
       handlePageChange,
       handleAnalysis,
       handleNullRate,
-      handleAnalysisByHand
+      handleAnalysisByHand,
+      AITableRowStyle,
+
+      ids,
+      tableRowStyle
     };
   },
 };
@@ -324,7 +364,7 @@ export default {
   font-size: 14px;
 }
 .red {
-  color: #ff0000;
+  color: skyblue;
 }
 .mr10 {
   margin-right: 10px;
@@ -335,4 +375,5 @@ export default {
   width: 40px;
   height: 40px;
 }
+
 </style>

+ 1 - 3
src/views/ml/ModelList.vue

@@ -62,9 +62,7 @@
             <div v-else>
               <el-button type="text" style="color: gray">暂未成功训练</el-button>
             </div>
-            <div>
-              <el-button type="text" class="yellow" @click="handleShare(scope.$index, scope.row)">分享</el-button>
-            </div>
+            <el-button type="text" class="yellow" @click="handleShare(scope.$index, scope.row)">分享</el-button>
             <el-button type="text" class="red" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
           </template>
         </el-table-column>