فهرست منبع

简单查询、高级查询增加条件限制、取消默认查询

chenjun 3 سال پیش
والد
کامیت
b779baa768
1فایلهای تغییر یافته به همراه86 افزوده شده و 47 حذف شده
  1. 86 47
      src/views/advancedQuery/views/advancedHome.vue

+ 86 - 47
src/views/advancedQuery/views/advancedHome.vue

@@ -74,10 +74,10 @@
       <div class="rowDialog">
         <div class="title">高级查询</div>
         <div class="content">
-          <el-form ref="form" :model="form" label-width="100px">
+          <el-form ref="form" :model="form" :rules="rules" label-width="100px">
             <el-row :gutter="20">
               <el-col :span="16">
-                <el-form-item label="航班日期">
+                <el-form-item label="航班日期" prop="time">
                   <el-date-picker v-model="form.time" size="small" type="daterange" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期">
                   </el-date-picker>
                 </el-form-item>
@@ -90,7 +90,7 @@
             </el-row>
             <el-row :gutter="20">
               <el-col :span="8">
-                <el-form-item label="航班号">
+                <el-form-item label="航班号" prop="flightNumber">
                   <el-input size="small" v-model="form.flightNumber"></el-input>
                 </el-form-item>
               </el-col>
@@ -143,7 +143,7 @@
         </div>
         <div class="foot right t30">
           <el-button size="medium" class="r24" @click="onCheckGj" type="primary">确定</el-button>
-          <el-button size="medium" @click="gjFlag = false">取消</el-button>
+          <el-button size="medium" @click="closeCheckGj">取消</el-button>
         </div>
       </div>
     </Dialog>
@@ -164,22 +164,22 @@ export default {
       rowFlag: false,
       gjFlag: false,
       tableData: [
-        {
-          FlightNO: 'CA1200',
-          FlightDate: '2022-04-24',
-          SourceAirport: 'PEK',
-          TargetAirport: 'CTU',
-          PassengerNameUpcase: 'ZHANGSAN',
-          BagSN: '39923234',
-          SpecialType: 'VIP行李',
-          checkIn: '',
-          deleted: '',
-          activated: '',
-          BagWeight: '120KG',
-          latestStatus: '分拣',
-          bagLocation: '四层直接导入',
-          TransferFlightNO: ''
-        }
+        // {
+        //   FlightNO: '',
+        //   FlightDate: '',
+        //   SourceAirport: '',
+        //   TargetAirport: '',
+        //   PassengerNameUpcase: '',
+        //   BagSN: '',
+        //   SpecialType: '',
+        //   checkIn: '',
+        //   deleted: '',
+        //   activated: '',
+        //   BagWeight: '',
+        //   latestStatus: '',
+        //   bagLocation: '',
+        //   TransferFlightNO: ''
+        // }
       ],
       tableColsCopy: [],
       checkList: [],
@@ -199,17 +199,26 @@ export default {
         pnr: '',
         check: ''
       },
-      dataContent: []
+      dataContent: [],
+      rules: {
+        // 机器信息表单验证
+        time: [
+          { type: 'date', required: true, message: '请选择有效时间', trigger: 'change' }
+        ],
+        flightNumber: [
+          { required: true, message: "请输入有效航班号", trigger: "blur" },
+        ],
+      },
     }
   },
   created () {
     //参数顺序   【航班开始日期,航班结束日期,航班号,航班号,行李牌号,行李牌号,起飞站,起飞站,目的站,目的站,特殊行李类型,特殊 行李类型,旅客姓名大写拼音,旅客姓名大写拼音,pnr,pnr,值机号,值机号】
     const dataContent = [this.timeStart, this.timeEnd];
-    for (let i = 0; i < 18; i++) {
-      dataContent.push(null)
-    }
+    // for (let i = 0; i < 18; i++) {
+    //   dataContent.push(null)
+    // }
     // this.integratedQuery();
-    this.statItemsQueryByStatMain(dataContent);
+    // this.statItemsQueryByStatMain(dataContent);
   },
   mounted () {
     document.querySelector('.interfaceLog_head_time_start .el-input__prefix i').remove()
@@ -226,11 +235,17 @@ export default {
   methods: {
     //查询
     getSearchData (val) {
-      console.log(val)
+      if(this.timeStart==""||this.timeEnd==""||val==""){
+        this.$message.error('请先输入完整查询信息');
+      }
+      else{
+        let searchData = {dataContent:[this.timeStart,this.timeEnd,val]}
+        this.sempleQueryByStatMain(searchData)
+      }
     },
     //清除查询
     clearSearchData () {
-
+      this.tableData=[]
     },
     //列设置-确定
     onCheck () {
@@ -254,25 +269,34 @@ export default {
     //高级查询-确定
     onCheckGj () {
       //参数顺序   【航班开始日期,航班结束日期,航班号,航班号,行李牌号,行李牌号,起飞站,起飞站,目的站,目的站,特殊行李类型,特殊 行李类型,旅客姓名大写拼音,旅客姓名大写拼音,pnr,pnr,值机号,值机号】
-      this.dataContent = [];
-      const { time, status, flightNumber, destination, station, grade, type, container, name, pnr, check } = this.form
-      if (time && time.length) {
-        this.dataContent.push(time[0]);
-        this.dataContent.push(time[1]);
-      } else {
-        this.dataContent.push(null);
-        this.dataContent.push(null);
-      }
-      this.setDataContent(status);
-      this.setDataContent(flightNumber);
-      this.setDataContent(grade);
-      this.setDataContent(station);
-      this.setDataContent(destination);
-      this.setDataContent(type);
-      this.setDataContent(name);
-      this.setDataContent(pnr);
-      this.setDataContent(check);
-      this.statItemsQueryByStatMain(this.dataContent);
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          this.dataContent = [];
+          const { time, status, flightNumber, destination, station, grade, type, container, name, pnr, check } = this.form
+          if (time && time.length) {
+            this.dataContent.push(time[0]);
+            this.dataContent.push(time[1]);
+          } else {
+            this.dataContent.push(null);
+            this.dataContent.push(null);
+          }
+          this.setDataContent(status);
+          this.setDataContent(flightNumber);
+          this.setDataContent(grade);
+          this.setDataContent(station);
+          this.setDataContent(destination);
+          this.setDataContent(type);
+          this.setDataContent(name);
+          this.setDataContent(pnr);
+          this.setDataContent(check);
+          this.statItemsQueryByStatMain(this.dataContent);
+          this.gjFlag = false;
+        }
+      })
+    },
+    closeCheckGj(){
+      this.form = {}
+      this.$refs['form'].resetFields();
       this.gjFlag = false;
     },
     setDataContent (target) {
@@ -315,6 +339,21 @@ export default {
       } catch (error) {
         console.log('出错了', error)
       }
+    },
+    async sempleQueryByStatMain (dataContent) {
+      try {
+        const res = await getQuery({
+          id: 31,
+          dataContent
+        })
+        if (res.code == 0) {
+          this.tableData = res.returnData
+        } else {
+          this.$message.error(res.message)
+        }
+      } catch (error) {
+        console.log('出错了', error)
+      }
     }
   }
 }
@@ -351,4 +390,4 @@ export default {
     }
   }
 }
-</style>
+</style>