|
@@ -1,589 +1,57 @@
|
|
|
-import type {
|
|
|
- KeyType,
|
|
|
- TableColumn,
|
|
|
- TableColumnInGroup,
|
|
|
- StationFormData,
|
|
|
-} from '../type'
|
|
|
+import { Ref } from 'vue'
|
|
|
+import { Query } from '@/api/webApi'
|
|
|
+import { CommonData, CommonTableColumn } from '~/common'
|
|
|
|
|
|
-type TableColumnsGroup = {
|
|
|
- groupTitle: string
|
|
|
- children: {
|
|
|
- key: KeyType
|
|
|
- title: string
|
|
|
- width?: number
|
|
|
- headerClass?: string
|
|
|
- }[]
|
|
|
-}
|
|
|
-enum Alignment {
|
|
|
- LEFT = 'left',
|
|
|
- CENTER = 'center',
|
|
|
- RIGHT = 'right',
|
|
|
-}
|
|
|
type TableDataSource =
|
|
|
| 'departure'
|
|
|
| 'arrival'
|
|
|
| 'internationalDeparture'
|
|
|
| 'internationalArrival'
|
|
|
- | 'test'
|
|
|
|
|
|
const headerClassReflect = ['bg-yellow', 'bg-green', 'bg-cyan']
|
|
|
-
|
|
|
-const departureColumnGroups = [
|
|
|
- {
|
|
|
- groupTitle: '航班相关',
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: 'flightNO',
|
|
|
- title: '航班号',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'flightDate',
|
|
|
- title: '执飞日期',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'takeOffTime',
|
|
|
- title: '起飞时间',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'desitination',
|
|
|
- title: '目的站',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'gate',
|
|
|
- title: '停机位',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'preFlightNO',
|
|
|
- title: '前序航班',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'landingTime',
|
|
|
- title: '实际降落\n时间',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- groupTitle: '货站相关',
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: 'special',
|
|
|
- title: '特货信息',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'projectLoad',
|
|
|
- title: '预计装载数\n(运单/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'transferIn',
|
|
|
- title: '中转进\n(运单/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'cancel',
|
|
|
- title: '退运\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- groupTitle: '地服相关',
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: 'receive',
|
|
|
- title: '收运核单\n(运单/件/重量)',
|
|
|
- width: 140,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'check',
|
|
|
- title: '查验\n(拒运/查验)',
|
|
|
- width: 120,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'security',
|
|
|
- title: '安检\n(运单/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'add',
|
|
|
- title: '加货\n(运单/板卡/件/重量)',
|
|
|
- width: 160,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'wait',
|
|
|
- title: '待运区\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'stowage',
|
|
|
- title: '配载\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'handOverTime',
|
|
|
- title: '计划交接\n时间',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'stationHandOver',
|
|
|
- title: '货站交接\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'recheck',
|
|
|
- title: '运输前复核\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'flightHandOver',
|
|
|
- title: '机下交接\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'load',
|
|
|
- title: '装机\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'goodsRegister',
|
|
|
- title: '拉货登记\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'pullBack',
|
|
|
- title: '拉回确认\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-]
|
|
|
-const arrivalColumnGroups = [
|
|
|
- {
|
|
|
- groupTitle: '航班相关',
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: 'flightNO',
|
|
|
- title: '航班号',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'flightDate',
|
|
|
- title: '执飞日期',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'landingTime',
|
|
|
- title: '降落时间',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'desitination',
|
|
|
- title: '目的站',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'gate',
|
|
|
- title: '停机位',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- groupTitle: '货站相关',
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: 'special',
|
|
|
- title: '特货信息',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'projectUnload',
|
|
|
- title: '预计卸载数\n(运单/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'transferOut',
|
|
|
- title: '中转出\n(运单/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'difference',
|
|
|
- title: '收货差异\n(板卡/件)',
|
|
|
- width: 100,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- groupTitle: '地服相关',
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: 'unload',
|
|
|
- title: '卸机\n(板/箱/卡)',
|
|
|
- width: 160,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'flightHandOver',
|
|
|
- title: '机下交接\n(板/箱/卡)',
|
|
|
- width: 160,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'stationHandOver',
|
|
|
- title: '货站交接\n(板/箱/卡)',
|
|
|
- width: 160,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'settle',
|
|
|
- title: '理货\n(板卡/运单/件/重量)',
|
|
|
- width: 160,
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'outCargo',
|
|
|
- title: '出库\n(批/运单/件)',
|
|
|
- width: 160,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-]
|
|
|
-const groupsObj = {
|
|
|
- departure: departureColumnGroups,
|
|
|
- arrival: arrivalColumnGroups,
|
|
|
- internationalDeparture: departureColumnGroups,
|
|
|
- internationalArrival: arrivalColumnGroups,
|
|
|
-}
|
|
|
-const tableDatas = {
|
|
|
- departure: [
|
|
|
- {
|
|
|
- flightNO: 'ZH3423',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- takeOffTime: '22/09/10 12:01',
|
|
|
- desitination: '-NGK-PEK',
|
|
|
- gate: '84',
|
|
|
- preFlightNO: 'HU2451',
|
|
|
- landingTime: '2022/09/10 11:01',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectLoad: '365/536',
|
|
|
- transferIn: '1/2',
|
|
|
- cancel: '',
|
|
|
- receive: '364/534/1254KG',
|
|
|
- check: '0/7',
|
|
|
- security: '364/534',
|
|
|
- add: '8/365/536/1254KG',
|
|
|
- wait: '8/536',
|
|
|
- stowage: '8/536',
|
|
|
- handOverTime: '11:45',
|
|
|
- stationHandOver: '8/536',
|
|
|
- recheck: '8/536',
|
|
|
- flightHandOver: '8/536',
|
|
|
- load: '8/536',
|
|
|
- goodsRegister: '0/358/5',
|
|
|
- pullBack: '0/5',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'CA1512',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- takeOffTime: '22/09/10 12:01',
|
|
|
- desitination: '-NGK-PEK',
|
|
|
- gate: '84',
|
|
|
- preFlightNO: 'HU2451',
|
|
|
- landingTime: '2022/09/10 11:01',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectLoad: '365/536',
|
|
|
- transferIn: '1/2',
|
|
|
- cancel: '',
|
|
|
- receive: '364/534/1254KG',
|
|
|
- check: '0/7',
|
|
|
- security: '364/534',
|
|
|
- add: '8/365/536/1254KG',
|
|
|
- wait: '4/243',
|
|
|
- stowage: '8/536',
|
|
|
- handOverTime: '11:45',
|
|
|
- stationHandOver: '8/536',
|
|
|
- recheck: '8/536',
|
|
|
- flightHandOver: '8/536',
|
|
|
- load: '8/536',
|
|
|
- goodsRegister: '0/358/5',
|
|
|
- pullBack: '0/5',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'ZH3456',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- takeOffTime: '22/09/10 12:01',
|
|
|
- desitination: '-NGK-PEK',
|
|
|
- gate: '84',
|
|
|
- preFlightNO: 'HU2451',
|
|
|
- landingTime: '2022/09/10 11:01',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectLoad: '365/536',
|
|
|
- transferIn: '1/2',
|
|
|
- cancel: '',
|
|
|
- receive: '364/534/1254KG',
|
|
|
- check: '0/7',
|
|
|
- security: '364/534',
|
|
|
- add: '8/365/536/1254KG',
|
|
|
- wait: '8/536',
|
|
|
- stowage: '5/357',
|
|
|
- handOverTime: '11:45',
|
|
|
- stationHandOver: '8/536',
|
|
|
- recheck: '8/536',
|
|
|
- flightHandOver: '8/536',
|
|
|
- load: '8/536',
|
|
|
- goodsRegister: '0/358/5',
|
|
|
- pullBack: '0/5',
|
|
|
- },
|
|
|
- ],
|
|
|
- arrival: [
|
|
|
- {
|
|
|
- flightNO: 'ZH3423',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- landingTime: '22/09/10 12:01',
|
|
|
- desitination: 'NKG-PEK-',
|
|
|
- gate: '84',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectUnload: '363/543',
|
|
|
- transferOut: '',
|
|
|
- difference: '0/6',
|
|
|
- unload: '8/8/8',
|
|
|
- flightHandOver: '8/8/8',
|
|
|
- stationHandOver: '8/8/8',
|
|
|
- settle: '8/363/537/1254KG',
|
|
|
- outCargo: '3/363/537',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'CA1512',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- landingTime: '22/09/10 12:01',
|
|
|
- desitination: 'NKG-PEK-',
|
|
|
- gate: '84',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectUnload: '363/543',
|
|
|
- transferOut: '',
|
|
|
- difference: '',
|
|
|
- unload: '8/8/8',
|
|
|
- flightHandOver: '8/8/8',
|
|
|
- stationHandOver: '8/8/8',
|
|
|
- settle: '8/363/537/1254KG',
|
|
|
- outCargo: '3/363/537',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'ZH3456',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- landingTime: '22/09/10 12:01',
|
|
|
- desitination: 'NKG-PEK-',
|
|
|
- gate: '84',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectUnload: '363/543',
|
|
|
- transferOut: '',
|
|
|
- difference: '',
|
|
|
- unload: '8/8/8',
|
|
|
- flightHandOver: '8/8/8',
|
|
|
- stationHandOver: '8/8/8',
|
|
|
- settle: '8/363/537/1254KG',
|
|
|
- outCargo: '3/363/537',
|
|
|
- },
|
|
|
- ],
|
|
|
- internationalDeparture: [
|
|
|
- {
|
|
|
- flightNO: 'ZH3423',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- takeOffTime: '22/09/10 12:01',
|
|
|
- desitination: '-NGK-PEK',
|
|
|
- gate: '84',
|
|
|
- preFlightNO: 'HU2451',
|
|
|
- landingTime: '2022/09/10 11:01',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectLoad: '365/536',
|
|
|
- transferIn: '1/2',
|
|
|
- cancel: '',
|
|
|
- receive: '364/534/1254KG',
|
|
|
- check: '0/7',
|
|
|
- security: '364/534',
|
|
|
- add: '8/365/536/1254KG',
|
|
|
- wait: '8/536',
|
|
|
- stowage: '8/536',
|
|
|
- handOverTime: '11:45',
|
|
|
- stationHandOver: '8/536',
|
|
|
- recheck: '8/536',
|
|
|
- flightHandOver: '8/536',
|
|
|
- load: '8/536',
|
|
|
- goodsRegister: '0/358/5',
|
|
|
- pullBack: '0/5',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'CA1512',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- takeOffTime: '22/09/10 12:01',
|
|
|
- desitination: '-NGK-PEK',
|
|
|
- gate: '84',
|
|
|
- preFlightNO: 'HU2451',
|
|
|
- landingTime: '2022/09/10 11:01',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectLoad: '365/536',
|
|
|
- transferIn: '1/2',
|
|
|
- cancel: '',
|
|
|
- receive: '364/534/1254KG',
|
|
|
- check: '0/7',
|
|
|
- security: '364/534',
|
|
|
- add: '8/365/536/1254KG',
|
|
|
- wait: '4/243',
|
|
|
- stowage: '8/536',
|
|
|
- handOverTime: '11:45',
|
|
|
- stationHandOver: '8/536',
|
|
|
- recheck: '8/536',
|
|
|
- flightHandOver: '8/536',
|
|
|
- load: '8/536',
|
|
|
- goodsRegister: '0/358/5',
|
|
|
- pullBack: '0/5',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'ZH3456',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- takeOffTime: '22/09/10 12:01',
|
|
|
- desitination: '-NGK-PEK',
|
|
|
- gate: '84',
|
|
|
- preFlightNO: 'HU2451',
|
|
|
- landingTime: '2022/09/10 11:01',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectLoad: '365/536',
|
|
|
- transferIn: '1/2',
|
|
|
- cancel: '',
|
|
|
- receive: '364/534/1254KG',
|
|
|
- check: '0/7',
|
|
|
- security: '364/534',
|
|
|
- add: '8/365/536/1254KG',
|
|
|
- wait: '8/536',
|
|
|
- stowage: '5/357',
|
|
|
- handOverTime: '11:45',
|
|
|
- stationHandOver: '8/536',
|
|
|
- recheck: '8/536',
|
|
|
- flightHandOver: '8/536',
|
|
|
- load: '8/536',
|
|
|
- goodsRegister: '0/358/5',
|
|
|
- pullBack: '0/5',
|
|
|
- },
|
|
|
- ],
|
|
|
- internationalArrival: [
|
|
|
- {
|
|
|
- flightNO: 'ZH3423',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- landingTime: '22/09/10 12:01',
|
|
|
- desitination: 'NKG-PEK-',
|
|
|
- gate: '84',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectUnload: '363/543',
|
|
|
- transferOut: '',
|
|
|
- difference: '0/6',
|
|
|
- unload: '8/8/8',
|
|
|
- flightHandOver: '8/8/8',
|
|
|
- stationHandOver: '8/8/8',
|
|
|
- settle: '8/363/537/1254KG',
|
|
|
- outCargo: '3/363/537',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'CA1512',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- landingTime: '22/09/10 12:01',
|
|
|
- desitination: 'NKG-PEK-',
|
|
|
- gate: '84',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectUnload: '363/543',
|
|
|
- transferOut: '',
|
|
|
- difference: '',
|
|
|
- unload: '8/8/8',
|
|
|
- flightHandOver: '8/8/8',
|
|
|
- stationHandOver: '8/8/8',
|
|
|
- settle: '8/363/537/1254KG',
|
|
|
- outCargo: '3/363/537',
|
|
|
- },
|
|
|
- {
|
|
|
- flightNO: 'ZH3456',
|
|
|
- flightDate: '2022/09/10',
|
|
|
- landingTime: '22/09/10 12:01',
|
|
|
- desitination: 'NKG-PEK-',
|
|
|
- gate: '84',
|
|
|
- special: '锂2/冷1',
|
|
|
- projectUnload: '363/543',
|
|
|
- transferOut: '',
|
|
|
- difference: '',
|
|
|
- unload: '8/8/8',
|
|
|
- flightHandOver: '8/8/8',
|
|
|
- stationHandOver: '8/8/8',
|
|
|
- settle: '8/363/537/1254KG',
|
|
|
- outCargo: '3/363/537',
|
|
|
- },
|
|
|
- ],
|
|
|
-}
|
|
|
-
|
|
|
export default function useTableData(
|
|
|
tableDataSource: TableDataSource,
|
|
|
- formData: StationFormData
|
|
|
+ formData: CommonData,
|
|
|
+ international: Ref<boolean>
|
|
|
) {
|
|
|
- const tableColumns = ref<TableColumnInGroup[] | TableColumn[]>([])
|
|
|
- const tableData = ref<{}[]>([])
|
|
|
- const getTableData = () => {
|
|
|
- if (tableDataSource === 'test') {
|
|
|
- tableColumns.value = [
|
|
|
- {
|
|
|
- key: 'flightNO',
|
|
|
- title: '航班号',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'flightDate',
|
|
|
- title: '执飞日期',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'takeOffTime',
|
|
|
- title: '起飞时间',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'desitination',
|
|
|
- title: '目的站',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'gate',
|
|
|
- title: '停机位',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'preFlightNO',
|
|
|
- title: '前序航班',
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'landingTime',
|
|
|
- title: '实际降落\n时间',
|
|
|
- },
|
|
|
- ].map(({ key, title }) => ({
|
|
|
- key,
|
|
|
- dataKey: key,
|
|
|
- title,
|
|
|
- width: 80,
|
|
|
- align: Alignment.CENTER,
|
|
|
+ const tableColumns = ref<CommonTableColumn[]>([])
|
|
|
+ const tableData = ref<CommonData[]>([])
|
|
|
+ const getTableData = async () => {
|
|
|
+ try {
|
|
|
+ const {
|
|
|
+ startDate,
|
|
|
+ endDate,
|
|
|
+ flightStatus,
|
|
|
+ flightWarning,
|
|
|
+ waybillType,
|
|
|
+ } = formData
|
|
|
+ const dataContent = [startDate, endDate, flightStatus, flightWarning]
|
|
|
+ if (international.value) {
|
|
|
+ dataContent.push(waybillType)
|
|
|
+ }
|
|
|
+ const {
|
|
|
+ code,
|
|
|
+ returnData: { columnSet, listValues },
|
|
|
+ message,
|
|
|
+ } = await Query({
|
|
|
+ id: DATACONTENT_ID[`${tableDataSource}Airport`],
|
|
|
+ dataContent,
|
|
|
+ })
|
|
|
+ if (Number(code) !== 0) {
|
|
|
+ throw new Error(message || '失败')
|
|
|
+ }
|
|
|
+ tableColumns.value = columnSet.map(column => ({
|
|
|
+ key: column.columnName,
|
|
|
+ dataKey: column.columnName,
|
|
|
+ title: column.columnLabel,
|
|
|
+ width: 200,
|
|
|
+ align: 'center',
|
|
|
+ ...column,
|
|
|
}))
|
|
|
- tableData.value = tableDatas.arrival
|
|
|
- return
|
|
|
+ tableData.value = listValues
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error)
|
|
|
}
|
|
|
-
|
|
|
- const groups: TableColumnsGroup[] = groupsObj[tableDataSource].map(
|
|
|
- (group: TableColumnsGroup, groupIndex: number) => {
|
|
|
- group.children.forEach(column => {
|
|
|
- column.headerClass = headerClassReflect[groupIndex]
|
|
|
- })
|
|
|
- return group
|
|
|
- }
|
|
|
- )
|
|
|
- tableColumns.value = groups.reduce(
|
|
|
- (columns: TableColumnInGroup[], group) => {
|
|
|
- columns.push(
|
|
|
- ...group.children.map(({ key, title, width, headerClass }) => ({
|
|
|
- key,
|
|
|
- dataKey: key,
|
|
|
- title,
|
|
|
- width: width ?? 80,
|
|
|
- headerClass,
|
|
|
- align: Alignment.CENTER,
|
|
|
- groupTitle: group.groupTitle,
|
|
|
- }))
|
|
|
- )
|
|
|
- return columns
|
|
|
- },
|
|
|
- []
|
|
|
- )
|
|
|
- tableData.value = tableDatas[tableDataSource]
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
getTableData()
|