增加房屋综合管理、快速建房、批量建房
This commit is contained in:
parent
fd950b875f
commit
d96a9ccc7a
@ -50,14 +50,18 @@ public class HouseRouteController extends AbstractController {
|
||||
return new ModelAndView("house/list-myself");
|
||||
}
|
||||
|
||||
@GetMapping("save-batch")
|
||||
public ModelAndView saveBatch() {
|
||||
return new ModelAndView("house/save-batch");
|
||||
}
|
||||
|
||||
@GetMapping("list-summary")
|
||||
public ModelAndView listSummary() {
|
||||
return new ModelAndView("house/list-summary");
|
||||
}
|
||||
|
||||
@GetMapping("save-quick")
|
||||
public ModelAndView saveQuick() {
|
||||
return new ModelAndView("house/save-quick");
|
||||
}
|
||||
@GetMapping("save-batch")
|
||||
public ModelAndView saveBatch() {
|
||||
return new ModelAndView("house/save-batch");
|
||||
}
|
||||
|
||||
}
|
@ -64,9 +64,9 @@
|
||||
</div>
|
||||
<div id="treeBody" class="layui-card-body"></div>
|
||||
<div id="treeFooter" class="layui-card-footer">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-xs">上一页</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs">下一页</button>
|
||||
<div class="layui-btn-group" id="buildingPageBtnGroup">
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="nextBuildingPageBtn">上一页</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="prevBuildingPageBtn">下一页</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -74,10 +74,10 @@
|
||||
<div class="layui-col-xs10">
|
||||
<div class="layui-card">
|
||||
<div id="contentHeader" class="layui-card-header">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-xs">快速新增 <i class="fa fa-plus"></i></button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal">批量新增 <i class="fa fa-plus"></i></button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary">单独新增 <i class="fa fa-plus"></i></button>
|
||||
<div class="layui-btn-group" id="createBtnGroup" style="display: none;">
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="saveQuickBtn"><i class="fa fa-plus"></i> 快速建房</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" id="saveBatchBtn"><i class="fa fa-plus"></i> 批量建房</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" id="saveNormalBtn"><i class="fa fa-plus"></i> 单独建房</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
@ -115,6 +115,8 @@
|
||||
community: '',
|
||||
housingEstate: '',
|
||||
buildingId: '',
|
||||
buildingFloorsNum: '',
|
||||
buildingUnitNum: '',
|
||||
}
|
||||
var buildingPager = {
|
||||
currentPage: 1,
|
||||
@ -208,20 +210,42 @@
|
||||
}
|
||||
|
||||
var renderBuilding = function() {
|
||||
var renderBuildingLise = function() {
|
||||
var lis = '';
|
||||
$.each(buildingPager.datas, function(index, item) {
|
||||
lis += `<li data-id="${item.buildingId}">${index + 1}.${item.name}</li>`;
|
||||
lis += `<li data-id="${item.buildingId}" data-floors-num="${item.floorsNum}" data-unit-num="${item.unitNum}">${index + 1}.${item.name}</li>`;
|
||||
});
|
||||
var $treeBody = $('#treeBody');
|
||||
$treeBody.empty();
|
||||
if(lis) {
|
||||
$treeBody.append(`<span>楼宇</span><ul>${lis}</ul>`);
|
||||
$treeBody.append(`<span>楼/排列表</span><ul>${lis}</ul>`);
|
||||
} else {
|
||||
$treeBody.append('<div>暂无数据</div>')
|
||||
}
|
||||
}
|
||||
|
||||
var renderPageBtn = function() {
|
||||
var $buildingPageBtnGroup = $('#buildingPageBtnGroup');
|
||||
if(buildingPager.totalPage > 1) {
|
||||
$buildingPageBtnGroup.show();
|
||||
} else {
|
||||
$buildingPageBtnGroup.hide();
|
||||
}
|
||||
}
|
||||
|
||||
renderBuildingLise();
|
||||
renderPageBtn();
|
||||
initHouse();
|
||||
}
|
||||
|
||||
var renderCreateBtnGroup = function() {
|
||||
if(selectedRelation.buildingId) {
|
||||
$('#createBtnGroup').show();
|
||||
} else {
|
||||
$('#createBtnGroup').hide();
|
||||
}
|
||||
}
|
||||
|
||||
var initBuilding = function() {
|
||||
selectedRelation.buildingId = '';
|
||||
top.restAjax.get(top.restAjax.path('api/building/listpage', []), {
|
||||
@ -236,13 +260,13 @@
|
||||
buildingPager.total = data.total;
|
||||
buildingPager.totalPage = buildingPager.total % buildingPager.rows === 0? buildingPager.total / buildingPager.rows : Math.floor(buildingPager.total / buildingPager.rows) + 1;
|
||||
renderBuilding();
|
||||
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
})
|
||||
}
|
||||
|
||||
var initHouse = function() {
|
||||
renderCreateBtnGroup();
|
||||
var data = {
|
||||
floorCount: 18, // 层
|
||||
unitCount: 3, // 单元
|
||||
@ -388,7 +412,7 @@
|
||||
<div class="option">
|
||||
<a href="javascript:void(0)" class="house-edit" data-id="${ktem.houseId}">编辑</a>
|
||||
<span>|</span>
|
||||
<a href="javascript:void(0)" class="house-remove" data-id="${ktem.houseId}">删除</a>
|
||||
<a href="javascript:void(0)" class="house-remove" data-id="${ktem.houseId}" data-name="${ktem.name}">删除</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -403,7 +427,7 @@
|
||||
|
||||
var initData = function() {
|
||||
if(!selectedRelation.buildingId) {
|
||||
$top.append(`<div style="font-size: 14px; width: ${$('#contentBody').width() - 100}px; height: 100%; display: flex; justify-content: center; align-items: center; border: 1px solid #e6e6e6; box-sizing: border-box; background-color: #f2f2f2;">请选择楼宇</div>`)
|
||||
$top.append(`<div style="font-size: 14px; width: ${$('#contentBody').width() - 100}px; height: 100%; display: flex; justify-content: center; align-items: center; border: 1px solid #e6e6e6; box-sizing: border-box; background-color: #f2f2f2;">请选择楼/排</div>`)
|
||||
return;
|
||||
}
|
||||
var loadLayerIndex;
|
||||
@ -433,8 +457,72 @@
|
||||
$lis.filter('.active').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
selectedRelation.buildingId = this.dataset.id;
|
||||
selectedRelation.buildingFloorsNum = this.dataset.floorsNum;
|
||||
selectedRelation.buildingUnitNum = this.dataset.unitNum;
|
||||
initHouse();
|
||||
});
|
||||
$(document).on('click', '#nextBuildingPageBtn', function() {
|
||||
if(buildingPager.currentPage <= 1) {
|
||||
return;
|
||||
}
|
||||
buildingPager.currentPage -= 1;
|
||||
initBuilding();
|
||||
});
|
||||
$(document).on('click', '#prevBuildingPageBtn', function() {
|
||||
if(buildingPager.currentPage >= buildingPager.totalPage) {
|
||||
return;
|
||||
}
|
||||
buildingPager.currentPage += 1;
|
||||
initBuilding();
|
||||
});
|
||||
// 快速创建
|
||||
$(document).on('click', '#saveQuickBtn', function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['40%', '100%'],
|
||||
offset: 'r',
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/house/save-quick?buildingId={buildingId}', [selectedRelation.buildingId]),
|
||||
end: function() {
|
||||
initHouse();
|
||||
}
|
||||
});
|
||||
})
|
||||
// 批量创建
|
||||
$(document).on('click', '#saveBatchBtn', function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['50%', '100%'],
|
||||
offset: 'r',
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path(`route/house/save-batch?buildingId={buildingId}&floorsNum={buildingFloorsNum}&unitNum={buildingUnitNum}`, [selectedRelation.buildingId, selectedRelation.buildingFloorsNum, selectedRelation.buildingUnitNum]),
|
||||
end: function() {
|
||||
initHouse();
|
||||
}
|
||||
});
|
||||
})
|
||||
// 普通创建
|
||||
$(document).on('click', '#saveNormalBtn', function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['40%', '100%'],
|
||||
offset: 'r',
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/house/save-normal?buildingId={buildingId}', [selectedRelation.buildingId]),
|
||||
end: function() {
|
||||
initHouse();
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#contentBody .center').scroll(function(e) {
|
||||
var $top = $('#contentBody .top');
|
||||
var $left = $('#contentBody .left');
|
||||
@ -464,7 +552,27 @@
|
||||
});
|
||||
$(document).on('click', '#contentBody .center .main .floor .unit .house .info .option .house-remove', function() {
|
||||
var houseId = this.dataset.id;
|
||||
console.log('remove', houseId);
|
||||
var name = this.dataset.name;
|
||||
top.dialog.msg(`确定删除【${name}】这个房间吗?`, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/house/remove/{ids}', [houseId]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function() {
|
||||
initHouse();
|
||||
});
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -488,8 +596,8 @@
|
||||
var $top = $center.find('.top');
|
||||
var $left = $center.find('.left');
|
||||
$center.css({
|
||||
width: `${contentBody.width - 80}px`,
|
||||
height: `${contentBody.height - 30}px`
|
||||
width: `${contentBody.width - 100}px`,
|
||||
height: `${contentBody.height - 50}px`
|
||||
})
|
||||
}
|
||||
|
||||
|
337
src/main/resources/templates/house/save-batch.html
Normal file
337
src/main/resources/templates/house/save-batch.html
Normal file
@ -0,0 +1,337 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>批量建房</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div id="tableContainer"></div>
|
||||
<div>
|
||||
<button type="button" class="layui-btn layui-btn-xs unit-add-btn">增加单元</button>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var query = top.restAjax.params(window.location.href);
|
||||
var buildingId = query.buildingId;
|
||||
var floorsCount = query.floorsNum;
|
||||
var unitCount = query.unitNum;
|
||||
|
||||
var batchHouseData = {
|
||||
units: [{
|
||||
unitValue: 1,
|
||||
floorList: [{
|
||||
floorValue: 1,
|
||||
houseList: [{
|
||||
houseValue: ''
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
|
||||
var renderHouseTable = function() {
|
||||
var renderHouseTable = function(unit, floor, houses) {
|
||||
var trs = '';
|
||||
$.each(houses, function(index, item) {
|
||||
trs += `
|
||||
<tr>
|
||||
<td>${unit.value}单元${floor.value}层</td>
|
||||
<td>
|
||||
<input type="text" class="layui-input house-input" value="${item.houseValue}" required lay-verify="required" placeholder="请输入房号" data-unit-index="${unit.index}" data-floor-index="${floor.index}" data-house-index="${index}">
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger house-remove-btn" data-unit-index="${unit.index}" data-floor-index="${floor.index}" data-house-index="${index}">删除房屋</button>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
return `
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
<col width="80">
|
||||
</colgroup>
|
||||
<tbody>${trs}</tbody>
|
||||
</table>
|
||||
`;
|
||||
}
|
||||
|
||||
var renderFloorTable = function(unit, floors) {
|
||||
var renderFloorOptions = function(floorValue) {
|
||||
var options = '';
|
||||
for(var i = 0; i < floorsCount; i++) {
|
||||
var value = i + 1;
|
||||
options += `<option value="${value}" ${(floorValue === value ? 'selected': '')}>${value}</option>`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
var trs = '';
|
||||
$.each(floors, function(index, item) {
|
||||
trs += `
|
||||
<tr>
|
||||
<td>${unit.value}单元</td>
|
||||
<td>
|
||||
<select name="city" lay-verify="required" lay-filter="floorSelectFilter" data-unit-index="${unit.index}" data-floor-index="${index}">${renderFloorOptions(item.floorValue)}</select>
|
||||
</td>
|
||||
<td>层</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger floor-remove-btn" data-unit-index="${unit.index}" data-floor-index="${index}">删除层</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<button type="button" class="layui-btn layui-btn-xs house-add-btn" data-unit-index="${unit.index}" data-floor-index="${index}">添加房屋</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><div class="house-table">${renderHouseTable(unit, {index: index, value: item.floorValue}, item.houseList)}</div></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
return `
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="80">
|
||||
<col>
|
||||
<col>
|
||||
<col width="80">
|
||||
</colgroup>
|
||||
<tbody>${trs}</tbody>
|
||||
</table>
|
||||
`;
|
||||
}
|
||||
|
||||
var renderUnitTable = function() {
|
||||
var renderUnitOptions = function(unitValue) {
|
||||
var options = '';
|
||||
for(var i = 0; i < unitCount; i++) {
|
||||
var value = i + 1;
|
||||
options += `<option value="${value}" ${(unitValue === value ? 'selected': '')}>${value}</option>`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
var trs = '';
|
||||
$.each(batchHouseData.units, function(index, item) {
|
||||
trs += `
|
||||
<tr>
|
||||
<td colspan="3"><label>单元</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="city" lay-verify="required" lay-filter="unitSelectFilter" data-unit-index="${index}">${renderUnitOptions(item.unitValue)}</select>
|
||||
</td>
|
||||
<td>单元</td>
|
||||
<td>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger unit-remove-btn" data-unit-index="${index}">删除单元</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">${item.floorList.length >= floorsCount ? '' : `<button type="button" class="layui-btn layui-btn-xs floor-add-btn" data-unit-index="${index}">添加楼层</button>`}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><div class="floor-table">${renderFloorTable({index: index, value: item.unitValue}, item.floorList)}</div></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
var table = `
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col width="60">
|
||||
</colgroup>
|
||||
<tbody>${trs}</tbody>
|
||||
</table>
|
||||
`;
|
||||
var $tableContainer = $('#tableContainer');
|
||||
$tableContainer.empty();
|
||||
$tableContainer.append(table);
|
||||
}
|
||||
renderUnitTable();
|
||||
form.render();
|
||||
|
||||
if(batchHouseData.units.length >= unitCount) {
|
||||
$('.unit-add-btn').hide();
|
||||
} else {
|
||||
$('.unit-add-btn').show();
|
||||
}
|
||||
}
|
||||
|
||||
var addEvent = function() {
|
||||
$(document).on('click', '.unit-add-btn', function() {
|
||||
batchHouseData.units.push({
|
||||
unitValue: batchHouseData.units.length + 1,
|
||||
floorList: [{
|
||||
floorValue: 1,
|
||||
houseList: [{
|
||||
houseValue: ''
|
||||
}]
|
||||
}]
|
||||
});
|
||||
renderHouseTable();
|
||||
});
|
||||
// 新增
|
||||
$(document).on('click', '.floor-add-btn', function() {
|
||||
var unitIndex = this.dataset.unitIndex;
|
||||
batchHouseData.units[unitIndex].floorList.push({
|
||||
floorValue: batchHouseData.units[unitIndex].floorList.length + 1,
|
||||
houseList: [{
|
||||
houseValue: ''
|
||||
}]
|
||||
});
|
||||
renderHouseTable();
|
||||
});
|
||||
$(document).on('click', '.house-add-btn', function() {
|
||||
var unitIndex = this.dataset.unitIndex;
|
||||
var floorIndex = this.dataset.floorIndex;
|
||||
batchHouseData.units[unitIndex].floorList[floorIndex].houseList.push({
|
||||
houseValue: ''
|
||||
});
|
||||
renderHouseTable();
|
||||
});
|
||||
// 输入
|
||||
$(document).on('keyup', '.house-input', function() {
|
||||
var unitIndex = this.dataset.unitIndex;
|
||||
var floorIndex = this.dataset.floorIndex;
|
||||
var houseIndex = this.dataset.houseIndex;
|
||||
batchHouseData.units[unitIndex].floorList[floorIndex].houseList[houseIndex].houseValue = this.value;
|
||||
});
|
||||
// 删除
|
||||
$(document).on('click', '.unit-remove-btn', function() {
|
||||
var unitIndex = this.dataset.unitIndex;
|
||||
if(batchHouseData.units.length <= 1) {
|
||||
top.dialog.msg('最少保留一个单元');
|
||||
return;
|
||||
}
|
||||
batchHouseData.units.splice(unitIndex, 1);
|
||||
renderHouseTable();
|
||||
});
|
||||
$(document).on('click', '.floor-remove-btn', function() {
|
||||
var unitIndex = this.dataset.unitIndex;
|
||||
var floorIndex = this.dataset.floorIndex;
|
||||
if(batchHouseData.units[unitIndex].floorList.length <= 1) {
|
||||
top.dialog.msg(`${unitIndex + 1}最少保留一个楼层`);
|
||||
return;
|
||||
}
|
||||
batchHouseData.units[unitIndex].floorList.splice(floorIndex, 1);
|
||||
renderHouseTable();
|
||||
});
|
||||
$(document).on('click', '.house-remove-btn', function() {
|
||||
var unitIndex = this.dataset.unitIndex;
|
||||
var floorIndex = this.dataset.floorIndex;
|
||||
var houseIndex = this.dataset.houseIndex;
|
||||
if(batchHouseData.units[unitIndex].floorList[floorIndex].houseList.length <= 1) {
|
||||
top.dialog.msg(`${unitIndex + 1}单元${floorIndex + 1}层最少保留一间房`);
|
||||
return;
|
||||
}
|
||||
batchHouseData.units[unitIndex].floorList[floorIndex].houseList.splice(houseIndex, 1);
|
||||
renderHouseTable();
|
||||
});
|
||||
// 选择
|
||||
form.on('select(unitSelectFilter)', function(data) {
|
||||
var dataset = data.elem.dataset;
|
||||
var unitIndex = dataset.unitIndex;
|
||||
batchHouseData.units[unitIndex].unitValue = parseInt(data.value);
|
||||
renderHouseTable();
|
||||
});
|
||||
form.on('select(floorSelectFilter)', function(data) {
|
||||
var dataset = data.elem.dataset;
|
||||
var unitIndex = dataset.unitIndex;
|
||||
var floorIndex = dataset.floorIndex;
|
||||
batchHouseData.units[unitIndex].floorList[floorIndex].floorValue = parseInt(data.value);
|
||||
renderHouseTable();
|
||||
});
|
||||
}
|
||||
|
||||
renderHouseTable();
|
||||
addEvent();
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/house/saveBatch', []), {
|
||||
buildingId: buildingId,
|
||||
resultList: batchHouseData.units
|
||||
}, null, function(code, data) {
|
||||
top.dialog.msg('创建成功', {time: 1000}, function() {
|
||||
closeBox();
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
unsignInt: function(value, item) {
|
||||
if(/^\d+/.test(value)) {
|
||||
return '只能是正整数';
|
||||
}
|
||||
value = parseInt(value);
|
||||
if(value <= 0) {
|
||||
return '只能是正整数';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
101
src/main/resources/templates/house/save-quick.html
Normal file
101
src/main/resources/templates/house/save-quick.html
Normal file
@ -0,0 +1,101 @@
|
||||
<!doctype html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<base th:href="${#request.getContextPath() + '/'}">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>快速建房</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="div-base-population-info">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label" style="width: 140px;">每层每单元户数</label>
|
||||
<div class="layui-input-block" style="margin-left: 140px;">
|
||||
<input type="number" id="floorUnitHouseCount" name="floorUnitHouseCount" class="layui-input" value="" step="1" placeholder="请输入每层每单元户数" lay-verify="required|unsignInt">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var buildingId = top.restAjax.params(window.location.href).buildingId;
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
formData.field.buildingId = buildingId;
|
||||
top.restAjax.post(top.restAjax.path('api/house/saveAuto', []), formData.field, null, function(code, data) {
|
||||
top.dialog.msg('创建成功', {time: 1000}, function() {
|
||||
closeBox();
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
unsignInt: function(value, item) {
|
||||
if(!(/(^[1-9]\d*$)/.test(value))) {
|
||||
return '只能是正整数';
|
||||
}
|
||||
value = parseInt(value);
|
||||
if(value <= 0) {
|
||||
return '只能是正整数';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user