From 2b182598f37baa723e9c4cd395d69149d10e19ec Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Wed, 1 Jun 2022 16:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E4=B8=9A=E6=99=AE=E9=81=8D=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=20=E8=BD=A6=E8=BE=86=20=E5=93=81=E7=89=8C=E5=92=8C?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=20=E6=94=B9=E6=88=90=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/components/property/addCar/addCar.html | 7 +- public/components/property/addCar/addCar.js | 40 ++---- .../components/property/editCar/editCar.html | 6 +- public/components/property/editCar/editCar.js | 134 +++++++----------- 4 files changed, 75 insertions(+), 112 deletions(-) diff --git a/public/components/property/addCar/addCar.html b/public/components/property/addCar/addCar.html index 95fd23382..89d33a245 100755 --- a/public/components/property/addCar/addCar.html +++ b/public/components/property/addCar/addCar.html @@ -16,7 +16,7 @@
- +
@@ -33,7 +33,7 @@
- +
@@ -63,8 +63,7 @@
- +
diff --git a/public/components/property/addCar/addCar.js b/public/components/property/addCar/addCar.js index 9d9aaa9b7..8d6101a58 100755 --- a/public/components/property/addCar/addCar.js +++ b/public/components/property/addCar/addCar.js @@ -90,27 +90,21 @@ } ], 'addCarInfo.carBrand': [{ - limit: "required", - param: "", - errInfo: "车品牌不能为空" - }, - { - limit: "maxLength", - param: "50", - errInfo: "车品牌超出限制" - } - ], + limit: "maxLength", + param: "50", + errInfo: "车品牌超出限制" + }], 'addCarInfo.carType': [{ limit: "required", param: "", errInfo: "车类型不能为空" }], -// 'addCarInfo.value': [{ -// limit: "required", -// param: "", -// errInfo: "是否是预约车不能为空" -// }], + // 'addCarInfo.value': [{ + // limit: "required", + // param: "", + // errInfo: "是否是预约车不能为空" + // }], 'addCarInfo.startTime': [{ limit: "required", param: "", @@ -122,16 +116,10 @@ errInfo: "结租时间不能为空" }], 'addCarInfo.carColor': [{ - limit: "required", - param: "", - errInfo: "车颜色不能为空" - }, - { - limit: "maxLength", - param: "12", - errInfo: "车颜色超出限制" - } - ] + limit: "maxLength", + param: "12", + errInfo: "车颜色超出限制" + }] }); }, _loadCarAttrSpec: function() { @@ -157,7 +145,7 @@ }); }); }, - saveAddCarInfo: function () { + saveAddCarInfo: function() { let _carNumType = $that.addCarInfo.carNumType; if (_carNumType == 'S') { $that.addCarInfo.startTime = vc.dateTimeFormat(new Date().getTime()); diff --git a/public/components/property/editCar/editCar.html b/public/components/property/editCar/editCar.html index cb1588b8f..8ccffc8c3 100755 --- a/public/components/property/editCar/editCar.html +++ b/public/components/property/editCar/editCar.html @@ -17,7 +17,7 @@
- +
@@ -32,7 +32,7 @@
- +
@@ -67,4 +67,4 @@
-
+
\ No newline at end of file diff --git a/public/components/property/editCar/editCar.js b/public/components/property/editCar/editCar.js index 52f5b6ea7..320be4d7b 100755 --- a/public/components/property/editCar/editCar.js +++ b/public/components/property/editCar/editCar.js @@ -1,13 +1,13 @@ /** 权限组 **/ -(function (vc) { +(function(vc) { vc.extends({ data: { editCarInfo: { carId: '', - memberId:'', + memberId: '', carNum: '', carBrand: '', carType: '', @@ -17,8 +17,7 @@ endTime: '', carNumType: '' }, - carTypes: [ - { + carTypes: [{ key: '9901', value: '家用小汽车' }, @@ -32,36 +31,37 @@ } ] }, - _initMethod: function () { + _initMethod: function() { var param = { - params: { - name: 'owner_car', - type: 'car_type' + params: { + name: 'owner_car', + type: 'car_type' + } } - } - //发送get请求 + //发送get请求 vc.http.get('hireParkingSpace', 'listCarType', param, - function (json, res) { + function(json, res) { var carTypes = JSON.parse(json); vc.component.carTypes = carTypes; - }, function (errInfo, error) { + }, + function(errInfo, error) { console.log('请求失败处理'); } ); //vc.component._initEditCarDateInfo(); }, - _initEvent: function () { - vc.on('editCar', 'openEditCar', function (_carInfo) { + _initEvent: function() { + vc.on('editCar', 'openEditCar', function(_carInfo) { vc.copyObject(_carInfo, $that.editCarInfo); if (_carInfo.startTime.indexOf(":") > -1) { - $that.editCarInfo.startTime = $that.editCarInfo.startTime.substring(0,10); + $that.editCarInfo.startTime = $that.editCarInfo.startTime.substring(0, 10); } if (_carInfo.endTime.indexOf(":") > -1) { - $that.editCarInfo.endTime = $that.editCarInfo.endTime.substring(0,10); + $that.editCarInfo.endTime = $that.editCarInfo.endTime.substring(0, 10); } $('#editCarModal').modal('show'); vc.component._initEditCarDateInfo(); @@ -69,13 +69,12 @@ }, methods: { - editCarValidate: function () { + editCarValidate: function() { return vc.validate.validate({ editCarInfo: vc.component.editCarInfo }, { - 'editCarInfo.carNum': [ - { + 'editCarInfo.carNum': [{ limit: "required", param: "", errInfo: "车牌号不能为空" @@ -86,61 +85,39 @@ errInfo: "车牌号不正确" } ], - 'editCarInfo.carBrand': [ - { - limit: "required", - param: "", - errInfo: "车品牌不能为空" - }, - { - limit: "maxLength", - param: "50", - errInfo: "车品牌超出限制" - } - ], - 'editCarInfo.carType': [ - { - limit: "required", - param: "", - errInfo: "车类型不能为空" - } - ], - 'editCarInfo.startTime': [ - { - limit: "required", - param: "", - errInfo: "起租时间不能为空" - } - ], - 'editCarInfo.endTime': [ - { - limit: "required", - param: "", - errInfo: "结租时间不能为空" - } - ], - 'editCarInfo.carColor': [ - { - limit: "required", - param: "", - errInfo: "车颜色不能为空" - }, - { - limit: "maxLength", - param: "12", - errInfo: "车颜色超出限制" - } - ], - 'editCarInfo.memberId': [ - { - limit: "required", - param: "", - errInfo: "车辆数据错误" - } - ], + 'editCarInfo.carBrand': [{ + limit: "maxLength", + param: "50", + errInfo: "车品牌超出限制" + }], + 'editCarInfo.carType': [{ + limit: "required", + param: "", + errInfo: "车类型不能为空" + }], + 'editCarInfo.startTime': [{ + limit: "required", + param: "", + errInfo: "起租时间不能为空" + }], + 'editCarInfo.endTime': [{ + limit: "required", + param: "", + errInfo: "结租时间不能为空" + }], + 'editCarInfo.carColor': [{ + limit: "maxLength", + param: "12", + errInfo: "车颜色超出限制" + }], + 'editCarInfo.memberId': [{ + limit: "required", + param: "", + errInfo: "车辆数据错误" + }], }); }, - _submitEditCarInfo: function () { + _submitEditCarInfo: function() { if (!vc.component.editCarValidate()) { vc.toast(vc.validate.errInfo); return; @@ -150,11 +127,10 @@ vc.http.apiPost( 'owner.editOwnerCar', - JSON.stringify(vc.component.editCarInfo), - { + JSON.stringify(vc.component.editCarInfo), { emulateJSON: true }, - function (json, res) { + function(json, res) { //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); if (res.status == 200) { //关闭model @@ -169,13 +145,13 @@ } vc.toast(json); }, - function (errInfo, error) { + function(errInfo, error) { console.log('请求失败处理'); vc.toast(errInfo); }); }, - _initEditCarDateInfo: function () { + _initEditCarDateInfo: function() { //vc.component.editCarInfo.startTime = vc.dateTimeFormat(new Date().getTime()); $('.editCarStartTime').datetimepicker({ minView: "month", @@ -189,7 +165,7 @@ }); $('.editCarStartTime').datetimepicker() - .on('changeDate', function (ev) { + .on('changeDate', function(ev) { var value = $(".editCarStartTime").val(); vc.component.editCarInfo.startTime = value; }); @@ -204,7 +180,7 @@ todayBtn: true }); $('.editCarEndTime').datetimepicker() - .on('changeDate', function (ev) { + .on('changeDate', function(ev) { var value = $(".editCarEndTime").val(); var start = Date.parse(new Date(vc.component.editCarInfo.startTime)) var end = Date.parse(new Date(value))