优化车辆管理

This commit is contained in:
java110 2020-08-29 18:06:50 +08:00
parent 498ef8f947
commit dc19363bb2
7 changed files with 342 additions and 38 deletions

8
app.js
View File

@ -34,10 +34,10 @@ let opts = {
//app.use('/callComponent',proxy('https://app.demo.winqi.cn/',opts));
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012/',opts));
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts));
app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
app.use('/app',proxy('http://192.168.1.16:8012',opts));
app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts));
app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts));
//app.use('/callComponent',proxy('http://192.168.1.16:8012',opts));
//app.use('/app',proxy('http://192.168.1.16:8012',opts));
//app.listen(3000);
app.use(express.json());

View File

@ -0,0 +1,72 @@
<div id="editCarModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">修改</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">车牌号</label>
<div class="col-sm-10">
<input v-model="editCarInfo.carNum" type="text" placeholder="必填,请填写车牌号" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">车品牌</label>
<div class="col-sm-10">
<input v-model="editCarInfo.carBrand" type="text" placeholder="必填,请填写车品牌,如 宝马X6" class="form-control">
</div>
</div>
<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="editCarInfo.carType">
<option selected disabled value="">必填,请选择类型</option>
<option v-for="carType in carTypes" :key="carType.statusCd" v-bind:value="carType.statusCd">{{carType.name}}</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">颜色</label>
<div class="col-sm-10">
<input v-model="editCarInfo.carColor" type="text" placeholder="必填,请填写车颜色,如白色" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">起租时间</label>
<div class="col-sm-10">
<input v-model="editCarInfo.startTime" type="text" placeholder="必填,请填写起租时间"
class="form-control editStartTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">结租时间</label>
<div class="col-sm-10">
<input v-model="editCarInfo.endTime" type="text" placeholder="必填,请填写结租时间"
class="form-control editEndTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10">
<textarea v-model="editCarInfo.remark" type="text" placeholder="请填写备注信息" rows="3" class="form-control"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="_submitEditCarInfo()"><i
class="fa fa-check"></i>&nbsp;保存
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
</button>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,204 @@
/**
权限组
**/
(function (vc) {
vc.extends({
data: {
editCarInfo: {
carId: '',
carNum: '',
carBrand: '',
carType: '',
carColor: '',
remark: "",
startTime: '',
endTime: '',
carNumType: ''
},
carTypes: [
{
key: '9901',
value: '家用小汽车'
},
{
key: '9902',
value: '客车'
},
{
key: '9903',
value: '货车'
}
]
},
_initMethod: function () {
var param = {
params: {
name: 'owner_car',
type: 'car_type'
}
}
//发送get请求
vc.http.get('hireParkingSpace',
'listCarType',
param,
function (json, res) {
var carTypes = JSON.parse(json);
vc.component.carTypes = carTypes;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
vc.component._initDateInfo();
},
_initEvent: function () {
vc.on('editCar', 'openEditCar', function (_carInfo) {
vc.copyObject(_carInfo, $that.editCarInfo);
$('#editCarModal').modal('show');
});
},
methods: {
editCarValidate: function () {
return vc.validate.validate({
editCarInfo: vc.component.editCarInfo
}, {
'editCarInfo.carNum': [
{
limit: "required",
param: "",
errInfo: "车牌号不能为空"
},
{
limit: "maxin",
param: "2,12",
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: "车颜色超出限制"
}
]
});
},
_submitEditCarInfo: function () {
if (!vc.component.editCarValidate()) {
return;
}
vc.component.editCarInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'owner.editOwnerCar',
JSON.stringify(vc.component.editCarInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
$('#editCarModal').modal('hide');
vc.emit('lisOwnerCar', 'listOwnerCarData', {});
for (let key in $that.editCarInfo) {
$that.editCarInfo[key] = '';
}
return;
}
vc.toast(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
_initDateInfo: function () {
vc.component.editCarInfo.startTime = vc.dateFormat(new Date().getTime());
$('.editStartTime').datetimepicker({
language: 'zh-CN',
fontAwesome: 'fa',
format: 'yyyy-mm-dd hh:ii:ss',
initTime: true,
initialDate: new Date(),
autoClose: 1,
todayBtn: true
});
$('.editStartTime').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".editStartTime").val();
vc.component.editCarInfo.startTime = value;
});
$('.editEndTime').datetimepicker({
language: 'zh-CN',
fontAwesome: 'fa',
format: 'yyyy-mm-dd hh:ii:ss',
initTime: true,
initialDate: new Date(),
autoClose: 1,
todayBtn: true
});
$('.editEndTime').datetimepicker()
.on('changeDate', function (ev) {
var value = $(".editEndTime").val();
var start = Date.parse(new Date(vc.component.editCarInfo.startTime))
var end = Date.parse(new Date(value))
if (start - end >= 0) {
vc.toast("结租时间必须大于起租时间")
$(".editEndTime").val('')
} else {
vc.component.editCarInfo.endTime = value;
}
});
},
}
});
})(window.vc);

View File

@ -76,13 +76,15 @@
return ;
}
var param = {
communityId:vc.getCurrentCommunity().communityId,
data:vc.component.hireParkingSpaceInfo.infos
}
let _infos = vc.component.hireParkingSpaceInfo.infos
let param = _infos[2];
param.communityId = vc.getCurrentCommunity().communityId;
param.ownerId = _infos[1].ownerId;
param.psId = _infos[0].psId;
vc.http.apiPost(
'owner.saveOwnerCars',
'owner.saveOwnerCar',
JSON.stringify(param),
{
emulateJSON:true

View File

@ -94,7 +94,7 @@
{{car.carBrand}}
</td>
<td>
{{car.carType}}
{{car.carTypeName}}
</td>
<td>
{{car.carColor}}
@ -115,12 +115,16 @@
{{car.endTime}}
</td>
<td>
{{car.state}}
{{car.stateName}}
</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditParkingSpaceModel(car)">修改</button>
v-on:click="_deleteCarParkingSpace(car)">释放车位</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditOwnerCar(car)">修改</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
@ -143,9 +147,7 @@
</div>
</div>
</div>
<vc:create path="property/addParkingSpace" notifyLoadDataComponentName="lisOwnerCar"></vc:create>
<vc:create path="property/editParkingSpace" notifyLoadDataComponentName="lisOwnerCar"></vc:create>
<vc:create path="property/deleteOwnerCar" notifyLoadDataComponentName="lisOwnerCar"></vc:create>
<vc:create path="property/editCar" notifyLoadDataComponentName="listOwnerCar"></vc:create>
<vc:create path="property/deleteOwnerCar" notifyLoadDataComponentName="listOwnerCar"></vc:create>
</div>

View File

@ -12,7 +12,7 @@
conditions: {
carNum: '',
num: '',
state:''
state: ''
}
}
},
@ -29,12 +29,12 @@
},
methods: {
_listOwnerCar: function (_page, _row) {
let _params = $that.listOwnerCarInfo.conditions;
_params.page = _page;
_params.row = _row;
_params.communityId = vc.getCurrentCommunity().communityId;
var param = {
params: {
page: _page,
row: _row,
communityId: vc.getCurrentCommunity().communityId,
}
params: _params
}
//发送get请求
@ -58,9 +58,12 @@
);
},
_addOwnerCar:function(){ //出租
_addOwnerCar: function () { //出租
vc.jumpToPage('/admin.html#/pages/property/hireParkingSpace');
},
_openEditOwnerCar: function (_car) {
vc.emit('editCar', 'openEditCar', _car);
},
_queryMethod: function () {
$that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
},
@ -71,9 +74,31 @@
$that.listOwnerCarInfo.moreCondition = true;
}
},
_openDelOwnerCarModel:function(_car){
vc.emit('deleteOwnerCar','openOwnerCarModel',_car);
_openDelOwnerCarModel: function (_car) {
vc.emit('deleteOwnerCar', 'openOwnerCarModel', _car);
},
_deleteCarParkingSpace: function (_car) {
vc.http.apiPost(
'owner.deleteCarParkingSpace',
JSON.stringify(_car),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
vc.toast('释放成功');
$that._listOwnerCar(DEFAULT_PAGE, DEFAULT_ROWS);
return;
}
vc.toast(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
}
}
})
})(window.vc);

View File

@ -85,36 +85,35 @@
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th>车位ID</th>
<th data-hide="phone">车位编码</th>
<th data-hide="phone">停车场ID</th>
<th data-hide="phone">停车场编号</th>
<th data-hide="phone">停车场</th>
<th data-hide="phone">车位</th>
<th data-hide="phone">车位状态</th>
<th data-hide="phone">面积</th>
<th>车位ID</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="parkingSpace in listParkingSpaceInfo.parkingSpaces">
<td>
{{parkingSpace.psId}}
</td>
<td>
{{parkingSpace.num}}
{{parkingSpace.areaNum}}号停车场
</td>
<td>
{{parkingSpace.paId}}
</td>
<td>
{{parkingSpace.areaNum}}
{{parkingSpace.num}}车位
</td>
<td>
{{vc.component._viewParkingSpaceState(parkingSpace.state)}}
</td>
<td>
{{parkingSpace.area}}
</td>
<td>
{{parkingSpace.psId}}
</td>
<td class="text-right">
<!-- <div class="btn-group" v-if="parkingSpace.state =='F'">
<button class="btn-white btn btn-xs"