From 5bdaf416d66b675131004de1aba5d161772a52b0 Mon Sep 17 00:00:00 2001
From: liubp <1535785116@qq.com>
Date: 星期五, 19 十二月 2025 18:27:52 +0800
Subject: [PATCH] 添加所属小区字段

---
 public/pages/common/communityManage/add/add.js |   94 +++++++++++++++++++++++------------------------
 1 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/public/pages/common/communityManage/add/add.js b/public/pages/common/communityManage/add/add.js
index 292903a..43ee78d 100644
--- a/public/pages/common/communityManage/add/add.js
+++ b/public/pages/common/communityManage/add/add.js
@@ -122,7 +122,7 @@
             // 纭繚 vc.component 宸插畬鍏ㄥ垵濮嬪寲鍚庡啀璋冪敤
             let retryCount = 0;
             const maxRetries = 20; // 鏈�澶氶噸璇�20娆★紙绾�1绉掞級
-            const loadData = function() {
+            const loadData = function () {
                 if (vc.component && typeof vc.component._loadCommunityDetail === 'function') {
                     vc.component._loadCommunityDetail();
                 } else {
@@ -140,14 +140,14 @@
         _initEvent: function () {
             // 鍒濆鍖栨椂娣诲姞杈撳叆浜嬩欢鐩戝惉锛岃嚜鍔ㄧЩ闄ら敊璇牱寮�
             const $that = this;
-            setTimeout(function() {
+            setTimeout(function () {
                 // 涓烘墍鏈夎緭鍏ユ鍜岄�夋嫨妗嗘坊鍔犺緭鍏ヤ簨浠剁洃鍚�
                 const inputs = document.querySelectorAll('.community-add input, .community-add select');
-                inputs.forEach(function(input) {
-                    input.addEventListener('input', function() {
+                inputs.forEach(function (input) {
+                    input.addEventListener('input', function () {
                         $that.removeError(input.id);
                     });
-                    input.addEventListener('change', function() {
+                    input.addEventListener('change', function () {
                         $that.removeError(input.id);
                     });
                 });
@@ -155,33 +155,33 @@
         },
         methods: {
             // 娣诲姞閿欒鏍峰紡
-            addError: function(elementId) {
+            addError: function (elementId) {
                 const element = document.getElementById(elementId);
                 if (element) {
                     element.classList.add('error');
                 }
             },
             // 绉婚櫎閿欒鏍峰紡
-            removeError: function(elementId) {
+            removeError: function (elementId) {
                 const element = document.getElementById(elementId);
                 if (element) {
                     element.classList.remove('error');
                 }
             },
             // 娓呴櫎鎵�鏈夐敊璇牱寮�
-            clearAllErrors: function() {
+            clearAllErrors: function () {
                 const elements = document.querySelectorAll('.community-add input.error, .community-add select.error');
-                elements.forEach(function(element) {
+                elements.forEach(function (element) {
                     element.classList.remove('error');
                 });
             },
-            toBoolString: function(value, defaultValue) {
+            toBoolString: function (value, defaultValue) {
                 if (value === undefined || value === null) {
                     return defaultValue;
                 }
                 return value ? 'true' : 'false';
             },
-            chooseProvince: function(event) {
+            chooseProvince: function (event) {
                 const provCode = event.target.value;
                 vc.component.selectProv = provCode;
                 vc.component.selectCity = '';
@@ -190,7 +190,7 @@
                 vc.component.areas = [];
                 // 鏇存柊 formData 涓殑鐪佷唤鍚嶇О
                 if (vc.component.provs && vc.component.provs.length > 0) {
-                    vc.component.provs.forEach(function(_param) {
+                    vc.component.provs.forEach(function (_param) {
                         if (_param.areaCode == provCode) {
                             vc.component.selectProvName = _param.areaName;
                             vc.component.formData.projectAddressProvince = _param.areaName;
@@ -204,14 +204,14 @@
                     vc.component._initArea('202', provCode);
                 }
             },
-            chooseCity: function(event) {
+            chooseCity: function (event) {
                 const cityCode = event.target.value;
                 vc.component.selectCity = cityCode;
                 vc.component.selectArea = '';
                 vc.component.areas = [];
                 // 鏇存柊 formData 涓殑鍩庡競鍚嶇О
                 if (vc.component.citys && vc.component.citys.length > 0) {
-                    vc.component.citys.forEach(function(_param) {
+                    vc.component.citys.forEach(function (_param) {
                         if (_param.areaCode == cityCode) {
                             vc.component.selectCityName = _param.areaName;
                             vc.component.formData.projectAddressCity = _param.areaName;
@@ -224,25 +224,25 @@
                     vc.component._initArea('303', cityCode);
                 }
             },
-            chooseArea: function(event) {
+            chooseArea: function (event) {
                 const areaCode = event.target.value;
                 vc.component.selectArea = areaCode;
                 vc.component.formData.cityCode = areaCode;
                 vc.component.formData.areaAddress = '';
-                
+
                 // 鏇存柊 formData 涓殑鍖哄幙鍚嶇О
                 if (vc.component.areas && vc.component.areas.length > 0) {
-                    vc.component.areas.forEach(function(_param) {
+                    vc.component.areas.forEach(function (_param) {
                         if (_param.areaCode == areaCode) {
                             vc.component.selectAreaName = _param.areaName;
                             vc.component.formData.projectAddressDistrict = _param.areaName;
                         }
                     });
                 }
-                
+
                 // 鏋勫缓鍖哄煙鍦板潃
                 if (vc.component.provs && vc.component.provs.length > 0) {
-                    vc.component.provs.forEach(function(_param) {
+                    vc.component.provs.forEach(function (_param) {
                         if (_param.areaCode == vc.component.selectProv) {
                             vc.component.selectProvName = _param.areaName;
                             vc.component.formData.areaAddress = _param.areaName;
@@ -250,7 +250,7 @@
                     });
                 }
                 if (vc.component.citys && vc.component.citys.length > 0) {
-                    vc.component.citys.forEach(function(_param) {
+                    vc.component.citys.forEach(function (_param) {
                         if (_param.areaCode == vc.component.selectCity) {
                             vc.component.selectCityName = _param.areaName;
                             if (vc.component.formData.areaAddress) {
@@ -262,7 +262,7 @@
                     });
                 }
                 if (vc.component.areas && vc.component.areas.length > 0) {
-                    vc.component.areas.forEach(function(_param) {
+                    vc.component.areas.forEach(function (_param) {
                         if (_param.areaCode == vc.component.selectArea) {
                             vc.component.selectAreaName = _param.areaName;
                             if (vc.component.formData.areaAddress) {
@@ -274,7 +274,7 @@
                     });
                 }
             },
-            _initArea: function(_areaLevel, _parentAreaCode) {
+            _initArea: function (_areaLevel, _parentAreaCode) {
                 var _param = {
                     params: {
                         areaLevel: _areaLevel,
@@ -291,7 +291,7 @@
                                 // 濉厖鐪佷唤涓嬫媺妗�
                                 const provinceSelect = document.getElementById('province');
                                 if (provinceSelect) {
-                                    _tmpAreas.forEach(function(item) {
+                                    _tmpAreas.forEach(function (item) {
                                         const option = document.createElement('option');
                                         option.value = item.areaCode;
                                         option.textContent = item.areaName;
@@ -304,7 +304,7 @@
                                 const citySelect = document.getElementById('city');
                                 if (citySelect) {
                                     citySelect.innerHTML = '<option value="">璇烽�夋嫨甯�</option>';
-                                    _tmpAreas.forEach(function(item) {
+                                    _tmpAreas.forEach(function (item) {
                                         const option = document.createElement('option');
                                         option.value = item.areaCode;
                                         option.textContent = item.areaName;
@@ -317,7 +317,7 @@
                                 const areaSelect = document.getElementById('area');
                                 if (areaSelect) {
                                     areaSelect.innerHTML = '<option value="">璇烽�夋嫨鍖�</option>';
-                                    _tmpAreas.forEach(function(item) {
+                                    _tmpAreas.forEach(function (item) {
                                         const option = document.createElement('option');
                                         option.value = item.areaCode;
                                         option.textContent = item.areaName;
@@ -338,7 +338,7 @@
                     return {};
                 }
                 return {
-                    communityId: info.communityId || info.communityId || '',
+                    communityId: info.communityId || '',
                     newBId: info.newBId || '',
                     feePrice: info.feePrice || '',
                     projectAddressProvince: info.projectAddressProvince || info.provinceName || '',
@@ -393,7 +393,7 @@
                     groundNonMotorVehicleArea: info.groundNonMotorVehicleArea || info.nonElectricCarGroundArea || '',
                     undergroundNonMotorVehicleArea: info.undergroundNonMotorVehicleArea || info.nonElectricCarUndergroundArea || '',
                     clubhouseArea: info.clubhouseArea || info.clubArea || '',
-                    hasDecorationRubbishPoint: vc.component.toBoolString(info.hasDecorationRubbishPoint, info.garbageFixed ? 'true' : 'false'),
+                    hasDecorationRubbishPoint: info.hasDecorationRubbishPoint === '鏄�' || info.garbageFixed == 1 ? '鏄�' : '鍚�',
                     securityEntranceCount: info.securityEntranceCount || info.gateGuardTotal || '',
                     elevatorCount: info.elevatorCount || info.elevatorTotal || '',
                     elevatorType: info.elevatorType || '',
@@ -435,17 +435,17 @@
                 }
                 const $that = this;
                 const formData = vc.component.formData;
-                
+
                 // 娓呴櫎涔嬪墠鐨勯敊璇牱寮�
                 vc.component.clearAllErrors();
-                
+
                 // 楠岃瘉蹇呭~瀛楁
                 if (!formData.name || formData.name.trim() === '') {
                     vc.toast('璇疯緭鍏ュ皬鍖哄悕绉�');
                     vc.component.addError('input-name');
                     return;
                 }
-                
+
                 // 鏋勫缓璇︾粏鍦板潃
                 const addressParts = [];
                 if (formData.projectAddressTown) {
@@ -455,7 +455,7 @@
                     addressParts.push(formData.projectAddressRoad);
                 }
                 const address = addressParts.join(' ') || '';
-                
+
                 if (!address || address.trim() === '') {
                     vc.toast('璇疯緭鍏ヨ缁嗗湴鍧�');
                     if (!formData.projectAddressTown || formData.projectAddressTown.trim() === '') {
@@ -466,7 +466,7 @@
                     }
                     return;
                 }
-                
+
                 // 鏋勫缓鍖哄煙鍦板潃
                 let areaAddress = formData.areaAddress || '';
                 // 濡傛灉 areaAddress 涓虹┖锛屽皾璇曚粠鐪佸競鍖哄悕绉版瀯寤�
@@ -489,7 +489,7 @@
                     }
                     areaAddress = areaParts.join('');
                 }
-                
+
                 if (!areaAddress || areaAddress.trim() === '') {
                     vc.toast('璇烽�夋嫨鎵�鍦ㄥ煄甯�');
                     if (!vc.component.selectProv) {
@@ -503,7 +503,7 @@
                     }
                     return;
                 }
-                
+
                 // 楠岃瘉鍖哄煙缂栫爜锛堝繀椤婚�夋嫨鍒板尯鍘跨骇鍒級
                 const cityCode = formData.cityCode || vc.component.selectArea || '';
                 if (!cityCode || cityCode.trim() === '') {
@@ -519,7 +519,7 @@
                     }
                     return;
                 }
-                
+
                 // 楠岃瘉鑱旂郴鐢佃瘽锛堜娇鐢ㄧ墿涓氳仈绯讳汉鐢佃瘽鎴栨姤淇數璇濓級
                 const tel = formData.propertyManagerPhone || formData.dayRepairPhone || '';
                 if (!tel || tel.trim() === '') {
@@ -529,13 +529,13 @@
                         vc.component.addError('input-phone');
                     }
                     // 濡傛灉鐗╀笟鑱旂郴浜虹數璇濅负绌猴紝涓旀棩闂寸數璇濅篃涓虹┖锛屽垯涔熸爣璁版棩闂寸數璇�
-                    if ((!formData.propertyManagerPhone || formData.propertyManagerPhone.trim() === '') && 
+                    if ((!formData.propertyManagerPhone || formData.propertyManagerPhone.trim() === '') &&
                         (!formData.dayRepairPhone || formData.dayRepairPhone.trim() === '')) {
                         vc.component.addError('input-day-phone');
                     }
                     return;
                 }
-                
+
                 // 鐘舵�佹槧灏勶細statusCd (1=姝e父, 2=鏆傚仠, 3=娉ㄩ攢) -> state (鐘舵�佺紪鐮�)
                 let state = '1100'; // 榛樿姝e父鐘舵��
                 if (formData.statusCd === '1') {
@@ -545,7 +545,7 @@
                 } else if (formData.statusCd === '3') {
                     state = '1300'; // 娉ㄩ攢锛堝亣璁剧紪鐮侊級
                 }
-                
+
                 // 鏋勫缓鎻愪氦鏁版嵁
                 const submitData = {
                     // 鍩虹鍙傛暟 - 蹇呭~
@@ -555,7 +555,7 @@
                     tel: tel,
                     cityCode: cityCode,
                     state: state,
-                    
+
                     // 鍩虹鍙傛暟 - 鍙��
                     tmpAddress: formData.tmpAddress || '',
                     nearbyLandmarks: formData.nearbyLandmarks || '',
@@ -568,7 +568,7 @@
                     communityId: formData.communityId || '',
                     communityCode: formData.communityCode || '',
                     communityArea: formData.communityArea || '',
-                    
+
                     // 椤圭洰鎵╁睍鍙傛暟
                     projectAddressProvince: formData.projectAddressProvince || '',
                     projectAddressCity: formData.projectAddressCity || '',
@@ -622,7 +622,6 @@
                     groundNonMotorVehicleArea: formData.groundNonMotorVehicleArea || '',
                     undergroundNonMotorVehicleArea: formData.undergroundNonMotorVehicleArea || '',
                     clubhouseArea: formData.clubhouseArea || '',
-                    hasDecorationRubbishPoint: formData.hasDecorationRubbishPoint || '',
                     securityEntranceCount: formData.securityEntranceCount || '',
                     elevatorCount: formData.elevatorCount || '',
                     elevatorType: formData.elevatorType || '',
@@ -650,11 +649,11 @@
                     multilayerVillaBuildingCount: formData.multilayerVillaBuildingCount || '',
                     residentialHouseholdCount: formData.residentialHouseholdCount || '',
                     shopHouseholdCount: formData.shopHouseholdCount || '',
-                    
+
                     // 鎵╁睍灞炴��
                     attrs: formData.attrs || []
                 };
-                
+
                 // 杞崲鏁板瓧瀛楁
                 const numberFields = [
                     'fireHydrantCount', 'fireChannelCount', 'waterTankCount', 'reservoirCount',
@@ -665,23 +664,22 @@
                     'barrierGateCount', 'waterPumpCount', 'groundParkingSpaces', 'undergroundParkingSpaces',
                     'totalBuildingCount', 'buildingUnitCount', 'highRiseBuildingCount',
                     'multilayerVillaBuildingCount', 'residentialHouseholdCount', 'shopHouseholdCount',
-                    'payFeeMonth', 'hasManagerCertificate', 'hasDecorationRubbishPoint'
+                    'payFeeMonth', 'hasManagerCertificate'
                 ];
                 numberFields.forEach(field => {
                     if (submitData[field] !== '' && submitData[field] !== null && submitData[field] !== undefined) {
                         submitData[field] = Number(submitData[field]);
-                    } else if (field === 'hasManagerCertificate' || field === 'hasDecorationRubbishPoint') {
+                    } else if (field === 'hasManagerCertificate') {
                         submitData[field] = 0;
                     }
                 });
-                
                 // 杞崲Decimal瀛楁
                 const decimalFields = [
                     'feePrice', 'projectLandArea', 'totalConstructionArea', 'chargeableTotalArea',
                     'chargeableAreaMultilayer', 'chargeableAreaHighRise1', 'chargeableAreaHighRiseUp',
                     'chargeableAreaShop', 'chargeableAreaVilla', 'chargeableAreaOffice',
                     'chargeableAreaCommercialHouse', 'greenArea', 'groundNonMechanicalFee',
-                    'garageNonMechanicalFee', 'temporaryHourlyFee', 'temporaryDailyFee', 
+                    'garageNonMechanicalFee', 'temporaryHourlyFee', 'temporaryDailyFee',
                     'temporaryPerTimeFee', 'communityArea'
                 ];
                 decimalFields.forEach(field => {
@@ -691,7 +689,7 @@
                         submitData[field] = 0;
                     }
                 });
-                
+
                 // 娓呯悊绌哄瓧绗︿覆瀛楁锛岃浆鎹负null鎴栧垹闄�
                 Object.keys(submitData).forEach(key => {
                     if (submitData[key] === '') {

--
Gitblit v1.8.0