liuYb 4 年之前
父节点
当前提交
356158bc4e
共有 2 个文件被更改,包括 109 次插入71 次删除
  1. 27 22
      src/views/data/InforList.vue
  2. 82 49
      src/views/data/components/InfoListItemDetail.vue

+ 27 - 22
src/views/data/InforList.vue

@@ -77,7 +77,7 @@
                     v-for="(operationObj, i) in operation"
                     :key="i"
                     @click="
-                      operationObj.function(obj);
+                      operationObj.function(obj, index);
                       nowIndex = index;
                     "
                     >{{ operationObj.name }}
@@ -99,11 +99,12 @@
       </div>
     </div>
     <div v-else>
-      <Detail
+      <Detail></Detail>
+      <!-- <Detail
         :detailData="tableData"
         :nowIndex="nowIndex"
         :fileData="tableFileData"
-      ></Detail>
+      ></Detail> -->
     </div>
   </div>
 </template>
@@ -146,30 +147,25 @@ export default {
       operation: [
         {
           name: "下载",
-          function: (obj) => {
+          function: (obj, i) => {
+            console.log(obj, i);
             let config = {
               url: "/dealerDownload",
               data: {
                 informationId: obj.id,
-                // agentId: obj.agentId,
               },
             };
             this.downloadPost(config);
           },
         },
-        /*    {
-          name: "反馈",
-          function: () => {
-            this.feedback();
-          },
-        }, */
         {
           name: "查看详情>",
-          function: (obj) => {
+          function: (obj, i) => {
             let data = {
               informationId: obj.id,
             };
-            this.showDetail(data);
+            this.showDetail(data, i);
+            console.log(obj, i);
           },
         },
       ],
@@ -276,7 +272,9 @@ export default {
       }); */
     },
     //查看详情
-    showDetail: function (config) {
+    showDetail: function (config, i) {
+      console.log(config);
+      /*  //获取附件数据
       this.$http({
         url: "/selectInformationFileList",
         method: "post",
@@ -289,9 +287,17 @@ export default {
         })
         .catch((err) => {
           console.log(err);
-        });
-      //this.initialPage = !this.initialPage;
-      this.$router.push({ query: { tag: "infoListDetail" } });
+        }); */
+      this.$router.push({
+        query: {
+          tag: "infoListDetail",
+          informationId: config.informationId,
+          nowIndex: i,
+          agentId: this.userId,
+          Page: this.currentPage,
+          Rows: this.pageSize,
+        },
+      });
     },
     //获取资料列表
     getDataList: function () {
@@ -299,7 +305,7 @@ export default {
         url: "/firmsUploadListByAgent",
         method: "post",
         data: {
-          agentId: 254,
+          agentId: this.userId,
           Page: this.currentPage,
           Rows: this.pageSize,
         },
@@ -321,7 +327,7 @@ export default {
         url: "/firmsUploadListByAgent",
         method: "post",
         data: {
-          agentId: 254,
+          agentId: this.userId,
           Page: nowpage,
           Rows: this.pageSize,
         },
@@ -330,7 +336,6 @@ export default {
           console.log(res);
           if (res.data.code === 200) {
             this.tableData = res.data.data;
-            //this.sum = res.data.count;
           }
         })
         .catch((err) => {
@@ -387,7 +392,7 @@ export default {
         download: download,
         Page: 1,
         Rows: this.pageSize,
-        agentId: 254,
+        agentId: this.userId,
       };
       this.newGetDataList(data);
     },
@@ -395,7 +400,7 @@ export default {
   mounted() {
     let localUserId = localStorage.getItem("userId");
     if (localUserId) {
-      console.log("经销商ID",localUserId);
+      console.log("经销商ID", localUserId);
       this.userId = localUserId;
     } else {
       console.log("经销商ID 254");

+ 82 - 49
src/views/data/components/InfoListItemDetail.vue

@@ -4,7 +4,7 @@
       <p class="data_detail">数据详情</p>
     </div>
     <div class="content">
-      <div class="content_datail">
+      <div class="content_datail" v-if="detailData[nowIndex].informationName">
         <div class="detail">
           <span>资料名称:</span>
           <span>{{ detailData[nowIndex].informationName }}</span>
@@ -63,43 +63,61 @@
 <script>
 export default {
   props: {
-    detailData: {
+    /*     detailData: {
       type: Array,
       default: () => {
         return [];
       },
-    },
-    fileData: {
+    }, */
+    /*     fileData: {
       type: Array,
       default: () => {
         return [];
       },
-    },
-    nowIndex: {
+    }, */
+    /*     nowIndex: {
       type: Number,
       default: -1,
-    },
+    }, */
   },
   components: {},
   data() {
     return {
       dataObj: {},
       onlineUrl: "http://8.136.230.133:8080",
+      informationId: this.$route.query.informationId || "",
+      nowIndex: this.$route.query.nowIndex || "",
+
+      rows: this.$route.query.Rows || 20,
+      page: this.$route.query.Page || 1,
+      agentId: (this.$route.query && this.$route.query.agentId) || "",
+
+      detailData: [
+        {
+          accountScope: '',
+          agentId: "",
+          asc: '',
+          download: "",
+          downloadCount: null,
+          fileDiscription: "",
+          filePulishTime: "",
+          fileUploadCreator: "",
+          fileUploadDate: "",
+          fileUploadDateLt: null,
+          id: "",
+          informationName: "1234",
+          report: "",
+          reportId: "",
+          totalCount: null,
+        },
+      ],
+      fileData: [],
     };
   },
-  computed: {
-    // 表格总页数
-    totalPage() {
-      return Math.ceil(this.sum / this.pageSize);
-    },
-  },
+  computed: {},
   methods: {
     // 下载附件
     downloadFile: function (index) {
-      /* let config = {
-        informationId: this.fileData[index].informationId,
-        fileId: this.fileData[index].id,
-      }; */
       let config =
         "informationId=" +
         this.fileData[index].informationId +
@@ -109,40 +127,54 @@ export default {
       let url = this.onlineUrl + "/dealerDownload?" + config;
       console.log("下载附件:", config, url);
       window.open(url);
-      /* 
-       return new Promise((resolve, reject) => {
-        this.$http({
-          //dealerDownload
-          //url: '/selectInformationFileList',
-          url: "/dealerDownload",
-          method: "get",
-          params: config,
+    },
+
+    //查看详情
+    showDetail: function () {
+      //获取附件数据
+      this.$http({
+        url: "/selectInformationFileList",
+        method: "post",
+        data: {
+          informationId: this.informationId,
+        },
+      })
+        .then((res) => {
+          if (res.data.code === 200) {
+            this.fileData = res.data.data;
+          }
         })
-          .then((res) => {
-            console.log(res);
-            window.open(res)
-            resolve(res);
-            let link = document.createElement("a");
-            link.href = window.URL.createObjectURL(new Blob([res.data]));
-            link.target = "_blank";
-            //文件名和格式
-            link.download = "文件模板.txt";
-            document.body.appendChild(link);
-            link.click();
-            document.body.removeChild(link);
-          })
-          .catch((err) => {
-            reject(err);
-          });
-      }); */
+        .catch((err) => {
+          console.log(err);
+        });
     },
 
-    /* infoListDetail: function (i) {
-      this.$emit("infoListDetail", i);
-    }, */
+    //分页 获取资料列表
+    getDataListPage: function () {
+      this.$http({
+        url: "/firmsUploadListByAgent",
+        method: "post",
+        data: {
+          agentId: this.agentId,
+          Page: this.page,
+          Rows: this.rows,
+        },
+      })
+        .then((res) => {
+          if (res.data.code === 200) {
+            this.detailData = res.data.data;
+            console.log(this.detailData);
+            this.showDetail();
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
   },
   mounted() {
-    /* this.infoListDetail(this.nowIndex); */
+    this.getDataListPage();
+    console.log(this.detailData);
   },
 };
 </script>
@@ -207,9 +239,10 @@ export default {
   /* width: 80px; */
   margin-right: 16px;
 }
-/* .detail span:nth-child(2){
-  width: 150px;
-} */
+.filesStyle {
+  margin-right: 16px;
+}
+
 .filesName p {
   color: #4b8ec7;
 }