|
@@ -43,6 +43,7 @@
|
|
|
<div class="advance__table">
|
|
|
<SimpleTable
|
|
|
:loading="loading"
|
|
|
+ height="calc(100vh - 158px)"
|
|
|
:table-cols="tableCols"
|
|
|
:data="tableData"
|
|
|
:header-cell-class-name="headerCellClass"
|
|
@@ -51,6 +52,7 @@
|
|
|
:formatter="tableFormatter"
|
|
|
show-summary
|
|
|
@load="load"
|
|
|
+ @cell-click="cellClickHandler"
|
|
|
/>
|
|
|
</div>
|
|
|
<!--高级查询-->
|
|
@@ -132,7 +134,7 @@
|
|
|
<el-select
|
|
|
v-model="scope.row[col.prop]"
|
|
|
placeholder="请选择"
|
|
|
- :disabled="scope.$index < 2 && ['paramKey', 'connector'].includes(col.prop)"
|
|
|
+ :disabled="scope.$index < 2 && ['leftBrackets', 'paramKey', 'rightBrackets', 'connector'].includes(col.prop)"
|
|
|
@change="value => { selectChangeHandler(value, scope.$index, index) }"
|
|
|
>
|
|
|
<el-option
|
|
@@ -140,6 +142,7 @@
|
|
|
:key="index"
|
|
|
:value="option.value"
|
|
|
:label="option.label"
|
|
|
+ :disabled="col.prop === 'paramKey' && option.value === 'flightDate'"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</template>
|
|
@@ -168,6 +171,8 @@
|
|
|
value-format="yyyy-MM-dd"
|
|
|
placeholder="请选择"
|
|
|
:clearable="false"
|
|
|
+ :picker-options="datePickerOptions(scope.$index, index)"
|
|
|
+ @change="value => { dateChangeHandler(value, scope.$index, index) }"
|
|
|
/>
|
|
|
</template>
|
|
|
<template v-else-if="col.inputType[scope.$index] === 'datetime'">
|
|
@@ -280,7 +285,7 @@ export default {
|
|
|
leftBrackets: '',
|
|
|
paramKey: 'flightDate',
|
|
|
comparisonOperator: '>=',
|
|
|
- paramValue: '',
|
|
|
+ paramValue: parseTime(new Date(), '{y}-{m}-{d}'),
|
|
|
rightBrackets: '',
|
|
|
connector: 'and'
|
|
|
},
|
|
@@ -288,7 +293,7 @@ export default {
|
|
|
leftBrackets: '',
|
|
|
paramKey: 'flightDate',
|
|
|
comparisonOperator: '<=',
|
|
|
- paramValue: '',
|
|
|
+ paramValue: parseTime(new Date(), '{y}-{m}-{d}'),
|
|
|
rightBrackets: '',
|
|
|
connector: 'and'
|
|
|
}
|
|
@@ -373,24 +378,15 @@ export default {
|
|
|
columnSet: {}
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapGetters(['clickedCells'])
|
|
|
- },
|
|
|
watch: {
|
|
|
- // flightDate: {
|
|
|
- // handler(val) {
|
|
|
- // if (val === null) {
|
|
|
- // this.flightDate = ['', '']
|
|
|
+ // $route: {
|
|
|
+ // handler({ path, query }) {
|
|
|
+ // if (path === '/advance') {
|
|
|
+ // this.queryHandler(query)
|
|
|
// }
|
|
|
// },
|
|
|
// deep: true
|
|
|
// },
|
|
|
- queryString: {
|
|
|
- handler() {
|
|
|
- this.resetTable()
|
|
|
- this.queryTableData()
|
|
|
- }
|
|
|
- },
|
|
|
tableCols: {
|
|
|
handler(arr) {
|
|
|
this.getColumnSet(arr)
|
|
@@ -398,10 +394,9 @@ export default {
|
|
|
deep: true
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- this.paramsForm.params[0].paramValue = this.flightDate[0]
|
|
|
- this.paramsForm.params[1].paramValue = this.flightDate[1]
|
|
|
- },
|
|
|
+ // mounted() {
|
|
|
+ // this.queryHandler(this.$route.query)
|
|
|
+ // },
|
|
|
deactivated() {
|
|
|
this.loading = false
|
|
|
},
|
|
@@ -409,11 +404,55 @@ export default {
|
|
|
this.loading = false
|
|
|
},
|
|
|
methods: {
|
|
|
+ queryHandler(query) {
|
|
|
+ // let queryFlag = false
|
|
|
+ // const { singleJump } = query
|
|
|
+ // const queryEntries = Object.entries(query)
|
|
|
+ // if (queryEntries.length) {
|
|
|
+ // this.clearForm()
|
|
|
+ // queryEntries.forEach(([key, value]) => {
|
|
|
+ // if ((value ?? '') !== '') {
|
|
|
+ // queryFlag = true
|
|
|
+ // switch (key) {
|
|
|
+ // case 'singleJump':
|
|
|
+ // break
|
|
|
+ // case 'startDate':
|
|
|
+ // this.$set(this.flightDate, 0, value)
|
|
|
+ // break
|
|
|
+ // case 'endDate':
|
|
|
+ // this.$set(this.flightDate, 1, value)
|
|
|
+ // break
|
|
|
+ // case 'unLoad':
|
|
|
+ // case 'checkIn':
|
|
|
+ // case 'active':
|
|
|
+ // case 'transferIn':
|
|
|
+ // case 'canceled':
|
|
|
+ // this.paramsForm.params.push({
|
|
|
+ // leftBrackets: '',
|
|
|
+ // paramKey: key,
|
|
|
+ // comparisonOperator: '=',
|
|
|
+ // paramValue: value,
|
|
|
+ // rightBrackets: '',
|
|
|
+ // connector: 'and'
|
|
|
+ // })
|
|
|
+ // break
|
|
|
+ // default:
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // if (queryFlag) {
|
|
|
+ // this.advancedQueryHandler(singleJump)
|
|
|
+ // }
|
|
|
+ },
|
|
|
dateRangePickHandler({ maxDate, minDate }) {
|
|
|
if (!maxDate) {
|
|
|
this.pickedDate = minDate
|
|
|
} else {
|
|
|
this.pickedDate = null
|
|
|
+ this.paramsForm.params[0].paramValue = minDate
|
|
|
+ this.paramsForm.params[1].paramValue = maxDate
|
|
|
}
|
|
|
},
|
|
|
dateRangeDisabled(date) {
|
|
@@ -442,7 +481,7 @@ export default {
|
|
|
comparisonOperator: '',
|
|
|
paramValue: '',
|
|
|
rightBrackets: '',
|
|
|
- connector: ''
|
|
|
+ connector: 'and'
|
|
|
})
|
|
|
},
|
|
|
selectChangeHandler(value, rowIndex, colIndex) {
|
|
@@ -458,14 +497,15 @@ export default {
|
|
|
this.paramsTableCols[2].options[rowIndex] = comparisonOperatorOptions.slice(4, 5)
|
|
|
this.paramsTableCols[3].inputType[rowIndex] = 'select'
|
|
|
this.paramsTableCols[3].options[rowIndex] = options
|
|
|
+ this.paramsForm.params[rowIndex].paramValue = ''
|
|
|
} else if (dataType === 'number') {
|
|
|
this.paramsTableCols[2].options[rowIndex] = comparisonOperatorOptions.slice(0, 5).reverse()
|
|
|
this.paramsTableCols[3].inputType[rowIndex] = 'number'
|
|
|
+ this.paramsForm.params[rowIndex].paramValue = ''
|
|
|
} else {
|
|
|
this.paramsTableCols[2].options[rowIndex] = comparisonOperatorOptions.slice(4)
|
|
|
this.paramsTableCols[3].inputType[rowIndex] = 'text'
|
|
|
}
|
|
|
-
|
|
|
this.paramsForm.params[rowIndex].comparisonOperator = this.paramsTableCols[2].options[rowIndex][0].value
|
|
|
} else if (colIndex === 2) {
|
|
|
if (['is Null', 'is not Null'].includes(value)) {
|
|
@@ -476,6 +516,39 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ datePickerOptions(rowIndex, colIndex) {
|
|
|
+ return rowIndex === 1 && colIndex === 3 ? { disabledDate: this.endDateDisabled } : {}
|
|
|
+ },
|
|
|
+ endDateDisabled(endDate) {
|
|
|
+ const startDate = new Date(this.paramsForm.params[0].paramValue)
|
|
|
+ endDate = new Date(endDate)
|
|
|
+ return (
|
|
|
+ startDate.getTime() >= endDate.getTime() + 24 * 60 * 60 * 1000 ||
|
|
|
+ startDate.getTime() < endDate.getTime() - 3 * 24 * 60 * 60 * 1000
|
|
|
+ )
|
|
|
+ },
|
|
|
+ dateChangeHandler(dateString, rowIndex, colIndex) {
|
|
|
+ if (colIndex !== 3) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let startDate, endDate
|
|
|
+ if (rowIndex === 0) {
|
|
|
+ startDate = new Date(dateString)
|
|
|
+ endDate = new Date(this.paramsForm.params[1].paramValue)
|
|
|
+ } else if (rowIndex === 1) {
|
|
|
+ startDate = new Date(this.paramsForm.params[0].paramValue)
|
|
|
+ endDate = new Date(dateString)
|
|
|
+ }
|
|
|
+ if (startDate.getTime() >= endDate.getTime() + 24 * 60 * 60 * 1000) {
|
|
|
+ this.$message.warning('开始日期不能大于结束日期')
|
|
|
+ this.paramsForm.params[1].paramValue = ''
|
|
|
+ } else if (startDate.getTime() < endDate.getTime() - 3 * 24 * 60 * 60 * 1000) {
|
|
|
+ this.$message.warning('间隔日期不能超过三天')
|
|
|
+ this.paramsForm.params[1].paramValue = ''
|
|
|
+ } else {
|
|
|
+ this.flightDate = [this.paramsForm.params[0].paramValue, this.paramsForm.params[1].paramValue]
|
|
|
+ }
|
|
|
+ },
|
|
|
inputHold(value) {
|
|
|
this.checkValue = value
|
|
|
},
|
|
@@ -489,7 +562,7 @@ export default {
|
|
|
this.paramsForm.params[rowIndex].paramValue = value.slice(0, -1)
|
|
|
}
|
|
|
},
|
|
|
- advancedQueryHandler() {
|
|
|
+ advancedQueryHandler(singleJump) {
|
|
|
let bracketsDifference = 0
|
|
|
try {
|
|
|
const paramsRowNum = this.paramsForm.params.length
|
|
@@ -499,19 +572,18 @@ export default {
|
|
|
if (bracketsDifference < 0) {
|
|
|
throw new Error('左右括号不匹配!')
|
|
|
}
|
|
|
- return (
|
|
|
- preString +
|
|
|
- leftBrackets +
|
|
|
- paramKey +
|
|
|
- ` ${comparisonOperator} ` +
|
|
|
- (['is Null', 'is not Null'].includes(comparisonOperator)
|
|
|
- ? ''
|
|
|
- : comparisonOperator === 'like'
|
|
|
- ? `%${paramValue}%`
|
|
|
- : paramValue) +
|
|
|
- rightBrackets +
|
|
|
- (index < paramsRowNum - 1 ? connector : '')
|
|
|
- )
|
|
|
+ preString += leftBrackets + paramKey + ` ${comparisonOperator} `
|
|
|
+ if (!['is Null', 'is not Null'].includes(comparisonOperator)) {
|
|
|
+ if (comparisonOperator === 'like') {
|
|
|
+ preString += `\'%${paramValue}%\'`
|
|
|
+ } else if (this.columnSet[paramKey].dataType === 'number') {
|
|
|
+ preString += paramValue
|
|
|
+ } else {
|
|
|
+ preString += `\'${paramValue}\'`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ preString += rightBrackets + (index < paramsRowNum - 1 ? ` ${connector} ` : '')
|
|
|
+ return preString
|
|
|
},
|
|
|
''
|
|
|
)
|
|
@@ -519,6 +591,8 @@ export default {
|
|
|
throw new Error('左右括号不匹配!')
|
|
|
}
|
|
|
this.queryString = queryString
|
|
|
+ this.resetTable()
|
|
|
+ this.queryTableData(singleJump)
|
|
|
this.dialogHide()
|
|
|
} catch (error) {
|
|
|
this.$message.error(error.message)
|
|
@@ -527,25 +601,26 @@ export default {
|
|
|
deleteParam(index) {
|
|
|
this.paramsTableCols[3].inputType.splice(index, 1)
|
|
|
this.paramsForm.params.splice(index, 1)
|
|
|
+ this.paramsForm.disabled.splice(index, 1)
|
|
|
},
|
|
|
clearForm() {
|
|
|
- this.paramsTableCols[2].options = []
|
|
|
- this.paramsTableCols[3].inputType = ['text']
|
|
|
+ this.paramsTableCols[2].options = new Array(2).fill(comparisonOperatorOptions.slice(0, 5).reverse())
|
|
|
+ this.paramsTableCols[3].inputType = ['date', 'date']
|
|
|
this.paramsTableCols[3].options = []
|
|
|
- this.$refs['paramsForm'].resetFields()
|
|
|
+ this.paramsForm.params.splice(2)
|
|
|
+ this.paramsForm.disabled = []
|
|
|
},
|
|
|
- getColumnSet(columnSet) {
|
|
|
- this.columnSet = {}
|
|
|
- this.paramsTableCols[1].options = []
|
|
|
+ async getColumnSet(columnSet) {
|
|
|
+ const reflect = {}
|
|
|
columnSet.forEach(async column => {
|
|
|
if (!this.columnSet[column.columnName]) {
|
|
|
this.columnSet[column.columnName] = column
|
|
|
- if (column.listqueryTemplateID && !this.columnSet[column.columnName.options]) {
|
|
|
- const options = await this.getSelectData(column.listqueryTemplateID)
|
|
|
- this.columnSet[column.columnName].options = options.map(option => ({
|
|
|
- label: option.k,
|
|
|
- value: option.v
|
|
|
- }))
|
|
|
+ if ((column.listqueryTemplateID ?? '') !== '' && !this.columnSet[column.columnName].options) {
|
|
|
+ if (reflect[column.listqueryTemplateID]) {
|
|
|
+ reflect[column.listqueryTemplateID].push(column.columnName)
|
|
|
+ } else {
|
|
|
+ reflect[column.listqueryTemplateID] = [column.columnName]
|
|
|
+ }
|
|
|
}
|
|
|
this.paramsTableCols[1].options.push({
|
|
|
label: column.columnLabel,
|
|
@@ -553,6 +628,17 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ const optionsList = await Promise.all(
|
|
|
+ Object.keys(reflect).map(listqueryTemplateID => this.getSelectData(Number(listqueryTemplateID)))
|
|
|
+ )
|
|
|
+ optionsList.forEach(({ id, options }) => {
|
|
|
+ reflect[id].forEach(columnName => {
|
|
|
+ this.columnSet[columnName].options = options.map(option => ({
|
|
|
+ label: option.k,
|
|
|
+ value: option.v
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
load() {
|
|
|
if (this.noMore || this.loading) {
|
|
@@ -678,8 +764,8 @@ export default {
|
|
|
},
|
|
|
// 清除查询
|
|
|
clearSearchData() {
|
|
|
- this.clearForm()
|
|
|
- this.resetTable()
|
|
|
+ // this.clearForm()
|
|
|
+ // this.resetTable()
|
|
|
},
|
|
|
// 统计行数
|
|
|
summaryRow(num) {
|
|
@@ -688,47 +774,74 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getSearchData(val) {
|
|
|
- this.$message.info('开发中')
|
|
|
- // this.clearForm()
|
|
|
- // if (!val) {
|
|
|
- // this.$message.error('请先输入完整查询信息')
|
|
|
- // return
|
|
|
- // }
|
|
|
- // const az = /^[a-zA-Z]+$/
|
|
|
- // const azNum = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/
|
|
|
- // const top2 = /^([a-zA-Z][0-9])|([0-9][a-zA-Z])|([a-zA-Z]{2})/
|
|
|
- // const num = /^[0-9]+$/
|
|
|
- // const bagNo = /^[a-zA-Z]{2}[0-9]{6}$/
|
|
|
- // // 纯字母则为旅客姓名
|
|
|
- // if (az.test(val)) {
|
|
|
- //
|
|
|
- // } else if (azNum.test(val) && top2.test(val)) {
|
|
|
- // // 字母加数字且前两位为字母则为航班号
|
|
|
- //
|
|
|
- // } else if ((num.test(val) && val.length === 10) || bagNo.test(val)) {
|
|
|
- // // 纯数字且位数等于10则为行李牌号
|
|
|
- //
|
|
|
- // } else {
|
|
|
- // this.$message.error('请先输入有效查询信息如航班号、旅客姓名首字母、行李牌号')
|
|
|
- // }
|
|
|
+ // this.$message.info('开发中')
|
|
|
+ this.clearForm()
|
|
|
+ if (!val) {
|
|
|
+ this.$message.error('请先输入完整查询信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const az = /^[a-zA-Z]+$/
|
|
|
+ const azNum = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/
|
|
|
+ const top2 = /^([a-zA-Z][0-9])|([0-9][a-zA-Z])|([a-zA-Z]{2})/
|
|
|
+ const num = /^[0-9]+$/
|
|
|
+ const bagNo = /^[a-zA-Z]{2}[0-9]{6}$/
|
|
|
+ if (az.test(val)) {
|
|
|
+ // 纯字母则为旅客姓名
|
|
|
+ this.paramsForm.params.push({
|
|
|
+ leftBrackets: '',
|
|
|
+ paramKey: 'passengerName',
|
|
|
+ comparisonOperator: '=',
|
|
|
+ paramValue: val,
|
|
|
+ rightBrackets: '',
|
|
|
+ connector: 'and'
|
|
|
+ })
|
|
|
+ } else if (azNum.test(val) && top2.test(val)) {
|
|
|
+ // 字母加数字且前两位为字母则为航班号
|
|
|
+ this.paramsForm.params.push({
|
|
|
+ leftBrackets: '',
|
|
|
+ paramKey: 'flightNO',
|
|
|
+ comparisonOperator: '=',
|
|
|
+ paramValue: val,
|
|
|
+ rightBrackets: '',
|
|
|
+ connector: 'and'
|
|
|
+ })
|
|
|
+ } else if ((num.test(val) && val.length === 10) || bagNo.test(val)) {
|
|
|
+ // 纯数字且位数等于10则为行李牌号
|
|
|
+ this.paramsForm.params.push({
|
|
|
+ leftBrackets: '',
|
|
|
+ paramKey: 'bagNo',
|
|
|
+ comparisonOperator: '=',
|
|
|
+ paramValue: val,
|
|
|
+ rightBrackets: '',
|
|
|
+ connector: 'and'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error('请先输入有效查询信息如航班号、旅客姓名首字母、行李牌号')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.paramsTableCols[2].options[2] = comparisonOperatorOptions.slice(4)
|
|
|
+ this.paramsTableCols[3].inputType[2] = 'text'
|
|
|
+ this.advancedQueryHandler()
|
|
|
},
|
|
|
// 获取下拉数据
|
|
|
async getSelectData(id) {
|
|
|
+ const result = { id }
|
|
|
try {
|
|
|
const { code, returnData } = await Query({
|
|
|
id,
|
|
|
dataContent: []
|
|
|
})
|
|
|
if (Number(code) === 0) {
|
|
|
- return returnData.listValues
|
|
|
+ result.options = returnData.listValues
|
|
|
} else {
|
|
|
- return []
|
|
|
+ result.options = []
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- this.$message.error('失败')
|
|
|
+ result.options = []
|
|
|
}
|
|
|
+ return result
|
|
|
},
|
|
|
- async queryTableData() {
|
|
|
+ async queryTableData(singleJump) {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
const {
|
|
@@ -737,12 +850,47 @@ export default {
|
|
|
} = await Query({
|
|
|
id: DATACONTENT_ID.advancedQueryNew,
|
|
|
needPage: ++this.page,
|
|
|
- dataContent: this.queryString ? { whereString: this.queryString } : []
|
|
|
+ dataContent: [],
|
|
|
+ queryConcat: this.queryString || '1 = 2'
|
|
|
})
|
|
|
if (Number(code) === 0) {
|
|
|
- if (listValues.length === 0) {
|
|
|
+ if (!listValues.length) {
|
|
|
this.page--
|
|
|
this.noMore = true
|
|
|
+ } else if (singleJump) {
|
|
|
+ if (listValues.length === 1) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/advance/baggageView',
|
|
|
+ query: {
|
|
|
+ bagSN: listValues[0].bagSN,
|
|
|
+ flightNO: listValues[0].flightNO,
|
|
|
+ flightDate: listValues[0].flightDate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const onlyFlight = listValues.reduce((pre, curr) => {
|
|
|
+ if (
|
|
|
+ pre === null ||
|
|
|
+ (curr.flightNO &&
|
|
|
+ curr.flightDate &&
|
|
|
+ curr.flightNO === pre.flightNO &&
|
|
|
+ curr.flightDate === pre.flightDate)
|
|
|
+ ) {
|
|
|
+ return {
|
|
|
+ flightNO: curr.flightNO,
|
|
|
+ flightDate: curr.flightDate
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return {}
|
|
|
+ }
|
|
|
+ }, null)
|
|
|
+ if (onlyFlight.flightNO) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/advance/flightView',
|
|
|
+ query: onlyFlight
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
this.tableCols = columnSet
|
|
|
this.tableData.push(...listValues)
|
|
@@ -792,7 +940,6 @@ export default {
|
|
|
}
|
|
|
.advance__table {
|
|
|
width: 100%;
|
|
|
- height: calc(100vh - 158px);
|
|
|
::v-deep .el-table {
|
|
|
.el-table__body-wrapper {
|
|
|
tr.bgl-deleted {
|