瀏覽代碼

资料列表问题修改与搜索优化

liuYb 4 年之前
父節點
當前提交
47df12dc58
共有 3 個文件被更改,包括 77 次插入70 次删除
  1. 1 1
      src/App.vue
  2. 63 66
      src/views/data/InforList.vue
  3. 13 3
      src/views/data/components/InfoListItemDetail.vue

+ 1 - 1
src/App.vue

@@ -43,7 +43,7 @@ export default {
           url: '/uploadInfor'
         }
       ],
-      isManufacturer: 'manufacturer', // distributor 经销商 manufacturer 厂商
+      isManufacturer: 'distributor', // distributor 经销商 manufacturer 厂商
       userAccount: '',
       userToken:''
     }

+ 63 - 66
src/views/data/InforList.vue

@@ -267,10 +267,10 @@ export default {
     // 获取某一页面的数据,展示在表格
     changePage: function (page) {
       this.currentPage = page;
-      // this.getDataListPage(this.currentPage);
 
       //携带搜索条件
       let data = {
+        informationName: this.searchName,
         asc: this.timeSortVal == "dec" ? false : true,
         report: "",
         download: "",
@@ -303,9 +303,10 @@ export default {
           break;
       }
       console.log(this.currentPage);
-      // this.getDataListPage(this.currentPage);
+
       //携带搜索条件
       let data = {
+        informationName: this.searchName,
         asc: this.timeSortVal == "dec" ? false : true,
         report: "",
         download: "",
@@ -333,13 +334,20 @@ export default {
       window.open(url);
 
       let data = {
-        // asc: asc,
-        // report: report,
-        //download: 1,
+        informationName: this.searchName,
+        asc: this.timeSortVal == "dec" ? false : true,
+        report: "",
+        download: "",
         Page: this.currentPage,
         Rows: this.pageSize,
         agentId: this.userId,
       };
+       if (this.reportSortVal) {
+        data.report = this.reportSortVal === "already" ? true : false;
+      }
+      if (this.downloadSortVal) {
+        data.download = this.downloadSortVal === "already" ? true : false;
+      }
       this.newGetDataList(data);
     },
     //查看详情
@@ -359,20 +367,34 @@ export default {
         .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;
+      }
       this.$router.push({
-        path: '/inforList/detail',
+        path: "/inforList/detail",
         query: {
           tag: "infoListDetail",
           informationId: config.informationId,
           nowIndex: i,
-          agentId: this.userId,
-          Page: this.currentPage,
-          Rows: this.pageSize,
+        
+        informationName: this.searchName,
+        asc: this.timeSortVal == "dec" ? false : true,
+        report: report,
+        download: download,
+        Page: this.currentPage,
+        Rows: this.pageSize,
+        agentId: this.userId,
+
         },
       });
     },
     //获取资料列表
-    getDataList: function () {
+    getDataListPage: function () {
       this.$http({
         url: "/firmsUploadListByAgent",
         method: "post",
@@ -384,7 +406,6 @@ export default {
         },
       })
         .then((res) => {
-          console.log(res);
           if (res.data.code === 200) {
             this.tableData = res.data.data;
             this.sum = res.data.count;
@@ -394,27 +415,6 @@ export default {
           console.log(err);
         });
     },
-    //分页 获取资料列表
-    getDataListPage: function (nowpage) {
-      this.$http({
-        url: "/firmsUploadListByAgent",
-        method: "post",
-        data: {
-          agentId: this.userId,
-          Page: nowpage,
-          Rows: this.pageSize,
-        },
-      })
-        .then((res) => {
-          console.log(res,2222);
-          if (res.data.code === 200) {
-            this.tableData = res.data.data;
-          }
-        })
-        .catch((err) => {
-          console.log(err);
-        });
-    },
     //条件筛选 获取新的资料列表
     newGetDataList: function (config) {
       console.log("new Getdata1", config);
@@ -427,11 +427,6 @@ export default {
           if (res.data.code === 200) {
             this.tableData = res.data.data;
             this.sum = res.data.count;
-
-            //添加资料名称搜索筛选分页
-            if (this.searchName) {
-              this.searchByName(config.Page);
-            }
           }
         })
         .catch((err) => {
@@ -457,7 +452,6 @@ export default {
       this.timeSortVal = "dec";
       this.reportSortVal = "";
       this.downloadSortVal = "";
-      // this.newGetDataList(data);
 
       this.$http({
         url: "/firmsUploadListByAgent",
@@ -476,32 +470,35 @@ export default {
     },
 
     searchByCondition: function () {
-      console.log("insearchByCondition", this.searchName);
+      let asc = this.timeSortVal === "dec" ? false : true;
+      let report = "";
+      if (this.reportSortVal === "already") {
+        report = this.reportSortVal === "already" ? true : false;
+      } else if (this.reportSortVal === "notyet") {
+        report = this.reportSortVal === "notyet" ? false : true;
+      }
+      let download = "";
+      if (this.downloadSortVal === "already") {
+        download = this.downloadSortVal === "already" ? true : false;
+      } else if (this.downloadSortVal === "notyet") {
+        download = this.downloadSortVal === "notyet" ? false : true;
+      }
+      let data = {
+        informationName: '',
+        asc: asc,
+        report: report,
+        download: download,
+        Page: this.currentPage,
+        Rows: this.pageSize,
+        agentId: this.userId,
+      };
       if (!this.searchName) {
-        let asc = this.timeSortVal === "dec" ? false : true;
-        let report = "";
-        if (this.reportSortVal === "already") {
-          report = this.reportSortVal === "already" ? true : false;
-        } else if (this.reportSortVal === "notyet") {
-          report = this.reportSortVal === "notyet" ? false : true;
-        }
-        let download = "";
-        if (this.downloadSortVal === "already") {
-          download = this.downloadSortVal === "already" ? true : false;
-        } else if (this.downloadSortVal === "notyet") {
-          download = this.downloadSortVal === "notyet" ? false : true;
-        }
-        let data = {
-          asc: asc,
-          report: report,
-          download: download,
-          Page: 1,
-          Rows: this.pageSize,
-          agentId: this.userId,
-        };
         this.newGetDataList(data);
+        console.log("insearchByCondition", data);
       } else {
-        console.log("ssssssssssssssssssssssssssss");
+        data.informationName = this.searchName;
+        this.newGetDataList(data);
+        console.log("insearchByCondition", data);
       }
     },
     //待办跳转
@@ -528,11 +525,11 @@ export default {
   //   }
   // },
   mounted() {
-    setTimeout(()=>{
-      this.userId = localStorage.getItem('userId');
-      this.getDataListPage()
-    },500)
-  }
+    setTimeout(() => {
+      this.userId = localStorage.getItem("userId");
+      this.getDataListPage();
+    }, 500);
+  },
 };
 </script>
 

+ 13 - 3
src/views/data/components/InfoListItemDetail.vue

@@ -7,7 +7,7 @@
       <div class="content_datail" v-if="status">
         <div class="detail">
           <span>资料名称:</span>
-          <span>{{ detailData[nowIndex].informationName || '' }}</span>
+          <span>{{ detailData[nowIndex].informationName || "" }}</span>
         </div>
         <div class="detail">
           <span>上传时间:</span>
@@ -52,7 +52,7 @@
         </div>
         <div class="detail">
           <span>资料描述:</span>
-          <span>{{ detailData[nowIndex].fileDiscription || '' }}</span>
+          <span>{{ detailData[nowIndex].fileDiscription || "" }}</span>
         </div>
         <div class="filesStyle multiDetail">
           <span>附件:</span>
@@ -100,6 +100,7 @@ export default {
       status: false,
       dataObj: {},
       onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
+
       informationId: this.$route.query.informationId || "",
       nowIndex: this.$route.query.nowIndex || "",
 
@@ -107,6 +108,11 @@ export default {
       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: "",
@@ -174,6 +180,10 @@ export default {
           agentId: this.agentId,
           Page: this.page,
           Rows: this.rows,
+          informationName: this.informationName,
+          asc: this.asc,
+          report: this.report,
+          download: this.download,
         },
       })
         .then((res) => {
@@ -192,7 +202,7 @@ export default {
   mounted() {
     this.getDataListPage();
     console.log(this.detailData);
-  }
+  },
 };
 </script>