import { Query } from '@/api/webApi' import { ellipsisCell } from '@/components/SimpleTable/customRender' import { CommonValue, CommonData, CommonTableColumn } from '~/common' const idGetter = (name: string) => { // if (name.endsWith('WaybillGoods')) { // return DATACONTENT_ID.waybillGoods // } else { // return DATACONTENT_ID[name.slice(0, 1).toLowerCase() + name.slice(1)] // } return DATACONTENT_ID[name.slice(0, 1).toLowerCase() + name.slice(1)] } const tableColumnsMap: { [tableName: string]: ({ columnLabel: string columnName: string } & { [x: string]: any })[] } = { DepartureFlightContainer: [ { columnLabel: '集装器编号', columnName: 'stowageNo', width: 120, needCount: 1, countMode: 'all', }, { columnLabel: '配载运单', columnName: 'list', width: 60 }, { columnLabel: '件数', columnName: 'number', width: 60, needCount: 1 }, { columnLabel: '重量', columnName: 'weight', width: 60, needCount: 1 }, { columnLabel: '拉下', columnName: 'pull', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '加货', columnName: 'tally', className: 'cell-filter cell-filter-yellow', }, // { // columnLabel: '待运区', // columnName: 'wait', // className: 'cell-filter cell-filter-yellow', // }, { columnLabel: '预配载', columnName: 'stowage', className: 'cell-filter cell-filter-yellow', }, // { // columnLabel: '货站交接', // columnName: 'depot', // className: 'cell-filter cell-filter-yellow', // }, { columnLabel: '交接复核', columnName: 'resure', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '机下交接', columnName: 'planeDown', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '装机', columnName: 'loadPlane', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '拉回确认', columnName: 'pullSure', className: 'cell-filter cell-filter-yellow', }, ], DepartureFlightWaybill: [ { columnLabel: '运单号', columnName: 'stockCode', width: 120 }, { columnLabel: '集装器数量', columnName: 'stowageNum' }, { columnLabel: '品名', columnName: 'typeCode', width: 300, showOverflowTooltip: true, }, { columnLabel: '特货信息', columnName: 'speCargoInfo', customRender: ellipsisCell, }, { columnLabel: '运单件数', columnName: 'luggageCount', needCount: 1 }, { columnLabel: '货物重量', columnName: 'weight', needCount: 1 }, { columnLabel: '拉下件数', columnName: 'pullNum', needCount: 1 }, { columnLabel: '退运件数', columnName: 'returnNum', needCount: 1 }, { columnLabel: '最新节点', columnName: 'nodeCode' }, // { columnLabel: '最新位置', columnName: 'execPosition' }, { columnLabel: '处理结果', columnName: 'execResult' }, { columnLabel: '处理时间', columnName: 'execTime', width: 130 }, // { columnLabel: '中转进航班号', columnName: 'inFlightNO' }, // { // columnLabel: '中转航班降落时间', // columnName: 'inFlightNOLandTime', // width: 130, // }, // { columnLabel: '装载序号', columnName: 'queueNo' }, ], DepartureWaybillGoods: [ { columnLabel: '航班号', columnName: 'flightNO', needFilters: 1, width: 70, }, { columnLabel: '集装器编号', columnName: 'ULDNO', width: 100, needFilters: 1, }, { columnLabel: '货物编码', columnName: 'cargoSN', needFilters: 1 }, { columnLabel: '拉下', columnName: 'pullMark', needFilters: 1, width: 60 }, { columnLabel: '退运', columnName: 'returnMark', needFilters: 1, width: 60, }, { columnLabel: '收货核单', columnName: 'DEH', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '收运核查', columnName: 'ACC_CHECK', className: 'cell-filter cell-filter-green node-departure', }, // { // columnLabel: '拒运', // columnName: 'ACC_CHECK_2', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '安检', columnName: '安检', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '加货', columnName: 'ACC_BUP', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '预配载', columnName: 'LS_CARGO', className: 'cell-filter cell-filter-green node-departure', }, // { // columnLabel: '待运区', // columnName: 'WAT_LOC', // className: 'cell-filter cell-filter-green node-departure', // }, // { // columnLabel: '货站交接', // columnName: 'CARGOS_HANDOVER_STATUS_02', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '交接复核', columnName: 'CARGOS_HANDOVER_STATUS_03', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '机下交接', columnName: '出港货邮', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '装机', columnName: '装载完成', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '关闭舱门', columnName: '关闭舱门', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '拉下登记', columnName: 'CARGOS_OFFLOAD', className: 'cell-filter cell-filter-green node-departure', checkDisabled: true, }, { columnLabel: '拉回确认', columnName: 'OFFLOAD_CONFIRM', className: 'cell-filter cell-filter-green node-departure', checkDisabled: true, }, // { // columnLabel: '起飞', // columnName: 'C15', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '退运', columnName: 'BILL_RETURN', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '卸机', columnName: 'CARGOS_ARR_HANDOVER', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '库区到达', columnName: 'CARGOS_HANDOVER_STATUS_01', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '货站交接', columnName: '货站交接', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '理货', columnName: 'IMP_TALLY', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '出库', columnName: 'FSUDLV', className: 'cell-filter cell-filter-cyan node-arrival', }, ], DepartureGoodsFlight: [ { columnLabel: '航班号', columnName: 'C0' }, { columnLabel: '航班日期', columnName: 'C1' }, { columnLabel: '起飞航站\n预计起飞时间', columnName: 'C2' }, { columnLabel: '目的航站\n预计降落时间', columnName: 'C3' }, { columnLabel: '节点名称', columnName: 'C4' }, { columnLabel: '位置码', columnName: 'C5' }, { columnLabel: '位置描述', columnName: 'C6' }, { columnLabel: '处理时间', columnName: 'C7' }, { columnLabel: '处理结果', columnName: 'C8' }, { columnLabel: '数据来源', columnName: 'C9' }, { columnLabel: '设备ID', columnName: 'C10' }, { columnLabel: '操作人', columnName: 'C11' }, { columnLabel: '发往位置', columnName: 'C12' }, { columnLabel: '发往位置描述', columnName: 'C13' }, { columnLabel: '集装器编号', columnName: 'C14' }, ], ArrivalFlightWaybill: [ { columnLabel: '运单号', columnName: 'stockCode', width: 120 }, { columnLabel: '品名', columnName: 'typeCode', width: 300, showOverflowTooltip: true, }, { columnLabel: '特货信息', columnName: 'speCargoInfo', needCount: 1, customRender: ellipsisCell, }, { columnLabel: '运单件数', columnName: 'messageCargos_in', needCount: 1, }, { columnLabel: '理货件数', columnName: 'acCargos_in', needCount: 1, }, { columnLabel: '货物重量', columnName: 'weight', needCount: 1, }, { columnLabel: '最新节点', columnName: 'nodeCode' }, // { columnLabel: '最新位置', columnName: 'execPosition' }, { columnLabel: '处理结果', columnName: 'execResult' }, { columnLabel: '处理时间', columnName: 'execTime', width: 130 }, // { columnLabel: '中转出航班号', columnName: 'transferFlightNO' }, // { // columnLabel: '中转航班起飞时间', // columnName: 'transferFlightDepTime', // width: 130, // }, // { columnLabel: '装载序号', columnName: 'queueNo' }, ], ArrivalWaybillGoods: [ { columnLabel: '航班号', columnName: 'flightNO', needFilters: 1, width: 70, }, { columnLabel: '货物编码', columnName: 'cargoSN', needFilters: 1, width: 100, }, // { columnLabel: '中转', columnName: 'transMark', needFilters: 1 }, { columnLabel: '拉下', columnName: 'pullMark', needFilters: 1, width: 60 }, { columnLabel: '退运', columnName: 'returnMark', needFilters: 1, width: 60, }, { columnLabel: '卸机', columnName: 'CARGOS_ARR_HANDOVER', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '库区到达', columnName: 'CARGOS_HANDOVER_STATUS_01', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '货站交接', columnName: 'CARGOS_HANDOVER_STATUS_99', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '理货', columnName: 'IMP_TALLY', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '出库', columnName: 'FSUDLV', className: 'cell-filter cell-filter-cyan node-arrival', }, { columnLabel: '收货核单', columnName: 'DEH', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '查验', columnName: 'ACC_CHECK', className: 'cell-filter cell-filter-green node-departure', }, // { // columnLabel: '拒运', // columnName: 'ACC_CHECK_2', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '安检', columnName: '安检', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '加货', columnName: 'ACC_BUP', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '预配载', columnName: 'LS_CARGO', className: 'cell-filter cell-filter-green node-departure', }, // { // columnLabel: '待运区', // columnName: 'WAT_LOC', // className: 'cell-filter cell-filter-green node-departure', // }, // { // columnLabel: '货站交接', // columnName: 'CARGOS_HANDOVER_STATUS_02', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '交接复核', columnName: 'CARGOS_HANDOVER_STATUS_03', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '机下交接', columnName: '出港货邮', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '装机', columnName: '装载完成', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '关闭舱门', columnName: '关闭舱门', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '拉下登记', columnName: 'CARGOS_OFFLOAD', className: 'cell-filter cell-filter-green node-departure', checkDisabled: true, }, { columnLabel: '拉回确认', columnName: 'OFFLOAD_CONFIRM', className: 'cell-filter cell-filter-green node-departure', checkDisabled: true, }, // { // columnLabel: '起飞', // columnName: 'C15', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '退运', columnName: 'BILL_RETURN', className: 'cell-filter cell-filter-green node-departure', }, ], ArrivalGoodsFlight: [ { columnLabel: '航班号', columnName: 'C0' }, { columnLabel: '航班日期', columnName: 'C1' }, { columnLabel: '起飞航站\n预计起飞时间', columnName: 'C2' }, { columnLabel: '目的航站\n预计降落时间', columnName: 'C3' }, { columnLabel: '节点名称', columnName: 'C4' }, { columnLabel: '位置码', columnName: 'C5' }, { columnLabel: '位置描述', columnName: 'C6' }, { columnLabel: '处理时间', columnName: 'C7' }, { columnLabel: '处理结果', columnName: 'C8' }, { columnLabel: '数据来源', columnName: 'C9' }, { columnLabel: '设备ID', columnName: 'C10' }, { columnLabel: '操作人', columnName: 'C11' }, { columnLabel: '发往位置', columnName: 'C12' }, { columnLabel: '发往位置描述', columnName: 'C13' }, ], InternationalDepartureFlightContainer: [ { columnLabel: '集装器编号', columnName: 'stowageNo', width: 120, needCount: 1, countMode: 'all', }, { columnLabel: '配载运单', columnName: 'list', width: 60 }, { columnLabel: '件数', columnName: 'number', width: 60, needCount: 1 }, { columnLabel: '重量', columnName: 'weight', width: 60, needCount: 1 }, { columnLabel: '拉下', columnName: 'pull', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '理货', columnName: 'tally', className: 'cell-filter cell-filter-yellow', }, // { // columnLabel: '待运区', // columnName: 'wait', // className: 'cell-filter cell-filter-yellow', // }, // { // columnLabel: '货站交接', // columnName: 'depot', // className: 'cell-filter cell-filter-yellow', // }, { columnLabel: '交接复核', columnName: 'resure', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '机下交接', columnName: 'planeDown', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '装机', columnName: 'loadPlane', className: 'cell-filter cell-filter-yellow', }, { columnLabel: '实配', columnName: 'stowage', className: 'cell-filter cell-filter-yellow', }, // { // columnLabel: '拉回确认', // columnName: 'pullSure', // className: 'cell-filter cell-filter-yellow', // }, ], InternationalDepartureFlightWaybill: [ { columnLabel: '运单号', columnName: 'stockCode', width: 120 }, { columnLabel: '分类', columnName: 'type' }, { columnLabel: '集装器数量', columnName: 'stowageNum' }, { columnLabel: '品名', columnName: 'typeCode', width: 300, showOverflowTooltip: true, }, { columnLabel: '特货信息', columnName: 'speCargoInfo', customRender: ellipsisCell, }, { columnLabel: '运单件数', columnName: 'luggageCount', needCount: 1 }, { columnLabel: '货物重量', columnName: 'weight', needCount: 1 }, { columnLabel: '拉下件数', columnName: 'pullNum', needCount: 1 }, { columnLabel: '退运件数', columnName: 'returnNum', needCount: 1 }, { columnLabel: '最新节点', columnName: 'nodeCode' }, // { columnLabel: '最新位置', columnName: 'execPosition' }, { columnLabel: '处理结果', columnName: 'execResult' }, { columnLabel: '处理时间', columnName: 'execTime', width: 130 }, // { columnLabel: '中转进航班号', columnName: 'inFlightNO' }, // { // columnLabel: '中转航班降落时间', // columnName: 'inFlightNOLandTime', // width: 130, // }, // { columnLabel: '装载序号', columnName: 'queueNo' }, ], InternationalDepartureWaybillGoods: [ { columnLabel: '航班号', columnName: 'flightNO', needFilters: 1, width: 70, }, { columnLabel: '集装器编号', columnName: 'ULDNO', width: 100, needFilters: 1, }, { columnLabel: '货物编码', columnName: 'cargoSN', needFilters: 1 }, { columnLabel: '拉下', columnName: 'pullMark', needFilters: 1, width: 60 }, { columnLabel: '退运', columnName: 'returnMark', needFilters: 1, width: 60, }, { columnLabel: '入园', columnName: 'EPORTREL', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '海关', columnName: 'MTREL_out', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '运抵', columnName: 'FOH', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '安检', columnName: 'REH', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '收运核单', columnName: 'RCS', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '理货', columnName: 'ACC_BUP', className: 'cell-filter cell-filter-green node-departure', }, // { // columnLabel: '待运区', // columnName: 'WAT_LOC', // className: 'cell-filter cell-filter-green node-departure', // }, // { // columnLabel: '货站交接', // columnName: 'CARGOS_HANDOVER_STATUS_02', // className: 'cell-filter cell-filter-green node-departure', // }, { columnLabel: '交接复核', columnName: 'CARGOS_HANDOVER_STATUS_03', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '机下交接', columnName: '出港货邮', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '装机', columnName: '装载完成', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '拉下', columnName: 'CARGOS_OFFLOAD', className: 'cell-filter cell-filter-green node-departure', checkDisabled: true, }, { columnLabel: '实配', columnName: 'LS_CARGO', className: 'cell-filter cell-filter-green node-departure', }, ], InternationalDepartureGoodsFlight: [ { columnLabel: '航班号', columnName: 'C0' }, { columnLabel: '航班日期', columnName: 'C1' }, { columnLabel: '起飞航站\n预计起飞时间', columnName: 'C2' }, { columnLabel: '目的航站\n预计降落时间', columnName: 'C3' }, { columnLabel: '节点名称', columnName: 'C4' }, { columnLabel: '位置码', columnName: 'C5' }, { columnLabel: '位置描述', columnName: 'C6' }, { columnLabel: '处理时间', columnName: 'C7' }, { columnLabel: '处理结果', columnName: 'C8' }, { columnLabel: '数据来源', columnName: 'C9' }, { columnLabel: '设备ID', columnName: 'C10' }, { columnLabel: '操作人', columnName: 'C11' }, { columnLabel: '发往位置', columnName: 'C12' }, { columnLabel: '发往位置描述', columnName: 'C13' }, { columnLabel: '集装器编号', columnName: 'C14' }, ], InternationalArrivalFlightWaybill: [ { columnLabel: '运单号', columnName: 'stockCode', width: 120 }, { columnLabel: '品名', columnName: 'typeCode', width: 160, showOverflowTooltip: true, }, { columnLabel: '特货信息', columnName: 'speCargoInfo', needCount: 1, customRender: ellipsisCell, }, { columnLabel: '运单件数', columnName: 'messageCargos_in', needCount: 1, }, { columnLabel: '理货件数', columnName: 'acCargos_in', needCount: 1, }, { columnLabel: '货物重量', columnName: 'weight', needCount: 1, }, { columnLabel: '最新节点', columnName: 'nodeCode' }, // { columnLabel: '最新位置', columnName: 'execPosition' }, { columnLabel: '处理结果', columnName: 'execResult' }, { columnLabel: '处理时间', columnName: 'execTime', width: 130 }, { columnLabel: '中转出航班号', columnName: 'transferFlightNO' }, { columnLabel: '中转航班起飞时间', columnName: 'transferFlightDepTime', width: 130, }, { columnLabel: '装载序号', columnName: 'queueNo' }, ], InternationalArrivalWaybillGoods: [ { columnLabel: '航班号', columnName: 'flightNO', needFilters: 1, width: 70, }, { columnLabel: '货物编码', columnName: 'cargoSN', needFilters: 1, width: 100, }, // { columnLabel: '中转', columnName: 'C2', needFilters: 1 }, { columnLabel: '退运', columnName: 'returnMark', needFilters: 1, width: 60, }, { columnLabel: '海关异常', columnName: 'exceptionCustomsMark', needFilters: 1, width: 60, }, { columnLabel: '卸机', columnName: 'FFM', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '机下交接', columnName: 'CARGOS_HANDOVER_STATUS_01', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '货站交接', columnName: 'CARGOS_HANDOVER_STATUS_99', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '理货', columnName: 'RCF报', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '海关放行', columnName: 'MTREL_in', className: 'cell-filter cell-filter-green node-departure', }, { columnLabel: '出库', columnName: 'DLV报', className: 'cell-filter cell-filter-green node-departure', }, // { // columnLabel: '海关罚没', // columnName: 'C11', // className: 'cell-filter cell-filter-green node-departure', // }, ], InternationalArrivalGoodsFlight: [ { columnLabel: '航班号', columnName: 'C0' }, { columnLabel: '航班日期', columnName: 'C1' }, { columnLabel: '起飞航站\n预计起飞时间', columnName: 'C2' }, { columnLabel: '目的航站\n预计降落时间', columnName: 'C3' }, { columnLabel: '节点名称', columnName: 'C4' }, { columnLabel: '位置码', columnName: 'C5' }, { columnLabel: '位置描述', columnName: 'C6' }, { columnLabel: '处理时间', columnName: 'C7' }, { columnLabel: '处理结果', columnName: 'C8' }, { columnLabel: '数据来源', columnName: 'C9' }, { columnLabel: '设备ID', columnName: 'C10' }, { columnLabel: '操作人', columnName: 'C11' }, { columnLabel: '发往位置', columnName: 'C12' }, { columnLabel: '发往位置描述', columnName: 'C13' }, ], } export function useTable(tableName: string, dataContent?: CommonValue[]) { const tableColumns = ref([]) const tableData = ref([]) const getTableColumns = () => { tableColumns.value = tableColumnsMap[tableName].map(column => ({ columnDescribe: '', dataType: '', listqueryTemplateID: null, needCount: null, needFilters: null, needGroup: null, needSearch: null, needShow: 1, needSort: null, orderNumber: null, queryTemplateColumnSetID: null, queryTemplateID: null, ...column, })) } const getTableData = async () => { if (!idGetter(tableName)) { return } try { const { code, returnData: { listValues }, message, } = await Query({ id: idGetter(tableName), dataContent, }) if (Number(code) !== 0) { throw new Error(message || '失败') } tableData.value = listValues.filter( row => !Object.values(row).some( cellValue => typeof cellValue === 'string' && cellValue.includes('undefined') ) ) } catch (error) { console.error(error) } } onMounted(() => { if (tableColumnsMap[tableName]) { getTableColumns() // getTableData() } }) return { tableColumns, tableData, getTableData, } }