zhangjq
2026-01-27 6f51f667ae7b13dca029045c221d0b1722cf98df
public/components/property/addMeterWater/addMeterWater.js
@@ -26,7 +26,44 @@
                ownerName: '',
                meterTypes: [],
                computingFormula: '',
                price: 0
                price: 0,
                // 原有字段
                powerSupplyBureau: '',
                // 费用类型相关字段
                householdName: '',
                householdNumber: '',
                electricMeterId: '',
                handler: '',
                isTransferred: '',
                companyNameAfterTransfer: '',
                transferDate: '',
                correspondingHouseholdCount: 0,
                lastPaymentDate: '',
                readingType: '',
                multiplyingFactor: 0,
                unitPrice: 0,
                invoiceAmount: 0,
                amountDifference: 0,
                autoDeduction: '',
                remark2: '',
                address: '',
                writeTime: '',
                writer: '',
                // 水费专用字段
                checkApplyCompanyName: '',
                checkApplyDeptProject: '',
                waterFeePayer: '',
                accountNumber: '',
                meterReadBookNo: '',
                waterConsumption: '',
                sewageTreatmentWater: '',
                collectionStandard: '',
                arrearsUnpaid: '',
                latePaymentFine: '',
                latePaymentSurcharge: '',
                feePaymentStatus: '',
                carryOverBalance: '',
                totalPayableAmount: ''
            }
        },
        _initMethod: function () {
@@ -42,13 +79,13 @@
                    $that.addMeterWaterInfo.hasRoom = true;
                    $that.addMeterWaterInfo.roomId = _param.roomId;
                    $that.addMeterWaterInfo.objId = _param.roomId;
                    // $that.addMeterWaterInfo.objName = _param.roomName.replace('0单元', ''); //处理商铺
                    $that.addMeterWaterInfo.objName = $that.transRoomName(_param.roomName);
                    $that.addMeterWaterInfo.objName = _param.roomName.replace('0单元', ''); //处理商铺
                    // $that.addMeterWaterInfo.objName = $that.transRoomName(_param.roomName);
                    let _ownerName = _param.roomName;
                    if(_param.ownerName){
                        _ownerName += ('(' + _param.ownerName + ')') ;
                    if (_param.ownerName) {
                        _ownerName += ('(' + _param.ownerName + ')');
                    }
                    $that.addMeterWaterInfo.ownerName =  _ownerName;
                    $that.addMeterWaterInfo.ownerName = _ownerName;
                    $that._queryPreMeterWater(_param.roomId);
                }
                $that.addMeterWaterInfo.preReadingTime = vcFramework.dateTimeFormat(new Date().getTime());
@@ -60,8 +97,8 @@
                if (_param.hasOwnProperty("roomId") && _param.roomId != "") {
                    $that.addMeterWaterInfo.roomId = _param.roomId;
                    $that.addMeterWaterInfo.objId = _param.roomId;
                    // $that.addMeterWaterInfo.objName = _param.name.replace('0单元', ''); //处理商铺;
                    $that.addMeterWaterInfo.objName = $that.transRoomName(_param.name);
                    $that.addMeterWaterInfo.objName = _param.name.replace('0单元', ''); //处理商铺;
                    // $that.addMeterWaterInfo.objName = $that.transRoomName(_param.name);
                    $that._queryPreMeterWater(_param.roomId);
                }
            });
