Browse Source

feat: 分析可视化对接

icenaked 3 years ago
parent
commit
278a2a4be7

+ 6 - 8
src/api/analysis.js

@@ -1,4 +1,4 @@
-import {ANALYSIS_MODULE, MOCK} from "./_prefix";
+import {ANALYSIS_VISUALIZE_MODULE, MOCK} from "./_prefix";
 import {axios} from '../utils/request'
 
 /**
@@ -8,10 +8,7 @@ import {axios} from '../utils/request'
  */
 export const visualize = async payload => {
     const { userId, configId, func} = payload;
-    // return await axios.post(`${MOCK}`, {
-    return await axios.post(`${MOCK}/analysis/visualize/:configId`, {
-        userId, configId, func
-    }).then(res => {
+    return await axios.post(`${ANALYSIS_VISUALIZE_MODULE}/${configId}?userId=${userId}&func=${func}`).then(res => {
         return res;
     });
 }
@@ -21,8 +18,9 @@ export const visualize = async payload => {
  * @param userId
  * @returns
  */
-export const getAnalysisByConfig = async configId => {
-    // const res = await axios.get(`${MODEL_MODULE}/get/all`, {params: {userId: userId}})
-    const res = await axios.get(`${MOCK}/analysis/visualize/{configId}`)
+export const getAnalysisByConfig = async payload => {
+    const{ userId, configId} = payload
+    const res = await axios.get(`${ANALYSIS_VISUALIZE_MODULE}/api/analysis/visualize/${configId}?userId=${userId}`)
+    // const res = await axios.get(`${MOCK}/analysis/visualize/{configId}`)
     return res
 }

+ 4 - 5
src/api/analysisConfig.js

@@ -36,8 +36,8 @@ export const getAnalysisConfig = payload => {
  */
 export const deleteAnalysisConfig = payload => {
     const {configId} = payload;
-    // return axios.get(`${CONFIG_MODULE}/delete?configId=${configId}`).then(res => {
-    return axios.delete(`${MOCK}/ml/configs/${configId}`).then(res => {
+    return axios.delete(`${ANALYSIS_CONFIG_MODULE}/${configId}`).then(res => {
+    // return axios.delete(`${MOCK}/ml/configs/${configId}`).then(res => {
         return res;
     });
 }
@@ -49,8 +49,7 @@ export const deleteAnalysisConfig = payload => {
  */
 export const getOneAnalysisConfig = payload => {
     const { configId } = payload;
-    // return axios.get(`${CONFIG_MODULE}/get/one/config?configId=${configId}`).then(res => {
-    //   return res;});
-    return axios.get(`${MOCK}/analysis/configs/${configId}`).then(res => {
+    return axios.get(`${ANALYSIS_CONFIG_MODULE}/${configId}`).then(res => {
+    // return axios.get(`${MOCK}/analysis/configs/${configId}`).then(res => {
         return res;});
 }

+ 3 - 2
src/views/analysis/Analysis.vue

@@ -205,12 +205,12 @@ export default {
     };
     getPage();
 
-    const handleDelete = (id) => {
+    const handleDelete = (configId) => {
       ElMessageBox.confirm("确定要删除吗?", "提示", {
         type: "warning",
       })
           .then(() => {
-            deleteAnalysisConfig({id}
+            deleteAnalysisConfig({configId}
             ).then(res=>{
               if(res.msg === '成功'){
                 ElMessage.success("删除成功!")
@@ -244,6 +244,7 @@ export default {
         configId: selectConfigId,
         func: analysisType.value,
       }
+      console.log(payload)
       if (payload.func !== undefined){
         analysisVisible.value = false;
         ElMessageBox( {

+ 2 - 2
src/views/analysis/AnalysisConfig.vue

@@ -65,12 +65,12 @@ export default {
     };
     getPage();
 
-    const handleDelete = (id) => {
+    const handleDelete = (configId) => {
       ElMessageBox.confirm("确定要删除吗?", "提示", {
         type: "warning",
       })
           .then(() => {
-            deleteAnalysisConfig({id}
+            deleteAnalysisConfig({configId}
             ).then(res=>{
               if(res.msg === '成功'){
                 ElMessage.success("删除成功!")

+ 6 - 2
src/views/analysis/AnalysisHistory.vue

@@ -84,9 +84,13 @@ export default {
 
     const getData = () => {
       const route=useRoute()
+      const payload={
+        userId: 1,
+        configId: route.query.configId
+      }
       if(route.query.configId!=null) {
-        getAnalysisByConfig(route.query.configId).then(res => {
-          tableData.value = res.result.visualizationVOList;
+        getAnalysisByConfig(payload).then(res => {
+          tableData.value = res.result;
           for (let i=0;i<tableData.value.length;i++){
             tableData.value[i].analysisResult=JSON.stringify(tableData.value[i].analysisResult)
           }