Jelajahi Sumber

工程现场页面及相关接口调用调整

zhanghao 2 bulan lalu
induk
melakukan
ba8fdc73a3

+ 22 - 6
src/views/screen/engineering/main.vue

@@ -354,6 +354,8 @@ export default {
   methods: {
     transmit(appOrg){
       this.appOrg = appOrg
+      this.getProjectNum();
+      this.getProjectNumX();
     },
     //前期审批数量
     getProjectNum() {
@@ -367,8 +369,15 @@ export default {
       getProjectNumX(this.appOrg).then((res) => {
         if (Number(res.code) === 200) {
           const fetchedData = res.data;
-          for (let i = 0; i < fetchedData.length; i++) {
-            this.parest[fetchedData[i].subdivision-1].num= fetchedData[i].num;
+          if (res.data.length > 0) {
+            for (let i = 0; i < fetchedData.length; i++) {
+              this.parest[fetchedData[i].subdivision - 1].num = fetchedData[i].num;
+            }
+          }
+          else {
+            for (let i = 0; i < this.parest1.length; i++){
+              this.parest[i].num = 0
+            }
           }
         }
       });
@@ -377,11 +386,16 @@ export default {
       getProjectNumY(this.appOrg).then((res) => {
         if (Number(res.code) === 200) {
           const fetchedData = res.data;
-          for (let i = 0; i < fetchedData.length; i++) {
-            this.parest1[fetchedData[i].subdivision-11].num= fetchedData[i].num;
+          if (res.data.length > 0){
+            for (let i = 0; i < fetchedData.length; i++) {
+              this.parest1[fetchedData[i].subdivision-11].num= fetchedData[i].num;
+            }
+          }
+          else {
+            for (let i = 0; i < this.parest1.length; i++){
+              this.parest1[i].num = 0
+            }
           }
-          this.leftShow = false;
-          this.rightShow = true;
         }
       });
     },
@@ -475,6 +489,8 @@ export default {
     showDialog(type) {
       if (type === 1) {
         this.getProjectNumY();
+        this.leftShow = false;
+        this.rightShow = true;
       } else {
         this.rightShow = false;
         this.leftShow = true;

+ 0 - 3
src/views/screen/engineering/unitAccess.vue

@@ -49,7 +49,6 @@
 <script>
 import PieChart from "@/components/Echarts/PieChart";
 import BarChart from "@/components/Echarts/BarChart.vue";
-import { getProjectNum, getProjectNumX } from '@/api/screen/service'
 
 
 
@@ -363,8 +362,6 @@ export default {
   created() {
     this.handlePie();
     this.handleBar();
-    this.getProjectNumX();
-    this.getProjectNum();
   },
   destroyed() {},
   beforeDestroy() {},