@@ -122,24 +159,25 @@
                        }
                    });
                //防止多次点击时间插件失去焦点
                document.getElementsByClassName('form-control addPreReadingTime')[0].addEventListener('click', myfunc)
                function myfunc(e) {
                    e.currentTarget.blur();
                var preReadingTimeElement = document.getElementsByClassName('form-control addPreReadingTime')[0];
                if (preReadingTimeElement) {
                    preReadingTimeElement.addEventListener('click', function(e) {
                        e.currentTarget.blur();
                    });
                }
                document.getElementsByClassName("form-control addCurReadingTime")[0].addEventListener('click', myfunc)
                function myfunc(e) {
                    e.currentTarget.blur();
                var curReadingTimeElement = document.getElementsByClassName("form-control addCurReadingTime")[0];
                if (curReadingTimeElement) {
                    curReadingTimeElement.addEventListener('click', function(e) {
                        e.currentTarget.blur();
                    });
                }
            },
            addMeterWaterValidate() {
                return vc.validate.validate({
                    addMeterWaterInfo: $that.addMeterWaterInfo
                }, {
                    'addMeterWaterInfo.preDegrees': [
                        {
                    'addMeterWaterInfo.preDegrees': [{
                            limit: "required",
                            param: "",
                            errInfo: "上期度数不能为空"
@@ -150,8 +188,7 @@
                            errInfo: "上期度数格式错误"
                        }
                    ],
                    'addMeterWaterInfo.curDegrees': [
                        {
                    'addMeterWaterInfo.curDegrees': [{
                            limit: "required",
                            param: "",
                            errInfo: "本期度数不能为空"
@@ -162,8 +199,7 @@
                            errInfo: "本期度数格式错误"
                        }
                    ],
                    'addMeterWaterInfo.preReadingTime': [
                        {
                    'addMeterWaterInfo.preReadingTime': [{
                            limit: "required",
                            param: "",
                            errInfo: "上期读表时间不能为空"
@@ -174,8 +210,7 @@
                            errInfo: "上期读表时间格式错误"
                        }
                    ],
                    'addMeterWaterInfo.curReadingTime': [
                        {
                    'addMeterWaterInfo.curReadingTime': [{
                            limit: "required",
                            param: "",
                            errInfo: "本期读表时间不能为空"
@@ -186,34 +221,26 @@
                            errInfo: "本期读表时间格式错误"
                        }
                    ],
                    'addMeterWaterInfo.roomId': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "房屋必填"
                        }
                    ],
                    'addMeterWaterInfo.meterType': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "抄表类型必填"
                        }
                    ],
                    'addMeterWaterInfo.configId': [
                        {
                            limit: "required",
                            param: "",
                            errInfo: "费用必填"
                        }
                    ],
                    'addMeterWaterInfo.remark': [
                        {
                            limit: "maxLength",
                            param: "500",
                            errInfo: "备注格式错误"
                        }
                    ]
                    'addMeterWaterInfo.roomId': [{
                        limit: "required",
                        param: "",
                        errInfo: "房屋必填"
                    }],
                    'addMeterWaterInfo.meterType': [{
                        limit: "required",
                        param: "",
                        errInfo: "抄表类型必填"
                    }],
                    'addMeterWaterInfo.configId': [{
                        limit: "required",
                        param: "",
                        errInfo: "费用必填"
                    }],
                    'addMeterWaterInfo.remark': [{
                        limit: "maxLength",
                        param: "500",
                        errInfo: "备注格式错误"
                    }]
                });
            },
            saveMeterWaterInfo: function () {
@@ -260,8 +287,8 @@
                        vc.message(errInfo);
                    });
            },
            _changeAddMeterWaterFeeTypeCd:  function (_feeTypeCd){
                $that.addMeterWaterInfo.secondaryFeeTypeCd='';
            _changeAddMeterWaterFeeTypeCd: function (_feeTypeCd) {
                $that.addMeterWaterInfo.secondaryFeeTypeCd = '';
                $that.addMeterWaterInfo.configId = '';
                let param = {
                    params: {
@@ -271,15 +298,24 @@
                vc.http.apiGet('/secondaryFeeTypeCdGl.list.show', param,
                    function (json, res) {
                        let result = JSON.parse(json);
                        $that.$set($that.addMeterWaterInfo, 'secondaryFeeTypeCds', result);
                        if (result.length ) {
                            $that.$set($that.addMeterWaterInfo, 'secondaryFeeTypeCds', result);
                        } else {
                            $that.$set($that.addMeterWaterInfo, 'secondaryFeeTypeCds', [{
                                secondaryFeeTypeCd: "",
                                secondaryFeeTypeName: "无关联子类型,请直接选择收费项目"
                            }]);
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        vc.toast(errInfo);
                    }
                );
                $that._changeSecondaryFeeTypeCdz(_feeTypeCd, '');
            },
            _changeSecondaryFeeTypeCdz: function (_feeTypeCd,_secondaryFeeTypeCd) {
            _changeSecondaryFeeTypeCdz: function (_feeTypeCd, _secondaryFeeTypeCd) {
                $that.addMeterWaterInfo.configId = '';
                var param = {
                    params: {
                        page: 1,
@@ -305,7 +341,7 @@
                $that._queryPreMeterWater($that.addMeterWaterInfo.roomId);
            },
            _queryPreMeterWater: function (_roomId) {
                if (!_roomId) {
                if (!_roomId || !$that.addMeterWaterInfo) {
                    return;
                }
                let param = {
@@ -319,17 +355,23 @@
                //发送get请求
                vc.http.apiGet('/meterWater/queryPreMeterWater', param,
                    function (json, res) {
                        let _meterWaterInfo = JSON.parse(json);
                        let _total = _meterWaterInfo.total;
                        if (_total < 1) {
                            $that.addMeterWaterInfo.preDegrees = '0';
                            $that.addMeterWaterInfo.preReadingTime = vcFramework.dateTimeFormat(new Date().getTime());
                            return;
                        }
                        $that.addMeterWaterInfo.preDegrees = _meterWaterInfo.data[0].curDegrees;
                        $that.addMeterWaterInfo.preReadingTime = _meterWaterInfo.data[0].curReadingTime;
                        if ($that.addMeterWaterInfo.computingFormula == '9009') {
                            $that.addMeterWaterInfo.price = _meterWaterInfo.data[0].price;
                        if (json) {
                            let _meterWaterInfo = JSON.parse(json);
                            if (_meterWaterInfo && $that.addMeterWaterInfo) {
                                let _total = _meterWaterInfo.total || 0;
                                if (_total < 1) {
                                    $that.addMeterWaterInfo.preDegrees = '0';
                                    $that.addMeterWaterInfo.preReadingTime = vcFramework.dateTimeFormat(new Date().getTime());
                                    return;
                                }
                                if (_meterWaterInfo.data && _meterWaterInfo.data.length > 0) {
                                    $that.addMeterWaterInfo.preDegrees = _meterWaterInfo.data[0].curDegrees;
                                    $that.addMeterWaterInfo.preReadingTime = _meterWaterInfo.data[0].curReadingTime;
                                    if ($that.addMeterWaterInfo.computingFormula == '9009') {
                                        $that.addMeterWaterInfo.price = _meterWaterInfo.data[0].price;
                                    }
                                }
                            }
                        }
                    },
                    function (errInfo, error) {
@@ -358,8 +400,12 @@
                vc.http.apiGet('meterType.listMeterType',
                    param,
                    function (json, res) {
                        var _meterTypeManageInfo = JSON.parse(json);
                        $that.addMeterWaterInfo.meterTypes = _meterTypeManageInfo.data;
                        if (json) {
                            var _meterTypeManageInfo = JSON.parse(json);
                            if (_meterTypeManageInfo && $that.addMeterWaterInfo) {
                                $that.addMeterWaterInfo.meterTypes = _meterTypeManageInfo.data || [];
                            }
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
@@ -387,7 +433,28 @@
                    ownerName: '',
                    meterTypes: [],
                    computingFormula: '',
                    price: 0
                    price: 0,
                    powerSupplyBureau: '',
                    // 费用类型相关字段
                    householdName: '',
                    householdNumber: '',
                    electricMeterId: '',
                    handler: '',
                    isTransferred: '',
                    companyNameAfterTransfer: '',
                    transferDate: '',
                    correspondingHouseholdCount: 0,
                lastPaymentDate: '',
                readingType: '',
                multiplyingFactor: 0,
                unitPrice: 0,
                invoiceAmount: 0,
                amountDifference: 0,
                autoDeduction: '',
                remark2: '',
                address: '',
                writeTime: '',
                writer: ''
                };
            },
            changeFeeConfig: function () {