|
@@ -14,11 +14,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="newQuery-head-right flex-wrap">
|
|
|
+ <el-popover placement="bottom" trigger="manual" content="请输入航班号(示例:CA1234)或行李牌号(示例:1234567890)" v-model="visible">
|
|
|
+ <el-input size="small" style="width: 320px;" slot="reference" prefix-icon="el-icon-search" placeholder="请输入您想要搜索的内容" clearable v-model="searchInput" @focus="visible = true" @blur="visible = false"></el-input>
|
|
|
+ </el-popover>
|
|
|
+ <el-button style="margin-left: 10px;" @click="handleSearch" size="mini" plain type="primary">查询</el-button>
|
|
|
<template v-if="flag">
|
|
|
<!-- <el-button @click="handleAdd" size="mini" plain type="primary">新增</el-button> -->
|
|
|
<el-button @click="saveItem" size="mini" plain type="primary">保存条件</el-button>
|
|
|
</template>
|
|
|
- <el-button @click="handleSearch" size="mini" plain type="primary">查询</el-button>
|
|
|
<el-button size="mini" class="r10" plain type="primary">
|
|
|
<router-link to="/newQueryAdvance">切换</router-link>
|
|
|
</el-button>
|
|
@@ -86,6 +89,8 @@ export default {
|
|
|
queryBtns: [],
|
|
|
flag: false,
|
|
|
queryType: '',
|
|
|
+ searchInput: '',
|
|
|
+ visible: false,
|
|
|
diaFlag: false,
|
|
|
rmFlag: false,
|
|
|
formObj: {
|
|
@@ -108,7 +113,8 @@ export default {
|
|
|
{ required: true, message: '请输入条件名称', trigger: 'blur' },
|
|
|
],
|
|
|
},
|
|
|
- nums: 1
|
|
|
+ nums: 1,
|
|
|
+ searchItems: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -250,10 +256,64 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ formatQuery (key, val) {
|
|
|
+ const r = {
|
|
|
+ left: '(',
|
|
|
+ column: key,
|
|
|
+ comparator: '=',
|
|
|
+ value: val,
|
|
|
+ right: ')',
|
|
|
+ connector: 'and'
|
|
|
+ }
|
|
|
+ this.searchItems.push(r)
|
|
|
+ this.flag = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.searchInput = ''
|
|
|
+ this.dataQuery = _.uniqBy(this.searchItems.reverse(), key)
|
|
|
+ this.tableTag = {
|
|
|
+ filter: this.dataQuery
|
|
|
+ }
|
|
|
+ }, 50);
|
|
|
+ },
|
|
|
//查询
|
|
|
handleSearch () {
|
|
|
- this.queryType = 'query'
|
|
|
- this.$refs.searchTable?.advancedQueryHandler()
|
|
|
+ let val = this.searchInput
|
|
|
+ if (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}$/
|
|
|
+ // const bagNumCA = /^CA[0-9]{6}$/
|
|
|
+ const bagNumShort = /^[0-9a-zA-Z][a-zA-Z][0-9]{6}$/
|
|
|
+ if (azNum.test(val) && top2.test(val) && val.length < 8) {
|
|
|
+ // 字母加数字且前两位为字母则为航班号
|
|
|
+ if (val.length <= 5) {
|
|
|
+ const len = val.length
|
|
|
+ const lenCx = 6 - len
|
|
|
+ val = val.substring(0, 2) + '0'.repeat(lenCx) + val.substring(2, len)
|
|
|
+ }
|
|
|
+ this.formatQuery('carrierFlights', val)
|
|
|
+ } else if (
|
|
|
+ bagNum.test(val) ||
|
|
|
+ bagNo.test(val) ||
|
|
|
+ (bagNumShort.test(val) &&
|
|
|
+ Object.keys(AIRPORT_ID).includes(val.slice(0, 2).toUpperCase()))
|
|
|
+ ) {
|
|
|
+ // 纯数字且位数等于10则为行李牌号
|
|
|
+ this.formatQuery('luggageNum', val)
|
|
|
+ } else {
|
|
|
+ this.$message.error(
|
|
|
+ '请先输入有效查询信息如航班号、行李牌号'
|
|
|
+ )
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.queryType = 'query'
|
|
|
+ this.$refs.searchTable?.advancedQueryHandler()
|
|
|
+ }
|
|
|
},
|
|
|
//确定-保存条件
|
|
|
handleOk (formName) {
|