Przeglądaj źródła

模糊搜索分页

liuYb 4 lat temu
rodzic
commit
ba15e9adfb
3 zmienionych plików z 99 dodań i 161 usunięć
  1. 1 1
      src/App.vue
  2. 89 138
      src/views/data/InforList.vue
  3. 9 22
      src/views/data/UploadLink.vue

+ 1 - 1
src/App.vue

@@ -38,7 +38,7 @@ export default {
     return {
       navTitle1: ' > 数据管理',
       navTitle2: '',
-      isManufacturer: 'manufacturer', // distributor 经销商 manufacturer 厂商
+      isManufacturer: 'distributor', // distributor 经销商 manufacturer 厂商
       userAccount: '',
       userToken:''
     }

+ 89 - 138
src/views/data/InforList.vue

@@ -13,7 +13,7 @@
             v-model="searchName"
           />
         </div>
-        <button @click="searchByName">搜索</button>
+        <button @click="searchByName()">搜索</button>
       </div>
       <!--    <div class="searchBox">
         <div class="search_inside">
@@ -66,14 +66,22 @@
               >
                 <!--  <td v-for="(item, i) in obj" :key="i" :style="trStyle"> -->
                 <td>{{ obj.informationName || "北京博瑞" }}</td>
-                <td>{{ obj.filePulishTime || "2021/02" }}</td>
+                <td>{{ (obj.filePulishTime || "").replace("-", "/") }}</td>
                 <td>{{ obj.accountScope == 1 ? "共通" : "部分" }}</td>
-                <td>{{ obj.fileUploadDate || "2021/01/10 12:12" }}</td>
+                <td>
+                  {{
+                    (obj.fileUploadDate || "")
+                      .replace("T", " ")
+                      .slice(0, -4)
+                      .replace(RegExp("-", "g"), "/")
+                  }}
+                </td>
                 <td>{{ obj.download > 0 ? "已下载" : "未下载" }}</td>
                 <td>
                   <span
                     @click="waitToReport(obj.report, index)"
-                    :class="showItemOperation" class="reportStyle"
+                    :class="showItemOperation"
+                    class="reportStyle"
                     >待办</span
                   >
                   <!--  :class="{ reportStyle: obj.report == 0 ? true : false }" -->
@@ -116,7 +124,7 @@
 <script>
 import TablePage from "../../components/TablePage";
 import Detail from "./components/InfoListItemDetail";
-import { env_url } from "../../config/env"
+import { env_url } from "../../config/env";
 
 export default {
   props: {
@@ -206,6 +214,7 @@ export default {
       onlineUrl: env_url, //'http://8.140.188.129:8080'线上 //http://8.136.230.133:8080 //测试
       userId: 254,
       endDate: "",
+      localReport: "",
     };
   },
   computed: {
@@ -217,35 +226,39 @@ export default {
       return this.$route.query && this.$route.query.tag ? true : false;
     },
     showItemOperation: function () {
-      let nowDate = this.CurentTime();
+      let now = new Date().getTime();
 
+    /*   if (!this.localReport) {
+        console.log(this.localReport);
+        return { showItemOperationStyle: false };
+      } else {
+        return { showItemOperationStyle: true };
+        if (!this.endDate) {
+          console.log("超出反馈时间");
+          return { showItemOperationStyle: true };
+        } else {
+          let end = Date.parse(new Date(this.endDate));
+          if (now > end) {
+            return { showItemOperationStyle: true };
+          } else {
+            return { showItemOperationStyle: false };
+          }
+        }
+      } */
       if (!this.endDate) {
-        console.log(nowDate);
+        console.log("超出反馈时间", this.endDate);
         return { showItemOperationStyle: true };
       } else {
-        console.log(this.endDate);
-        if (nowDate < this.endDate) {
-          return { showItemOperationStyle: false };
-        } else {
+        let end = Date.parse(new Date(this.endDate));
+        if (now > end) {
           return { showItemOperationStyle: true };
+        } else {
+          return { showItemOperationStyle: false };
         }
       }
     },
   },
   methods: {
-    CurentTime: function () {
-      var now = new Date();
-      var year = now.getFullYear(); //年
-      var month = now.getMonth() + 1; //月
-      var day = now.getDate(); //日
-      var clock = year + "/";
-
-      if (month < 10) clock += "0";
-      clock += month + "/";
-      if (day < 10) clock += "0";
-      clock += day;
-      return clock;
-    },
     download: function () {
       alert("下载");
     },
@@ -256,7 +269,7 @@ export default {
 
       //携带搜索条件
       let data = {
-        asc: this.changePage == "dec" ? false : true,
+        asc: this.timeSortVal == "dec" ? false : true,
         report: "",
         download: "",
         Page: this.currentPage,
@@ -291,7 +304,7 @@ export default {
       // this.getDataListPage(this.currentPage);
       //携带搜索条件
       let data = {
-        asc: this.changePage == "dec" ? false : true,
+        asc: this.timeSortVal == "dec" ? false : true,
         report: "",
         download: "",
         Page: this.currentPage,
@@ -371,35 +384,6 @@ export default {
           if (res.data.code === 200) {
             this.tableData = res.data.data;
             this.sum = res.data.count;
-            //修改素材时间显示格式
-            let len = this.tableData.length;
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].filePulishTime;
-              if (
-                this.tableData[0].filePulishTime.length != null &&
-                this.tableData[0].filePulishTime.length >= 7
-              ) {
-                newValue = temp.slice(0, 4) + "/" + temp.slice(5, 7); //+ "/" + temp.slice(8,10)
-                this.$set(this.tableData[i], "filePulishTime", newValue);
-              }
-            }
-            //修改上传时间显示格式
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].fileUploadDate;
-              if (this.tableData[0].fileUploadDate.length >= 10) {
-                newValue =
-                  temp.slice(0, 4) +
-                  "/" +
-                  temp.slice(5, 7) +
-                  "/" +
-                  temp.slice(8, 10) +
-                  " " +
-                  temp.slice(11, 19);
-                this.$set(this.tableData[i], "fileUploadDate", newValue);
-              }
-            }
           }
         })
         .catch((err) => {
@@ -421,35 +405,6 @@ export default {
           console.log(res);
           if (res.data.code === 200) {
             this.tableData = res.data.data;
-            //修改素材时间显示格式
-            let len = this.tableData.length;
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].filePulishTime;
-              if (
-                this.tableData[0].filePulishTime.length != null &&
-                this.tableData[0].filePulishTime.length >= 7
-              ) {
-                newValue = temp.slice(0, 4) + "/" + temp.slice(5, 7); //+ "/" + temp.slice(8,10)
-                this.$set(this.tableData[i], "filePulishTime", newValue);
-              }
-            }
-            //修改上传时间显示格式
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].fileUploadDate;
-              if (this.tableData[0].fileUploadDate.length >= 10) {
-                newValue =
-                  temp.slice(0, 4) +
-                  "/" +
-                  temp.slice(5, 7) +
-                  "/" +
-                  temp.slice(8, 10) +
-                  " " +
-                  temp.slice(11, 19);
-                this.$set(this.tableData[i], "fileUploadDate", newValue);
-              }
-            }
           }
         })
         .catch((err) => {
@@ -465,38 +420,13 @@ export default {
         data: config,
       })
         .then((res) => {
-          console.log("new Getdata2", res);
           if (res.data.code === 200) {
             this.tableData = res.data.data;
             this.sum = res.data.count;
-            //修改素材时间显示格式
-            let len = this.tableData.length;
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].filePulishTime;
-              if (
-                this.tableData[0].filePulishTime.length != null &&
-                this.tableData[0].filePulishTime.length >= 7
-              ) {
-                newValue = temp.slice(0, 4) + "/" + temp.slice(5, 7); //+ "/" + temp.slice(8,10)
-                this.$set(this.tableData[i], "filePulishTime", newValue);
-              }
-            }
-            //修改上传时间显示格式
-            for (let i = 0; i < len; i++) {
-              let newValue = "";
-              let temp = this.tableData[i].fileUploadDate;
-              if (this.tableData[0].fileUploadDate.length >= 10) {
-                newValue =
-                  temp.slice(0, 4) +
-                  "/" +
-                  temp.slice(5, 7) +
-                  "/" +
-                  temp.slice(8, 10) +
-                  " " +
-                  temp.slice(11, 19);
-                this.$set(this.tableData[i], "fileUploadDate", newValue);
-              }
+
+            //添加资料名称搜索筛选分页
+            if (this.searchName) {
+              this.searchByName(config.Page);
             }
           }
         })
