Browse Source

高级查询-特殊行李类型多选

zhongxiaoyu 2 years ago
parent
commit
f6a405e99f
1 changed files with 116 additions and 102 deletions
  1. 116 102
      src/views/advancedQuery/views/advancedHome.vue

+ 116 - 102
src/views/advancedQuery/views/advancedHome.vue

@@ -49,15 +49,21 @@
           <button
             class="btnAn"
             @click="dialogShow"
-          >高级查询</button>
+          >
+            高级查询
+          </button>
           <button
             class="btnAn"
             @click="exportHandler('table', '高级查询结果')"
-          >导出</button>
+          >
+            导出
+          </button>
           <button
             class="btnAn"
             @click="toNewAdvance"
-          >切换</button>
+          >
+            切换
+          </button>
           <!-- <div
             class="setting"
             @click="show"
@@ -156,15 +162,15 @@
     </Dialog> -->
     <!--高级查询-->
     <Dialog
-      width="852px"
+      width="900px"
       :flag="gjFlag"
     >
       <div
         ref="dialog"
-        class="rowDialog"
+        class="advanced-dialog"
         :tabindex="0"
-        @keyup.enter="onCheckGj(false)"
-        @keyup.self.esc="gjFlag=false"
+        @keyup.enter="advancedSubmitHandler(false)"
+        @keyup.self.esc="gjFlag = false"
       >
         <div class="title">高级查询</div>
         <div class="content">
@@ -218,6 +224,9 @@
                     <el-select
                       v-model="form.specialType"
                       size="small"
+                      class="multiple-select"
+                      multiple
+                      collapse-tags
                       filterable
                       allow-create
                       default-first-option
@@ -328,12 +337,14 @@
             size="medium"
             class="r24"
             type="primary"
-            @click="onCheckGj(false)"
-          >确定</el-button>
+            @click="advancedSubmitHandler(false)"
+            >确定</el-button
+          >
           <el-button
             size="medium"
-            @click="closeCheckGj"
-          >取消</el-button>
+            @click="dialogHide"
+            >取消</el-button
+          >
         </div>
       </div>
     </Dialog>
@@ -493,7 +504,7 @@ export default {
         destination: '',
         departureStation: '',
         baggageNO: '',
-        specialType: '',
+        specialType: [],
         loadType: '',
         U_Device_ID: '',
         passengerName: '',
@@ -760,7 +771,7 @@ export default {
     //     this.form[key] = this.queryForm[key]
     //   })
     //   this.flightDate = this.queryForm.flightDate
-    //   this.onCheckGj()
+    //   this.advancedSubmitHandler()
     // }
   },
   updated() {
@@ -789,7 +800,7 @@ export default {
       if (this.noMore || this.loading || this.page < 0) {
         return
       }
-      this.statItemsQueryByStatMain(this.dataContent)
+      this.advancedQuery(this.dataContent)
     },
     resetTable() {
       this.page = 0
@@ -802,6 +813,9 @@ export default {
         this.dialogFocus()
       })
     },
+    dialogHide() {
+      this.gjFlag = false
+    },
     toNewAdvance() {
       this.$router.push('/advance/advanceNew')
     },
@@ -830,7 +844,7 @@ export default {
         this.$set(this.flightDate, 1, endDate)
       }
       if (queryFlag) {
-        this.onCheckGj(singleJump)
+        this.advancedSubmitHandler(singleJump)
       }
     },
     // startDateChangeHandler(val) {
@@ -1015,33 +1029,31 @@ export default {
       this.clearForm()
       if (this.flightDate[0] === '' || this.flightDate[1] === '' || val === '') {
         this.$message.error('请先输入完整查询信息')
+        return
+      }
+      // 点击搜索后清除跳转携带的查询信息
+      this.$route.query && this.$router.replace(this.$route.path)
+      // let searchData = {dataContent:[this.time[0],this.time[1],val]}
+      const az = /^[a-zA-Z]+$/
+      const azNum = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/
+      // const top2 = /^[a-zA-Z]{2}\w*$/
+      const top2 = /^([a-zA-Z][0-9])|([0-9][a-zA-Z])|([a-zA-Z]{2})/
+      const bagNum = /^[0-9]{10}$/
+      const bagNo = /^[a-zA-Z]{2}[0-9]{6}$/
+      // 纯字母则为旅客姓名
+      if (az.test(val)) {
+        this.form['passengerName'] = val
+        this.advancedSubmitHandler(true)
+      } else if (azNum.test(val) && top2.test(val) && val.length < 8) {
+        // 字母加数字且前两位为字母则为航班号
+        this.form['flightNO'] = val
+        this.advancedSubmitHandler(true)
+      } else if (bagNum.test(val) || bagNo.test(val)) {
+        // 纯数字且位数等于10则为行李牌号
+        this.form['baggageNO'] = val
+        this.advancedSubmitHandler(true)
       } else {
-        // 点击搜索后清除跳转携带的查询信息
-        this.$route.query && this.$router.replace(this.$route.path)
-
-        // let searchData = {dataContent:[this.time[0],this.time[1],val]}
-        const az = /^[a-zA-Z]+$/
-        const azNum = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/
-        // const top2 = /^[a-zA-Z]{2}\w*$/
-        const top2 = /^([a-zA-Z][0-9])|([0-9][a-zA-Z])|([a-zA-Z]{2})/
-        const bagNum = /^[0-9]{10}$/
-        const bagNo = /^[a-zA-Z]{2}[0-9]{6}$/
-        // 纯字母则为旅客姓名
-        if (az.test(val)) {
-          this.form['passengerName'] = val
-          this.onCheckGj(true)
-        } else if (azNum.test(val) && top2.test(val) && val.length < 8) {
-          // 字母加数字且前两位为字母则为航班号
-          this.form['flightNO'] = val
-          this.onCheckGj(true)
-        } else if (bagNum.test(val) || bagNo.test(val)) {
-          // 纯数字且位数等于10则为行李牌号
-          this.form['baggageNO'] = val
-          this.onCheckGj(true)
-        } else {
-          this.$message.error('请先输入有效查询信息如航班号、旅客姓名首字母、行李牌号')
-        }
-        // this.sempleQueryByStatMain(searchData)
+        this.$message.error('请先输入有效查询信息如航班号、旅客姓名首字母、行李牌号')
       }
     },
     // 清除查询
