chenrui  пре 2 година
родитељ
комит
fd17dac76d

+ 10 - 1
src/api/statistics/statistics.js

@@ -36,7 +36,7 @@ export function waybill(query) {
   })
 }
 
-// // 航线货物关联统计接口
+// // 航线货物关联统计接口(重量)
 export function agent(query) {
   return request({
     url: '/risk/report/airlineCargo',
@@ -45,6 +45,15 @@ export function agent(query) {
   })
 }
 
+// // 航线货物关联统计接口(件)
+export function agentPiece(query) {
+  return request({
+    url: '/risk/report/airlineCargoPiece',
+    method: 'POST',
+    data: query
+  })
+}
+
 // 航线货物关联统计接口
 // export function agent(query) {
 //   return request({

+ 6 - 6
src/views/system/securityCheck/views/cargoCharts.vue

@@ -20,7 +20,7 @@
               <div :class="active == index ? 'log_types' : 'log_type'">{{ item.name }}</div>
             </div>
           </div>
-          <span>{{ active == 0 ? '单位:件' : '单位:吨' }}</span>
+          <span>{{ active == 1 ? '单位:件' : '单位:吨' }}</span>
         </div>
       </div>
       <div id="echarts-proportion"></div>
@@ -57,17 +57,17 @@
 import { eleCake } from '@/utils/app-ecahrts'
 import GraphicEchart from '../components/graphicHome.vue'
 import SecurityCheckHeader from '../components/securityCheckHeader.vue'
-import { agent, routeall } from '@/api/statistics/statistics.js'
+import { agent, routeall, agentPiece } from '@/api/statistics/statistics.js'
 export default {
   data() {
     return {
       Company: '件',
       treeTitles: [
         {
-          name: '件数',
+          name: '重量',
         },
         {
-          name: '重量',
+          name: '件数',
         },
       ],
       active: 0,
@@ -243,6 +243,7 @@ export default {
     //切换单位
     ups(item, index) {
       this.active = index
+      this.relationDate()
     },
     formatDate() {
       let date = new Date()
@@ -299,8 +300,7 @@ export default {
     //货物关联统计接口
     async relationDate() {
       try {
-        // console.log(params);
-        const result = await agent(this.queryData)
+        const result = this.active == 0 ? await agent(this.queryData) : await agentPiece(this.queryData)
         if (result.status == 200 && result.data.length > 0) {
           let arr = [] //高风险
           let Low = [] //低风险

+ 26 - 9
src/views/system/securityCheck/views/comprehensiveHome.vue

@@ -92,13 +92,29 @@ export default {
             arrx.push(element.date)
             element.datas.forEach((res) => {
               if (res.level === 'A') {
-                arr.push(res.count)
+                if (res.dayqty) {
+                  arr.push(res.count / res.dayqty)
+                } else {
+                  arr.push(res.count / 1)
+                }
               } else if (res.level == 'B') {
-                Low.push(res.count)
+                if (res.dayqty) {
+                  Low.push(res.count / res.dayqty)
+                } else {
+                  Low.push(res.count / 1)
+                }
               } else if (res.level == 'C') {
-                firs.push(res.count)
+                if (res.dayqty) {
+                  firs.push(res.count / res.dayqty)
+                } else {
+                  firs.push(res.count / 1)
+                }
               } else if (res.level == 'D') {
-                pt.push(res.count)
+                if (res.dayqty) {
+                  pt.push(res.count / res.dayqty)
+                } else {
+                  pt.push(res.count / 1)
+                }
               }
             })
             // console.log(arr);
@@ -119,21 +135,22 @@ export default {
             arrx.push(element.date)
             element.datas.forEach((res) => {
               if (res.level === 'A') {
-                arr.push(res.count)
+                arr.push((res.count / 24).toFixed(2))
               } else if (res.level == 'B') {
-                Low.push(res.count)
+                Low.push((res.count / 24).toFixed(2))
               } else if (res.level == 'C') {
-                firs.push(res.count)
+                firs.push((res.count / 24).toFixed(2))
               } else if (res.level == 'D') {
-                pt.push(res.count)
+                pt.push((res.count / 24).toFixed(2))
               }
             })
             // console.log(arr);
           })
           let datas = []
           for (let i = 0; i <= arr.length; i++) {
-            datas[i] = arr[i] + Low[i] + firs[i] + pt[i]
+            datas[i] = Number(arr[i]) + Number(Low[i]) + Number(firs[i]) + Number(pt[i])
           }
+          console.log(datas)
           this.inits(arr, arrx, Low, firs, pt, datas)
         }
         // console.log(result)