Bladeren bron

经销商详情面包屑&&详情页面优化

suxinf 4 jaren geleden
bovenliggende
commit
dbbe83879b
2 gewijzigde bestanden met toevoegingen van 24 en 134 verwijderingen
  1. 5 41
      src/views/data/InforList.vue
  2. 19 93
      src/views/data/components/InfoListItemDetail.vue

+ 5 - 41
src/views/data/InforList.vue

@@ -184,11 +184,7 @@ export default {
         {
           name: "查看详情>",
           function: (obj, i) => {
-            let data = {
-              informationId: obj.id,
-            };
-            this.showDetail(data, i);
-            console.log(obj, i);
+            this.showDetail(obj, i);
           },
         },
       ],
@@ -275,7 +271,6 @@ export default {
     // 获取某一页面的数据,展示在表格
     changePage: function (page) {
       this.currentPage = page;
-
       //携带搜索条件
       let data = {
         informationName: this.searchName,
@@ -336,44 +331,13 @@ export default {
       window.open(url);
     },
     //查看详情
-    showDetail: function (config, i) {
-      /*  //获取附件数据
-      this.$http({
-        url: "/selectInformationFileList",
-        method: "post",
-        data: config,
-      })
-        .then((res) => {
-          if (res.data.code === 200) {
-            this.tableFileData = res.data.data;
-          }
-        })
-        .catch((err) => {
-          console.log(err);
-        }); */
-      let report = '';
-      let download = '';
-      if (this.reportSortVal) {
-        report = this.reportSortVal === "already" ? true : false;
-      }
-      if (this.downloadSortVal) {
-        download = this.downloadSortVal === "already" ? true : false;
-      }
+    showDetail: function (config) {
       this.$router.push({
         path: "/inforList/detail",
         query: {
-          tag: "infoListDetail",
-          informationId: config.informationId,
-          nowIndex: i,
-        
-        informationName: this.searchName,
-        asc: this.timeSortVal == "dec" ? false : true,
-        report: report,
-        download: download,
-        Page: this.currentPage,
-        Rows: this.pageSize,
-        agentId: this.userId,
-
+          tag: "detail",
+          informationId: config.id,
+          informationName: config.informationName,
         },
       });
     },

+ 19 - 93
src/views/data/components/InfoListItemDetail.vue

@@ -4,40 +4,25 @@
       <p class="data_detail">数据详情</p>
     </div>
     <div class="content">
-      <div class="content_datail" v-if="status">
+      <div class="content_datail">
         <div class="detail">
           <span>资料名称:</span>
-          <span>{{ detailData[nowIndex].informationName || "" }}</span>
+          <span>{{ detailData.informationName || "-" }}</span>
         </div>
         <div class="detail">
           <span>上传时间:</span>
           <span>{{
-            (detailData[nowIndex].fileUploadDate || "")
+            (detailData.fileUploadDate || "-")
               .replace("T", " ")
               .slice(0, -4)
               .replace(RegExp("-", "g"), "/")
           }}</span>
         </div>
-        <!--  <div class="multiDetail">
-          
-          <div class="firstColumn">
-            <span>车系:</span>
-            <span>{{
-              detailData[nowIndex].spread
-            }}</span>
-          </div>
-          <div class="secondColumn">
-            <span>车型:</span>
-            <span>
-              {{ detailData[nowIndex].spread }}
-            </span> 
-          </div>
-        </div> -->
         <div class="multiDetail">
           <div class="firstColumn">
             <span>素材时间:</span>
             <span>{{
-              (detailData[nowIndex].filePulishTime || "").replace(
+              (detailData.filePulishTime || "-").replace(
                 RegExp("-", "g"),
                 "/"
               )
@@ -46,13 +31,13 @@
           <div class="secondColumn">
             <span>经销商范围:</span>
             <span>
-              {{ detailData[nowIndex].accountScope === 1 ? "共通" : "部分" }}
+              {{ detailData.accountScope === 1 ? "共通" : "部分" }}
             </span>
           </div>
         </div>
         <div class="detail">
           <span>资料描述:</span>
-          <span>{{ detailData[nowIndex].fileDiscription || "" }}</span>
+          <span>{{ detailData.fileDiscription || "-" }}</span>
         </div>
         <div class="filesStyle multiDetail">
           <span>附件:</span>
@@ -63,7 +48,7 @@
               :key="index"
               @click="downloadFile(index)"
             >
-              {{ item.fileName || "附件附件" }}
+              {{ item.fileName || "-" }}
             </p>
           </div>
         </div>
@@ -74,64 +59,16 @@
 
 <script>
 import { env_url } from "../../../config/env";
-
 export default {
-  props: {
-    /*     detailData: {
-      type: Array,
-      default: () => {
-        return [];
-      },
-    }, */
-    /*     fileData: {
-      type: Array,
-      default: () => {
-        return [];
-      },
-    }, */
-    /*     nowIndex: {
-      type: Number,
-      default: -1,
-    }, */
-  },
+  props: {},
   components: {},
   data() {
     return {
-      status: false,
-      dataObj: {},
-      onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
-
+      onlineUrl: env_url,
       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) || "",
-
-      informationName: this.searchName,
-      asc: this.$route.query.asc,
-      report: this.$route.query.report,
-      download: this.$route.query.download,
-
-      detailData: [
-        {
-          accountScope: "",
-          agentId: "",
-          asc: "",
-          download: "",
-          downloadCount: null,
-          fileDiscription: "",
-          filePulishTime: "",
-          fileUploadCreator: "",
-          fileUploadDate: "",
-          fileUploadDateLt: null,
-          id: "",
-          informationName: "1234",
-          report: "",
-          reportId: "",
-          totalCount: null,
-        },
-      ],
+      agentId: localStorage.getItem("userId"),
+      informationName: (this.$route.query && this.$route.query.informationName) || "",
+      detailData: [],
       fileData: [],
     };
   },
@@ -139,18 +76,10 @@ export default {
   methods: {
     // 下载附件
     downloadFile: function (index) {
-      /* let config =
-        "informationId=" +
-        this.fileData[index].informationId +
-        "&" +
-        "fileId=" +
-        this.fileData[index].id; */
       let config = "fileId=" + this.fileData[index].id + "&agentId=" + this.agentId;
       let url = this.onlineUrl + "/dealerDownload?" + config;
-      // console.log("下载附件:", config, url);
       window.open(url);
     },
-
     //查看详情
     showDetail: function () {
       //获取附件数据
@@ -170,7 +99,6 @@ export default {
           console.log(err);
         });
     },
-
     //分页 获取资料列表
     getDataListPage: function () {
       this.$http({
@@ -178,20 +106,13 @@ export default {
         method: "post",
         data: {
           agentId: this.agentId,
-          Page: this.page,
-          Rows: this.rows,
           informationName: this.informationName,
-          asc: this.asc,
-          report: this.report,
-          download: this.download,
         },
       })
         .then((res) => {
           if (res.data.code === 200) {
-            this.detailData = res.data.data;
-            console.log(this.detailData);
+            this.detailData = res.data.data[0];
             this.showDetail();
-            this.status = true;
           }
         })
         .catch((err) => {
@@ -201,8 +122,13 @@ export default {
   },
   mounted() {
     this.getDataListPage();
-    console.log(this.detailData);
   },
+  beforeRouteEnter(to, from, next) {
+    console.log(from)
+    let meta = to.meta;
+    meta[2].name = (to.query.informationName || '') + '详情'
+    next()
+  }
 };
 </script>