优化代码

This commit is contained in:
Your Name 2023-09-18 06:02:25 +08:00
parent e40c831971
commit 3251f856d3

View File

@ -27,18 +27,18 @@
}, },
_initEvent: function () { _initEvent: function () {
vc.on('parkingAreaControlCustomCarInout', 'open', function (_params) { vc.on('parkingAreaControlCustomCarInout', 'open', function (_params) {
vc.component.refreshParkingAreaControlCustomCarInoutInfo(); $that.refreshParkingAreaControlCustomCarInoutInfo();
$('#parkingAreaControlCustomCarInoutModel').modal('show'); $('#parkingAreaControlCustomCarInoutModel').modal('show');
// = _params; // = _params;
vc.copyObject(_params, vc.component.parkingAreaControlCustomCarInoutInfo); vc.copyObject(_params, $that.parkingAreaControlCustomCarInoutInfo);
vc.component.parkingAreaControlCustomCarInoutInfo.communityId = vc.getCurrentCommunity().communityId; $that.parkingAreaControlCustomCarInoutInfo.communityId = vc.getCurrentCommunity().communityId;
$that._queryCustomCarMoney(); $that._queryCustomCarMoney();
}); });
}, },
methods: { methods: {
parkingAreaControlCustomCarInoutValidate: function () { parkingAreaControlCustomCarInoutValidate: function () {
return vc.validate.validate({ return vc.validate.validate({
parkingAreaControlCustomCarInoutInfo: vc.component.parkingAreaControlCustomCarInoutInfo parkingAreaControlCustomCarInoutInfo: $that.parkingAreaControlCustomCarInoutInfo
}, { }, {
'parkingAreaControlCustomCarInoutInfo.carNum': [{ 'parkingAreaControlCustomCarInoutInfo.carNum': [{
limit: "required", limit: "required",
@ -48,13 +48,13 @@
}); });
}, },
parkingAreaControlCustomCarInout: function () { parkingAreaControlCustomCarInout: function () {
if (!vc.component.parkingAreaControlCustomCarInoutValidate()) { if (!$that.parkingAreaControlCustomCarInoutValidate()) {
vc.toast(vc.validate.errInfo); vc.toast(vc.validate.errInfo);
return; return;
} }
vc.http.apiPost( vc.http.apiPost(
'/machine.customCarInOutCmd', '/machine.customCarInOutCmd',
JSON.stringify(vc.component.parkingAreaControlCustomCarInoutInfo), { JSON.stringify($that.parkingAreaControlCustomCarInoutInfo), {
emulateJSON: true emulateJSON: true
}, },
function (json, res) { function (json, res) {
@ -76,7 +76,7 @@
}, },
refreshParkingAreaControlCustomCarInoutInfo: function () { refreshParkingAreaControlCustomCarInoutInfo: function () {
let _payTypes = $that.parkingAreaControlCustomCarInoutInfo.payTypes; let _payTypes = $that.parkingAreaControlCustomCarInoutInfo.payTypes;
vc.component.parkingAreaControlCustomCarInoutInfo = { $that.parkingAreaControlCustomCarInoutInfo = {
carNum: '', carNum: '',
amount: '', amount: '',
remark: '', remark: '',
@ -217,4 +217,4 @@
} }
}); });
})(window.vc, window.vc.component); })(window.vc, window.$that);