dedsudiyu před 2 roky
rodič
revize
6aed37fa0b

+ 44 - 45
src/views/comprehensive/laboratoryManagement/building/newIndex.vue

@@ -830,7 +830,7 @@
               newData.mapList[i].checkType = false;
             }
           }
-          let newObj = this.calculateMapMax(newData.mapList,260,550)
+          let newObj = this.calculateMapMax(newData.mapList,260,550,'min')
           newData.width = newObj.maxWidth
           newData.height = newObj.maxHeight
           newData.zoomData = newObj.zoomData
@@ -976,17 +976,12 @@
         this.handleQuery()
       },
       //计算布局最大尺寸
-      calculateMapMax(list, height,width) {
-        let num = 0;
-        let zoomType = 0;
+      calculateMapMax(list, height,width,type) {
+        //基础参数
         let maxWidth = 0
         let maxHeight = 0
         let zoomData = 1;
-        if(height>width){
-          num = height/width
-        } else{
-          num = width/height
-        }
+        //参数处理
         for (let i = 0; i < list.length; i++) {
           if ((list[i].x + list[i].w) > maxWidth) {
             maxWidth = list[i].x + list[i].w
@@ -995,48 +990,52 @@
             maxHeight = list[i].y + list[i].h
           }
         }
-        if(maxWidth>maxHeight){
-          if((maxWidth/maxHeight)>num){
-            // 以宽度缩放
-            zoomType = 1;
+        //处理等值数据
+        if(maxHeight == height){
+          maxHeight++
+        }
+        if(maxWidth == width){
+          maxWidth++
+        }
+        //缩放判断
+        if(maxHeight>height&&maxWidth>width){
+          if((maxHeight-height)>(maxWidth-width)){
+            zoomData = height/maxHeight;
+            this.$set(this,'zoomData',height/maxHeight);
+            if(type == 'min'){
+              this.$set(this,'minZoomData',height/maxHeight);
+            }
           }else{
-            // 以高度缩放
-            zoomType = 2;
+            zoomData = width / maxWidth;
+            this.$set(this,'zoomData',width / maxWidth);
+            if(type == 'min'){
+              this.$set(this,'minZoomData',width / maxWidth);
+            }
           }
-        }else{
-          if((maxHeight/maxWidth)>num){
-            // 以高度缩放
-            zoomType = 2;
+        }else if(maxHeight<height&&maxWidth<width){
+          if((height-maxHeight)>(width-maxWidth)){
+            zoomData = width / maxWidth;
+            this.$set(this,'zoomData',width / maxWidth);
+            if(type == 'min'){
+              this.$set(this,'minZoomData',width / maxWidth);
+            }
           }else{
-            // 以宽度缩放
-            zoomType = 1;
-          }
-        }
-
-        if(zoomType == 1){
-          if (width > maxWidth) {
-            zoomData = maxWidth / width;
-          } else {
-            zoomData =  width / maxWidth;
+            zoomData = height / maxHeight;
+            this.$set(this,'zoomData',height / maxHeight);
+            if(type == 'min'){
+              this.$set(this,'minZoomData',height / maxHeight);
+            }
           }
-          if (width > maxWidth) {
-            this.$set(this,'zoomData',maxWidth / width);
-            this.$set(this,'minZoomData',maxWidth / width);
-          } else {
-            this.$set(this,'zoomData',width / maxWidth);
+        }else if(maxHeight<height&&maxWidth>width){
+          zoomData = width / maxWidth;
+          this.$set(this,'zoomData',width / maxWidth);
+          if(type == 'min'){
             this.$set(this,'minZoomData',width / maxWidth);
           }
-        }else if(zoomType == 2){
-          if (height > maxHeight) {
-            zoomData = maxHeight / height;
-          } else {
-            zoomData =  height / maxHeight;
-          }
-          if (height > maxHeight) {
-            this.$set(this,'zoomData',maxHeight / height);
-            this.$set(this,'minZoomData',maxHeight / height);
-          } else {
-            this.$set(this,'zoomData',height / maxHeight);
+        }else if(maxHeight>height&&maxWidth<width){
+          zoomData = height / maxHeight;
+          this.$set(this,'zoomData',height / maxHeight);
+          if(type == 'min'){
             this.$set(this,'minZoomData',height / maxHeight);
           }
         }

+ 29 - 4
src/views/emergencyManagement/plan/newAssociatedPage.vue

@@ -316,10 +316,35 @@
             }
             newList.push(obj);
           }
-          riskPlanJoinSub(newList).then(response => {
-            this.msgSuccess(response.msg);
-            this.resetQuery();
-            this.$set(this,'dialogAssociatedOpen',false);
+          let newObj = {
+            riskPlanId:self.associationData.id,
+            yesOrNo:0,
+            labRiskPlanSubVos:newList,
+          }
+          riskPlanJoinSub(newObj).then(response => {
+            if(response.data.ifConflict == 1){
+              self.$confirm(response.data.message, "警告", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+              }).then(function() {
+                let newData =  {
+                  riskPlanId:self.associationData.id,
+                  yesOrNo:1,
+                  labRiskPlanSubVos:newList,
+                }
+                riskPlanJoinSub(newData).then(response => {
+                  self.msgSuccess(response.msg);
+                  self.resetQuery();
+                  self.$set(self,'dialogAssociatedOpen',false);
+                });
+              }).then(() => {
+              }).catch(() => {});
+            }else{
+              self.msgSuccess(response.msg);
+              self.resetQuery();
+              self.$set(self,'dialogAssociatedOpen',false);
+            }
           });
         }
       },

+ 31 - 31
src/views/newEvacuationBigData.vue

@@ -1476,10 +1476,13 @@
       },
       //计算布局最大尺寸
       calculateMapMax(list) {
-        let zoomType = 0;
+        //基础参数
+        let height = 500;
+        let width = 1000;
         let maxWidth = 0
         let maxHeight = 0
         let zoomData = 1;
+        //参数处理
         for (let i = 0; i < list.length; i++) {
           if ((list[i].x + list[i].w) > maxWidth) {
             maxWidth = list[i].x + list[i].w
@@ -1488,39 +1491,36 @@
             maxHeight = list[i].y + list[i].h
           }
         }
-        if(maxWidth>maxHeight){
-          if((maxWidth/maxHeight)>2){
-            // 以宽度缩放
-            zoomType = 1;
+        //处理等值数据
+        if(maxHeight == height){
+          maxHeight++
+        }
+        if(maxWidth == width){
+          maxWidth++
+        }
+        //缩放判断
+        if(maxHeight>height&&maxWidth>width){
+          if((maxHeight-height)>(maxWidth-width)){
+            zoomData = height/maxHeight;
+            this.$set(this,'zoomData',height/maxHeight);
           }else{
-            // 以高度缩放
-            zoomType = 2;
+            zoomData = width / maxWidth;
+            this.$set(this,'zoomData',width / maxWidth);
           }
-        }else{
-          if((maxHeight/maxWidth)>2){
-            // 以高度缩放
-            zoomType = 2;
+        }else if(maxHeight<height&&maxWidth<width){
+          if((height-maxHeight)>(width-maxWidth)){
+            zoomData = width / maxWidth;
+            this.$set(this,'zoomData',width / maxWidth);
           }else{
-            // 以宽度缩放
-            zoomType = 1;
-          }
-        }
-        if(zoomType == 1){
-          if (1000 > maxWidth) {
-            zoomData = maxWidth / 1000;
-            this.$set(this,'zoomData',maxWidth / 1000);
-          } else {
-            zoomData =  1000 / maxWidth;
-            this.$set(this,'zoomData',1000 / maxWidth);
-          }
-        }else if(zoomType == 2){
-          if (500 > maxHeight) {
-            zoomData = maxHeight / 500;
-            this.$set(this,'zoomData',maxHeight / 500);
-          } else {
-            zoomData =  500 / maxHeight;
-            this.$set(this,'zoomData',500 / maxHeight);
-          }
+            zoomData = height / maxHeight;
+            this.$set(this,'zoomData',height / maxHeight);
+          }
+        }else if(maxHeight<height&&maxWidth>width){
+          zoomData = width / maxWidth;
+          this.$set(this,'zoomData',width / maxWidth);
+        }else if(maxHeight>height&&maxWidth<width){
+          zoomData = height / maxHeight;
+          this.$set(this,'zoomData',height / maxHeight);
         }
         return { maxWidth: maxWidth, maxHeight: maxHeight,zoomData:zoomData }
       },