Quellcode durchsuchen

房屋是否有单元判断

Shannon_mu vor 3 Jahren
Ursprung
Commit
00c2c6deb2

+ 9 - 15
operationSupport/src/components/common/buildingTree.vue

@@ -44,7 +44,7 @@ export default {
                 if (!!item.children & (item.type !== 'unit')) {
                     this.dimension(item.children);
                 } else {
-                    if (item.name.indexOf('单元') === -1) {
+                    if (item.name.indexOf('单元') === -1 && item.type === 'unit') {
                         item.name = item.name + '单元';
                     }
                 }
@@ -70,17 +70,12 @@ export default {
         },
         treeClick(e) {
             if (e.value == 0) return;
-            // for(var i=0;i<this.organList.length;i++){
-            //     this.buildingInformationNav(this.organList[i],e)
-            // }
-            // this.buildingInformationNav(this.organList,e)
-            let unitPa = {};
-            if (e.value == 0) return;
-
             let onData = '';
+            let newValueIds = e.id.split('-');
+            let thisE = this.$refs.tree.getNode(e);
             if (e.type == 'building') {
                 onData = {
-                    communityId: this.$refs.tree.getNode(e).parent.data.value,
+                    communityId: thisE.parent.data.value,
                     buildingId: e.value,
                     unitId: '',
                     roomId: ''
@@ -88,18 +83,17 @@ export default {
                 this.$emit('buildingInformation', onData);
             } else if (e.type == 'unit') {
                 onData = {
-                    communityId: this.$refs.tree.getNode(e).parent.parent.data.value,
-                    buildingId: this.$refs.tree.getNode(e).parent.data.value,
+                    communityId: thisE.parent.parent.data.value,
+                    buildingId: thisE.parent.data.value,
                     unitId: e.value,
                     roomId: ''
                 };
                 this.$emit('buildingInformation', onData);
-                // this.$emit('organId', unitPa);
             } else if (e.type == 'room') {
                 onData = {
-                    communityId: this.$refs.tree.getNode(e).parent.parent.parent.data.value,
-                    buildingId: this.$refs.tree.getNode(e).parent.parent.data.value,
-                    unitId: this.$refs.tree.getNode(e).parent.data.value,
+                    communityId: newValueIds.length == 4 ? thisE.parent.parent.parent.data.value : thisE.parent.parent.data.value,
+                    buildingId: newValueIds.length == 4 ? thisE.parent.parent.data.value : thisE.parent.data.value,
+                    unitId: newValueIds.length == 4 ? thisE.parent.data.value : '',
                     roomId: e.value
                 };
                 this.$emit('buildingInformation', onData);

+ 21 - 17
operationSupport/src/components/common/organTree.vue

@@ -22,6 +22,7 @@
 <script>
 export default {
     name: 'organTree',
+    props: ['buildingType'],
     data() {
         return {
             filterText: '',
@@ -39,23 +40,25 @@ export default {
     },
     methods: {
         getOrgTreeList() {
-            this.$http.get('/sc-community/assets/tree/community/find').then(({ status, data, msg }) => {
-                if (status === 0 && data) {
-                    this.dimension(data);
-                    this.organList = data;
-                    this.$nextTick().then(() => {
-                        const firstNode = document.querySelector('.el-tree-node');
-                        firstNode.click();
-                    });
-                }
-            });
+            this.$http
+                .get('/sc-community/assets/tree/community/find', { buildingType: this.buildingType })
+                .then(({ status, data, msg }) => {
+                    if (status === 0 && data) {
+                        this.dimension(data);
+                        this.organList = data;
+                        this.$nextTick().then(() => {
+                            const firstNode = document.querySelector('.el-tree-node');
+                            firstNode.click();
+                        });
+                    }
+                });
         },
         dimension(arr) {
             arr.map((item, index) => {
                 if (!!item.children & (item.type !== 'unit')) {
                     this.dimension(item.children);
                 } else {
-                    if (item.name.indexOf('单元') === -1) {
+                    if (item.name.indexOf('单元') === -1 && item.type === 'unit') {
                         item.name = item.name + '单元';
                     }
                 }
@@ -78,6 +81,7 @@ export default {
                 houseId: '',
                 type: e.type
             };
+            let newValueIds = e.id.split('-');
             let thisObj = this.$refs.tree.getNode(e);
             if (e.type == 'building') {
                 unitPa.communityName = thisObj.parent.data.name;
@@ -92,12 +96,12 @@ export default {
                 unitPa.unitName = e.name;
                 unitPa.unitId = e.value;
             } else if (e.type == 'room') {
-                unitPa.communityName = thisObj.parent.parent.parent.data.name;
-                unitPa.communityId = thisObj.parent.parent.parent.data.value;
-                unitPa.buildingName = thisObj.parent.parent.data.name;
-                unitPa.buildingId = thisObj.parent.parent.data.value;
-                unitPa.unitName = thisObj.parent.data.name;
-                unitPa.unitId = thisObj.parent.data.value;
+                unitPa.communityName = newValueIds.length == 4 ? thisObj.parent.parent.parent.data.name : thisObj.parent.parent.data.name;
+                unitPa.communityId = newValueIds.length == 4 ? thisObj.parent.parent.parent.data.value : thisObj.parent.parent.data.value;
+                unitPa.buildingName = newValueIds.length == 4 ? thisObj.parent.parent.data.name : thisObj.parent.data.name;
+                unitPa.buildingId = newValueIds.length == 4 ? thisObj.parent.parent.data.value : thisObj.parent.data.value;
+                unitPa.unitName = newValueIds.length == 4 ? thisObj.parent.data.name : '';
+                unitPa.unitId = newValueIds.length == 4 ? thisObj.parent.data.value : '';
                 unitPa.houseName = e.name;
                 unitPa.houseId = e.value;
             } else {

+ 2 - 4
operationSupport/src/views/buildingManagement/pageJump/addoredit.vue

@@ -724,11 +724,9 @@ export default {
                     if (data.buildingUnitList.length !== 0) {
                         this.formdata = data;
                         this.formdata.householdsPerFloor = data.buildingUnitList[0].unitFloorList[0].roomList.length;
-                        
-                        debugger;
                         this.initialUnitList = {
-                            checkedUnit: false,
-                            enableUnit: 1, //勾选了复选框
+                            checkedUnit: data.unitNumber !== 0 ? true : false,
+                            enableUnit: data.unitNumber !== 0 ? 1 : 0,
                             unit: {
                                 type: 'Number', //  Number letter
                                 start: data.buildingUnitList[0]['unitName'], // 1 A单元的起始单元

+ 7 - 1
operationSupport/src/views/deviceManagement/popups/addDeviceManagement.vue

@@ -127,7 +127,11 @@ export default {
                     title: '楼栋信息'
                 });
             }).then((e) => {
-                this.formData.address = ` ${e.buildingName} - ${e.unitName} - ${e.houseName}`;
+                if (!!e.unitName) {
+                    this.formData.address = ` ${e.buildingName} - ${e.unitName} - ${e.houseName}`;
+                } else {
+                    this.formData.address = ` ${e.buildingName} - ${e.houseName}`;
+                }
             });
         },
         submit() {
@@ -148,6 +152,8 @@ export default {
                             this.$message.success(msg);
                             this.params.callback();
                             this.$emit('close');
+                        } else {
+                            this.$message.error(msg);
                         }
                         loading.close();
                     })

+ 8 - 2
operationSupport/src/views/deviceManagement/popups/addFacilities.vue

@@ -12,7 +12,7 @@
                 </el-input>
             </template>
             <template slot="communityId">
-                <el-select v-model="formData.communityId" >
+                <el-select v-model="formData.communityId">
                     <el-option v-for="(item, index) in communityArr" :key="index" :label="item.communityName" :value="item.id"></el-option>
                 </el-select>
             </template>
@@ -119,7 +119,11 @@ export default {
                 this.formData.buildingId = e.buildingId;
                 this.formData.unitName = e.unitName;
                 this.formData.houseId = e.houseId;
-                this.formData.address = ` ${e.buildingName} - ${e.unitName} - ${e.houseName}`;
+                if (!!e.unitName) {
+                    this.formData.address = ` ${e.buildingName} - ${e.unitName} - ${e.houseName}`;
+                } else {
+                    this.formData.address = ` ${e.buildingName} - ${e.houseName}`;
+                }
             });
         },
         submit() {
@@ -139,6 +143,8 @@ export default {
                             this.$message.success(msg);
                             this.params.callback();
                             this.$emit('close');
+                        } else {
+                            this.$message.error(msg);
                         }
                         loading.close();
                     })

+ 2 - 0
operationSupport/src/views/deviceManagement/popups/addType.vue

@@ -59,6 +59,8 @@ export default {
                             this.$message.success(msg);
                             this.params.callback && this.params.callback();
                             this.$emit('close');
+                        }else {
+                            this.$message.error(msg);
                         }
                         loading.close();
                     })

+ 9 - 6
operationSupport/src/views/deviceManagement/popups/poptreeSelect.vue

@@ -29,6 +29,7 @@ export default {
     mounted() {},
     methods: {
         submit() {
+                        debugger;
             if (this.unitPa.type === 'room') {
                 this.params.callback && this.params.callback(this.unitPa);
                 this.$emit('close');
@@ -39,13 +40,15 @@ export default {
         },
         treeClick(e) {
             this.unitPa.type = e.type;
+            let newValueIds = e.id.split('-');
+            let thisObj = this.$refs.tenantstree.getNode(e);
             if (e.type == 'room') {
-                this.unitPa.buildingId = this.$refs.tenantstree.getNode(e).parent.parent.data.value;
-                this.unitPa.buildingName = this.$refs.tenantstree.getNode(e).parent.parent.data.name;
-                this.unitPa.unitId = this.$refs.tenantstree.getNode(e).parent.data.value;
-                this.unitPa.unitName = this.$refs.tenantstree.getNode(e).parent.data.name;
-                this.unitPa.houseId = e.value;
+                this.unitPa.buildingName = newValueIds.length == 4 ? thisObj.parent.parent.data.name : thisObj.parent.data.name;
+                this.unitPa.buildingId = newValueIds.length == 4 ? thisObj.parent.parent.data.value : thisObj.parent.data.value;
+                this.unitPa.unitName = newValueIds.length == 4 ? thisObj.parent.data.name : '';
+                this.unitPa.unitId = newValueIds.length == 4 ? thisObj.parent.data.value : '';
                 this.unitPa.houseName = e.name;
+                this.unitPa.houseId = e.value;
             }
         },
         dimension(arr) {
@@ -53,7 +56,7 @@ export default {
                 if (!!item.children & (item.type !== 'unit')) {
                     this.dimension(item.children);
                 } else {
-                    if (item.name.indexOf('单元') === -1) {
+                    if (item.name.indexOf('单元') === -1 && item.type === 'unit') {
                         item.name = item.name + '单元';
                     }
                 }

+ 6 - 4
operationSupport/src/views/ownerManagement/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="content main">
-        <organ-tree @organId="currentOrganId" v-if="!ownerStatus"></organ-tree>
+        <organ-tree @organId="currentOrganId" v-if="!ownerStatus" :buildingType="1"></organ-tree>
         <div class="content-right" v-if="!ownerStatus">
             <div class="search">
                 <el-input
@@ -65,7 +65,9 @@
             >
                 <template slot-scope="scope" slot="roomNumber">
                     <div class="table-list" v-for="(item, index) in scope.row.houseList" :key="index">
-                        {{ item.buildingName }}-{{ item.unitName.indexOf('单元') === -1 ? item.unitName + '单元' : item.unitName }}-{{ item.roomNumber }}
+                        {{ item.buildingName }}-{{ item.unitName.indexOf('单元') === -1 ? item.unitName + '单元' : item.unitName }}-{{
+                            item.roomNumber
+                        }}
                     </div>
                 </template>
                 <template slot-scope="scope" slot="householdType">
@@ -124,7 +126,7 @@ import addOwner from './stepPage/add.vue';
 import Index from '../../components/mapPopup/index.vue';
 export default {
     mixins: [list],
-    name:"ownerManagement",
+    name: 'ownerManagement',
     components: { addOwner, Index },
     data() {
         return {
@@ -361,7 +363,7 @@ export default {
                     this.mixins_query.buildingId = newValueIds[1];
                     this.mixins_query.unitName = newValueIds[2];
                 } else if (newValue.type === 'room') {
-                    this.mixins_query.roomNumber = newValueIds[3];
+                    this.mixins_query.roomNumber = newValueIds[newValueIds.length - 1];
                 }
             }
 

+ 3 - 2
operationSupport/src/views/ownerManagement/stepPage/add.vue

@@ -140,7 +140,7 @@
                     <div class="block-title">
                         <div class="floor list-title">
                             {{
-                                `${item.buildingName} ${item.unitName.indexOf('单元') !== -1 ? item.unitName : item.unitName + '单元'}${
+                                `${item.buildingName} ${item.unitName.indexOf('单元') !== -1 ? item.unitName : !!item.unitName?item.unitName + '单元':''}${
                                     item.roomNumber
                                 }`
                             }}
@@ -545,6 +545,7 @@ export default {
                     res.forEach((item, index) => {
                         let newObj = {};
                         if (num === 1) {
+                            debugger;
                             newObj = {
                                 checkInDate: '',
                                 householdType: 1,
@@ -653,7 +654,7 @@ export default {
                 if (!!item.children & (item.type !== 'unit')) {
                     this.dimension(item.children);
                 } else {
-                    if (item.name.indexOf('单元') === -1) {
+                    if (item.name.indexOf('单元') === -1 && item.type === 'unit') {
                         item.name = item.name + '单元';
                     }
                 }

+ 3 - 2
operationSupport/src/views/ownerManagement/stepPage/poptreeSelect.vue

@@ -32,6 +32,7 @@ export default {
             let combination = [];
             arrs.forEach((item, index) => {
                 let thisValue = this.$refs.tenantstree.getNode(item);
+                let newValueIds = thisValue.data.id.split('-');
                 let objArray = {};
                 if (
                     (item.children == null || item.children == undefined) &&
@@ -40,8 +41,8 @@ export default {
                     if (thisValue.data.type === 'room') {
                         objArray = {
                             houseId: thisValue.data.value,
-                            buildingName: thisValue.parent.parent.data.name,
-                            unitName: thisValue.parent.data.name,
+                            buildingName: newValueIds.length === 4 ? thisValue.parent.parent.data.name : thisValue.parent.data.name,
+                            unitName: newValueIds.length === 4 ? thisValue.parent.data.name : '',
                             roomNumber: thisValue.data.name
                         };
                     } else if (thisValue.data.type === 'parking') {