shaun-sheep vor 4 Jahren
Ursprung
Commit
8a66163a87
2 geänderte Dateien mit 34 neuen und 3 gelöschten Zeilen
  1. 18 1
      src/components/Rotation/src/rotation.vue
  2. 16 2
      src/views/equipment/eqDialog.vue

+ 18 - 1
src/components/Rotation/src/rotation.vue

@@ -23,7 +23,7 @@
 <script>
 export default {
     name: 'Rotation',
-    props: ['rotationImg', 'type'],
+    props: ['rotationImg', 'type', 'size'],
     data() {
         return {
             rotationImgs: [{ url: require('@/assets/images/login_back.png') }],
@@ -73,6 +73,23 @@ export default {
     /deep/ .el-carousel__container {
         height: 100%;
     }
+    .rotationConType {
+        height: 100%;
+        width: 100%;
+        overflow: auto;
+    }
+    /deep/ .el-carousel__item {
+        text-align: center;
+        background: #fff;
+    }
+    img {
+        width: 100%;
+        // height: 100%;
+        // object-fit: fill;
+        // min-width: 100%;
+        // width: 100%;
+        // min-height: 100%;
+    }
 }
 
 // .rotation {

+ 16 - 2
src/views/equipment/eqDialog.vue

@@ -19,7 +19,7 @@
             <div v-if='Object.keys(dialogInfo).length>0 && dialogInfo.children.length==0' style='margin:16px 0 0 24px;height:100%'>
                 <!-- 原理图 -->
                 <div v-if='dialogInfo.id.slice(2,4)=="YL"' style='width:100%;overflow:auto;height:100%;margin:0 auto'>
-                    <rotation type='3' v-if='rotationImg.length>0' :rotationImg='rotationImg'></rotation>
+                    <rotation type='3' v-if='rotationImg.length>0' :size='sizePic' :rotationImg='rotationImg'></rotation>
                 </div>
                 <!-- 土建装饰主要材料清单 -->
                 <tj-table v-else-if='dialogInfo.id.slice(0,4)=="TJQD"' :param='param'></tj-table>
@@ -113,6 +113,8 @@ export default {
             rotationImg: [],
             tabLabel: '',
             tabCount: [],
+            sizePic: '',
+            imgInfo: {},
             showFenbuPic: false //显示楼层分布组件
         }
     },
@@ -210,7 +212,19 @@ export default {
             }
             queryPic({ getParams }).then(res => {
                 this.rotationImg = res.data || []
-                console.log(this.rotationImg)
+                this.rotationImg[0].url
+                let img = new Image()
+                img.src = this.rotationImg[0].url
+                const vm = this
+                img.onload = function() {
+                    vm.$set(vm.imgInfo, 'width', img.width)
+                    vm.$set(vm.imgInfo, 'height', img.height)
+                    if (vm.imgInfo.width > vm.imgInfo.height) {
+                        vm.sizePic = 'width'
+                    } else {
+                        vm.sizePic = 'height'
+                    }
+                }
             })
         },
         //原理图没图片不显示tab 因为供电和燃气系统没有tab所以分开判断