@@ -1056,7 +1068,7 @@ export default {
       })
     },
     // 高级查询-确定
-    onCheckGj(singleJump) {
+    advancedSubmitHandler(singleJump) {
       function digitFormat(num) {
         if (num) {
           num = '000' + num
@@ -1072,63 +1084,58 @@ export default {
       是否已翻减(null/OFF/其他),是否已翻减(null/OFF/其他),是否值机(null/0/1),是否值机(null/0/1),
       是否激活(null/0/1),是否激活(null/0/1),是否中转(null/0/1),是否中转(null/0/1),是否取消行李(null/0/1),是否取消行李(null/0/1)】 */
       this.dataContent = []
-      const flightDate = this.flightDate
-      if (flightDate && flightDate.length) {
-        this.dataContent.push(flightDate[0])
-        this.dataContent.push(flightDate[1])
-        if (Object.values(this.form).every(value => value === '')) {
-          this.$message.error('请先输入查询信息')
-        } else {
-          const {
-            flightNO,
-            baggageNO,
-            departureStation,
-            destination,
-            specialType,
-            passengerName,
-            PNR,
-            checkInSequence,
-            transferArrival,
-            transferDeparture,
-            loadType,
-            U_Device_ID,
-            unLoad,
-            checkIn,
-            active,
-            transferIn,
-            canceled,
-            status,
-            noBSM
-          } = this.form
-          this.setDataContent(
-            flightNO,
-            baggageNO,
-            departureStation,
-            destination,
-            specialType,
-            passengerName,
-            PNR,
-            digitFormat(checkInSequence),
-            transferArrival,
-            transferDeparture,
-            U_Device_ID,
-            unLoad,
-            checkIn,
-            active,
-            transferIn,
-            canceled,
-            status,
-            noBSM,
-            loadType
-          )
-          this.statItemsQueryByStatMain(this.dataContent, singleJump)
-          this.gjFlag = false
-        }
-      } else {
+      if (!this.flightDate?.length) {
         this.$message.error('请先选择要查询的时间')
+        return
       }
-    },
-    closeCheckGj() {
+      if (Object.values(this.form).every(value => value === '')) {
+        this.$message.error('请先输入查询信息')
+        return
+      }
+      this.dataContent.push(...this.flightDate)
+      const {
+        flightNO,
+        baggageNO,
+        departureStation,
+        destination,
+        specialType,
+        passengerName,
+        PNR,
+        checkInSequence,
+        transferArrival,
+        transferDeparture,
+        loadType,
+        U_Device_ID,
+        unLoad,
+        checkIn,
+        active,
+        transferIn,
+        canceled,
+        status,
+        noBSM
+      } = this.form
+      this.setDataContent(
+        flightNO,
+        baggageNO,
+        departureStation,
+        destination,
+        specialType.map(v => v.replace(',', '/')).join(),
+        passengerName,
+        PNR,
+        digitFormat(checkInSequence),
+        transferArrival,
+        transferDeparture,
+        U_Device_ID,
+        unLoad,
+        checkIn,
+        active,
+        transferIn,
+        canceled,
+        status,
+        noBSM,
+        loadType
+      )
+      this.advancedQuery(this.dataContent, singleJump)
       this.gjFlag = false
     },
     setDataContent(...dataContent) {
@@ -1142,7 +1149,7 @@ export default {
       })
     },
     // 数据查询
-    async statItemsQueryByStatMain(dataContent, singleJump) {
+    async advancedQuery(dataContent, singleJump) {
       this.loading = true
       try {
         const {
@@ -1195,7 +1202,6 @@ export default {
               }
             }
           }
-          // const tableData = this._.sortBy(result, ['flightDate', 'departureTime', 'passengerNameUpcase', 'bagSN'])
           this.tableData = [...this.tableData, ...result]
           setTableFilters(this.tableData, this.tableDataFilters)
         } else {
@@ -1238,7 +1244,10 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped>
+<style
+  lang="scss"
+  scoped
+>
 .advance {
   padding: 8px;
   &__head {
@@ -1329,7 +1338,12 @@ export default {
   background-color: red;
 }
 
-.rowDialog::v-deep .el-form > .el-row > .el-col:nth-child(1) .el-date-editor {
-  width: 100%;
+.advanced-dialog::v-deep .el-form > .el-row > .el-col {
+  &:nth-child(1) .el-date-editor {
+    width: 100%;
+  }
+  .multiple-select .el-select__tags > span > .el-tag:first-child > .el-select__tags-text {
+    width: 35px;
+  }
 }
 </style>