فهرست منبع

航站视图-重量统计

zhongxiaoyu 2 سال پیش
والد
کامیت
0475ca9b16

+ 9 - 5
public/config.js

@@ -4,7 +4,7 @@ var LOOP_INTERVAL = {
   flight: 15 * 1000,
   waybill: 15 * 1000,
   goods: 15 * 1000,
-};
+}
 
 // const PLATFROM_CONFIG = {
 //   baseNewUrl: "http://120.26.64.82:8083/", //登录前的http请求地址
@@ -179,10 +179,14 @@ var DATACONTENT_ID = {
 
   /***-----综合可视化------***/
   // 航站
-  departureAirport: 1803524, // 国内港航站
-  internationalDepartureAirport: 1803525, // 国际港航站
+  departureAirport: 1803524, // 国内港航站
+  internationalDepartureAirport: 1803525, // 国际港航站
   arrivalAirport: 1803522, // 国内进港航站
   internationalArrivalAirport: 1803523, // 国际进港航站
+  departureAirportWeightCount: 1803614, // 国内离港重量统计
+  internationalDepartureAirportWeightCount: 1803613, // 国际离港重量统计
+  arrivalAirportWeightCount: 1803616, // 国内进港重量统计
+  internationalArrivalAirportWeightCount: 1803615, // 国际进港重量统计
   warningRules: 18040, // 报警预警策略
   // 航班
   departureFlightInfo: 1803528, // 国内离港航班基础信息
@@ -279,7 +283,7 @@ var DATACONTENT_ID = {
   nodeExportAirline: 1805, // 节点统计导出-航线
   nodeExportAirport: 1805, // 节点统计导出-航站
   nodeAxisDesc: 90, // 节点统计指示器名称解释
-};
+}
 
 var SERVICE_ID = {
   /***-----账号管理------***/
@@ -314,4 +318,4 @@ var SERVICE_ID = {
 
   /***-----离港管理------***/
   departureScId: 8011, //发送报警预警日志信息
-};
+}

+ 9 - 4
src/components/ColumnSet/index.vue

@@ -26,9 +26,11 @@
               :key="column.columnName"
               class="checkbox-wrapper"
             >
-              <el-checkbox :label="column.columnName">{{
-                column.columnLabel?.replace('\n', '')
-              }}</el-checkbox>
+              <el-checkbox
+                :label="column.columnName"
+                :disabled="column.checkDisabled"
+                >{{ column.columnLabel?.replace('\n', '') }}</el-checkbox
+              >
             </div>
           </el-checkbox-group>
         </div>
@@ -40,7 +42,10 @@
             :key="column.columnName"
             class="checkbox-wrapper"
           >
-            <el-checkbox :label="column.columnName">
+            <el-checkbox
+              :label="column.columnName"
+              :disabled="column.checkDisabled"
+            >
               {{ column.columnLabel?.replace('\n', '') }}
             </el-checkbox>
           </div>

+ 1 - 3
src/views/realTime/components/AirportView/index.scss