@@ -504,13 +434,14 @@ export default {
           console.log(err);
         });
     },
+
     //搜索资料名
-    searchByName: function () {
-      console.log("insearchByName", this.searchName);
+    searchByName: function (p) {
+      console.log("insearchByName", p);
       let searchName = this.searchName;
       let data = {
         informationName: searchName,
-        Page: 1,
+        Page: p,
         Rows: this.pageSize,
         agentId: this.userId,
         //搜索条件重置
@@ -522,37 +453,57 @@ export default {
       this.timeSortVal = "dec";
       this.reportSortVal = "";
       this.downloadSortVal = "";
-      this.newGetDataList(data);
+      // this.newGetDataList(data);
+
+      this.$http({
+        url: "/firmsUploadListByAgent",
+        method: "post",
+        data: data,
+      })
+        .then((res) => {
+          if (res.data.code === 200) {
+            this.tableData = res.data.data;
+            this.sum = res.data.count;
+          }
+        })
+        .catch((err) => {
+          console.log(err);
+        });
     },
 
     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;
+      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);
+      } else {
+        console.log("ssssssssssssssssssssssssssss");
       }
-      let data = {
-        asc: asc,
-        report: report,
-        download: download,
-        Page: 1,
-        Rows: this.pageSize,
-        agentId: this.userId,
-      };
-      this.newGetDataList(data);
     },
     //待办跳转
     waitToReport: function (flag, i) {
       this.endDate = this.tableData[i].endDate;
+      this.localReport = this.tableData[i].report;
       if (flag) {
         console.log("待办跳转");
         this.$router.replace({ path: "/uploadLink/sonuploadLink" });

+ 9 - 22
src/views/data/UploadLink.vue

@@ -193,7 +193,7 @@
 import Modal from "../../components/Modal";
 import TablePage from "../../components/TablePage";
 import deleteModal from "../data/components/UploadLinkModalDelete";
-import { env_url } from "../../config/env"
+import { env_url } from "../../config/env";
 
 export default {
   props: {
@@ -300,35 +300,22 @@ export default {
     },
 
     showItemOperation: function () {
-      let myDate = new Date();
-      myDate.getTime();
-      let R= "2021-04-15T10:52:13.480";
-      R = R.replace("T", " ").slice(0,-4);
-      console.log(R)
-      let startDateTime = new Date(R.replace(RegExp("-", "g"), "/")).getTime();
-      let time=new Date(R);
-      console.log(startDateTime)
-      console.log(time);
-      //
-      console.log(myDate.getTime());
-
-      let nowDate = this.CurentTime();
-
+      let now = new Date().getTime();
       if (!this.endTime) {
-        console.log(nowDate);
         return { showItemOperationStyle: true };
       } else {
-        console.log(this.endTime);
-        if (nowDate < this.endTime) {
-          return { showItemOperationStyle: false };
-        } else {
+        let end = Date.parse(new Date(this.endTime));
+        if (now > end) {
+          console.log("超出反馈时间");
           return { showItemOperationStyle: true };
+        } else {
+          return { showItemOperationStyle: false };
         }
       }
     },
   },
   methods: {
-    CurentTime: function () {
+    /*  CurentTime: function () {
       var now = new Date();
       var year = now.getFullYear(); //年
       var month = now.getMonth() + 1; //月
@@ -340,7 +327,7 @@ export default {
       if (day < 10) clock += "0";
       clock += day;
       return clock;
-    },
+    }, */
     /*toggleModal:点击编辑后弹窗; toggleModal2:点击删除后弹窗; toggleModal3:点击导入后弹窗;  */
     toggleModal: function (i) {
       this.showModal = !this.showModal;