Pārlūkot izejas kodu

Merge branch 'master' of http://120.26.64.82:3000/BFFE/CABaggageData2.0

chenjun 2 gadi atpakaļ
vecāks
revīzija
d71ede0c41

BIN
public/国航行李整合及应用项目-用户使用手册V2.1.pdf


+ 33 - 0
src/layout/components/Navbar.vue

@@ -26,6 +26,7 @@
             </el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
+        <el-button @click="downFile" class="btn-help" plain>帮助</el-button>
         <!-- <div class="seting">
           <span @click="toSystem" class="img-icon"></span>
         </div> -->
@@ -108,6 +109,23 @@ export default {
     exitDialog () {
       this.$store.dispatch("app/toggleOutflag", true);
     },
+    //下载
+    downFile () {
+      const a = document.createElement('a');
+      // 给a标签的href属性值加上地址,注意:这里是绝对路径,不用加 点.
+      a.href = './国航行李整合及应用项目-用户使用手册V2.1.pdf';
+      // 设置下载文件文件名,这里加上.xlsx指定文件类型,pdf文件就指定.fpd即可
+      a.download = '国航行李整合及应用项目-用户使用手册V2.1.pdf';
+      // 障眼法藏起来a标签
+      a.style.display = 'none';
+      // 将a标签追加到文档对象中
+      document.body.appendChild(a);
+      // 模拟点击了<a>标签,会触发<a>标签的href的读取,浏览器就会自动下载了
+      a.click();
+      // 一次性的,用完就删除a标签
+      a.remove();
+      // window.location.href = './国航行李整合及应用项目-用户使用手册V2.1.pdf'
+    }
   },
 };
 </script>
@@ -234,6 +252,21 @@ export default {
           }
         }
       }
