|
@@ -1,10 +1,16 @@
|
|
import { Query } from '@/api/webApi'
|
|
import { Query } from '@/api/webApi'
|
|
import { CommonData, CommonTableColumn } from '~/common'
|
|
import { CommonData, CommonTableColumn } from '~/common'
|
|
|
|
|
|
|
|
+interface SimpleColumn {
|
|
|
|
+ columnName: string
|
|
|
|
+ columnLabel: string
|
|
|
|
+ [x: string]: any
|
|
|
|
+}
|
|
|
|
+
|
|
const columnGroupsMap: {
|
|
const columnGroupsMap: {
|
|
[x: string]: {
|
|
[x: string]: {
|
|
groupName: string
|
|
groupName: string
|
|
- children: { columnName: string; columnLabel: string; [x: string]: any }[]
|
|
|
|
|
|
+ children: SimpleColumn[]
|
|
}[]
|
|
}[]
|
|
} = {
|
|
} = {
|
|
departure: [
|
|
departure: [
|
|
@@ -19,10 +25,12 @@ const columnGroupsMap: {
|
|
{
|
|
{
|
|
columnName: 'flightDate',
|
|
columnName: 'flightDate',
|
|
columnLabel: '执飞日期',
|
|
columnLabel: '执飞日期',
|
|
|
|
+ width: 73,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
columnName: 'planDepartureTime',
|
|
columnName: 'planDepartureTime',
|
|
columnLabel: '起飞时间',
|
|
columnLabel: '起飞时间',
|
|
|
|
+ width: 73,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
columnName: 'landingAirport',
|
|
columnName: 'landingAirport',
|
|
@@ -40,6 +48,7 @@ const columnGroupsMap: {
|
|
{
|
|
{
|
|
columnName: 'planLandingTime',
|
|
columnName: 'planLandingTime',
|
|
columnLabel: '实际降落\n时间',
|
|
columnLabel: '实际降落\n时间',
|
|
|
|
+ width: 73,
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
@@ -326,22 +335,23 @@ const simulateTableDataMap = {
|
|
}
|
|
}
|
|
const headerClassMap = ['bg-yellow', 'bg-green', 'bg-cyan']
|
|
const headerClassMap = ['bg-yellow', 'bg-green', 'bg-cyan']
|
|
|
|
|
|
-const computedWidth = (text: string) => {
|
|
|
|
|
|
+const computedWidth = (column: SimpleColumn) => {
|
|
let width = 0
|
|
let width = 0
|
|
- text.split('\n').forEach(line => {
|
|
|
|
|
|
+ column.columnLabel.split('\n').forEach(line => {
|
|
const len = line.length
|
|
const len = line.length
|
|
let realLength = 0
|
|
let realLength = 0
|
|
for (let i = 0; i < len; i++) {
|
|
for (let i = 0; i < len; i++) {
|
|
realLength += line.charCodeAt(i) > 255 ? 2 : 1
|
|
realLength += line.charCodeAt(i) > 255 ? 2 : 1
|
|
}
|
|
}
|
|
- if (width < realLength * 8) {
|
|
|
|
- width = realLength * 8
|
|
|
|
|
|
+ if (width < (realLength + 2) * 6) {
|
|
|
|
+ width = (realLength + 2) * 6
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- if (['航班号', '目的站'].includes(text)) {
|
|
|
|
- width += 8
|
|
|
|
|
|
+ if (column.needFilters || column.needSort) {
|
|
|
|
+ width += 6
|
|
}
|
|
}
|
|
- return width
|
|
|
|
|
|
+ // border
|
|
|
|
+ return width + 1
|
|
}
|
|
}
|
|
|
|
|
|
export default function useAirportTable(name: string, formData: CommonData) {
|
|
export default function useAirportTable(name: string, formData: CommonData) {
|
|
@@ -369,7 +379,7 @@ export default function useAirportTable(name: string, formData: CommonData) {
|
|
orderNumber: null,
|
|
orderNumber: null,
|
|
queryTemplateColumnSetID: null,
|
|
queryTemplateColumnSetID: null,
|
|
queryTemplateID: null,
|
|
queryTemplateID: null,
|
|
- width: computedWidth(column.columnLabel),
|
|
|
|
|
|
+ width: computedWidth(column),
|
|
flexGrow: 1,
|
|
flexGrow: 1,
|
|
align: 'center',
|
|
align: 'center',
|
|
headerClass: headerClassMap[groupIndex],
|
|
headerClass: headerClassMap[groupIndex],
|