优化代码

This commit is contained in:
java110 2022-08-29 22:38:31 +08:00
parent 5290b3236e
commit 8b3203089d
5 changed files with 96 additions and 38 deletions

View File

@ -119,7 +119,7 @@
params: {
page: 1,
row: 1,
roomId: '',
roomId: $that.addNotepadInfo.roomId,
communityId: vc.getCurrentCommunity().communityId
}
};

View File

@ -1,5 +1,4 @@
<div id="parkingAreaControlCustomCarInoutModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div id="parkingAreaControlCustomCarInoutModel" class="modal fade" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
@ -10,26 +9,35 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="车牌号" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="parkingAreaControlCustomCarInoutInfo.carNum" type="text"
:placeholder="vc.i18n('必填,请填写车牌号','parkingAreaControlCustomCarInout')" class="form-control">
<input v-model="parkingAreaControlCustomCarInoutInfo.carNum" type="text" @blur="_queryCustomCarMoney()" :placeholder="vc.i18n('必填,请填写车牌号','parkingAreaControlCustomCarInout')" class="form-control">
</div>
</div>
<div class="form-group row" v-if="parkingAreaControlCustomCarInoutInfo.type != '1101'">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="收费金额" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></label>
<div class="col-sm-10"><input v-model="parkingAreaControlCustomCarInoutInfo.amount"
type="number" :placeholder="vc.i18n('必填,请填写收费金额','parkingAreaControlCustomCarInout')" class="form-control"></div>
<div class="col-sm-10"><input v-model="parkingAreaControlCustomCarInoutInfo.amount" type="number" :placeholder="vc.i18n('必填,请填写收费金额','parkingAreaControlCustomCarInout')" class="form-control"></div>
</div>
<div class="form-group row" v-if="parkingAreaControlCustomCarInoutInfo.type != '1101'">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="停车时间" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></label>
<div class="col-sm-10"><input v-model="parkingAreaControlCustomCarInoutInfo.costMin" type="number" disabled :placeholder="vc.i18n('必填,请填写停车时间','parkingAreaControlCustomCarInout')" class="form-control"></div>
</div>
<div class="form-group row" v-if="parkingAreaControlCustomCarInoutInfo.type != '1101'">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="支付方式" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></label>
<div class="col-sm-10">
<select class="custom-select" v-model="parkingAreaControlCustomCarInoutInfo.payType" @change="_swatchVedio()">
<option selected value="">{{vc.i18n('请选择支付方式','parkingAreaControlCustomCarInout')}}</option>
<option :value="item.statusCd"
v-for="(item,index) in parkingAreaControlCustomCarInoutInfo.payTypes">{{item.name}}
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="备注" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></label>
<div class="col-sm-10"><textarea cols="5"
v-model="parkingAreaControlCustomCarInoutInfo.remark" type="text"
:placeholder="vc.i18n('请填写备注信息','parkingAreaControlCustomCarInout')" class="form-control"></textarea></div>
<div class="col-sm-10"><textarea cols="5" v-model="parkingAreaControlCustomCarInoutInfo.remark" type="text" :placeholder="vc.i18n('请填写备注信息','parkingAreaControlCustomCarInout')" class="form-control"></textarea></div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="parkingAreaControlCustomCarInout()"><span><vc:i18n name="提交" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal"><span><vc:i18n name="取消" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></button>
<button class="btn btn-primary float-right" type="button" v-on:click="parkingAreaControlCustomCarInout()"><span><vc:i18n name="提交" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal"><span><vc:i18n name="取消" namespace="parkingAreaControlCustomCarInout"></vc:i18n></span></button>
</div>
</div>
</div>
@ -37,4 +45,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
(function (vc, vm) {
(function(vc, vm) {
vc.extends({
data: {
@ -8,14 +8,21 @@
remark: '',
type: '1101',
payCharge: '',
machineId: ''
costMin: '0',
machineId: '',
boxId: '',
payType: '',
payTypes: [],
inoutId: ''
}
},
_initMethod: function () {
_initMethod: function() {
vc.getDict('car_inout_payment', 'pay_type', function(_data) {
$that.parkingAreaControlCustomCarInoutInfo.payTypes = _data;
})
},
_initEvent: function () {
vc.on('parkingAreaControlCustomCarInout', 'open', function (_params) {
_initEvent: function() {
vc.on('parkingAreaControlCustomCarInout', 'open', function(_params) {
vc.component.refreshParkingAreaControlCustomCarInoutInfo();
$('#parkingAreaControlCustomCarInoutModel').modal('show');
// = _params;
@ -24,31 +31,28 @@
});
},
methods: {
parkingAreaControlCustomCarInoutValidate: function () {
parkingAreaControlCustomCarInoutValidate: function() {
return vc.validate.validate({
parkingAreaControlCustomCarInoutInfo: vc.component.parkingAreaControlCustomCarInoutInfo
}, {
'parkingAreaControlCustomCarInoutInfo.carNum': [
{
limit: "required",
param: "",
errInfo: "车牌号不能为空"
}
]
'parkingAreaControlCustomCarInoutInfo.carNum': [{
limit: "required",
param: "",
errInfo: "车牌号不能为空"
}]
});
},
parkingAreaControlCustomCarInout: function () {
parkingAreaControlCustomCarInout: function() {
if (!vc.component.parkingAreaControlCustomCarInoutValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.http.apiPost(
'/machine.customCarInOutCmd',
JSON.stringify(vc.component.parkingAreaControlCustomCarInoutInfo),
{
JSON.stringify(vc.component.parkingAreaControlCustomCarInoutInfo), {
emulateJSON: true
},
function (json, res) {
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _data = JSON.parse(json);
$('#parkingAreaControlCustomCarInoutModel').modal('hide');
@ -59,21 +63,66 @@
vc.emit('parkingAreaControlFee', 'clear', {})
}
},
function (errInfo, error) {
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
refreshParkingAreaControlCustomCarInoutInfo: function () {
refreshParkingAreaControlCustomCarInoutInfo: function() {
let _payTypes = $that.parkingAreaControlCustomCarInoutInfo.payTypes;
vc.component.parkingAreaControlCustomCarInoutInfo = {
carNum: '',
amount: '',
remark: '',
type: '1101',
payCharge: '',
machineId: ''
machineId: '',
boxId: '',
costMin: '',
payType: '',
payTypes: _payTypes,
inoutId: ''
}
},
_loadParkingAreaControlCustomCarInoutData: function() {
let param = {
params: {
page: 1,
row: 1,
communityId: vc.getCurrentCommunity().communityId,
boxId: $that.parkingAreaControlCustomCarInoutInfo.boxId,
carNum: $that.parkingAreaControlCustomCarInoutInfo.carNum,
}
};
//发送get请求
vc.http.apiGet('/carInout.listCarInParkingAreaCmd',
param,
function(json) {
let _feeConfigInfo = JSON.parse(json);
let _data = _feeConfigInfo.data;
if (!_data || _data.length < 1) {
vc.toast('未查询在场车辆,请检查!');
return;
}
$that.parkingAreaControlCustomCarInout.payCharge = _data[0].payCharge;
$that.parkingAreaControlCustomCarInout.inoutId = _data[0].inoutId;
$that.parkingAreaControlCustomCarInout.costMin = _data[0].hours + "时" + _data[0].min + "分";
},
function() {
console.log('请求失败处理');
}
);
},
_queryCustomCarMoney: function() {
if (!$that.parkingAreaControlCustomCarInoutInfo.carNum) {
return;
}
if ($that.parkingAreaControlCustomCarInoutInfo.type == '1101') {
return;
}
$that._loadParkingAreaControlCustomCarInoutData();
}
}
});

View File

@ -35,7 +35,7 @@
communityId: vc.getCurrentCommunity().communityId,
boxId: $that.parkingAreaControlInCarInfo.boxId,
carNum: $that.parkingAreaControlInCarInfo.carNum,
state: $that.parkingAreaControlInCarInfo.carNum
state: $that.parkingAreaControlInCarInfo.state
}
};
//发送get请求

View File

@ -274,7 +274,8 @@
}
vc.emit('parkingAreaControlCustomCarInout', 'open', {
type: _type,
machineId: _machineId
machineId: _machineId,
boxId: $that.parkingAreaControlVideoInfo.boxId
})
},
unlicensedCarIn: function(_type) {