|
@@ -9,7 +9,7 @@
|
|
|
:rules="rules"
|
|
|
@submit.native.prevent
|
|
|
>
|
|
|
- <div v-if="name === 'freight'" class="form-dates">
|
|
|
+ <div v-if="name === 'freight'" class="form-left">
|
|
|
<el-form-item prop="startDate">
|
|
|
<el-date-picker
|
|
|
v-model="formData.startDate"
|
|
@@ -20,6 +20,7 @@
|
|
|
placeholder="开始日期"
|
|
|
:prefix-icon="datePreTitle('开始')"
|
|
|
:clearable="false"
|
|
|
+ class="pre-text"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="endDate">
|
|
@@ -33,51 +34,127 @@
|
|
|
placeholder="结束日期"
|
|
|
:prefix-icon="datePreTitle('结束')"
|
|
|
:clearable="false"
|
|
|
+ class="pre-text"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <div class="form-keyWords">
|
|
|
- <el-form-item prop="keyWords">
|
|
|
- <el-input
|
|
|
- v-model.trim="formData.keyWords"
|
|
|
+ <div v-if="name === 'flight'" class="form-left">
|
|
|
+ <el-form-item prop="flightDate" style="width: 148px">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.flightDate"
|
|
|
+ format="YYYY-MM-DD"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
size="default"
|
|
|
- :placeholder="keyWordsPlaceHolder"
|
|
|
- :prefix-icon="Search"
|
|
|
- clearable
|
|
|
- @keyup.enter.prevent="dataQuery"
|
|
|
+ type="date"
|
|
|
+ placeholder="请选择航班日期"
|
|
|
+ :clearable="false"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="name === 'flight'" prop="company">
|
|
|
+ <el-form-item prop="inOrOut" style="width: 108px">
|
|
|
+ <el-select v-model="formData.inOrOut" size="default">
|
|
|
+ <el-option value="in" label="进港航班" />
|
|
|
+ <el-option value="out" label="离港航班" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="false" prop="planeType" style="width: 108px">
|
|
|
<el-select
|
|
|
- v-model="formData.company"
|
|
|
+ v-model="formData.planeType"
|
|
|
size="default"
|
|
|
- placeholder="请选择航空公司进行搜索"
|
|
|
+ placeholder="航班类型"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option value="货机" label="货机" />
|
|
|
+ <el-option value="客机" label="客机" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="sAirport" style="width: 108px">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.sAirport"
|
|
|
+ :disabled="formData.inOrOut === 'out'"
|
|
|
+ size="default"
|
|
|
+ placeholder="始发站"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="{ value, label } in airportOptions"
|
|
|
+ :key="value"
|
|
|
+ :value="value"
|
|
|
+ :label="label"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="eAirport" style="width: 108px">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.eAirport"
|
|
|
+ :disabled="formData.inOrOut === 'in'"
|
|
|
+ size="default"
|
|
|
+ placeholder="目的站"
|
|
|
clearable
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="{ value, label } in companyOptions"
|
|
|
+ v-for="{ value, label } in airportOptions"
|
|
|
:key="value"
|
|
|
:value="value"
|
|
|
:label="label"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="name === 'flight'" prop="flightDate">
|
|
|
+ <el-form-item prop="flightType" style="width: 108px">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.flightType"
|
|
|
+ size="default"
|
|
|
+ placeholder="属性"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option value="DOM" label="国内" />
|
|
|
+ <el-option value="INT" label="国际" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="sFlightDate" style="width: 148px">
|
|
|
<el-date-picker
|
|
|
- v-model="formData.flightDate"
|
|
|
+ v-model="formData.sFlightDate"
|
|
|
format="YYYY-MM-DD"
|
|
|
value-format="YYYY-MM-DD"
|
|
|
size="default"
|
|
|
type="date"
|
|
|
- placeholder="请选择航班日期"
|
|
|
- :clearable="false"
|
|
|
+ placeholder="请选择实飞时间"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ <div class="form-right">
|
|
|
+ <el-form-item
|
|
|
+ v-if="name === 'flight'"
|
|
|
+ prop="company"
|
|
|
+ style="width: 180px"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="formData.company"
|
|
|
+ size="default"
|
|
|
+ placeholder="请输入航司进行搜索"
|
|
|
+ :prefix-icon="Search"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.prevent="dataQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ prop="keyWords"
|
|
|
+ :style="name === 'flight' ? { width: '190px' } : {}"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="formData.keyWords"
|
|
|
+ size="default"
|
|
|
+ :placeholder="keyWordsPlaceHolder"
|
|
|
+ :prefix-icon="Search"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.prevent="dataQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</el-form>
|
|
|
- <el-button size="default" type="primary" @click="dataQuery"
|
|
|
+ <el-button size="default" color="#ac014d" @click="dataQuery"
|
|
|
>搜索</el-button
|
|
|
>
|
|
|
+ <el-button size="default" plain @click="resetForm">重置</el-button>
|
|
|
<ColumnSet
|
|
|
:table-columns="tableColumns"
|
|
|
@checked-submit="columnChecked"
|
|
@@ -126,13 +203,26 @@ const props = defineProps({
|
|
|
|
|
|
const today = parseTime(new Date(), '{y}-{m}-{d}') as string
|
|
|
const formData = reactive({
|
|
|
+ flightDate: today,
|
|
|
+ inOrOut: 'out',
|
|
|
+ planeType: '',
|
|
|
+ sAirport: '',
|
|
|
+ eAirport: '',
|
|
|
+ flightType: '',
|
|
|
+ sFlightDate: '',
|
|
|
+ company: '',
|
|
|
startDate: today,
|
|
|
endDate: today,
|
|
|
keyWords: '',
|
|
|
- company: '',
|
|
|
- flightDate: today,
|
|
|
})
|
|
|
watchEffect(() => {
|
|
|
+ if (formData.inOrOut === 'in') {
|
|
|
+ formData.sAirport = ''
|
|
|
+ formData.eAirport = 'SZX'
|
|
|
+ } else {
|
|
|
+ formData.sAirport = 'SZX'
|
|
|
+ formData.eAirport = ''
|
|
|
+ }
|
|
|
if (!formData.startDate || !formData.endDate) {
|
|
|
return
|
|
|
}
|
|
@@ -166,23 +256,23 @@ const keyWordsPlaceHolder = computed(
|
|
|
() => `请输入${searchTitleMap[props.name] ?? '内容'}进行搜索`
|
|
|
)
|
|
|
|
|
|
-const companyOptions = ref<{ value: string; label: string }[]>([])
|
|
|
-const getCompanys = async () => {
|
|
|
+const airportOptions = ref<{ value: string; label: string }[]>([])
|
|
|
+const getAirports = async () => {
|
|
|
try {
|
|
|
const {
|
|
|
code,
|
|
|
returnData: { listValues },
|
|
|
message,
|
|
|
} = await Query<{ [x: string]: string }>({
|
|
|
- id: DATACONTENT_ID.twoCharacterOptions,
|
|
|
+ id: DATACONTENT_ID.airportCode,
|
|
|
dataContent: [],
|
|
|
})
|
|
|
if (Number(code) !== 0) {
|
|
|
throw new Error(message || '失败')
|
|
|
}
|
|
|
- companyOptions.value = listValues.map(({ v }) => ({
|
|
|
- value: v,
|
|
|
- label: v,
|
|
|
+ airportOptions.value = listValues.map(({ code3 }) => ({
|
|
|
+ value: code3,
|
|
|
+ label: code3,
|
|
|
}))
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
@@ -190,7 +280,7 @@ const getCompanys = async () => {
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
if (props.name === 'flight') {
|
|
|
- getCompanys()
|
|
|
+ getAirports()
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -221,6 +311,13 @@ const rules = {
|
|
|
endDate: [{ required: true, message: '请选择结束日期', trigger: 'blur' }],
|
|
|
keyWords: [{ validator: keyWordsValidator, trigger: 'blur' }],
|
|
|
flightDate: [{ required: true, message: '请选择航班日期', trigger: 'blur' }],
|
|
|
+ company: [
|
|
|
+ {
|
|
|
+ pattern: /^[A-Za-z0-9][A-Za-z]$/,
|
|
|
+ message: '请输入正确的航司',
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
+ ],
|
|
|
}
|
|
|
const formRef = ref<FormInstance | null>()
|
|
|
const dataQuery = () => {
|
|
@@ -232,6 +329,10 @@ const dataQuery = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const resetForm = () => {
|
|
|
+ formRef.value?.resetFields()
|
|
|
+}
|
|
|
+
|
|
|
const loading = ref(false)
|
|
|
const page = ref(1)
|
|
|
const noMore = ref(false)
|
|
@@ -373,13 +474,13 @@ const cellClickHandler = (row, column, cell, event) => {
|
|
|
flex: 1;
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|
|
|
- .form-dates {
|
|
|
+ .form-left {
|
|
|
flex: 1;
|
|
|
display: flex;
|
|
|
.el-form-item {
|
|
|
width: 168px;
|
|
|
margin-right: 8px;
|
|
|
- .el-date-editor {
|
|
|
+ .el-date-editor.pre-text {
|
|
|
.el-input__prefix {
|
|
|
flex-basis: 42px;
|
|
|
padding-left: 15px;
|
|
@@ -393,7 +494,7 @@ const cellClickHandler = (row, column, cell, event) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .form-keyWords {
|
|
|
+ .form-right {
|
|
|
display: flex;
|
|
|
justify-content: flex-end;
|
|
|
.el-form-item {
|