加入批量 生成车位功能

This commit is contained in:
Your Name 2023-01-28 23:13:18 +08:00
parent 32e91f5383
commit 467a4ddb94
8 changed files with 380 additions and 116 deletions

View File

@ -0,0 +1,69 @@
<div id="batchAddParkingSpaceModel" 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">
<h3 class="m-t-none m-b ">
<span><vc:i18n name="添加" namespace="batchAddParkingSpace"></vc:i18n></span>
</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="编号前缀" namespace="batchAddParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="batchAddParkingSpaceInfo.preNum" type="text" :placeholder="vc.i18n('选填,不是纯数字时前面字母 如A12 时填写A','batchAddParkingSpace')" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="开始编号" namespace="batchAddParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="batchAddParkingSpaceInfo.startNum" type="number" :placeholder="vc.i18n('必填,请填写编码中数字部分开始编号','batchAddParkingSpace')" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="结束编号" namespace="batchAddParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="batchAddParkingSpaceInfo.endNum" type="number" :placeholder="vc.i18n('必填,请填写编码中数字部分结束编号','batchAddParkingSpace')" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="停车场" namespace="batchAddParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<select class="custom-select" v-model="batchAddParkingSpaceInfo.paId">
<option selected disabled value="">
{{vc.i18n('必填,请选择停车场','batchAddParkingSpace')}}
</option>
<option :value="item.paId"
v-for="(item,index) in batchAddParkingSpaceInfo.parkingAreas">{{item.num}}
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="车位类型" namespace="batchAddParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<select class="custom-select" v-model="batchAddParkingSpaceInfo.parkingType">
<option selected value="">{{vc.i18n('必填,请选择车位类型','batchAddParkingSpace')}}</option>
<option v-for="(item,index) in batchAddParkingSpaceInfo.parkingTypes" :key="index"
:value="item.statusCd">{{item.name}}
</option>
</select>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="saveParkingSpaceInfo()">
<i class="fa fa-check"></i>&nbsp;保存
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">
<i class="fa fa-times"></i>&nbsp;取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,126 @@
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROW = 10;
vc.extends({
propTypes: {
notifyLoadDataComponentName: vc.propTypes.string
},
data: {
batchAddParkingSpaceInfo: {
startNum: '',
endNum: '',
preNum: '',
paId: '',
area: '1',
remark: '',
psId: '',
parkingType: '1',
parkingTypes: [],
parkingAreas: []
}
},
_initMethod: function () {
//与字典表关联
vc.getDict('parking_space', "parking_type", function (_data) {
vc.component.batchAddParkingSpaceInfo.parkingTypes = _data;
});
},
_initEvent: function () {
vc.on('batchAddParkingSpace', 'openAddParkingSpaceModal', function () {
$that._loadAddParkingAreas();
$('#batchAddParkingSpaceModel').modal('show');
});
},
methods: {
batchAddParkingSpaceValidate() {
return vc.validate.validate({
batchAddParkingSpaceInfo: vc.component.batchAddParkingSpaceInfo
}, {
'batchAddParkingSpaceInfo.startNum': [{
limit: "required",
param: "",
errInfo: "开始编号不能为空"
},
],
'batchAddParkingSpaceInfo.endNum': [{
limit: "required",
param: "",
errInfo: "结束编号不能为空"
},
],
'batchAddParkingSpaceInfo.paId': [{
limit: "required",
param: "",
errInfo: "停车场不能为空"
}],
'batchAddParkingSpaceInfo.parkingType': [{
limit: "required",
param: "",
errInfo: "车位类型不能为空"
}],
});
},
saveParkingSpaceInfo: function () {
if (!vc.component.batchAddParkingSpaceValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.component.batchAddParkingSpaceInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'/parkingSpace.batchSaveParkingSpace',
JSON.stringify(vc.component.batchAddParkingSpaceInfo), {
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#batchAddParkingSpaceModel').modal('hide');
vc.component.clearAddParkingSpaceInfo();
vc.toast("添加成功");
vc.emit($props.notifyLoadDataComponentName, 'listParkingSpaceData', {});
return;
}
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
clearAddParkingSpaceInfo: function () {
let _parkingTypes = $that.batchAddParkingSpaceInfo.parkingTypes;
vc.component.batchAddParkingSpaceInfo = {
startNum: '',
endNum: '',
preNum: '',
paId: '',
area: '1',
remark: '',
psId: '',
parkingType: '1',
parkingTypes: _parkingTypes,
parkingAreas: []
}
},
_loadAddParkingAreas: function () {
let param = {
params: {
page: 1,
row: 50,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/parkingArea.listParkingAreas', param,
function (json, res) {
let _parkingAreaManageInfo = JSON.parse(json);
$that.batchAddParkingSpaceInfo.parkingAreas = _parkingAreaManageInfo.parkingAreas;
},
function (errInfo, error) {
console.log('请求失败处理');
});
},
}
});
})(window.vc);

View File

@ -17,10 +17,14 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="停车场" namespace="addParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<vc:create path="property/parkingAreaSelect2" parentModal="addParkingSpace"
callBackListener="addParkingSpace" callBackFunction="notify"
namespace="addParkingSpace">
</vc:create>
<select class="custom-select" v-model="addParkingSpaceInfo.paId">
<option selected disabled value="">
{{vc.i18n('必填,请选择停车场','addParkingSpace')}}
</option>
<option :value="item.paId"
v-for="(item,index) in addParkingSpaceInfo.parkingAreas">{{item.num}}
</option>
</select>
</div>
</div>
<div class="form-group row">
@ -43,7 +47,7 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="备注" namespace="addParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="addParkingSpaceInfo.remark" type="tel" :placeholder="vc.i18n('可填,请填写备注','addParkingSpace')" class="form-control">
<input v-model="addParkingSpaceInfo.remark" type="text" :placeholder="vc.i18n('可填,请填写备注','addParkingSpace')" class="form-control">
</div>
</div>
<div class="ibox-content">

View File

@ -28,6 +28,7 @@
if (_parkingSpaceId != null || _parkingSpaceId != -1) {
vc.component.addParkingSpaceInfo.parkingSpaceId = _parkingSpaceId;
}
$that._loadAddParkingAreas();
$('#addParkingSpaceModel').modal('show');
});
vc.on("addParkingSpace", "notify", function (_param) {
@ -115,11 +116,26 @@
vc.component.addParkingSpaceInfo.area = '1';
vc.component.addParkingSpaceInfo.remark = '';
vc.component.addParkingSpaceInfo.parkingType = '1';
vc.emit('addParkingSpace', 'parkingAreaSelect2', 'setParkingArea', {
paId: '',
num: ''
});
}
vc.component.addParkingSpaceInfo.parkingAreas = [];
},
_loadAddParkingAreas: function () {
let param = {
params: {
page: 1,
row: 50,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/parkingArea.listParkingAreas', param,
function (json, res) {
let _parkingAreaManageInfo = JSON.parse(json);
$that.addParkingSpaceInfo.parkingAreas = _parkingAreaManageInfo.parkingAreas;
},
function (errInfo, error) {
console.log('请求失败处理');
});
},
}
});
})(window.vc);

