chenrui  2 years ago
parent
commit
1a52acf39b
1 changed files with 21 additions and 2 deletions
  1. 21 2
      src/views/system/securityCheck/views/cargoCharts.vue

+ 21 - 2
src/views/system/securityCheck/views/cargoCharts.vue

@@ -289,7 +289,7 @@ export default {
       try {
         // console.log(params);
         const result = await agent(this.queryData)
-        if (result.status == 200) {
+        if (result.status == 200 && result.data.length > 0) {
           let arr = [] //高风险
           let Low = [] //低风险
           let firs = [] //优先级
@@ -313,6 +313,11 @@ export default {
             })
             // console.log(arr);
           })
+          console.log(arr, 'arr')
+          console.log(Low, 'Low')
+          console.log(firs, 'firs')
+          console.log(pt, 'pt')
+          console.log(strictly, 'strictly')
           let arrall = eval(arr.join('+')) //高风险总和
           let Lowall = eval(Low.join('+')) //低风险级总和
           let firsall = eval(firs.join('+')) //优先级总和
@@ -320,9 +325,10 @@ export default {
           let strictlyall = eval(strictly.join('+')) //严控级总和
           let alldata = arrall + Lowall + firsall + ptall + strictlyall // 总数
           let datas = []
-          for (let i = 0; i <= arr.length; i++) {
+          for (let i = 0; i <= arrx.length; i++) {
             datas[i] = arr[i] + Low[i] + firs[i] + pt[i] + strictly[i]
           }
+          // console.log(arrx)
           // arrx.forEach((element) => {
           //   let obj = {
           //     name: element,
@@ -375,6 +381,19 @@ export default {
           this.dataordinary.data = arrordinary
           this.datastrictly.cont = strictlyall
           this.datastrictly.data = arrstrictly
+        } else {
+          this.dataall.cont = '0'
+          this.dataall.data = []
+          this.datarisk.cont = '0'
+          this.datarisk.data = []
+          this.dataLowrisk.cont = '0'
+          this.dataLowrisk.data = []
+          this.datafirst.cont = '0'
+          this.datafirst.data = []
+          this.dataordinary.cont = '0'
+          this.dataordinary.data = []
+          this.datastrictly.cont = '0'
+          this.datastrictly.data = []
         }
       } catch (error) {
         console.log(error)