liubp
2025-12-19 5bdaf416d66b675131004de1aba5d161772a52b0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
 
(function (vc) {
    vc.extends({
        data: {
            formData: {
                communityId: '',
                statusCd: '1',
                newBId: '',
                feePrice: '',
                projectAddressProvince: '',
                projectAddressCity: '',
                projectAddressDistrict: '',
                address: '',
                projectAddressTown: '',
                projectAddressRoad: '',
                houseCompletionDate: '',
                projectNature: '',
                projectType: '',
                projectLandArea: '',
                totalConstructionArea: '',
                chargeableTotalArea: '',
                chargeableAreaMultilayer: '',
                chargeableAreaHighRise1: '',
                chargeableAreaHighRiseUp: '',
                chargeableAreaShop: '',
                chargeableAreaVilla: '',
                chargeableAreaOffice: '',
                chargeableAreaCommercialHouse: '',
                greenArea: '',
                areaDetails: '',
                propertyManagementAddress: '',
                propertyManagerName: '',
                propertyManagerPhone: '',
                propertyRoomArea: '',
                publicArea: '',
                dayRepairPhone: '',
                nightRepairPhone: '',
                projectManager: '',
                hasManagerCertificate: '',
                certificateName: '',
                managerCertificateNo: '',
                managerPhone: '',
                neighborhoodCommitteeName: '',
                neighborhoodCommitteeAddress: '',
                neighborhoodSecretary: '',
                neighborhoodOfficePhone: '',
                secretaryPhone: '',
                ownersCommitteeAddress: '',
                ownersCommitteeChairman: '',
                chairmanPhone: '',
                fireHydrantCount: '',
                fireChannelCount: '',
                waterTankCount: '',
                reservoirCount: '',
                totalMotorVehicleSpaces: '',
                groundMotorVehicleSpaces: '',
                undergroundMotorVehicleSpaces: '',
                newEnergyChargingPiles: '',
                nonMotorVehicleChargingPoints: '',
                groundNonMotorVehicleArea: '',
                undergroundNonMotorVehicleArea: '',
                clubhouseArea: '',
                hasDecorationRubbishPoint: '',
                securityEntranceCount: '',
                elevatorCount: '',
                elevatorType: '',
                elevatorInstallDate: '',
                elevatorServiceLife: '',
                elevatorBrand1: '',
                elevatorBrand2: '',
                monitorCount: '',
                monitorMaintenanceCompany: '',
                barrierGateCount: '',
                barrierGateBrand: '',
                barrierSupplierContact: '',
                barrierSupplierPhone: '',
                waterPumpCount: '',
                groundParkingSpaces: '',
                undergroundParkingSpaces: '',
                groundNonMechanicalFee: '',
                garageNonMechanicalFee: '',
                temporaryHourlyFee: '',
                temporaryDailyFee: '',
                temporaryPerTimeFee: '',
                totalBuildingCount: '',
                buildingUnitCount: '',
                highRiseBuildingCount: '',
                multilayerVillaBuildingCount: '',
                residentialHouseholdCount: '',
                shopHouseholdCount: '',
                entryDate: '',
                exitDate: '',
                name: '',
                communityCode: '',
                cityCode: '',
                areaAddress: '',
                tel: '',
                tmpAddress: '',
                nearbyLandmarks: '',
                mapX: '',
                mapY: '',
                payFeeMonth: 12,
                takeTime: '',
                outTime: '',
                state: '1100',
                communityArea: '',
                attrs: []
            },
            provs: [],
            citys: [],
            areas: [],
            selectProv: '',
            selectCity: '',
            selectArea: '',
            selectProvName: '',
            selectCityName: '',
            selectAreaName: ''
        },
        _initMethod: function () {
            // 初始化省份列表
            vc.component._initArea('101', '0');
            // 确保 vc.component 已完全初始化后再调用
            let retryCount = 0;
            const maxRetries = 20; // 最多重试20次(约1秒)
            const loadData = function () {
                if (vc.component && typeof vc.component._loadCommunityDetail === 'function') {
                    vc.component._loadCommunityDetail();
                } else {
                    retryCount++;
                    if (retryCount >= maxRetries) {
                        console.error('无法找到 _loadCommunityDetail 方法,已重试', maxRetries, '次');
                        return;
                    }
                    // 如果还未初始化,等待一下再试
                    setTimeout(loadData, 50);
                }
            };
            loadData();
        },
        _initEvent: function () {
            // 初始化时添加输入事件监听,自动移除错误样式
            const $that = this;
            setTimeout(function () {
                // 为所有输入框和选择框添加输入事件监听
                const inputs = document.querySelectorAll('.community-add input, .community-add select');
                inputs.forEach(function (input) {
                    input.addEventListener('input', function () {
                        $that.removeError(input.id);
                    });
                    input.addEventListener('change', function () {
                        $that.removeError(input.id);
                    });
                });
            }, 100);
        },
        methods: {
            // 添加错误样式
            addError: function (elementId) {
                const element = document.getElementById(elementId);
                if (element) {
                    element.classList.add('error');
                }
            },
            // 移除错误样式
            removeError: function (elementId) {
                const element = document.getElementById(elementId);
                if (element) {
                    element.classList.remove('error');
                }
            },
            // 清除所有错误样式
            clearAllErrors: function () {
                const elements = document.querySelectorAll('.community-add input.error, .community-add select.error');
                elements.forEach(function (element) {
                    element.classList.remove('error');
                });
            },
            toBoolString: function (value, defaultValue) {
                if (value === undefined || value === null) {
                    return defaultValue;
                }
                return value ? 'true' : 'false';
            },
            chooseProvince: function (event) {
                const provCode = event.target.value;
                vc.component.selectProv = provCode;
                vc.component.selectCity = '';
                vc.component.selectArea = '';
                vc.component.citys = [];
                vc.component.areas = [];
                // 更新 formData 中的省份名称
                if (vc.component.provs && vc.component.provs.length > 0) {
                    vc.component.provs.forEach(function (_param) {
                        if (_param.areaCode == provCode) {
                            vc.component.selectProvName = _param.areaName;
                            vc.component.formData.projectAddressProvince = _param.areaName;
                        }
                    });
                }
                // 清空城市和区县
                vc.component.formData.projectAddressCity = '';
                vc.component.formData.projectAddressDistrict = '';
                if (provCode) {
                    vc.component._initArea('202', provCode);
                }
            },
            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) {
                        if (_param.areaCode == cityCode) {
                            vc.component.selectCityName = _param.areaName;
                            vc.component.formData.projectAddressCity = _param.areaName;
                        }
                    });
                }
                // 清空区县
                vc.component.formData.projectAddressDistrict = '';
                if (cityCode) {
                    vc.component._initArea('303', cityCode);
                }
            },
            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) {
                        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) {
                        if (_param.areaCode == vc.component.selectProv) {
                            vc.component.selectProvName = _param.areaName;
                            vc.component.formData.areaAddress = _param.areaName;
                        }
                    });
                }
                if (vc.component.citys && vc.component.citys.length > 0) {
                    vc.component.citys.forEach(function (_param) {
                        if (_param.areaCode == vc.component.selectCity) {
                            vc.component.selectCityName = _param.areaName;
                            if (vc.component.formData.areaAddress) {
                                vc.component.formData.areaAddress += _param.areaName;
                            } else {
                                vc.component.formData.areaAddress = _param.areaName;
                            }
                        }
                    });
                }
                if (vc.component.areas && vc.component.areas.length > 0) {
                    vc.component.areas.forEach(function (_param) {
                        if (_param.areaCode == vc.component.selectArea) {
                            vc.component.selectAreaName = _param.areaName;
                            if (vc.component.formData.areaAddress) {
                                vc.component.formData.areaAddress += _param.areaName;
                            } else {
                                vc.component.formData.areaAddress = _param.areaName;
                            }
                        }
                    });
                }
            },
            _initArea: function (_areaLevel, _parentAreaCode) {
                var _param = {
                    params: {
                        areaLevel: _areaLevel,
                        parentAreaCode: _parentAreaCode
                    }
                };
                vc.http.apiGet('/area.listAreas',
                    _param,
                    function (json, res) {
                        if (res.status == 200) {
                            var _tmpAreas = JSON.parse(json).areas;
                            if (_areaLevel == '101') {
                                vc.component.provs = _tmpAreas;
                                // 填充省份下拉框
                                const provinceSelect = document.getElementById('province');
                                if (provinceSelect) {
                                    _tmpAreas.forEach(function (item) {
                                        const option = document.createElement('option');
                                        option.value = item.areaCode;
                                        option.textContent = item.areaName;
                                        provinceSelect.appendChild(option);
                                    });
                                }
                            } else if (_areaLevel == '202') {
                                vc.component.citys = _tmpAreas;
                                // 填充城市下拉框
                                const citySelect = document.getElementById('city');
                                if (citySelect) {
                                    citySelect.innerHTML = '<option value="">请选择市</option>';
                                    _tmpAreas.forEach(function (item) {
                                        const option = document.createElement('option');
                                        option.value = item.areaCode;
                                        option.textContent = item.areaName;
                                        citySelect.appendChild(option);
                                    });
                                }
                            } else {
                                vc.component.areas = _tmpAreas;
                                // 填充区县下拉框
                                const areaSelect = document.getElementById('area');
                                if (areaSelect) {
                                    areaSelect.innerHTML = '<option value="">请选择区</option>';
                                    _tmpAreas.forEach(function (item) {
                                        const option = document.createElement('option');
                                        option.value = item.areaCode;
                                        option.textContent = item.areaName;
                                        areaSelect.appendChild(option);
                                    });
                                }
                            }
                            return;
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理', errInfo);
                        vc.toast("查询地区失败");
                    });
            },
            _formatCommunityData: function (info) {
                if (!info) {
                    return {};
                }
                return {
                    communityId: info.communityId || '',
                    newBId: info.newBId || '',
                    feePrice: info.feePrice || '',
                    projectAddressProvince: info.projectAddressProvince || info.provinceName || '',
                    projectAddressCity: info.projectAddressCity || info.cityName || '',
                    projectAddressDistrict: info.projectAddressDistrict || info.areaName || '',
                    projectAddressTown: info.projectAddressTown || '',
                    projectAddressRoad: info.projectAddressRoad || '',
                    address: [info.projectAddressTown, info.projectAddressRoad].filter(Boolean).join(' ') || info.communityAddress || '',
                    nearbyLandmarks: '1',
                    houseCompletionDate: info.houseCompletionDate || info.completionDate || '',
                    projectNature: info.projectNature || info.propertyType || '',
                    projectType: info.projectType || info.communityType || '',
                    projectLandArea: info.projectLandArea || info.area || '',
                    totalConstructionArea: info.totalConstructionArea || info.totalArea || '',
                    chargeableTotalArea: info.chargeableTotalArea || info.chargeableArea || '',
                    chargeableAreaMultilayer: info.chargeableAreaMultilayer || info.multiStoreyArea || '',
                    chargeableAreaHighRise1: info.chargeableAreaHighRise1 || info.highStoreyArea1 || '',
                    chargeableAreaHighRiseUp: info.chargeableAreaHighRiseUp || info.highStoreyArea2 || '',
                    chargeableAreaShop: info.chargeableAreaShop || info.commercialArea || '',
                    chargeableAreaVilla: info.chargeableAreaVilla || info.villaArea || '',
                    chargeableAreaOffice: info.chargeableAreaOffice || info.officeArea || '',
                    chargeableAreaCommercialHouse: info.chargeableAreaCommercialHouse || '',
                    greenArea: info.greenArea || '',
                    areaDetails: info.areaDetails || '',
                    propertyManagementAddress: info.propertyManagementAddress || info.managementAddress || '',
                    propertyManagerName: info.propertyManagerName || info.managementContactName || '',
                    propertyManagerPhone: info.propertyManagerPhone || info.managementContactTel || '',
                    dayRepairPhone: info.dayRepairPhone || info.managementContactDayTel || '',
                    nightRepairPhone: info.nightRepairPhone || info.managementContactNightTel || '',
                    projectManager: info.projectManager || info.managerName || '',
                    hasManagerCertificate: toBoolString(info.hasManagerCertificate, info.managerCert ? 'true' : 'false'),
                    certificateName: info.certificateName || info.managerCertName || '',
                    managerCertificateNo: info.managerCertificateNo || info.managerCertNo || '',
                    managerPhone: info.managerPhone || info.managerTel || '',
                    neighborhoodCommitteeName: info.neighborhoodCommitteeName || info.committeeName || '',
                    neighborhoodCommitteeAddress: info.neighborhoodCommitteeAddress || info.committeeAddress || '',
                    neighborhoodSecretary: info.neighborhoodSecretary || info.committeeSecretaryName || '',
                    neighborhoodOfficePhone: info.neighborhoodOfficePhone || info.committeeOfficeTel || '',
                    secretaryPhone: info.secretaryPhone || info.committeeSecretaryTel || '',
                    ownersCommitteeAddress: info.ownersCommitteeAddress || '',
                    ownersCommitteeChairman: info.ownersCommitteeChairman || info.committeeChairmanName || '',
                    chairmanPhone: info.chairmanPhone || info.committeeChairmanTel || '',
                    fireHydrantCount: info.fireHydrantCount || info.fireSprinklerTotal || '',
                    fireChannelCount: info.fireChannelCount || info.fireChannelTotal || '',
                    waterTankCount: info.waterTankCount || info.waterTankTotal || '',
                    reservoirCount: info.reservoirCount || info.waterPoolTotal || '',
                    totalMotorVehicleSpaces: info.totalMotorVehicleSpaces || info.carTotal || '',
                    groundMotorVehicleSpaces: info.groundMotorVehicleSpaces || info.groundParkingSpaces || info.carGroundTotal || '',
                    undergroundMotorVehicleSpaces: info.undergroundMotorVehicleSpaces || info.undergroundParkingSpaces || info.carUndergroundTotal || '',
                    newEnergyChargingPiles: info.newEnergyChargingPiles || info.electricCarTotal || '',
                    nonMotorVehicleChargingPoints: info.nonMotorVehicleChargingPoints || info.nonElectricCarTotal || '',
                    groundNonMotorVehicleArea: info.groundNonMotorVehicleArea || info.nonElectricCarGroundArea || '',
                    undergroundNonMotorVehicleArea: info.undergroundNonMotorVehicleArea || info.nonElectricCarUndergroundArea || '',
                    clubhouseArea: info.clubhouseArea || info.clubArea || '',
                    hasDecorationRubbishPoint: info.hasDecorationRubbishPoint === '是' || info.garbageFixed == 1 ? '是' : '否',
                    securityEntranceCount: info.securityEntranceCount || info.gateGuardTotal || '',
                    elevatorCount: info.elevatorCount || info.elevatorTotal || '',
                    elevatorType: info.elevatorType || '',
                    elevatorInstallDate: info.elevatorInstallDate || '',
                    elevatorServiceLife: info.elevatorServiceLife || info.elevatorUseYears || '',
                    elevatorBrand1: info.elevatorBrand1 || '',
                    elevatorBrand2: info.elevatorBrand2 || '',
                    monitorCount: info.monitorCount || info.monitorTotal || '',
                    monitorMaintenanceCompany: info.monitorMaintenanceCompany || info.monitorMaintenanceUnit || '',
                    barrierGateCount: info.barrierGateCount || info.gateTotal || '',
                    barrierGateBrand: info.barrierGateBrand || info.gateBrand || '',
                    barrierSupplierContact: info.barrierSupplierContact || info.gateSupplierContactName || '',
                    barrierSupplierPhone: info.barrierSupplierPhone || info.gateSupplierContactTel || '',
                    waterPumpCount: info.waterPumpCount || info.pumpTotal || '',
                    groundParkingSpaces: info.groundParkingSpaces || '',
                    undergroundParkingSpaces: info.undergroundParkingSpaces || '',
                    groundNonMechanicalFee: info.groundNonMechanicalFee || '',
                    garageNonMechanicalFee: info.garageNonMechanicalFee || '',
                    temporaryHourlyFee: info.temporaryHourlyFee || info.hourlyFee || '',
                    temporaryDailyFee: info.temporaryDailyFee || info.dailyFee || '',
                    temporaryPerTimeFee: info.temporaryPerTimeFee || info.onceFee || '',
                    totalBuildingCount: info.totalBuildingCount || info.naturalBuildingTotal || '',
                    buildingUnitCount: info.buildingUnitCount || info.doorBuildingTotal || '',
                    highRiseBuildingCount: info.highRiseBuildingCount || info.highBuildingTotal || '',
                    multilayerVillaBuildingCount: info.multilayerVillaBuildingCount || info.lowBuildingTotal || '',
                    residentialHouseholdCount: info.residentialHouseholdCount || info.residentialHousehold || '',
                    shopHouseholdCount: info.shopHouseholdCount || info.commercialHousehold || '',
                    entryDate: info.entryDate || '',
                    exitDate: info.exitDate || '',
                    name: info.communityName || info.name || '',
                    communityCode: info.communityCode || info.code || '',
                };
            },
            submit: function (event) {
                // 阻止表单默认提交行为
                if (event) {
                    event.preventDefault();
                    event.stopPropagation();
                }
                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) {
                    addressParts.push(formData.projectAddressTown);
                }
                if (formData.projectAddressRoad) {
                    addressParts.push(formData.projectAddressRoad);
                }
                const address = addressParts.join(' ') || '';
 
                if (!address || address.trim() === '') {
                    vc.toast('请输入详细地址');
                    if (!formData.projectAddressTown || formData.projectAddressTown.trim() === '') {
                        vc.component.addError('input-town');
                    }
                    if (!formData.projectAddressRoad || formData.projectAddressRoad.trim() === '') {
                        vc.component.addError('input-road');
                    }
                    return;
                }
 
                // 构建区域地址
                let areaAddress = formData.areaAddress || '';
                // 如果 areaAddress 为空,尝试从省市区名称构建
                if (!areaAddress || areaAddress.trim() === '') {
                    const areaParts = [];
                    if (vc.component.selectProvName) {
                        areaParts.push(vc.component.selectProvName);
                    } else if (formData.projectAddressProvince) {
                        areaParts.push(formData.projectAddressProvince);
                    }
                    if (vc.component.selectCityName) {
                        areaParts.push(vc.component.selectCityName);
                    } else if (formData.projectAddressCity) {
                        areaParts.push(formData.projectAddressCity);
                    }
                    if (vc.component.selectAreaName) {
                        areaParts.push(vc.component.selectAreaName);
                    } else if (formData.projectAddressDistrict) {
                        areaParts.push(formData.projectAddressDistrict);
                    }
                    areaAddress = areaParts.join('');
                }
 
                if (!areaAddress || areaAddress.trim() === '') {
                    vc.toast('请选择所在城市');
                    if (!vc.component.selectProv) {
                        vc.component.addError('province');
                    }
                    if (!vc.component.selectCity) {
                        vc.component.addError('city');
                    }
                    if (!vc.component.selectArea) {
                        vc.component.addError('area');
                    }
                    return;
                }
 
                // 验证区域编码(必须选择到区县级别)
                const cityCode = formData.cityCode || vc.component.selectArea || '';
                if (!cityCode || cityCode.trim() === '') {
                    vc.toast('请选择所在区域(需选择到区县)');
                    if (!vc.component.selectProv) {
                        vc.component.addError('province');
                    }
                    if (!vc.component.selectCity) {
                        vc.component.addError('city');
                    }
                    if (!vc.component.selectArea) {
                        vc.component.addError('area');
                    }
                    return;
                }
 
                // 验证联系电话(使用物业联系人电话或报修电话)
                const tel = formData.propertyManagerPhone || formData.dayRepairPhone || '';
                if (!tel || tel.trim() === '') {
                    vc.toast('请输入联系电话');
                    // 优先标记物业联系人电话,如果为空则标记日间电话
                    if (!formData.propertyManagerPhone || formData.propertyManagerPhone.trim() === '') {
                        vc.component.addError('input-phone');
                    }
                    // 如果物业联系人电话为空,且日间电话也为空,则也标记日间电话
                    if ((!formData.propertyManagerPhone || formData.propertyManagerPhone.trim() === '') &&
                        (!formData.dayRepairPhone || formData.dayRepairPhone.trim() === '')) {
                        vc.component.addError('input-day-phone');
                    }
                    return;
                }
 
                // 状态映射:statusCd (1=正常, 2=暂停, 3=注销) -> state (状态编码)
                let state = '1100'; // 默认正常状态
                if (formData.statusCd === '1') {
                    state = '1100'; // 正常
                } else if (formData.statusCd === '2') {
                    state = '1200'; // 暂停(假设编码)
                } else if (formData.statusCd === '3') {
                    state = '1300'; // 注销(假设编码)
                }
 
                // 构建提交数据
                const submitData = {
                    // 基础参数 - 必填
                    name: formData.name,
                    address: address,
                    areaAddress: areaAddress,
                    tel: tel,
                    cityCode: cityCode,
                    state: state,
 
                    // 基础参数 - 可选
                    tmpAddress: formData.tmpAddress || '',
                    nearbyLandmarks: formData.nearbyLandmarks || '',
                    mapX: formData.mapX || '',
                    mapY: formData.mapY || '',
                    payFeeMonth: formData.payFeeMonth || 12,
                    feePrice: formData.feePrice || 0,
                    takeTime: formData.entryDate || formData.takeTime || '',
                    outTime: formData.exitDate || formData.outTime || '2099-12-31',
                    communityId: formData.communityId || '',
                    communityCode: formData.communityCode || '',
                    communityArea: formData.communityArea || '',
 
                    // 项目扩展参数
                    projectAddressProvince: formData.projectAddressProvince || '',
                    projectAddressCity: formData.projectAddressCity || '',
                    projectAddressDistrict: formData.projectAddressDistrict || '',
                    projectAddressTown: formData.projectAddressTown || '',
                    projectAddressRoad: formData.projectAddressRoad || '',
                    houseCompletionDate: formData.houseCompletionDate || '',
                    projectNature: formData.projectNature || '',
                    projectType: formData.projectType || '',
                    projectLandArea: formData.projectLandArea || '',
                    propertyRoomArea: info.propertyRoomArea || '',
                    publicArea: info.publicArea || '',
                    totalConstructionArea: formData.totalConstructionArea || '',
                    chargeableTotalArea: formData.chargeableTotalArea || '',
                    chargeableAreaMultilayer: formData.chargeableAreaMultilayer || '',
                    chargeableAreaHighRise1: formData.chargeableAreaHighRise1 || '',
                    chargeableAreaHighRiseUp: formData.chargeableAreaHighRiseUp || '',
                    chargeableAreaShop: formData.chargeableAreaShop || '',
                    chargeableAreaVilla: formData.chargeableAreaVilla || '',
                    chargeableAreaOffice: formData.chargeableAreaOffice || '',
                    chargeableAreaCommercialHouse: formData.chargeableAreaCommercialHouse || '',
                    greenArea: formData.greenArea || '',
                    areaDetails: formData.areaDetails || '',
                    propertyManagementAddress: formData.propertyManagementAddress || '',
                    propertyManagerName: formData.propertyManagerName || '',
                    propertyManagerPhone: formData.propertyManagerPhone || '',
                    dayRepairPhone: formData.dayRepairPhone || '',
                    nightRepairPhone: formData.nightRepairPhone || '',
                    projectManager: formData.projectManager || '',
                    hasManagerCertificate: formData.hasManagerCertificate || 0,
                    certificateName: formData.certificateName || '',
                    managerCertificateNo: formData.managerCertificateNo || '',
                    managerPhone: formData.managerPhone || '',
                    neighborhoodCommitteeName: formData.neighborhoodCommitteeName || '',
                    neighborhoodCommitteeAddress: formData.neighborhoodCommitteeAddress || '',
                    neighborhoodSecretary: formData.neighborhoodSecretary || '',
                    neighborhoodOfficePhone: formData.neighborhoodOfficePhone || '',
                    secretaryPhone: formData.secretaryPhone || '',
                    ownersCommitteeAddress: formData.ownersCommitteeAddress || '',
                    ownersCommitteeChairman: formData.ownersCommitteeChairman || '',
                    chairmanPhone: formData.chairmanPhone || '',
                    fireHydrantCount: formData.fireHydrantCount || '',
                    fireChannelCount: formData.fireChannelCount || '',
                    waterTankCount: formData.waterTankCount || '',
                    reservoirCount: formData.reservoirCount || '',
                    totalMotorVehicleSpaces: formData.totalMotorVehicleSpaces || '',
                    groundMotorVehicleSpaces: formData.groundMotorVehicleSpaces || '',
                    undergroundMotorVehicleSpaces: formData.undergroundMotorVehicleSpaces || '',
                    newEnergyChargingPiles: formData.newEnergyChargingPiles || '',
                    nonMotorVehicleChargingPoints: formData.nonMotorVehicleChargingPoints || '',
                    groundNonMotorVehicleArea: formData.groundNonMotorVehicleArea || '',
                    undergroundNonMotorVehicleArea: formData.undergroundNonMotorVehicleArea || '',
                    clubhouseArea: formData.clubhouseArea || '',
                    securityEntranceCount: formData.securityEntranceCount || '',
                    elevatorCount: formData.elevatorCount || '',
                    elevatorType: formData.elevatorType || '',
                    elevatorInstallDate: formData.elevatorInstallDate || '',
                    elevatorServiceLife: formData.elevatorServiceLife || '',
                    elevatorBrand1: formData.elevatorBrand1 || '',
                    elevatorBrand2: formData.elevatorBrand2 || '',
                    monitorCount: formData.monitorCount || '',
                    monitorMaintenanceCompany: formData.monitorMaintenanceCompany || '',
                    barrierGateCount: formData.barrierGateCount || '',
                    barrierGateBrand: formData.barrierGateBrand || '',
                    barrierSupplierContact: formData.barrierSupplierContact || '',
                    barrierSupplierPhone: formData.barrierSupplierPhone || '',
                    waterPumpCount: formData.waterPumpCount || '',
                    groundParkingSpaces: formData.groundParkingSpaces || '',
                    undergroundParkingSpaces: formData.undergroundParkingSpaces || '',
                    groundNonMechanicalFee: formData.groundNonMechanicalFee || '',
                    garageNonMechanicalFee: formData.garageNonMechanicalFee || '',
                    temporaryHourlyFee: formData.temporaryHourlyFee || '',
                    temporaryDailyFee: formData.temporaryDailyFee || '',
                    temporaryPerTimeFee: formData.temporaryPerTimeFee || '',
                    totalBuildingCount: formData.totalBuildingCount || '',
                    buildingUnitCount: formData.buildingUnitCount || '',
                    highRiseBuildingCount: formData.highRiseBuildingCount || '',
                    multilayerVillaBuildingCount: formData.multilayerVillaBuildingCount || '',
                    residentialHouseholdCount: formData.residentialHouseholdCount || '',
                    shopHouseholdCount: formData.shopHouseholdCount || '',
 
                    // 扩展属性
                    attrs: formData.attrs || []
                };
 
                // 转换数字字段
                const numberFields = [
                    'fireHydrantCount', 'fireChannelCount', 'waterTankCount', 'reservoirCount',
                    'totalMotorVehicleSpaces', 'groundMotorVehicleSpaces', 'undergroundMotorVehicleSpaces',
                    'newEnergyChargingPiles', 'nonMotorVehicleChargingPoints',
                    'groundNonMotorVehicleArea', 'undergroundNonMotorVehicleArea', 'clubhouseArea',
                    'securityEntranceCount', 'elevatorCount', 'elevatorServiceLife', 'monitorCount',
                    'barrierGateCount', 'waterPumpCount', 'groundParkingSpaces', 'undergroundParkingSpaces',
                    'totalBuildingCount', 'buildingUnitCount', 'highRiseBuildingCount',
                    'multilayerVillaBuildingCount', 'residentialHouseholdCount', 'shopHouseholdCount',
                    'payFeeMonth', 'hasManagerCertificate'
                ];
                numberFields.forEach(field => {
                    if (submitData[field] !== '' && submitData[field] !== null && submitData[field] !== undefined) {
                        submitData[field] = Number(submitData[field]);
                    } 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',
                    'temporaryPerTimeFee', 'communityArea'
                ];
                decimalFields.forEach(field => {
                    if (submitData[field] !== '' && submitData[field] !== null && submitData[field] !== undefined) {
                        submitData[field] = Number(submitData[field]);
                    } else {
                        submitData[field] = 0;
                    }
                });
 
                // 清理空字符串字段,转换为null或删除
                Object.keys(submitData).forEach(key => {
                    if (submitData[key] === '') {
                        delete submitData[key];
                    }
                });
                submitData.mapX = 101.33;
                submitData.mapY = 101.33;
                // 提交数据到接口
                vc.http.apiPost(
                    '/community.saveCommunity',
                    JSON.stringify(submitData),
                    {
                        emulateJSON: true
                    },
                    function (json, res) {
                        const data = JSON.parse(json);
                        console.log('data', data);
                        if (data.code == 0) {
 
                            vc.toast('保存成功');
                            setTimeout(function () {
                                $that.goBack();
                            }, 1500);
                        } else {
                            vc.toast(data.msg || errInfo || '保存失败');
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理', errInfo);
                        vc.toast(errInfo || '保存失败,请稍后重试');
                    }
                );
            },
            goBack: function () {
                // 跳转回小区管理列表页
                window.location.href = '/#/pages/common/communityManage';
            },
            reset: function () {
                // 重新加载数据
                vc.component._loadCommunityDetail();
            }
        }
    });
})(window.vc);