浏览代码

单元楼栋补全

Shannon_mu 3 年之前
父节点
当前提交
cddf57f0e7

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

@@ -72,9 +72,7 @@ export default {
                 if (!!item.children & (item.type !== 'unit')) {
                     this.dimension(item.children);
                 } else {
-                    if (item.name.indexOf('单元') === -1 && item.type === 'unit') {
-                        item.name = item.name + '单元';
-                    }
+                    item.name = this.CheckChinese(item.name, type == 'unit' ? '单元' : '楼栋');
                 }
             });
         },
@@ -132,6 +130,14 @@ export default {
             } else {
                 this.$emit('buildingInformation', e);
             }
+        },
+        CheckChinese(val, name) {
+            var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
+            let newVal = val;
+            if (!reg.test(val)) {
+                newVal = val + name;
+            }
+            return newVal;
         }
     },
     created() {

+ 9 - 3
operationSupport/src/views/ownerManagement/index.vue

@@ -65,9 +65,7 @@
             >
                 <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 }}-{{ CheckChinese(item.unitName, '单元') }}-{{ item.roomNumber }}
                     </div>
                 </template>
                 <template slot-scope="scope" slot="householdType">
@@ -348,6 +346,14 @@ export default {
                     }
                 }
             });
+        },
+        CheckChinese(val, name) {
+            var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
+            let newVal = val;
+            if (!reg.test(val)) {
+                newVal = val + name;
+            }
+            return newVal;
         }
     },
     watch: {

+ 21 - 6
operationSupport/src/views/ownerManagement/stepPage/newAdd.vue

@@ -132,7 +132,7 @@
                         <!-- 添加编辑 -->
                         <template>
                             <template slot="householdType">
-                                <el-select v-model="item.householdType" clearable>
+                                <el-select v-model="item.householdType" clearable @change="householdTypeHide(item)">
                                     <el-option
                                         v-for="(item, index) in householdTypeArray"
                                         :key="index"
@@ -495,7 +495,7 @@ export default {
                     height: '400px',
                     props: {
                         num: 1,
-                        list: this.formData.houseList,
+                        list: this.formData.houseList || [],
                         tenantsTree: this.communityArr,
                         callback: resolve
                     },
@@ -525,6 +525,10 @@ export default {
             });
         },
         addCard(itemObj) {
+            if (itemObj.householdType !== 1) {
+                this.$message.error('只能业主才能绑定车位');
+                return;
+            }
             new Promise((resolve) => {
                 this.$store.dispatch('addPopup', {
                     url: '/ownerManagement/stepPage/poptreeSelect.vue',
@@ -532,7 +536,7 @@ export default {
                     height: '400px',
                     props: {
                         num: 2,
-                        list: itemObj.parkingList,
+                        list: itemObj.parkingList || [],
                         tenantsTree: this.garageArr,
                         callback: resolve
                     },
@@ -617,11 +621,22 @@ export default {
                 if (!!item.children & (item.type !== 'unit')) {
                     this.dimension(item.children);
                 } else {
-                    if (item.name.indexOf('单元') === -1 && item.type === 'unit') {
-                        item.name = item.name + '单元';
-                    }
+                    item.name = this.CheckChinese(item.name, type == 'unit' ? '单元' : '楼栋');
                 }
             });
+        },
+        CheckChinese(val, name) {
+            var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
+            let newVal = val;
+            if (!reg.test(val)) {
+                newVal = val + name;
+            }
+            return newVal;
+        },
+        householdTypeHide(item) {
+            if (item.householdType !== 1) {
+                item.parkingList = [];
+            }
         }
     }
 };