View File

@ -1,4 +1,4 @@
<div id="editParkingSpaceModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div id="editParkingSpaceModel" 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">
@ -17,8 +17,14 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="停车场" namespace="editParkingSpace"></vc:i18n></span></label>
<div class="col-sm-10">
<vc:create path="property/parkingAreaSelect2" parentModal="editParkingSpace" callBackListener="editParkingSpace" callBackFunction="notify" namespace="editParkingSpace">
</vc:create>
<select class="custom-select" v-model="editParkingSpaceInfo.paId">
<option selected disabled value="">
{{vc.i18n('必填,请选择停车场','editParkingSpace')}}
</option>
<option :value="item.paId"
v-for="(item,index) in editParkingSpaceInfo.parkingAreas">{{item.num}}
</option>
</select>
</div>
</div>
<div class="form-group row">

View File

@ -13,7 +13,8 @@
areaNum: '',
paId: '',
area: '',
remark: ''
remark: '',
parkingAreas:[]
}
},
_initMethod: function () {
@ -25,10 +26,7 @@
_initEvent: function () {
vc.on('editParkingSpace', 'openEditParkingSpaceModal', function (_parkingSpace) {
vc.copyObject(_parkingSpace, vc.component.editParkingSpaceInfo);
vc.emit('editParkingSpace', 'parkingAreaSelect2', 'setParkingArea', {
paId: vc.component.editParkingSpaceInfo.paId,
num: vc.component.editParkingSpaceInfo.areaNum
});
$that._loadEditParkingAreas();
$('#editParkingSpaceModel').modal('show');
});
vc.on("editParkingSpace", "notify", function (_param) {
@ -116,11 +114,28 @@
vc.component.editParkingSpaceInfo.area = '';
vc.component.editParkingSpaceInfo.remark = '';
vc.component.editParkingSpaceInfo.areaNum = '';
vc.emit('editParkingSpace', 'parkingAreaSelect2', 'setParkingArea', {
paId: '',
num: ''
});
}
vc.component.editParkingSpaceInfo.parkingAreas = [];
},
_loadEditParkingAreas: function () {
let param = {
params: {
page: 1,
row: 50,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/parkingArea.listParkingAreas', param,
function (json, res) {
let _parkingAreaManageInfo = JSON.parse(json);
$that.editParkingSpaceInfo.parkingAreas = _parkingAreaManageInfo.parkingAreas;
},
function (errInfo, error) {
console.log('请求失败处理');
});
},
}
});
})(window.vc);

