zhaoke 2 жил өмнө
parent
commit
06ea2a4fb8

+ 51 - 8
src/views/baggageManagement/components/transferArrival/index.vue

@@ -187,6 +187,8 @@
         :height="computedTableHeight"
         show-summary
         :summary-method="summaryMethod"
+        :span-method="arraySpanMethod"
+        @cell-click="cellClick"
         border
         stripe
       >
@@ -384,6 +386,9 @@ export default {
       loopEvent: null,
       leaveCount: 0,
       baggageCount: 0,
+      spanArr: [],
+      contactDot: 0,
+      flag: 0,
     };
   },
   created() {
@@ -398,6 +403,11 @@ export default {
   //   },
   // },
   methods: {
+    cellClick(row, column, cell, event) {
+      if (column.property == "PreFlightNO") {
+        this.$router.push({ path: "/advance/flightView", query: row });
+      }
+    },
     changeView() {
       this.$router.replace({
         path: "/transfer/departure",
@@ -406,7 +416,7 @@ export default {
     airPortChange() {
       this.getAviationData();
       this.upAviationData();
-      this.getTableData();
+      // this.getTableData();
     },
     //选择机场
     async getAirPortData() {
@@ -437,7 +447,7 @@ export default {
         });
         if (res.code == 0) {
           this.carrierProps = res.returnData;
-          this.getTableData();
+          // this.getTableData();
         } else {
           this.$message.error(res.message);
         }
@@ -454,7 +464,7 @@ export default {
         });
         if (res.code == 0) {
           this.carrierPropsop = res.returnData;
-          this.getTableData();
+          // this.getTableData();
         } else {
           this.$message.error(res.message);
         }
@@ -518,7 +528,27 @@ export default {
           dataContent: [...arr],
         });
         if (res.code == 0) {
-          this.initTableData(res.returnData);
+          // this.tableData = this._.sortBy(res.returnData, [
+          //   "FlightDate",
+          //   "PlanDepartureTime",
+          // ]);
+          this.tableData = res.returnData;
+          let contactDot = this.contactDot;
+          this.tableData.forEach((item, index) => {
+            item.index = index;
+            if (index === 0) {
+              this.spanArr.push(1);
+            } else {
+              if (item.PreFlightNO === this.tableData[index - 1].PreFlightNO) {
+                this.spanArr[contactDot] += 1;
+                this.spanArr.push(0);
+              } else {
+                this.spanArr.push(1);
+                contactDot = index;
+              }
+            }
+          });
+          //this.initTableData(res.returnData);
         } else {
           console.log(res.message);
         }
@@ -626,12 +656,25 @@ export default {
         };
       }
     },
+    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
+      for (let i = 0; i < 5; i++) {
+        if (columnIndex === i) {
+          const _row = this.spanArr[rowIndex];
+          const _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col,
+          };
+        }
+      }
+    },
   },
   mounted() {
-    let that = this;
-    this.loopEvent = setInterval(function () {
-      that.getTableData();
-    }, 3000);
+    // let that = this;
+    // this.loopEvent = setInterval(function () {
+    //   console.log(this.contactDot);
+    //   that.getTableData();
+    // }, 3000);
   },
   beforeDestroy() {
     clearInterval(this.loopEvent);

+ 46 - 8
src/views/baggageManagement/components/transferDeparture/index.vue

@@ -200,6 +200,8 @@
         :height="computedTableHeight"
         show-summary
         :summary-method="summaryMethod"
+        :span-method="arraySpanMethod"
+        @cell-click="cellClick"
         border
         stripe
       >
@@ -396,12 +398,20 @@ export default {
       loopEvent: null,
       leaveCount: 0,
       baggageCount: 0,
+      spanArr: [],
+      contactDot: 0,
+      flag: 0,
     };
   },
   created() {
     this.getAirPortData();
   },
   methods: {
+    cellClick(row, column, cell, event) {
+      if (column.property == "FlightNO") {
+        this.$router.push({ path: "/advance/flightView", query: row });
+      }
+    },
     changeView() {
       this.$router.replace({
         path: "/transfer/arrival",
@@ -410,7 +420,7 @@ export default {
     airPortChange() {
       this.getAviationData();
       this.upAviationData();
-      this.getTableData();
+      // this.getTableData();
     },
     //选择机场
     async getAirPortData() {
@@ -441,7 +451,7 @@ export default {
         });
         if (res.code == 0) {
           this.carrierProps = res.returnData;
-          this.getTableData();
+          // this.getTableData();
         } else {
           this.$message.error(res.message);
         }
@@ -458,7 +468,7 @@ export default {
         });
         if (res.code == 0) {
           this.carrierPropsop = res.returnData;
-          this.getTableData();
+          // this.getTableData();
         } else {
           this.$message.error(res.message);
         }
@@ -529,7 +539,23 @@ export default {
           dataContent: [...arr],
         });
         if (res.code == 0) {
-          this.initTableData(res.returnData);
+          this.tableData = res.returnData;
+          let contactDot = this.contactDot;
+          this.tableData.forEach((item, index) => {
+            item.index = index;
+            if (index === 0) {
+              this.spanArr.push(1);
+            } else {
+              if (item.FlightNO === this.tableData[index - 1].FlightNO) {
+                this.spanArr[contactDot] += 1;
+                this.spanArr.push(0);
+              } else {
+                this.spanArr.push(1);
+                contactDot = index;
+              }
+            }
+          });
+          //this.initTableData(res.returnData);
         } else {
           console.log(res.message);
         }
@@ -631,12 +657,24 @@ export default {
         };
       }
     },
+    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
+      for (let i = 0; i < 5; i++) {
+        if (columnIndex === i) {
+          const _row = this.spanArr[rowIndex];
+          const _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col,
+          };
+        }
+      }
+    },
   },
   mounted() {
-    let that = this;
-    this.loopEvent = setInterval(function () {
-      that.getTableData();
-    }, 3000);
+    // let that = this;
+    // this.loopEvent = setInterval(function () {
+    //   that.getTableData();
+    // }, 3000);
   },
   beforeDestroy() {
     clearInterval(this.loopEvent);