Explorar el Código

水电表问题

Shannon_mu hace 3 años
padre
commit
784975cc08

+ 9 - 2
energyManagement/src/views/instrumentManagement/popups/addDeviceManagement.vue

@@ -153,10 +153,17 @@ export default {
                 this.formData.houseId = e.roomId;
                 if (!!e.roomId) {
                     this.formData.addressType = 5;
-                    address = e.buildingName + '-' + e.unitName + '-' + e.floor + '-' + e.roomName;
+
+                    address = e.buildingName + '-' + e.floor + '-' + e.roomName;
+                    if (!!e.unitName) {
+                        address = e.buildingName + '-' + e.unitName + '-' + e.floor + '-' + e.roomName;
+                    }
                 } else if (!!e.floorId) {
                     this.formData.addressType = 4;
-                    address = e.buildingName + '-' + e.unitName + '-' + e.floor;
+                    address = e.buildingName + '-' + e.floor;
+                    if (!!e.unitName) {
+                        address = e.buildingName + '-' + e.unitName + '-' + e.floor;
+                    }
                 } else if (!!e.unitId) {
                     this.formData.addressType = 3;
                     address = e.buildingName + '-' + e.unitName;

+ 5 - 4
energyManagement/src/views/instrumentManagement/popups/poptreeSelect.vue

@@ -47,10 +47,11 @@ export default {
                 this.unitPa.unitName = e.name;
                 this.unitPa.unitId = e.value;
             } else if (e.type == 'floor') {
-                this.unitPa.buildingName = node.parent.parent.data.name;
-                this.unitPa.buildingId = node.parent.parent.data.value;
-                this.unitPa.unitName = node.parent.data.name;
-                this.unitPa.unitId = node.parent.data.value;
+                debugger;
+                this.unitPa.buildingName = this.unitPa.ids.length == 4 ? node.parent.parent.data.name : node.parent.data.name;
+                this.unitPa.buildingId = this.unitPa.ids.length == 4 ? node.parent.parent.data.value : node.parent.data.value;
+                this.unitPa.unitName = this.unitPa.ids.length == 4 ? node.parent.data.name : '';
+                this.unitPa.unitId = this.unitPa.ids.length == 4 ? node.parent.data.value : '';
                 this.unitPa.floor = e.name;
                 this.unitPa.floorId = e.value;
             } else if (e.type == 'room') {