mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-27 00:20:01 +08:00
优化代码
This commit is contained in:
parent
1862e4b485
commit
9f79eace97
@ -69,6 +69,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">开始时间</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addProxyFeeInfo.startTime" type="text"
|
||||
placeholder="必填,请填写开始时间" class="form-control proxyFeeStartTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">结束时间</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="addProxyFeeInfo.endTime" type="text"
|
||||
placeholder="必填,请填写结束时间" class="form-control proxyFeeEndTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button" v-on:click="saveProxyInfo()">
|
||||
<i class="fa fa-check"></i> 保存
|
||||
|
||||
@ -16,10 +16,24 @@
|
||||
consumption: '',
|
||||
configId: '',
|
||||
ownerName: '',
|
||||
objType: '3333'
|
||||
objType: '3333',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
vc.initDate('proxyFeeStartTime', function (_startTime) {
|
||||
$that.addProxyFeeInfo.startTime = _startTime;
|
||||
});
|
||||
vc.initDate('proxyFeeEndTime', function (_endTime) {
|
||||
$that.addProxyFeeInfo.endTime = _endTime;
|
||||
let start = Date.parse(new Date($that.addProxyFeeInfo.startTime))
|
||||
let end = Date.parse(new Date($that.addProxyFeeInfo.endTime))
|
||||
if (start - end >= 0) {
|
||||
vc.toast("结束时间必须大于开始时间")
|
||||
$that.addProxyFeeInfo.endTime = '';
|
||||
}
|
||||
});
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('addProxyFee', 'openAddProxyFeeModal', function (_param) {
|
||||
@ -75,7 +89,31 @@
|
||||
param: "",
|
||||
errInfo: "费用必填"
|
||||
}
|
||||
]
|
||||
],
|
||||
'addProxyFeeInfo.startTime': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "开始时间不能为空"
|
||||
},
|
||||
{
|
||||
limit: "date",
|
||||
param: "",
|
||||
errInfo: "开始时间格式错误"
|
||||
},
|
||||
],
|
||||
'addProxyFeeInfo.endTime': [
|
||||
{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "结束时间不能为空"
|
||||
},
|
||||
{
|
||||
limit: "date",
|
||||
param: "",
|
||||
errInfo: "结束时间格式错误"
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
saveProxyInfo: function () {
|
||||
@ -154,7 +192,9 @@
|
||||
feeConfigs: [],
|
||||
configId: '',
|
||||
ownerName: '',
|
||||
objType: '3333'
|
||||
objType: '3333',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
};
|
||||
},
|
||||
_getConfig: function () {
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">收费项目</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="custom-select" v-model="carCreateFeeAddInfo.configId">
|
||||
<select class="custom-select" v-model="carCreateFeeAddInfo.configId" @change="_carCreateFeeAddIfOnceFee(carCreateFeeAddInfo.configId)">
|
||||
<option selected disabled value="">必填,请选择收费项目</option>
|
||||
<option v-for="(item,index) in carCreateFeeAddInfo.feeConfigs" :key="index"
|
||||
v-bind:value="item.configId">{{item.feeName}}
|
||||
@ -81,6 +81,13 @@
|
||||
placeholder="必填,请填写计费起始时间" class="form-control carCreateFeeStartTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-show="carCreateFeeAddInfo.feeFlag == '2006012'">
|
||||
<label class="col-sm-2 col-form-label">计费结束时间</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="carCreateFeeAddInfo.endTime" type="text"
|
||||
placeholder="必填,请填写计费结束时间" class="form-control carCreateFeeEndTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button"
|
||||
v-on:click="saveCarCreateFeeInfo()">
|
||||
|
||||
@ -13,8 +13,10 @@
|
||||
carState: ['H', 'S'],
|
||||
isMore: false,
|
||||
locationTypeCdName: '',
|
||||
startTime: vc.dateTimeFormat(new Date().getTime()),
|
||||
paId: ''
|
||||
startTime: '',
|
||||
paId: '',
|
||||
feeFlag: '',
|
||||
endTime: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
@ -42,20 +44,19 @@
|
||||
},
|
||||
methods: {
|
||||
_initCarCreateFeeAddDateInfo: function () {
|
||||
$('.carCreateFeeStartTime').datetimepicker({
|
||||
language: 'zh-CN',
|
||||
fontAwesome: 'fa',
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
initTime: true,
|
||||
initialDate: new Date(),
|
||||
autoClose: 1,
|
||||
todayBtn: true
|
||||
|
||||
vc.initDate('carCreateFeeStartTime', function (_startTime) {
|
||||
$that.carCreateFeeAddInfo.startTime = _startTime;
|
||||
});
|
||||
vc.initDate('carCreateFeeEndTime', function (_endTime) {
|
||||
$that.carCreateFeeAddInfo.endTime = _endTime;
|
||||
let start = Date.parse(new Date($that.carCreateFeeAddInfo.startTime))
|
||||
let end = Date.parse(new Date($that.carCreateFeeAddInfo.endTime))
|
||||
if (start - end >= 0) {
|
||||
vc.toast("结束时间必须大于开始时间")
|
||||
$that.carCreateFeeAddInfo.endTime = '';
|
||||
}
|
||||
});
|
||||
$('.carCreateFeeStartTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
var value = $(".carCreateFeeStartTime").val();
|
||||
vc.component.carCreateFeeAddInfo.startTime = value;
|
||||
});
|
||||
//防止多次点击时间插件失去焦点,这里报错先取消
|
||||
//document.getElementsByClassName('form-control carCreateFeeStartTime')[0].addEventListener('click', myfunc)
|
||||
|
||||
@ -65,19 +66,19 @@
|
||||
},
|
||||
carCreateFeeAddValidate() {
|
||||
return vc.validate.validate({
|
||||
carCreateFeeAddInfo: vc.component.carCreateFeeAddInfo
|
||||
},
|
||||
carCreateFeeAddInfo: vc.component.carCreateFeeAddInfo
|
||||
},
|
||||
{
|
||||
'carCreateFeeAddInfo.locationTypeCd': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "收费范围不能为空"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "收费范围格式错误"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "收费范围格式错误"
|
||||
},
|
||||
],
|
||||
'carCreateFeeAddInfo.locationObjId': [{
|
||||
limit: "required",
|
||||
@ -108,11 +109,11 @@
|
||||
param: "",
|
||||
errInfo: "计费起始时间不能为空"
|
||||
},
|
||||
{
|
||||
limit: "datetime",
|
||||
param: "",
|
||||
errInfo: "计费起始时间格式错误 YYYY-MM-DD hh:mm:ss"
|
||||
}]
|
||||
{
|
||||
limit: "datetime",
|
||||
param: "",
|
||||
errInfo: "计费起始时间格式错误 YYYY-MM-DD hh:mm:ss"
|
||||
}]
|
||||
});
|
||||
},
|
||||
saveCarCreateFeeInfo: function () {
|
||||
@ -133,8 +134,8 @@
|
||||
}
|
||||
vc.component.carCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
|
||||
vc.http.post('parkingSpaceCreateFeeAdd', 'save', JSON.stringify(vc.component.carCreateFeeAddInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
if (res.status == 200) {
|
||||
//关闭model
|
||||
@ -170,7 +171,9 @@
|
||||
isMore: false,
|
||||
locationTypeCdName: '',
|
||||
startTime: vc.dateTimeFormat(new Date().getTime()),
|
||||
paId: ''
|
||||
paId: '',
|
||||
feeFlag: '',
|
||||
endTime: ''
|
||||
};
|
||||
vc.component.carCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
|
||||
vc.component.carCreateFeeAddInfo.parkingAreas = _parkingAreas;
|
||||
@ -215,6 +218,15 @@
|
||||
function (errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
});
|
||||
},
|
||||
_carCreateFeeAddIfOnceFee(_configId) {
|
||||
$that.carCreateFeeAddInfo.endTime = '';
|
||||
$that.carCreateFeeAddInfo.feeConfigs.forEach(item => {
|
||||
if (_configId == item.configId) {
|
||||
$that.carCreateFeeAddInfo.feeFlag = item.feeFlag;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">收费项目</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="custom-select" v-model="roomCreateFeeAddInfo.configId">
|
||||
<select class="custom-select" v-model="roomCreateFeeAddInfo.configId" @change="_roomCreateFeeAddIfOnceFee(roomCreateFeeAddInfo.configId)">
|
||||
<option selected disabled value="">必填,请选择收费项目</option>
|
||||
<option v-for="(item,index) in roomCreateFeeAddInfo.feeConfigs" :key="index"
|
||||
v-bind:value="item.configId">{{item.feeName}}
|
||||
@ -154,6 +154,13 @@
|
||||
placeholder="必填,请填写计费起始时间" class="form-control roomCreateFeeStartTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row" v-show="roomCreateFeeAddInfo.feeFlag == '2006012'">
|
||||
<label class="col-sm-2 col-form-label">计费结束时间</label>
|
||||
<div class="col-sm-10">
|
||||
<input v-model="roomCreateFeeAddInfo.endTime" type="text"
|
||||
placeholder="必填,请填写计费结束时间" class="form-control roomCreateFeeEndTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
<button class="btn btn-primary float-right" type="button"
|
||||
v-on:click="saveRoomCreateFeeInfo()">
|
||||
|
||||
@ -19,7 +19,9 @@
|
||||
locationTypeCdName: '',
|
||||
startTime: '',
|
||||
roomType: '1010301',
|
||||
feeLayer: '全部'
|
||||
feeLayer: '全部',
|
||||
feeFlag: '',
|
||||
endTime: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
@ -69,21 +71,19 @@
|
||||
},
|
||||
methods: {
|
||||
_initRoomCreateFeeAddInfo: function () {
|
||||
$('.roomCreateFeeStartTime').datetimepicker({
|
||||
minView: "month",
|
||||
language: 'zh-CN',
|
||||
fontAwesome: 'fa',
|
||||
format: 'yyyy-mm-dd',
|
||||
initTime: true,
|
||||
initialDate: new Date(),
|
||||
autoClose: 1,
|
||||
todayBtn: true
|
||||
|
||||
vc.initDate('roomCreateFeeStartTime', function (_startTime) {
|
||||
$that.roomCreateFeeAddInfo.startTime = _startTime;
|
||||
});
|
||||
vc.initDate('roomCreateFeeEndTime', function (_endTime) {
|
||||
$that.roomCreateFeeAddInfo.endTime = _endTime;
|
||||
let start = Date.parse(new Date($that.roomCreateFeeAddInfo.startTime))
|
||||
let end = Date.parse(new Date($that.roomCreateFeeAddInfo.endTime))
|
||||
if (start - end >= 0) {
|
||||
vc.toast("结束时间必须大于开始时间")
|
||||
$that.roomCreateFeeAddInfo.endTime = '';
|
||||
}
|
||||
});
|
||||
$('.roomCreateFeeStartTime').datetimepicker()
|
||||
.on('changeDate', function (ev) {
|
||||
var value = $(".roomCreateFeeStartTime").val();
|
||||
$that.roomCreateFeeAddInfo.startTime = value;
|
||||
});
|
||||
//防止多次点击时间插件失去焦点
|
||||
document.getElementsByClassName('form-control roomCreateFeeStartTime')[0].addEventListener('click', myfunc)
|
||||
|
||||
@ -93,19 +93,19 @@
|
||||
},
|
||||
roomCreateFeeAddValidate() {
|
||||
return vc.validate.validate({
|
||||
roomCreateFeeAddInfo: $that.roomCreateFeeAddInfo
|
||||
},
|
||||
roomCreateFeeAddInfo: $that.roomCreateFeeAddInfo
|
||||
},
|
||||
{
|
||||
'roomCreateFeeAddInfo.locationTypeCd': [{
|
||||
limit: "required",
|
||||
param: "",
|
||||
errInfo: "收费范围不能为空"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "收费范围格式错误"
|
||||
},
|
||||
{
|
||||
limit: "num",
|
||||
param: "",
|
||||
errInfo: "收费范围格式错误"
|
||||
},
|
||||
],
|
||||
'roomCreateFeeAddInfo.locationObjId': [{
|
||||
limit: "required",
|
||||
@ -132,11 +132,11 @@
|
||||
param: "",
|
||||
errInfo: "计费起始时间不能为空"
|
||||
},
|
||||
{
|
||||
limit: "datetime",
|
||||
param: "",
|
||||
errInfo: "计费起始时间格式错误 YYYY-MM-DD hh:mm:ss"
|
||||
}]
|
||||
{
|
||||
limit: "datetime",
|
||||
param: "",
|
||||
errInfo: "计费起始时间格式错误 YYYY-MM-DD hh:mm:ss"
|
||||
}]
|
||||
});
|
||||
},
|
||||
saveRoomCreateFeeInfo: function () {
|
||||
@ -166,8 +166,8 @@
|
||||
_roomCreateFeeAddInfo.roomState = _roomCreateFeeAddInfo.roomState.join(',');
|
||||
vc.http.post('roomCreateFeeAdd', 'save',
|
||||
JSON.stringify(_roomCreateFeeAddInfo), {
|
||||
emulateJSON: true
|
||||
},
|
||||
emulateJSON: true
|
||||
},
|
||||
function (json, res) {
|
||||
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
||||
if (res.status == 200) {
|
||||
@ -207,7 +207,9 @@
|
||||
isMore: false,
|
||||
locationTypeCdName: '',
|
||||
startTime: '',
|
||||
feeLayer: '全部'
|
||||
feeLayer: '全部',
|
||||
feeFlag: '',
|
||||
endTime: '',
|
||||
};
|
||||
$that.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
|
||||
},
|
||||
@ -247,6 +249,15 @@
|
||||
} else {
|
||||
$that.roomCreateFeeAddInfo.feeLayer = '全部'
|
||||
}
|
||||
},
|
||||
_roomCreateFeeAddIfOnceFee(_configId) {
|
||||
$that.roomCreateFeeAddInfo.endTime = '';
|
||||
$that.roomCreateFeeAddInfo.feeConfigs.forEach(item => {
|
||||
if (_configId == item.configId) {
|
||||
$that.roomCreateFeeAddInfo.feeFlag = item.feeFlag;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user