123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957 |
- import { Query } from '@/api/webApi'
- import { CommonData, CommonTableColumn } from '~/common'
- interface SimpleColumn {
- columnName: string
- columnLabel: string
- [x: string]: any
- }
- const columnGroupsMap: {
- [x: string]: {
- groupName: string
- children: SimpleColumn[]
- }[]
- } = {
- DepartureAirport: [
- {
- groupName: '航班相关',
- children: [
- {
- columnName: 'IATACode',
- columnLabel: '航司',
- needFilters: 1,
- },
- {
- columnName: 'flightNO',
- columnLabel: '航班号',
- needFilters: 1,
- },
- {
- columnName: 'flightDate',
- columnLabel: '执飞日期',
- width: 73,
- },
- {
- columnName: 'planDepartureTime',
- columnLabel: '起飞时间',
- width: 73,
- },
- {
- columnName: 'target',
- columnLabel: '目的站',
- needFilters: 1,
- },
- {
- columnName: 'takeOffStand',
- columnLabel: '停机位',
- },
- {
- columnName: 'lastflightNO',
- columnLabel: '前序航班',
- },
- {
- columnName: 'acLandingTime',
- columnLabel: '实际降落\n时间',
- width: 73,
- },
- ],
- },
- {
- groupName: '货站相关',
- children: [
- {
- columnName: 'speCargoInfo',
- columnLabel: '特货信息',
- },
- {
- columnName: 'transIn',
- columnLabel: '中转进\n(运单/件)',
- },
- {
- columnName: 'returns',
- columnLabel: '退运\n(板卡/件)',
- },
- ],
- },
- {
- groupName: '地服相关',
- children: [
- {
- columnName: 'preLoad',
- columnLabel: '运单申报\n(运单/件)',
- },
- {
- columnName: 'receiveSure',
- columnLabel: '收运核单\n(运单/件/重量)',
- },
- {
- columnName: 'receiveSureTime',
- columnLabel: '收运核单\n时间',
- },
- {
- columnName: 'receiveSure_No',
- columnLabel: '核单不通过\n(运单/件/重量)',
- },
- {
- columnName: 'receiveSureTime_No',
- columnLabel: '核单不通过\n时间',
- },
- {
- columnName: 'checks',
- columnLabel: '查验\n(拒运/查验)',
- },
- {
- columnName: 'checkTime',
- columnLabel: '查验时间',
- },
- {
- columnName: 'securityYes',
- columnLabel: '安检放行\n(运单/件)',
- },
- {
- columnName: 'securityTime',
- columnLabel: '安检放行\n时间',
- },
- {
- columnName: 'addCargo',
- columnLabel: '加货\n(运单/板卡/件/重量)',
- },
- {
- columnName: 'addCargoTime',
- columnLabel: '加货时间',
- },
- // {
- // columnName: 'wait',
- // columnLabel: '待运区\n(板卡/件)',
- // },
- // {
- // columnName: 'waitTime',
- // columnLabel: '待运区时间',
- // },
- {
- columnName: 'stowage',
- columnLabel: '预配载\n(板卡/件)',
- },
- {
- columnName: 'stowageTime',
- columnLabel: '预配载时间',
- },
- // {
- // columnName: 'planJoinTime',
- // columnLabel: '计划交接\n时间',
- // },
- // {
- // columnName: 'requestDepotJoin',
- // columnLabel: '发起货站交接\n(板卡/件)',
- // },
- // {
- // columnName: 'requestDepotJoinTime',
- // columnLabel: '发起货站交接\n时间',
- // },
- {
- columnName: 'depotJoin',
- columnLabel: '货站交接\n(板卡/件)',
- },
- {
- columnName: 'depotJoinTime',
- columnLabel: '货站交接\n时间',
- },
- {
- columnName: 'resure',
- columnLabel: '运输前复核\n(板卡/件)',
- },
- {
- columnName: 'resureTime',
- columnLabel: '运输前复核\n时间',
- },
- {
- columnName: 'planeDown',
- columnLabel: '机下交接\n(板卡/件)',
- columnDescribe: '根据运输前复核计算所得',
- },
- {
- columnName: 'planeDownTime',
- columnLabel: '机下交接\n时间',
- },
- // {
- // columnName: 'loadPlaneSure',
- // columnLabel: '装机\n(板卡/件)',
- // },
- {
- columnName: 'loadPlaneSureTime',
- columnLabel: '装机时间',
- },
- // {
- // columnName: 'loadPlane',
- // columnLabel: '关闭舱门\n(板卡/件)',
- // },
- {
- columnName: 'loadPlaneTime',
- columnLabel: '关闭舱门\n时间',
- },
- {
- columnName: 'register',
- columnLabel: '拉下登记\n(板卡/件)',
- },
- {
- columnName: 'pullRegisterTime',
- columnLabel: '拉下登记\n时间',
- },
- {
- columnName: 'pullSure',
- columnLabel: '拉回确认\n(板卡/件)',
- },
- {
- columnName: 'pullSureTime',
- columnLabel: '拉回确认\n时间',
- },
- ],
- },
- ],
- InternationalDepartureAirport: [
- {
- groupName: '航班相关',
- children: [
- {
- columnName: 'IATACode',
- columnLabel: '航司',
- needFilters: 1,
- },
- {
- columnName: 'flightNO',
- columnLabel: '航班号',
- needFilters: 1,
- },
- {
- columnName: 'flightDate',
- columnLabel: '执飞日期',
- width: 73,
- },
- {
- columnName: 'planDepartureTime',
- columnLabel: '起飞时间',
- width: 73,
- },
- {
- columnName: 'target',
- columnLabel: '目的站',
- needFilters: 1,
- },
- {
- columnName: 'takeOffStand',
- columnLabel: '停机位',
- },
- {
- columnName: 'lastflightNO',
- columnLabel: '前序航班',
- },
- {
- columnName: 'acLandingTime',
- columnLabel: '实际降落\n时间',
- width: 73,
- },
- ],
- },
- {
- groupName: '货站相关',
- children: [
- {
- columnName: 'speCargoInfo',
- columnLabel: '特货信息',
- },
- {
- columnName: 'preLoad',
- columnLabel: '预计装载数\n(运单/件)',
- },
- {
- columnName: 'transIn',
- columnLabel: '中转进\n(运单/件)',
- },
- {
- columnName: 'returns1',
- columnLabel: '退运\n(板卡/件)',
- },
- ],
- },
- {
- groupName: '地服相关',
- children: [
- {
- columnName: 'enterPark',
- columnLabel: '入园\n(运单/件)',
- },
- {
- columnName: 'enterParkTime',
- columnLabel: '入园时间',
- },
- {
- columnName: 'enterCustoms',
- columnLabel: '进入海关\n(运单/件)',
- },
- {
- columnName: 'enterCustomsTime',
- columnLabel: '进入海关时间',
- },
- {
- columnName: 'passCustoms',
- columnLabel: '海关放行\n(运单/件)',
- },
- {
- columnName: 'passCustomsTime',
- columnLabel: '海关放行\n时间',
- },
- {
- columnName: 'nopassCustoms',
- columnLabel: '海关不通过\n(运单/件)',
- },
- {
- columnName: 'nopassCustomsTime',
- columnLabel: '海关不通过\n时间',
- },
- {
- columnName: 'receiveSure1',
- columnLabel: '运抵货站\n(运单/件)',
- },
- {
- columnName: 'receiveSureTime',
- columnLabel: '运抵货站\n时间',
- },
- {
- columnName: 'returns2',
- columnLabel: '退运\n(板卡/件)',
- },
- {
- columnName: 'returnTime',
- columnLabel: '退运时间',
- },
- {
- columnName: 'securityYes',
- columnLabel: '安检放行\n(运单/件)',
- },
- {
- columnName: 'securityTime',
- columnLabel: '安检放行\n时间',
- },
- {
- columnName: 'receiveSure2',
- columnLabel: '收运核单\n(运单/件)',
- },
- {
- columnName: 'receiveSureResultTime',
- columnLabel: '收运核单\n时间',
- },
- {
- columnName: 'receiveSure_No',
- columnLabel: '核单不通过\n(运单/件)',
- },
- {
- columnName: 'receiveSureTime_No',
- columnLabel: '核单不通过\n时间',
- },
- {
- columnName: 'tally_out',
- columnLabel: '理货\n(板卡/运单/件)',
- },
- {
- columnName: 'tallyTime_out',
- columnLabel: '理货时间',
- },
- {
- columnName: 'planJoinTime',
- columnLabel: '计划交接\n时间',
- },
- {
- columnName: 'wait',
- columnLabel: '待运区\n(板卡/件)',
- },
- {
- columnName: 'waitTime',
- columnLabel: '待运区\n时间',
- },
- {
- columnName: 'stowage',
- columnLabel: '预配载\n(板卡/件)',
- },
- {
- columnName: 'stowageTime',
- columnLabel: '预配载时间',
- },
- {
- columnName: "concat(requestDepotJoinBoard,'/',requestDepotJoin)",
- columnLabel: '发起货站交接\n(板卡/件)',
- },
- {
- columnName: 'requestDepotJoinTime',
- columnLabel: '发起货站交接\n时间',
- },
- {
- columnName: 'depotJoin',
- columnLabel: '货站交接\n(板卡/件)',
- },
- {
- columnName: 'depotJoinTime',
- columnLabel: '货站交接\n时间',
- },
- {
- columnName: 'resure',
- columnLabel: '运输前复核\n(板卡/件)',
- },
- {
- columnName: 'resureTime',
- columnLabel: '运输前复核\n时间',
- },
- {
- columnName: 'planeDown',
- columnLabel: '机下交接\n(板卡/件)',
- },
- {
- columnName: 'planeDownTime',
- columnLabel: '机下交接\n时间',
- },
- {
- columnName: "concat(loadPlaneSureBoard,'/',loadPlaneSure)",
- columnLabel: '装机单确认\n(板卡/件)',
- },
- {
- columnName: 'loadPlaneSureTime',
- columnLabel: '装机单确认\n时间',
- },
- {
- columnName: 'loadPlane',
- columnLabel: '装机\n(板卡/件)',
- },
- {
- columnName: 'loadPlaneTime',
- columnLabel: '装机时间',
- },
- {
- columnName: 'register',
- columnLabel: '拉下登记\n(板卡/运单/件)',
- },
- {
- columnName: 'pullregisterTime',
- columnLabel: '拉下登记\n时间',
- },
- ],
- },
- ],
- ArrivalAirport: [
- {
- groupName: '航班相关',
- children: [
- {
- columnName: 'IATACode',
- columnLabel: '航司',
- needFilters: 1,
- },
- {
- columnName: 'flightNO',
- columnLabel: '航班号',
- needFilters: 1,
- },
- {
- columnName: 'flightDate',
- columnLabel: '执飞日期',
- },
- {
- columnName: 'planLandingTime',
- columnLabel: '降落时间',
- },
- {
- columnName: 'target',
- columnLabel: '目的站',
- needFilters: 1,
- },
- {
- columnName: 'landingStand',
- columnLabel: '停机位',
- },
- ],
- },
- {
- groupName: '货站相关',
- children: [
- {
- columnName: 'speCargoInfo',
- columnLabel: '特货信息',
- },
- {
- columnName: 'preUnLoad',
- columnLabel: '预计卸载数\n(运单/件)',
- },
- {
- columnName: 'transOut',
- columnLabel: '中转出\n(运单/件)',
- },
- {
- columnName: 'receiveDiff',
- columnLabel: '收货差异\n(板卡/件)',
- },
- ],
- },
- {
- groupName: '地服相关',
- children: [
- // {
- // columnName: 'unloadBill',
- // columnLabel: '卸机单\n(板/箱/卡)',
- // },
- // {
- // columnName: 'unloadBillTime',
- // columnLabel: '卸机单确认\n时间',
- // },
- {
- columnName: 'unLoad',
- columnLabel: '卸机\n(板/箱/卡)',
- },
- {
- columnName: 'unLoadTime',
- columnLabel: '卸机时间',
- },
- {
- columnName: 'planeDown',
- columnLabel: '机下交接\n(板/箱/卡)',
- columnDescribe: '根据运输前复核计算所得',
- },
- {
- columnName: 'planeDownTime_IN',
- columnLabel: '机下交接\n时间',
- },
- {
- columnName: 'depotJoin',
- columnLabel: '货站交接\n(板/箱/卡)',
- },
- {
- columnName: 'depotJoinTime_IN',
- columnLabel: '货站交接\n时间',
- },
- {
- columnName: 'tally',
- columnLabel: '理货\n(板卡/运单/件/重量)',
- },
- {
- columnName: 'tallyTime_in',
- columnLabel: '理货时间',
- },
- {
- columnName: 'outWarehouse',
- columnLabel: '出库\n(批/运单/件)',
- },
- {
- columnName: 'outWarehouseTime',
- columnLabel: '出库时间',
- },
- ],
- },
- ],
- InternationalArrivalAirport: [
- {
- groupName: '航班相关',
- children: [
- {
- columnName: 'IATACode',
- columnLabel: '航司',
- needFilters: 1,
- },
- {
- columnName: 'flightNO',
- columnLabel: '航班号',
- needFilters: 1,
- },
- {
- columnName: 'flightDate',
- columnLabel: '执飞日期',
- },
- {
- columnName: 'planLandingTime',
- columnLabel: '降落时间',
- },
- {
- columnName: 'target',
- columnLabel: '目的站',
- needFilters: 1,
- },
- {
- columnName: 'landingStand',
- columnLabel: '停机位',
- },
- ],
- },
- {
- groupName: '货站相关',
- children: [
- {
- columnName: 'speCargoInfo',
- columnLabel: '特货信息',
- },
- {
- columnName: 'preUnLoad',
- columnLabel: '预计卸载数\n(运单/件)',
- },
- {
- columnName: 'transOut',
- columnLabel: '中转出\n(运单/件)',
- },
- {
- columnName: 'receiveDiff',
- columnLabel: '收货差异\n(板卡/件)',
- },
- ],
- },
- {
- groupName: '地服相关',
- children: [
- // {
- // columnName: 'unloadBill',
- // columnLabel: '卸机单\n(板/箱/卡)',
- // },
- // {
- // columnName: 'unloadBillTime',
- // columnLabel: '卸机时间',
- // },
- {
- columnName: 'unLoad',
- columnLabel: '卸机\n(板/箱/卡)',
- },
- {
- columnName: 'unLoadTime',
- columnLabel: '卸机时间',
- },
- {
- columnName: 'planeDown',
- columnLabel: '机下交接\n(板/箱/卡)',
- },
- {
- columnName: 'planeDownTime_IN',
- columnLabel: '机下交接\n时间',
- },
- {
- columnName: 'depotJoin',
- columnLabel: '货站交接\n(板/箱/卡)',
- },
- {
- columnName: 'depotJoinTime_IN',
- columnLabel: '货站交接\n时间',
- },
- {
- columnName: 'tally',
- columnLabel: '理货\n(板卡/运单/件/重量)',
- },
- {
- columnName: 'tallyTime_in',
- columnLabel: '理货时间',
- },
- {
- columnName: "concat(passCustomsList_in,'/',passCustoms_in)",
- columnLabel: '海关放行\n(运单/件)',
- },
- {
- columnName: 'passCustomsTime_in',
- columnLabel: '海关放行\n时间',
- },
- {
- columnName: 'outWarehouse',
- columnLabel: '出库\n(批/运单/件)',
- },
- {
- columnName: 'outWarehouseTime',
- columnLabel: '出库时间',
- },
- {
- columnName: "concat(punishCustomsList_in,'/',punishCustoms_in)",
- columnLabel: '海关罚没\n(运单/件)',
- },
- {
- columnName: 'punishCustomsTime_in',
- columnLabel: '海关罚没\n时间',
- },
- ],
- },
- ],
- }
- const simulateTableDataMap = {
- DepartureAirport: Array.from({ length: 3 }, (_, i) => ({
- flightNO: 'ZH3423',
- flightDate: '2022/09/10',
- planDepartureTime: '22/09/10 12:01',
- landingAirport: '-NGK-PEK',
- takeOffStand: '84',
- inFlightNO: 'HU2451',
- planLandingTime: '2022/09/10 11:01',
- C1: '锂2/冷1',
- C2: '365/536',
- C3: '1/2',
- C4: '0/0',
- C5: '364/534/1254KG',
- C5_time: '12:02',
- C5_1: '364/534/1254KG',
- C5_1_time: '12:02',
- C6: '0/7',
- C6_time: '12:02',
- C7: '364/534',
- C7_time: '12:02',
- C8: '8/365/536/1254KG',
- C8_time: '12:02',
- C9: '8/536',
- C9_time: '12:02',
- C10: '8/536',
- C10_time: '12:02',
- C11: '11:45',
- C12_0: '8/536',
- C12_0_time: '12:02',
- C12: i === 1 ? '4/243' : '8/536',
- C12_time: '12:02',
- C13: i === 2 ? '5/357' : '8/536',
- C13_time: '12:02',
- C14: '8/536',
- C14_time: '12:02',
- C15_0: '8/536',
- C15_0_time: '12:02',
- C15: '8/536',
- C15_time: '12:02',
- C16: '358/5',
- C16_time: '12:02',
- C17: '0/5',
- C17_time: '12:02',
- })),
- InternationalDepartureAirport: Array.from({ length: 3 }, (_, i) => ({
- flightNO: 'ZH3423',
- flightDate: '2022/09/10',
- planDepartureTime: '22/09/10 12:01',
- landingAirport: '-NGK-PEK',
- takeOffStand: '84',
- inFlightNO: 'HU2451',
- planLandingTime: '2022/09/10 11:01',
- C1: '锂2/冷1',
- C2: '365/536',
- C3: '1/2',
- C4: '0/0',
- C5: '364/534',
- C5_time: '12:02',
- C6: '364/534',
- C6_time: '12:02',
- C7: '364/534',
- C7_time: '12:02',
- C8: '0/7',
- C8_time: '12:02',
- C9: '8/536',
- C9_time: '12:02',
- C10: '8/536',
- C10_time: '12:02',
- C11: '8/536',
- C11_time: '12:02',
- C12: '8/536',
- C12_time: '12:02',
- C13: '8/536',
- C13_time: '12:02',
- C14: '8/365/536',
- C14_time: '12:02',
- C15: '11:45',
- C16: '8/536',
- C16_time: '12:02',
- C17: '8/536',
- C17_time: '12:02',
- C18: '8/536',
- C18_time: '12:02',
- C19: '8/536',
- C19_time: '12:02',
- C20: '8/536',
- C20_time: '12:02',
- C21: '8/536',
- C21_time: '12:02',
- C22: '8/536',
- C22_time: '12:02',
- C23: '8/536',
- C23_time: '12:02',
- C24: '8/365/536',
- C24_time: '12:02',
- })),
- ArrivalAirport: Array.from({ length: 3 }, (_, i) => ({
- flightNO: 'ZH3423',
- flightDate: '2022/09/10',
- planLandingTime: '22/09/10 12:01',
- landingAirport: 'NKG-PEK-',
- landingStand: '84',
- C1: '锂2/冷1',
- C2: '363/543',
- C3: '0/0',
- C4: i === 0 ? '0/6' : '0/0',
- C5_0: '8/8/8',
- C5_0_time: '12:02',
- C5: '8/8/8',
- C5_time: '12:02',
- C6: '8/8/8',
- C6_time: '12:02',
- C7: '8/8/8',
- C7_time: '12:02',
- C8: '8/363/537/1254KG',
- C8_time: '12:02',
- C9: '3/363/537',
- C9_time: '12:02',
- })),
- InternationalArrivalAirport: Array.from({ length: 3 }, (_, i) => ({
- flightNO: 'ZH3423',
- flightDate: '2022/09/10',
- planLandingTime: '22/09/10 12:01',
- landingAirport: 'NKG-PEK-',
- landingStand: '84',
- C1: '锂2/冷1',
- C2: '363/543',
- C3: '0/0',
- C4: i === 0 ? '0/6' : '0/0',
- C5: '8/8/8',
- C6: '8/8/8',
- C6_time: '12:02',
- C7: '8/8/8',
- C7_time: '12:02',
- C8: '8/8/8',
- C8_time: '12:02',
- C9: '8/363/537/1254KG',
- C9_time: '12:02',
- C10: '8/536',
- C10_time: '12:02',
- C11: '1/8/536',
- C11_time: '12:02',
- C12: '8/536',
- C12_time: '12:02',
- })),
- }
- const headerClassMap = ['bg-yellow', 'bg-green', 'bg-cyan']
- const computedWidth = (column: SimpleColumn) => {
- let width = 0
- column.columnLabel.split('\n').forEach(line => {
- const len = line.length
- let realLength = 0
- for (let i = 0; i < len; i++) {
- realLength += line.charCodeAt(i) > 255 ? 2 : 1
- }
- if (width < realLength * 8) {
- width = realLength * 8
- }
- })
- if (column.needFilters || column.needSort) {
- width += 8
- }
- // border
- return width + 1
- }
- export function useAirportTable(name: string, formData: CommonData) {
- const tableColumns = ref<CommonTableColumn[]>([])
- const tableData = ref<CommonData[]>([])
- const getTableColumns = () => {
- const groups = columnGroupsMap[name]
- tableColumns.value = groups.reduce(
- (columns: CommonTableColumn[], group, groupIndex) => {
- group.children.forEach(column => {
- columns.push({
- key: column.columnName,
- dataKey: column.columnName,
- title: column.columnLabel,
- columnDescribe: '',
- dataType: '',
- listqueryTemplateID: null,
- needCount: null,
- needFilters: null,
- needGroup: null,
- needSearch: null,
- needShow: 1,
- needSort: null,
- orderNumber: null,
- queryTemplateColumnSetID: null,
- queryTemplateID: null,
- width: computedWidth(column),
- flexGrow: 1,
- align: 'center',
- headerClass: headerClassMap[groupIndex],
- groupName: group.groupName,
- ...column,
- })
- })
- return columns
- },
- []
- )
- }
- const getTableData = async () => {
- try {
- const {
- startDate,
- endDate,
- flightStatus,
- flightWarning,
- waybillType,
- } = formData
- const dataContent = [
- startDate + ':00',
- endDate + ':59',
- // flightStatus,
- // flightWarning
- ]
- // if (name.includes('International')) {
- // dataContent.push(waybillType)
- // }
- const {
- code,
- returnData: { columnSet, listValues },
- message,
- } = await Query<CommonData>({
- id: DATACONTENT_ID[name.slice(0, 1).toLowerCase() + name.slice(1)],
- dataContent,
- })
- if (Number(code) !== 0) {
- throw new Error(message || '失败')
- }
- // tableColumns.value = columnSet.map(column => ({
- // key: column.columnName,
- // dataKey: column.columnName,
- // title: column.columnLabel,
- // width: column.columnLabel.length * 50,
- // flexGrow: 1,
- // align: 'center',
- // ...column,
- // }))
- tableData.value = listValues
- } catch (error) {
- console.error(error)
- }
- }
- const getSimulateTableData = () => {
- tableData.value = simulateTableDataMap[name]
- }
- let queryLoop: number | null = null
- const startQuery = async () => {
- await getTableData()
- queryLoop = window.setTimeout(
- startQuery,
- LOOP_INTERVAL[name.slice(0, 1).toLowerCase() + name.slice(1)]
- )
- }
- const stopQuery = () => {
- if (queryLoop) {
- clearTimeout(queryLoop)
- queryLoop = null
- }
- }
- watch(formData, data => {
- stopQuery()
- if (data.startDate && data.endDate) {
- startQuery()
- }
- })
- onUnmounted(stopQuery)
- onMounted(() => {
- getTableColumns()
- // getSimulateTableData()
- })
- return {
- tableColumns,
- tableData,
- }
- }
|