12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- // import { ElMessage } from 'element-plus'
- import type { CellRenderProps } from '../type'
- export function useTableCellClick(tableName?: string) {
- const router = useRouter()
- const route = useRoute()
- const containerNO = ref('')
- const dialogFlag = ref(false)
- const cellClickHandler = (row, column, cell, event) => {
- if (tableName?.includes('FlightWaybill')) {
- switch (column.property) {
- case 'stockCode':
- router.push({
- path: `${route.path.split('/').slice(0, -1).join('/')}/waybill`,
- query: {
- waybillNO: row.stockCode,
- },
- })
- break
- // case 'stowageNum':
- // ElMessage.info('开发中')
- // break
- default:
- break
- }
- }
- if (tableName?.includes('FlightContainer')) {
- switch (column.property) {
- case 'stowageNo':
- containerNO.value = row.stowageNo
- dialogFlag.value = true
- break
- default:
- break
- }
- }
- // if (tableName?.includes('WaybillGoods')) {
- // switch (column.property) {
- // case 'CargoSN':
- // router.push({
- // path: `${route.path.split('/').slice(0, -1).join('/')}/goods`,
- // query: {
- // waybillNO: route.query.waybillNO,
- // goodsNO: row.CargoSN,
- // },
- // })
- // break
- // default:
- // break
- // }
- // }
- }
- const cellClickHandlerV2 = ({ column, rowData }: CellRenderProps) => {
- if (tableName?.includes('Airport')) {
- switch (column.columnName) {
- case 'flightNO':
- router.push({
- path: `${route.path.split('/').slice(0, -1).join('/')}/flight`,
- query: {
- flightDate: rowData.flightDate,
- flightNO: String(rowData.IATACode) + String(rowData.flightNO),
- },
- })
- break
- default:
- break
- }
- }
- }
- return {
- cellClickHandler,
- cellClickHandlerV2,
- dialogFlag,
- containerNO,
- }
- }
|