+      .btn-help {
+        height: 20px;
+        line-height: 20px;
+        padding: 0;
+        width: 38px;
+        margin-top: 14px;
+        border: 1px solid #fff;
+        background: none;
+        color: #fff;
+        transition: all 0.3s;
+        &:hover {
+          background: #fff;
+          color: #2d67e3;
+        }
+      }
       .user {
         img {
           position: relative;

+ 18 - 9
src/views/baggageManagement/components/baggage/index.vue

@@ -363,8 +363,12 @@ export default {
           prop: 'noBSM'
         },
         {
-          label: '中转标记',
-          prop: 'transitSign'
+          label: '中转进航班',
+          prop: 'inFlightNo'
+        },
+        {
+          label: '中转出航班',
+          prop: 'transferFlightNo'
         },
         {
           label: '速运标记',
@@ -442,7 +446,8 @@ export default {
         { name: '发往位置', prop: 'toLocation' },
         { name: '发往位置描述', prop: 'toLocationMark', width: 110 },
         { name: '装载序号', prop: 'LoadSN' },
-        { name: '容器编号', prop: 'U_Device_ID', width: 100 }
+        { name: '容器编号', prop: 'U_Device_ID', width: 100 },
+        { name: '数据来源', prop: 'dataSource' }
       ],
       baggageTableData: [],
       spanArr: [],
@@ -506,14 +511,12 @@ export default {
   watch: {
     $route: {
       handler({ path, query }) {
+        this.infoBtn = ''
         if (path.includes('baggageView')) {
           const { flightNO, flightDate, bagSN } = query
           if (flightNO && flightDate && bagSN) {
-            const { flightNO: oldFlightNO, flightDate: oldFlightDate, bagSN: oldBagSN } = this.queryData
-            if (flightNO !== oldFlightNO || flightDate !== oldFlightDate || bagSN !== oldBagSN) {
-              this.queryData = { flightNO, flightDate, bagSN }
-              this.infoBtn = this.infoRadios[0]
-            }
+            this.queryData = { flightNO, flightDate, bagSN }
+            this.infoBtn = this.infoRadios[0]
           } else {
             this.$router.push('/advance')
           }
@@ -740,6 +743,13 @@ export default {
           item['landingAirport'] = `${item['landingAirport']}\n${
             item['landingTime'] ? item['landingTime'].replace('T', '\n') : ''
           }`
+          if (item['DeviceCode'] === 'STARHUB') {
+            item['dataSource'] = 'Manual Load'
+          } else if (item['toLocation']?.length === 2) {
+            item['dataSource'] = 'RFID'
+          } else if (item['secondaryCode'] === 'R') {
+            item['dataSource'] = 'BRS'
+          }
           return item
         })
         this.initTableData(this.baggageTableData)
@@ -753,7 +763,6 @@ export default {
       try {
         const result = await this.queryMessage(dataContent)
         this.messageList = result.map(message => {
-          message.dataContent = message.dataContent
           // message.dataContent = JSON.parse(message.dataContent).dataContent
           return message
         })

+ 34 - 9
src/views/statisticsCharts/views/nodeStatisticsCharts.vue

@@ -558,6 +558,7 @@ export default {
         if (Number(res.code) === 0) {
           const { listValues } = res.returnData
           if (listValues.length) {
+            // 生成表格数据
             const xlsxDatas = [[]]
             const listArray = listValues.map(record =>
               Object.entries(record).filter(([key, value]) => key === 'a4' || this.checkList.includes(key))
@@ -565,12 +566,35 @@ export default {
             xlsxDatas[0].push(...listArray[0].map(([key, value]) => key))
             xlsxDatas.push(...listArray.map(record => record.map(([key, value]) => value)))
             xlsxDatas[0][0] = '日期'
+            // 添加合计行
+            if (xlsxDatas.length > 2) {
+              const summaryRow = ['合计']
+              const colNum = xlsxDatas[0].length
+              for (let columnIndex = 1; columnIndex < colNum; columnIndex++) {
+                summaryRow[columnIndex] = xlsxDatas.reduce((pre, currentRow, currentRowIndex) => {
+                  if (currentRowIndex === 0) {
+                    return pre
+                  } else {
+                    return pre + currentRow[columnIndex]
+                  }
+                }, 0)
+              }
+              xlsxDatas.push(summaryRow)
+            }
+            // 添加节点扫描率列,计算列宽
             const columnWidths = []
-            const rowNum = xlsxDatas.length
-            for (let rowIndex = 0; rowIndex < rowNum; rowIndex++) {
-              const colNum = xlsxDatas[rowIndex].length
-              for (let columnIndex = 0; columnIndex < colNum; columnIndex++) {
-                const cellTextLength = xlsxDatas[rowIndex][columnIndex]
+            xlsxDatas.forEach((row, rowIndex) => {
+              // 从行李总件数后一列开始遍历,添加节点扫描率数据
+              for (let columnIndex = 2; columnIndex < row.length; columnIndex += 2) {
+                const totalcell = row[1]
+                const cell = row[columnIndex]
+                const newCell =
+                  rowIndex === 0 ? `${cell.slice(0, 2)}扫描率` : `${cell ? ((cell / totalcell) * 100).toFixed(2) : 0}%`
+                row.splice(columnIndex + 1, 0, newCell)
+              }
+              // 计算每一列宽度
+              row.forEach((cell, columnIndex) => {
+                const cellTextLength = cell
                   .toString()
                   .split('')
                   .reduce((pre, curr) => {
@@ -580,22 +604,23 @@ export default {
                 if ((!columnWidths[columnIndex] && cellTextLength > 0) || cellTextLength > columnWidths[columnIndex]) {
                   columnWidths[columnIndex] = cellTextLength
                 }
-              }
-            }
+              })
+            })
+            // 生成表格
             const sheet = XLSX.utils.aoa_to_sheet(xlsxDatas)
+            // 添加列宽度
             sheet['!cols'] = columnWidths.map(width => ({
               wch: width + 2
             }))
             const workBook = XLSX.utils.book_new()
             XLSX.utils.book_append_sheet(workBook, sheet, '扫描节点与位置分析')
-            // console.log(workBook)
-            // return
             const tableWrite = XLSX_STYLE.write(workBook, {
               bookType: 'xlsx',
               bookSST: true,
               type: 'buffer',
               cellStyles: true
             })
+            // 下载表格
             const fileName = `扫描节点与位置分析-${queryData.join('-')}.xlsx`
             FileSaver.saveAs(new Blob([tableWrite], { type: 'application/octet-stream' }), fileName)
           }