123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- import { Column } from 'element-plus'
- import type { KeyType } from '../components/ColumnSet/index.vue'
- import { tableColumnInGroup } from '../components/ColumnSet/index.vue'
- type tableColumnsGroup = {
- groupTitle: string
- children: {
- key: KeyType
- title: string
- width?: number
- headerClass?: string
- }[]
- }
- enum Alignment {
- LEFT = 'left',
- CENTER = 'center',
- RIGHT = 'right',
- }
- const headerClassReflect = ['bg-yellow', 'bg-green', 'bg-cyan']
- const groupsObj = {
- departure: [
- {
- 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,
- },
- ],
- },
- ],
- arrival: [
- {
- 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 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',
- },
- ],
- }
- export default function useTableData(stationType: string = 'dearture') {
- const tableColumns = ref<tableColumnInGroup[] | Column[]>([])
- const tableData = ref<{}[]>([])
- const getTableData = () => {
- if (stationType === '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,
- }))
- tableData.value = tableDatas.arrival
- return
- }
- const groups: tableColumnsGroup[] = groupsObj[stationType].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[stationType]
- }
- onMounted(() => {
- getTableData()
- })
- return {
- tableColumns,
- tableData,
- }
- }
|