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

feat: getFileDetail接口测试成功

10702 4 лет назад
Родитель
Сommit
00ba86b23a
5 измененных файлов с 141 добавлено и 173 удалено
  1. 109 105
      src/api/file.js
  2. 1 1
      src/components/Sidebar.vue
  3. 1 1
      src/views/DLForm.vue
  4. 30 64
      src/views/FileList.vue
  5. 0 2
      vite.config.js

+ 109 - 105
src/api/file.js

@@ -46,115 +46,119 @@ export const GetAllFile = payload => {
  * @param {*} payload
  * @returns
  */
-export const getFileDetail = payload => {
-    // console.log(payload);
-    // const {fileId} = payload;
-    // return axios.get(`${FILE_MODULE}/get/detail`, {params:{fileId:fileId}}).then(res => {
-    //     return res.data;
-    // });
-    return Promise.resolve({
-        "timestamp": 1649398931190,
-        "status": 200,
-        "data": {
-            "fileName": "event_data",
-            "createTime": "2022-03-29T09:25:43.154+00:00",
-            "fileStrucInfo": {
-                "totalRows": "754"
-            },
-            "headerInfos": [
-                {
-                    "id": 103,
-                    "fileInfoId": 1,
-                    "fieldName": "frame_index",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 1,
-                    "fieldType": "int",
-                    "valueInfo": "[\"79\",\"89992\"]"
-                },
-                {
-                    "id": 104,
-                    "fileInfoId": 1,
-                    "fieldName": "time",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 1,
-                    "fieldType": "double",
-                    "valueInfo": "[\"3.16\",\"3599.68\"]"
-                },
-                {
-                    "id": 105,
-                    "fileInfoId": 1,
-                    "fieldName": "road",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 0,
-                    "fieldType": "string",
-                    "valueInfo": "[\"R\",\"L\"]"
-                },
-                {
-                    "id": 106,
-                    "fileInfoId": 1,
-                    "fieldName": "lane",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 0,
-                    "fieldType": "string",
-                    "valueInfo": "[\"r\",\"m\",\"l\"]"
-                },
-                {
-                    "id": 107,
-                    "fileInfoId": 1,
-                    "fieldName": "vehicle_class",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 0,
-                    "fieldType": "string",
-                    "valueInfo": "[\"car\",\"truck\",\"bus\"]"
-                },
-                {
-                    "id": 108,
-                    "fileInfoId": 1,
-                    "fieldName": "vehicle_id",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 1,
-                    "fieldType": "int",
-                    "valueInfo": "[\"20\",\"46862\"]"
-                },
-                {
-                    "id": 109,
-                    "fileInfoId": 1,
-                    "fieldName": "event_type",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 0,
-                    "fieldType": "string",
-                    "valueInfo": "[\"cruise\",\"overdrive\"]"
-                },
-                {
-                    "id": 110,
-                    "fileInfoId": 1,
-                    "fieldName": "duration",
-                    "aliasName": "",
-                    "fieldDes": "",
-                    "nullsRatio": 0.0,
-                    "conOrDis": 0,
-                    "fieldType": "string",
-                    "valueInfo": "[\"48,60\",\"24,36\",\"36,48\",\"12,24\",\"0,12\"]"
-                }
-            ]
+export const getFileDetail = fileId => {
+    return axios.get(`${FILE_MODULE}/get/detail`, {
+        params: {
+            fileId: fileId
         }
+    }).then(res => {
+        return res.data;
     })
+    //假数据:
+    // return Promise.resolve({
+    //     "timestamp": 1649398931190,
+    //     "status": 200,
+    //     "data": {
+    //         "fileName": "event_data",
+    //         "createTime": "2022-03-29T09:25:43.154+00:00",
+    //         "fileStrucInfo": {
+    //             "totalRows": "754"
+    //         },
+    //         "headerInfos": [
+    //             {
+    //                 "id": 103,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "frame_index",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 1,
+    //                 "fieldType": "int",
+    //                 "valueInfo": "[\"79\",\"89992\"]"
+    //             },
+    //             {
+    //                 "id": 104,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "time",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 1,
+    //                 "fieldType": "double",
+    //                 "valueInfo": "[\"3.16\",\"3599.68\"]"
+    //             },
+    //             {
+    //                 "id": 105,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "road",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 0,
+    //                 "fieldType": "string",
+    //                 "valueInfo": "[\"R\",\"L\"]"
+    //             },
+    //             {
+    //                 "id": 106,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "lane",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 0,
+    //                 "fieldType": "string",
+    //                 "valueInfo": "[\"r\",\"m\",\"l\"]"
+    //             },
+    //             {
+    //                 "id": 107,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "vehicle_class",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 0,
+    //                 "fieldType": "string",
+    //                 "valueInfo": "[\"car\",\"truck\",\"bus\"]"
+    //             },
+    //             {
+    //                 "id": 108,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "vehicle_id",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 1,
+    //                 "fieldType": "int",
+    //                 "valueInfo": "[\"20\",\"46862\"]"
+    //             },
+    //             {
+    //                 "id": 109,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "event_type",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 0,
+    //                 "fieldType": "string",
+    //                 "valueInfo": "[\"cruise\",\"overdrive\"]"
+    //             },
+    //             {
+    //                 "id": 110,
+    //                 "fileInfoId": 1,
+    //                 "fieldName": "duration",
+    //                 "aliasName": "",
+    //                 "fieldDes": "",
+    //                 "nullsRatio": 0.0,
+    //                 "conOrDis": 0,
+    //                 "fieldType": "string",
+    //                 "valueInfo": "[\"48,60\",\"24,36\",\"36,48\",\"12,24\",\"0,12\"]"
+    //             }
+    //         ]
+    //     }
+    // })
 }
 
+
 /**
  *  删除文件 GET /delete
  * @param {*} payload

+ 1 - 1
src/components/Sidebar.vue

@@ -33,7 +33,7 @@
 </template>
 
 <script>
-import { computed, watch } from "vue";
+import { computed } from "vue";
 import { useStore } from "vuex";
 import { useRoute } from "vue-router";
 export default {

+ 1 - 1
src/views/dlform.vue → src/views/DLForm.vue

@@ -95,7 +95,7 @@
 import { reactive, ref } from "vue";
 import { ElMessage } from "element-plus";
 export default {
-  name: "baseform",
+  name: "DLForm",
   setup() {
     const options = [
       {

+ 30 - 64
src/views/FileList.vue

@@ -1,31 +1,3 @@
-<!--<template>-->
-<!--<div className="home-page">-->
-<!--<div className="sub-menu">-->
-<!--  <button class="el-button el-button&#45;&#45;primary" type="button" data-v-4eda24fc="">&lt;!&ndash;v-if&ndash;&gt;<i class="el-icon-upload"></i><span>上传</span></button>-->
-
-
-<!--  <button class="el-button el-button&#45;&#45;primary" type="button" data-v-4eda24fc="">&lt;!&ndash;v-if&ndash;&gt;<i class="el-icon-s-home"></i><span>模型</span></button>-->
-<!--</div>-->
-<!--<div className="carousel-page">-->
-<!--  <h3 className="img-list-title">图片文件列表</h3>-->
-
-
-
-
-<!--    <el-table  :show-header="false" style="width: 100%">-->
-<!--      <div>1</div>>-->
-<!--    </el-table>-->
-
-
-
-
-
-
-<!--</div>-->
-<!--</div>-->
-<!--</template>-->
-
-
 <template>
   <div class="">
     <div class="crumbs">
@@ -33,41 +5,40 @@
         <el-breadcrumb-item><i class="el-icon-lx-file"></i> 我的文件</el-breadcrumb-item>
       </el-breadcrumb>
     </div>
+
     <div class="container">
+
       <el-tabs v-model="message">
+
         <el-tab-pane :label="`我的文件列表`" name="first">
           <el-table :data="state.fileList" :show-header="false" style="width: 100%">
+
             <el-table-column>
               <template #default="scope">
                 <span class="message-title">{{scope.row.fileName}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="date" width="180"></el-table-column>
-            <el-table-column width="120">
+
+            <el-table-column prop="date" width="180">
+
+            </el-table-column>
+
+            <el-table-column width="240">
               <template #default="scope">
                 <!----------------------------todo------------------------------->
                 <!----------------------------获取文件详细信息、跳转到响应页面;删除文件------------------------------->
-                <router-link :to="{path:'/fileDetail',query:{fileId:scope.row.fileId}}">
-                <!--<router-link to="/dashboard">-->
-                <el-button size="small" @click="handleFileGet(scope.row.fileId)">获取详情</el-button>
-                </router-link>
-                <el-button size="small" @click="handleFileDel(scope.$index)">删除文件</el-button>
+                <div style="display:flex;width: 100%;justify-content:space-around;">
+                  <router-link :to="{path:'/fileDetail',query:{fileId:scope.row.fileId}}">
+                    <el-button size="small" @click="handleFileGet(scope.row.fileId)">获取详情</el-button>
+                  </router-link>
+
+                  <el-button size="small" @click="handleFileDel(scope.$index)">删除文件</el-button>
+                </div>
               </template>
             </el-table-column>
           </el-table>
-<!--          <div class="handle-row">-->
-<!--            <el-button type="primary">全部标为已读</el-button>-->
-<!--          </div>-->
-
-<!--            <button class="el-button el-button&#45;&#45;primary" type="button" data-v-4eda24fc="">&lt;!&ndash;v-if&ndash;&gt;<i class="el-icon-upload"></i><span>上传</span></button>-->
-
-<!--            <router-link to="/config">-->
-<!--&lt;!&ndash;            <button class="el-button el-button&#45;&#45;primary" type="button" data-v-4eda24fc="">&lt;!&ndash;v-if&ndash;&gt;<i class="el-icon-s-home"></i><span>添加模型</span></button>&ndash;&gt;-->
-<!--              <el-button type="primary" size="large">配置模型</el-button>-->
-<!--            </router-link>-->
-
-
         </el-tab-pane>
+
         <el-tab-pane :label="`我的图片列表`" name="second">
           <el-table :data="state.picList" :show-header="false" style="width: 100%">
             <el-table-column>
@@ -83,13 +54,13 @@
             </el-table-column>
           </el-table>
         </el-tab-pane>
+
         <router-link to="/upload">
           <el-button type="primary" size="large">文件上传</el-button>
         </router-link>
-
-
       </el-tabs>
     </div>
+
   </div>
 </template>
 
@@ -99,7 +70,7 @@ import{GetAllFile,getFileDetail} from "../api/file";
 import router from "../router";
 
 export default {
-  name: "tabs",
+  name: "fileList",
   setup() {
     const message = ref("first");
     let userId=1;
@@ -123,18 +94,6 @@ export default {
           picName:"图片1"
         }
       ],
-      // read: [
-      //   {
-      //     date: "2018-04-19 20:00:00",
-      //     title: "【系统通知】该系统将于今晚凌晨2点到5点进行升级维护",
-      //   },
-      // ],
-      // recycle: [
-      //   {
-      //     date: "2018-04-19 20:00:00",
-      //     title: "【系统通知】该系统将于今晚凌晨2点到5点进行升级维护",
-      //   },
-      // ],
     });
 
     // const handleRead = (index) => {
@@ -159,9 +118,15 @@ export default {
     //   const item = state.recycle.splice(index, 1);
     //   state.read = item.concat(state.read);
     // };
-    const handleFileGet=(index)=>{
+
+    const handleFileGet=(fileId)=>{
       console.log("handleFileGet")
-      console.log(index)
+      console.log(fileId)
+      getFileDetail(fileId).then(res => {
+        console.log("getFileDetail返回")
+        console.log(res)
+      })
+      // getFileDetail()
       // this.router.push({
       //     path:'fileDetail',
       //   query:{
@@ -169,6 +134,7 @@ export default {
       //   }
       // })
 
+
       //todo:吧要查看的文件id传参
     }
 

+ 0 - 2
vite.config.js

@@ -9,8 +9,6 @@ export default {
 
     server:{
         proxy: {
-
-
             '/api': 'http://114.212.245.120:7788/',
             // '/api': {
             //     target: 'http://114.212.245.120:7788/',