@@ -13,10 +13,8 @@
     .airport-count {
       flex: 1;
       display: flex;
+      justify-content: space-around;
       align-items: center;
-      .count-box {
-        flex: 1;
-      }
     }
     .airport-settings {
       display: flex;

+ 43 - 6
src/views/realTime/components/AirportView/index.vue

@@ -5,18 +5,21 @@
       <div class="airport-count">
         <CountBox
           :count-number="tableDataCount.flightCount"
+          :length="4"
           label="今日计划航班数"
         />
         <CountBox
           :count-number="
             isDeparture ? finishedCount : tableDataCount.tallyCount
           "
+          :length="4"
           label="已完成航班数"
         />
-        <!-- <CountBox
-          :count-number="tableDataCount.weightCount"
-          label="已转载重量"
-        /> -->
+        <CountBox
+          :count-number="weightCount"
+          label="已转载重量KG"
+          :length="8"
+        />
       </div>
       <div class="airport-settings">
         <div v-permission="getPermission('count')">
@@ -85,6 +88,8 @@ import { CommonData } from '~/common'
 import { useLoop } from '@/hooks/useLoop'
 import { useTableSettingsStore } from '@/store/tableSettings'
 import { useFlightState } from './useFlightState'
+import { Query } from '@/api/webApi'
+import { ElMessage } from 'element-plus'
 
 const props = defineProps({
   name: {
@@ -107,12 +112,45 @@ const { tableColumns, tableData, getTableData } = useAirportTable(
 
 const finishedCount = ref(0)
 
+const weightCount = ref(0)
+const getWeightCount = async () => {
+  try {
+    const { startDate, endDate } = formData
+    const dataContent = [startDate, endDate]
+    const {
+      code,
+      returnData: { listValues },
+      message,
+    } = await Query({
+      id:
+        DATACONTENT_ID[
+          `${
+            props.name.slice(0, 1).toLowerCase() + props.name.slice(1)
+          }WeightCount`
+        ],
+      dataContent,
+    })
+    if (Number(code) !== 0) {
+      throw new Error(message || '失败')
+    }
+    if (!listValues.length) {
+      ElMessage.info('未查询到重量信息')
+      weightCount.value = 0
+      return
+    }
+    weightCount.value = listValues[0].weight
+  } catch (error) {
+    console.error(error)
+  }
+}
+
 const { getWarningRules } = useFlightState(props.name, tableData, finishedCount)
 
 useLoop(
   [
-    // getWarningRules,
+    getWeightCount,
     getTableData,
+    // getWarningRules,
   ],
   'airport',
   [formData]
@@ -249,7 +287,6 @@ const tableDataCount = computed(() =>
       loadCount: 0,
       unloadCount: 0,
       tallyCount: 0,
-      weightCount: 0,
     }
   )
 )

+ 25 - 41
src/views/realTime/components/WaybillView/index.vue

@@ -136,48 +136,32 @@ const { tableColumns, tableData: trackData, getTableData } = useTable(
 
 // 判断是否有另外一个机场的节点信息,没有则隐藏那些列
 watch(trackData, data => {
-  let anotherAirportNodes: string[] = []
-  let currentAirportNodeFlag = ''
-  if (props.name === 'DepartureWaybill') {
-    anotherAirportNodes = [
-      'CARGOS_ARR_HANDOVER',
-      'CARGOS_HANDOVER_STATUS_01',
-      '货站交接',
-      'IMP_TALLY',
-      'FSUDLV',
-    ]
-    currentAirportNodeFlag = 'node-departure'
-  }
-  if (props.name === 'ArrivalWaybill') {
-    anotherAirportNodes = [
-      'DEH',
-      'ACC_CHECK',
-      '安检',
-      'ACC_BUP',
-      'LS_CARGO',
-      // 'CARGOS_HANDOVER_STATUS_02',
-      'CARGOS_HANDOVER_STATUS_03',
-      '出港货邮',
-      '装载完成',
-      '关闭舱门',
-      'CARGOS_OFFLOAD',
-      'OFFLOAD_CONFIRM',
-      'BILL_RETURN',
-    ]
-    currentAirportNodeFlag = 'node-arrival'
-  }
-  const hasAnotherAirportData = data.some(
-    ({ nodeCode }) =>
-      typeof nodeCode === 'string' && anotherAirportNodes.includes(nodeCode)
-  )
-  if (!hasAnotherAirportData) {
-    tableColumns.value = tableColumns.value.filter(
-      ({ className }) =>
-        typeof className !== 'string' ||
-        !className.includes('node-') ||
-        className.includes(currentAirportNodeFlag)
-    )
+  let anotherAirportNodeFlag = ''
+  if (props.name.includes('Departure')) {
+    anotherAirportNodeFlag = 'node-arrival'
+  } else {
+    anotherAirportNodeFlag = 'node-departure'
   }
+  const activeNodes = data.reduce((nodes: string[], row) => {
+    if (typeof row.nodeCode === 'string' && !nodes.includes(row.nodeCode)) {
+      nodes.push(row.nodeCode)
+    }
+    return nodes
+  }, [])
+  tableColumns.value.forEach(column => {
+    if (
+      column.defaultDisabled ||
+      (typeof column.className === 'string' &&
+        column.className.includes(anotherAirportNodeFlag))
+    ) {
+      column.checkDisabled = true
+      if (activeNodes.includes(column.columnName)) {
+        column.hidden = false
+      } else {
+        column.hidden = true
+      }
+    }
+  })
 })
 
 useLoop([getWaybillInfo, getTableData], 'waybill')

+ 3 - 5
src/views/realTime/hooks/useTable.ts

@@ -189,13 +189,13 @@ const tableColumnsMap: {
       columnLabel: '拉下登记',
       columnName: 'CARGOS_OFFLOAD',
       className: 'cell-filter cell-filter-green node-departure',
-      checkDisabled: true,
+      defaultDisabled: true,
     },
     {
       columnLabel: '拉回确认',
       columnName: 'OFFLOAD_CONFIRM',
       className: 'cell-filter cell-filter-green node-departure',
-      checkDisabled: true,
+      defaultDisabled: true,
     },
     // {
     //   columnLabel: '起飞',
@@ -401,13 +401,11 @@ const tableColumnsMap: {
       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: '起飞',
@@ -605,7 +603,7 @@ const tableColumnsMap: {
       columnLabel: '拉下',
       columnName: 'CARGOS_OFFLOAD',
       className: 'cell-filter cell-filter-green node-departure',
-      checkDisabled: true,
+      defaultDisabled: true,
     },
     {
       columnLabel: '实配',