View File

@ -4,11 +4,13 @@
<div class="ibox ">
<div class="ibox-title">
<h5>
<span><vc:i18n name="查询条件" namespace="listParkingSpace"></vc:i18n></span>
<span>
<vc:i18n name="查询条件" namespace="listParkingSpace"></vc:i18n>
</span>
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-link btn-sm" style="margin-right:10px;"
v-on:click="_moreCondition()">{{listParkingSpaceInfo.moreCondition == true?'隐藏':'更多'}}
v-on:click="_moreCondition()">{{listParkingSpaceInfo.moreCondition == true?'隐藏':'更多'}}
</button>
</div>
</div>
@ -17,12 +19,14 @@
<div class="col-sm-3">
<div class="form-group input-group">
<input type="text" :placeholder="vc.i18n('请选择停车场','listParkingSpace')"
v-model="listParkingSpaceInfo.conditions.areaNum" class="form-control">
v-model="listParkingSpaceInfo.conditions.areaNum" class="form-control">
<div class="input-group-prepend">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_openChooseParkingArea()">
v-on:click="_openChooseParkingArea()">
<i class="fa fa-search"></i>
<span><vc:i18n name="选择" namespace="listParkingSpace"></vc:i18n></span>
<span>
<vc:i18n name="选择" namespace="listParkingSpace"></vc:i18n>
</span>
</button>
</div>
</div>
@ -30,7 +34,7 @@
<div class="col-sm-4">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请填写车位编号','listParkingSpace')"
class=" form-control" v-model="listParkingSpaceInfo.num">
class=" form-control" v-model="listParkingSpaceInfo.num">
</div>
</div>
<div class="col-sm-3">
@ -46,11 +50,15 @@
<div class="col-sm-2">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryRoomMethod()">
<i class="fa fa-search"></i>
<span><vc:i18n name="查询" namespace="listParkingSpace"></vc:i18n></span>
<span>
<vc:i18n name="查询" namespace="listParkingSpace"></vc:i18n>
</span>
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_resetRoomMethod()">
<i class="fa fa-repeat"></i>
<span><vc:i18n name="重置" namespace="listParkingSpace"></vc:i18n></span>
<span>
<vc:i18n name="重置" namespace="listParkingSpace"></vc:i18n>
</span>
</button>
</div>
</div>
@ -58,8 +66,7 @@
<div class="col-sm-3">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请填写车位ID','listParkingSpace')"
class="form-control form-control-sm"
v-model="listParkingSpaceInfo.conditions.psId">
class="form-control form-control-sm" v-model="listParkingSpaceInfo.conditions.psId">
</div>
</div>
</div>
@ -72,101 +79,117 @@
<div class="ibox">
<div class="ibox-title">
<h5>
<span><vc:i18n name="停车位信息" namespace="listParkingSpace"></vc:i18n></span>
<span>
<vc:i18n name="停车位信息" namespace="listParkingSpace"></vc:i18n>
</span>
</h5>
<div class="ibox-tools" style="top:10px;">
<form>
<div class="form-row">
<div class="col">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_openAddParkingSpaceModal(-1)">
<i class="fa fa-plus"></i>
<span><vc:i18n name="添加" namespace="listParkingSpace"></vc:i18n></span>
</button>
</div>
</div>
</form>
<button type="button" class="btn btn-white btn-sm" v-on:click="_openBatchAddParkingSpaceModal()">
<vc:i18n name="批量添加" namespace="listParkingSpace"></vc:i18n>
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddParkingSpaceModal(-1)">
<i class="fa fa-plus"></i>
<span>
<vc:i18n name="添加" namespace="listParkingSpace"></vc:i18n>
</span>
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th data-hide="phone" class="text-center">
<span><vc:i18n name="停车场" namespace="listParkingSpace"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center">
<span><vc:i18n name="车位" namespace="listParkingSpace"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center">
<span><vc:i18n name="车位状态" namespace="listParkingSpace"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center">
<span><vc:i18n name="车位类型" namespace="listParkingSpace"></vc:i18n></span>
</th>
<th data-hide="phone" class="text-center">
<span><vc:i18n name="面积" namespace="listParkingSpace"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="创建时间" namespace="listParkingSpace"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="操作" namespace="listParkingSpace"></vc:i18n></span>
</th>
</tr>
<tr>
<th data-hide="phone" class="text-center">
<span>
<vc:i18n name="停车场" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
<th data-hide="phone" class="text-center">
<span>
<vc:i18n name="车位" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
<th data-hide="phone" class="text-center">
<span>
<vc:i18n name="车位状态" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
<th data-hide="phone" class="text-center">
<span>
<vc:i18n name="车位类型" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
<th data-hide="phone" class="text-center">
<span>
<vc:i18n name="面积" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
<th class="text-center">
<span>
<vc:i18n name="创建时间" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
<th class="text-center">
<span>
<vc:i18n name="操作" namespace="listParkingSpace"></vc:i18n>
</span>
</th>
</tr>
</thead>
<tbody>
<tr v-for="parkingSpace in listParkingSpaceInfo.parkingSpaces">
<td class="text-center">
{{parkingSpace.areaNum}}
<span><vc:i18n name="号停车场" namespace="listParkingSpace"></vc:i18n></span>
</td>
<td class="text-center">
{{parkingSpace.num}}
<span><vc:i18n name="车位" namespace="listParkingSpace"></vc:i18n></span>
</td>
<td class="text-center">
{{vc.component._viewParkingSpaceState(parkingSpace.state)}}
</td>
<td class="text-center">
{{parkingSpace.parkingTypeName}}
</td>
<td class="text-center">
{{parkingSpace.area}}
</td>
<td class="text-center">
{{parkingSpace.createTime}}
</td>
<td class="text-center">
<!-- <div class="btn-group" v-if="parkingSpace.state =='F'">
<button class="btn-white btn btn-xs"
v-on:click="_openToHireParkingSpaceModel(parkingSpace)">{{vc.i18n('出租','listParkingSpace')}}</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openToSellParkingSpaceModel(parkingSpace)">{{vc.i18n('出售','listParkingSpace')}}</button>
</div> -->
<div class="btn-group">
<button class="btn-white btn btn-xs"
<tr v-for="parkingSpace in listParkingSpaceInfo.parkingSpaces">
<td class="text-center">
{{parkingSpace.areaNum}}
<span>
<vc:i18n name="号停车场" namespace="listParkingSpace"></vc:i18n>
</span>
</td>
<td class="text-center">
{{parkingSpace.num}}
<span>
<vc:i18n name="车位" namespace="listParkingSpace"></vc:i18n>
</span>
</td>
<td class="text-center">
{{vc.component._viewParkingSpaceState(parkingSpace.state)}}
</td>
<td class="text-center">
{{parkingSpace.parkingTypeName}}
</td>
<td class="text-center">
{{parkingSpace.area}}
</td>
<td class="text-center">
{{parkingSpace.createTime}}
</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditParkingSpaceModel(parkingSpace)">
<span><vc:i18n name="修改" namespace="listParkingSpace"></vc:i18n></span>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
<span>
<vc:i18n name="修改" namespace="listParkingSpace"></vc:i18n>
</span>
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDelParkingSpaceModel(parkingSpace)">
<span><vc:i18n name="删除" namespace="listParkingSpace"></vc:i18n></span>
</button>
</div>
</td>
</tr>
<span>
<vc:i18n name="删除" namespace="listParkingSpace"></vc:i18n>
</span>
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
@ -179,5 +202,7 @@
<vc:create path="property/editParkingSpace" notifyLoadDataComponentName="listParkingSpace"></vc:create>
<vc:create path="property/deleteParkingSpace" notifyLoadDataComponentName="listParkingSpace"></vc:create>
<vc:create path="property/chooseParkingArea" emitChooseParkingArea="listParkingSpace"
emitLoadData="listParkingSpace"></vc:create>
emitLoadData="listParkingSpace"></vc:create>
<vc:create path="car/batchAddParkingSpace" notifyLoadDataComponentName="listParkingSpace"></vc:create>
</div>

View File

@ -136,6 +136,9 @@
_openChooseParkingArea: function () {
vc.emit('chooseParkingArea', 'openChooseParkingAreaModel', {});
},
_openBatchAddParkingSpaceModal:function(){
vc.emit('batchAddParkingSpace', 'openAddParkingSpaceModal', {});
}
}
})
})(window.vc);