|
@@ -4,19 +4,17 @@
|
|
|
<AirportForm :name="name" @form-data-change="formDataChangeHandler" />
|
|
|
<div class="airport-count">
|
|
|
<CountBox
|
|
|
- :count-number="tableDataCount.flightCount"
|
|
|
+ :count-number="airportCount.flightNum"
|
|
|
:length="4"
|
|
|
label="今日计划航班数"
|
|
|
/>
|
|
|
<CountBox
|
|
|
- :count-number="
|
|
|
- isDeparture ? finishedCount : tableDataCount.tallyCount
|
|
|
- "
|
|
|
+ :count-number="airportCount.finishFlightNum"
|
|
|
:length="4"
|
|
|
label="已完成航班数"
|
|
|
/>
|
|
|
<CountBox
|
|
|
- :count-number="weightCount"
|
|
|
+ :count-number="airportCount.weight"
|
|
|
label="已转载重量KG"
|
|
|
:length="8"
|
|
|
/>
|
|
@@ -57,20 +55,6 @@
|
|
|
@cell-click="cellClickHandler"
|
|
|
/>
|
|
|
</div>
|
|
|
- <!-- <div class="table-footer">
|
|
|
- <span class="table-footer-count"
|
|
|
- >货运航班总数:{{ tableDataCount.freightFlightCount }}</span
|
|
|
- >
|
|
|
- <span class="table-footer-count"
|
|
|
- >货站交接总数:{{ tableDataCount.depotFlightCount }}</span
|
|
|
- >
|
|
|
- <span v-if="isDeparture" class="table-footer-count"
|
|
|
- >已装机总数:{{ tableDataCount.loadCount }}</span
|
|
|
- >
|
|
|
- <span v-else class="table-footer-count"
|
|
|
- >已卸机总数:{{ tableDataCount.unloadCount }}</span
|
|
|
- >
|
|
|
- </div> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="tsx" setup>
|
|
@@ -105,18 +89,18 @@ const formDataChangeHandler = (data: CommonData) => {
|
|
|
Object.assign(formData, data)
|
|
|
}
|
|
|
|
|
|
-const { tableColumns, tableData, getTableData } = useAirportTable(
|
|
|
- props.name,
|
|
|
- formData
|
|
|
-)
|
|
|
-
|
|
|
-const finishedCount = ref(0)
|
|
|
-
|
|
|
-const weightCount = ref(0)
|
|
|
-const getWeightCount = async () => {
|
|
|
+const airportCount = reactive({
|
|
|
+ flightNum: 0,
|
|
|
+ finishFlightNum: 0,
|
|
|
+ weight: 0,
|
|
|
+})
|
|
|
+const getAirportCount = async () => {
|
|
|
try {
|
|
|
const { startDate, endDate } = formData
|
|
|
- const dataContent = [startDate, endDate]
|
|
|
+ if (typeof startDate !== 'string' || typeof endDate !== 'string') {
|
|
|
+ throw new Error('Type Error: date must be string')
|
|
|
+ }
|
|
|
+ const dataContent = [startDate.slice(0, 10), endDate.slice(0, 10)]
|
|
|
const {
|
|
|
code,
|
|
|
returnData: { listValues },
|
|
@@ -126,7 +110,7 @@ const getWeightCount = async () => {
|
|
|
DATACONTENT_ID[
|
|
|
`${
|
|
|
props.name.slice(0, 1).toLowerCase() + props.name.slice(1)
|
|
|
- }WeightCount`
|
|
|
+ }AirportCount`
|
|
|
],
|
|
|
dataContent,
|
|
|
})
|
|
@@ -134,21 +118,31 @@ const getWeightCount = async () => {
|
|
|
throw new Error(message || '失败')
|
|
|
}
|
|
|
if (!listValues.length) {
|
|
|
- ElMessage.info('未查询到重量信息')
|
|
|
- weightCount.value = 0
|
|
|
+ ElMessage.info('未查询到统计信息')
|
|
|
+ airportCount.flightNum = airportCount.finishFlightNum = airportCount.weight = 0
|
|
|
return
|
|
|
}
|
|
|
- weightCount.value = listValues[0].weight
|
|
|
+ const { flightNum, finishFlightNum, weight } = listValues[0]
|
|
|
+ airportCount.flightNum = flightNum ?? 0
|
|
|
+ airportCount.finishFlightNum = finishFlightNum ?? 0
|
|
|
+ airportCount.weight = weight ?? 0
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const { tableColumns, tableData, getTableData } = useAirportTable(
|
|
|
+ props.name,
|
|
|
+ formData
|
|
|
+)
|
|
|
+
|
|
|
+const finishedCount = ref(0)
|
|
|
+
|
|
|
const { getWarningRules } = useFlightState(props.name, tableData, finishedCount)
|
|
|
|
|
|
useLoop(
|
|
|
[
|
|
|
- getWeightCount,
|
|
|
+ getAirportCount,
|
|
|
getTableData,
|
|
|
// getWarningRules,
|
|
|
],
|
|
@@ -247,50 +241,6 @@ const rowClassName = params => {
|
|
|
return `${rowClass(params)} ${classes.join(' ')}`
|
|
|
}
|
|
|
|
|
|
-const tableDataCount = computed(() =>
|
|
|
- tableData.value.reduce(
|
|
|
- (counts: { [x: string]: number }, current) => {
|
|
|
- // const preCount = current[isDeparture ? 'preLoad' : 'preUnload']
|
|
|
- // if (preCount) {
|
|
|
- // counts.waybillCount += Number(String(preCount).split('/')[0])
|
|
|
- // counts.goodsCount += Number(String(preCount).split('/')[1])
|
|
|
- // }
|
|
|
- if (typeof current['allNumber'] === 'number') {
|
|
|
- counts.flightCount = current['allNumber']
|
|
|
- }
|
|
|
- if (current['depotJoinTime'] || current['depotJoinTime_IN']) {
|
|
|
- counts.depotFlightCount++
|
|
|
- }
|
|
|
- const isFreight = tableColumns.value.some(
|
|
|
- column => column.groupName === '地服相关' && current[column.columnName]
|
|
|
- )
|
|
|
- if (isFreight) {
|
|
|
- counts.freightFlightCount++
|
|
|
- }
|
|
|
- if (current['loadPlaneSureTime']) {
|
|
|
- counts.loadCount++
|
|
|
- }
|
|
|
- if (current['unLoadTime']) {
|
|
|
- counts.unloadCount++
|
|
|
- }
|
|
|
- if (current['tallyTime_in']) {
|
|
|
- counts.tallyCount++
|
|
|
- }
|
|
|
- return counts
|
|
|
- },
|
|
|
- {
|
|
|
- // waybillCount: 0,
|
|
|
- // goodsCount: 0,
|
|
|
- flightCount: 0,
|
|
|
- depotFlightCount: 0,
|
|
|
- freightFlightCount: 0,
|
|
|
- loadCount: 0,
|
|
|
- unloadCount: 0,
|
|
|
- tallyCount: 0,
|
|
|
- }
|
|
|
- )
|
|
|
-)
|
|
|
-
|
|
|
const { cellClickHandler } = useTableCellClick(props.name)
|
|
|
|
|
|
const route = useRoute()
|