批量新增房屋信息功能 --renpc
This commit is contained in:
parent
4edb4501ad
commit
102256a603
@ -5,7 +5,8 @@
|
||||
<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">
|
||||
<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">
|
||||
@ -23,9 +24,11 @@
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在街道<span style="color: red;vertical-align: middle;">*</span></label>
|
||||
<label class="layui-form-label">所在街道<span
|
||||
style="color: red;vertical-align: middle;">*</span></label>
|
||||
<input type="hidden" id="streetName" name="streetName" class="layui-input" value="" maxlength="36">
|
||||
<div class="layui-input-block layui-form" id="streetNameSelectTemplateBox" lay-filter="streetNameSelectTemplateBox"></div>
|
||||
<div class="layui-input-block layui-form" id="streetNameSelectTemplateBox"
|
||||
lay-filter="streetNameSelectTemplateBox"></div>
|
||||
<script id="streetNameSelectTemplate" type="text/html">
|
||||
<select id="street" name="street" lay-filter="street" lay-verify="required" lay-search>
|
||||
<option value="">请选择街道</option>
|
||||
@ -36,9 +39,12 @@
|
||||
</script>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">所在社区<span style="color: red;vertical-align: middle;">*</span></label>
|
||||
<input type="hidden" id="communityName" name="communityName" class="layui-input" value="" maxlength="36">
|
||||
<div class="layui-input-block layui-form" id="communityNameSelectTemplateBox" lay-filter="communityNameSelectTemplateBox"></div>
|
||||
<label class="layui-form-label">所在社区<span
|
||||
style="color: red;vertical-align: middle;">*</span></label>
|
||||
<input type="hidden" id="communityName" name="communityName" class="layui-input" value=""
|
||||
maxlength="36">
|
||||
<div class="layui-input-block layui-form" id="communityNameSelectTemplateBox"
|
||||
lay-filter="communityNameSelectTemplateBox"></div>
|
||||
<script id="communityNameSelectTemplate" type="text/html">
|
||||
<select id="community" name="community" lay-filter="community" lay-verify="required" lay-search>
|
||||
<option value="">请选择社区</option>
|
||||
@ -50,10 +56,13 @@
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">小区<span style="color: red;vertical-align: middle;">*</span></label>
|
||||
<input type="hidden" id="residentialName" name="residentialName" class="layui-input" value="" placeholder="请输入小区名称" maxlength="36">
|
||||
<div class="layui-input-block layui-form" id="residentialNameSelectTemplateBox" lay-filter="residentialNameSelectTemplateBox"></div>
|
||||
<input type="hidden" id="residentialName" name="residentialName" class="layui-input" value=""
|
||||
placeholder="请输入小区名称" maxlength="36">
|
||||
<div class="layui-input-block layui-form" id="residentialNameSelectTemplateBox"
|
||||
lay-filter="residentialNameSelectTemplateBox"></div>
|
||||
<script id="residentialNameSelectTemplate" type="text/html">
|
||||
<select id="residentialId" name="residentialId" lay-filter="residentialId" lay-verify="required" lay-search>
|
||||
<select id="residentialId" name="residentialId" lay-filter="residentialId" lay-verify="required"
|
||||
lay-search>
|
||||
<option value="">请选择小区</option>
|
||||
{{# for(var i = 0, item; item = d[i++];) { }}
|
||||
<option value="{{item.residentialId}}">{{item.name}}</option>
|
||||
@ -64,31 +73,36 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">楼排名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="name" name="name" class="layui-input" value="" placeholder="请输入楼排名称" maxlength="255">
|
||||
<input type="text" id="name" name="name" class="layui-input" value="" placeholder="请输入楼排名称"
|
||||
maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">楼/排号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="buildNum" name="buildNum" class="layui-input" value="" placeholder="请输入楼/排号" lay-verify="required">
|
||||
<input type="number" id="buildNum" name="buildNum" class="layui-input" value=""
|
||||
placeholder="请输入楼/排号" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">楼层数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="floorsNum" name="floorsNum" class="layui-input" value="" placeholder="请输入楼层数" lay-verify="required">
|
||||
<input type="number" id="floorsNum" name="floorsNum" class="layui-input" value=""
|
||||
placeholder="请输入楼层数" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">单元/排数</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="unitNum" name="unitNum" class="layui-input" value="" placeholder="请输入单元/排数" lay-verify="required">
|
||||
<input type="number" id="unitNum" name="unitNum" class="layui-input" value=""
|
||||
placeholder="请输入单元/排数" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">详细地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="address" name="address" class="layui-input" value="" placeholder="请输入详细地址" maxlength="255">
|
||||
<input type="text" id="address" name="address" class="layui-input" value=""
|
||||
placeholder="请输入详细地址" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row" id="mapDiv">
|
||||
@ -100,13 +114,15 @@
|
||||
<div class="layui-col-xs6">
|
||||
<label class="layui-form-label">经度</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" readonly id="longitude" name="longitude" class="layui-input" value="" placeholder="请输入经度" maxlength="255">
|
||||
<input type="text" readonly id="longitude" name="longitude" class="layui-input" value=""
|
||||
placeholder="请输入经度" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs6">
|
||||
<label class="layui-form-label">纬度</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" readonly id="latitude" name="latitude" class="layui-input" value="" placeholder="请输入纬度" maxlength="255">
|
||||
<input type="text" readonly id="latitude" name="latitude" class="layui-input" value=""
|
||||
placeholder="请输入纬度" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -124,7 +140,9 @@
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="imageRemoveFile">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image"
|
||||
href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}"
|
||||
data-name="{{fileName}}" lay-filter="imageRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -132,7 +150,8 @@
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 9) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="图片" data-name="image" lay-filter="imageUploadFile">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="图片" data-name="image"
|
||||
lay-filter="imageUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -142,9 +161,9 @@
|
||||
</div>
|
||||
|
||||
<!-- 手动添加房屋信息 -->
|
||||
<div class="div-base-population-info">
|
||||
<div class="layui-form-item layui-row">
|
||||
<div class="">
|
||||
<div id="addDiv">
|
||||
<div class="layui-form-item layui-row" id="selUnitDiv">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-footer" style="left: 98%;">
|
||||
<button type="button" class="layui-btn selUnit">选择单元</button>
|
||||
</div>
|
||||
@ -152,7 +171,46 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<!--<div id="outerDiv" class="layui-form-item layui-row" style="margin-top: 30px;margin-bottom: 30px;border: 1px solid green;">
|
||||
<div id="unitDiv">
|
||||
<div class="layui-col-xs10" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<label class="layui-form-label">选择单元</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="unit" name="unit"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs2" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div class="layui-footer" style="left: 98%;">
|
||||
<button type="button" class="layui-btn selFloor" style="background-color: red;">选择楼层</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="floorDiv">
|
||||
<div class="layui-col-xs10" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<label class="layui-form-label">选择楼层</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="floor" name="floor"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs2" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<div class="layui-footer" style="left: 98%;">
|
||||
<button type="button" class="layui-btn selHouse">添加房屋</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="houseDiv">
|
||||
<div class="layui-col-xs4" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
<label class="layui-form-label">门牌号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="houseNum" name="houseNum" class="layui-input" value="" placeholder="请输入门牌号" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="layui-form-item layui-layout-admin" id="buttonDiv">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
@ -173,33 +231,132 @@
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function () {
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var viewerObj = {};
|
||||
// 用于给动态添加的元素增加下标
|
||||
var index = 0;
|
||||
var addFloorIndex = 0;
|
||||
var addHouseIndex = 0;
|
||||
var houseArr = {};
|
||||
var floorArr = {};
|
||||
|
||||
var centerPoint = {
|
||||
lng: [[${mapLng}]],
|
||||
lat: [[${mapLat}]],
|
||||
}
|
||||
|
||||
// 房主搜索
|
||||
function homeownerSearch() {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('route/house/list-popu', []),
|
||||
title: '人员选择',
|
||||
width: '80%',
|
||||
height: '80%',
|
||||
onClose: function(data) {
|
||||
var popuData = top.dialog.dialogData.popuData;
|
||||
$('#homeowner').val(popuData.name);
|
||||
$('#documentId').val('b7d74045-d984-4822-b0f3-711b15b933ca');
|
||||
$('#documentNum').val(popuData.idcard);
|
||||
$('#phone').val(popuData.phone);
|
||||
function addHouse(houseIndex) {
|
||||
|
||||
addHouseIndex += 1;
|
||||
|
||||
var html = '<div id="houseDiv_' + addHouseIndex + '">\n' +
|
||||
' <div class="layui-col-xs4" style="margin-bottom: 10px;">\n' +
|
||||
' <label class="layui-form-label">门牌号</label>\n' +
|
||||
' <div class="layui-input-block">\n' +
|
||||
' <input type="text" id="houseNum_' + addHouseIndex + '" name="houseNum_' + addHouseIndex + '" class="layui-input" value="" placeholder="请输入门牌号" lay-verify="required">\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>';
|
||||
|
||||
$('#floorDiv_' + houseIndex).find('#addFloorDiv_' + houseIndex).before(html);
|
||||
|
||||
form.render(null, 'dataForm');
|
||||
}
|
||||
|
||||
// 楼层选择
|
||||
function selFloor(floorIndex) {
|
||||
floorArr.index = index;
|
||||
floorArr.floorIndex = floorIndex;
|
||||
|
||||
let floorsNumValue = $('#floorsNum').val();
|
||||
if (!floorsNumValue) {
|
||||
top.dialog.msg('必须输入楼层数');
|
||||
return false;
|
||||
}
|
||||
|
||||
addFloorIndex += 1;
|
||||
|
||||
var html = '<div id="floorDiv_' + addFloorIndex + '">\n' +
|
||||
' <div class="layui-col-xs10" style="margin-top: 30px;margin-bottom: 10px;">\n' +
|
||||
' <label class="layui-form-label">选择楼层</label>\n' +
|
||||
' <div class="layui-input-block">\n' +
|
||||
' <select id="floor" name="floor"></select>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' <div class="layui-col-xs2" style="margin-top: 30px;margin-bottom: 10px;">\n' +
|
||||
' <div class="layui-footer" style="left: 98%;">\n' +
|
||||
' <button type="button" class="layui-btn selHouse">添加房屋</button>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="addFloorDiv_' + addFloorIndex + '">\n' +
|
||||
' <hr style="margin-top: 10px;border: none;' +
|
||||
' width: 80%;height: 1px;color: red;' +
|
||||
' background-color: red;margin-left: auto;' +
|
||||
' margin-right: auto;">\n' +
|
||||
' </div>';
|
||||
|
||||
$('#outerDiv_' + floorIndex).find('#addUnitDiv_' + floorIndex).before(html);
|
||||
|
||||
for (let i = 1; i <= floorsNumValue; i++) {
|
||||
var optionHtml = '<option>' + i + '</option>';
|
||||
$('#floorDiv_' + addFloorIndex).find('select').append(optionHtml);
|
||||
}
|
||||
|
||||
// 添加楼层点击方法
|
||||
$('#floorDiv_' + addFloorIndex).find('.selHouse').on('click', function () {
|
||||
var houseIndex = $(this).parent().parent().parent().attr('id').split('_')[1];
|
||||
addHouse(houseIndex);
|
||||
});
|
||||
|
||||
form.render(null, 'dataForm');
|
||||
}
|
||||
|
||||
// 单元选择
|
||||
function selUnit() {
|
||||
let unitNumValue = $('#unitNum').val();
|
||||
if (!unitNumValue) {
|
||||
top.dialog.msg('必须输入单元/排数');
|
||||
return false;
|
||||
}
|
||||
|
||||
index += 1;
|
||||
|
||||
var html = '<div id="outerDiv_' + index + '" class="layui-form-item layui-row" style="margin-top: 30px;border: 1px solid green;">\n' +
|
||||
' <div id="unitDiv_' + index + '">\n' +
|
||||
' <div class="layui-col-xs10" style="margin-top: 10px;">\n' +
|
||||
' <label class="layui-form-label">选择单元</label>\n' +
|
||||
' <div class="layui-input-block">\n' +
|
||||
' <select id="unit" name="unit"></select>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' <div class="layui-col-xs2" style="margin-top: 10px;margin-bottom: 10px;">\n' +
|
||||
' <div class="layui-footer" style="left: 98%;">\n' +
|
||||
' <button type="button" class="layui-btn selFloor" style="background-color: red;">选择楼层</button>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="addUnitDiv_' + index + '">\n' +
|
||||
' </div>\n' +
|
||||
' </div>';
|
||||
|
||||
$('#buttonDiv').before(html);
|
||||
|
||||
for (let i = 1; i <= unitNumValue; i++) {
|
||||
var optionHtml = '<option>' + i + '</option>';
|
||||
$('#outerDiv_' + index).find('#unitDiv_' + index).find('select').append(optionHtml);
|
||||
}
|
||||
|
||||
// 添加楼层点击方法
|
||||
$('#outerDiv_' + index).find('#unitDiv_' + index).find('.selFloor').on('click', function () {
|
||||
var unitIndex = $(this).parent().parent().parent().attr('id').split('_')[1];
|
||||
selFloor(unitIndex);
|
||||
});
|
||||
|
||||
form.render(null, 'dataForm');
|
||||
}
|
||||
|
||||
//初始化百度地图
|
||||
@ -215,15 +372,15 @@
|
||||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
|
||||
map.enableContinuousZoom();//开启缩放平滑
|
||||
// 点击获取地址
|
||||
var geocoder= new BMap.Geocoder();
|
||||
var geocoder = new BMap.Geocoder();
|
||||
mapMarkPoint(map, point);
|
||||
map.addEventListener("click", function(e) {
|
||||
map.addEventListener("click", function (e) {
|
||||
map.clearOverlays();
|
||||
$('#longitude').val(e.point.lng);
|
||||
$('#latitude').val(e.point.lat);
|
||||
point = new BMap.Point(e.point.lng, e.point.lat);
|
||||
mapMarkPoint(map, point);
|
||||
geocoder.getLocation(e.point, function(rs) {
|
||||
geocoder.getLocation(e.point, function (rs) {
|
||||
$('#address').val(rs.address);
|
||||
});
|
||||
});
|
||||
@ -234,34 +391,34 @@
|
||||
map.addOverlay(marker);
|
||||
}
|
||||
|
||||
form.on('select(street)', function(data){
|
||||
if(data.value) {
|
||||
form.on('select(street)', function (data) {
|
||||
if (data.value) {
|
||||
initCommunityNameSelect(data.value);
|
||||
initResidentialNameSelect(data.value, '');
|
||||
}else {
|
||||
} else {
|
||||
initCommunityNameSelect('9999');
|
||||
initResidentialNameSelect('', '');
|
||||
}
|
||||
});
|
||||
|
||||
// 社区change事件
|
||||
form.on('select(community)', function(data){
|
||||
form.on('select(community)', function (data) {
|
||||
var streetValue = $("#street").val();
|
||||
if(data.value) {
|
||||
if (data.value) {
|
||||
initResidentialNameSelect(streetValue, data.value);
|
||||
}else {
|
||||
} else {
|
||||
initResidentialNameSelect(streetValue, '');
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化社区下拉选择
|
||||
function initCommunityNameSelect(areaId) {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId=' + areaId, []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('communityNameSelectTemplate').innerHTML).render(data, function(html) {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId=' + areaId, []), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('communityNameSelectTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('communityNameSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'communityNameSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
@ -270,12 +427,12 @@
|
||||
initStreetNameSelect();
|
||||
|
||||
function initStreetNameSelect() {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render(data, function(html) {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/getStreetList', []), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('streetNameSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'streetNameSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
@ -285,12 +442,12 @@
|
||||
|
||||
function initResidentialNameSelect(street, community) {
|
||||
top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}',
|
||||
[street, community]), {}, null, function(code, data, args) {
|
||||
laytpl(document.getElementById('residentialNameSelectTemplate').innerHTML).render(data, function(html) {
|
||||
[street, community]), {}, null, function (code, data, args) {
|
||||
laytpl(document.getElementById('residentialNameSelectTemplate').innerHTML).render(data, function (html) {
|
||||
document.getElementById('residentialNameSelectTemplateBox').innerHTML = html;
|
||||
});
|
||||
form.render('select', 'residentialNameSelectTemplateBox');
|
||||
}, function(code, data) {
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
@ -303,8 +460,8 @@
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
laytpl(document.getElementById(fileName + 'FileDownload').innerHTML).render(dataRander, function (html) {
|
||||
document.getElementById(fileName + 'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
@ -314,9 +471,9 @@
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
if (!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
if (callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
@ -324,12 +481,12 @@
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
}, null, function (code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
if (callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
@ -338,31 +495,31 @@
|
||||
// 初始化图片图片上传
|
||||
function initImageUploadFile() {
|
||||
var files = $('#image').val();
|
||||
initFileList('image', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
initFileList('image', files, function (fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName + 'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(imageUploadFile)', function(obj) {
|
||||
form.on('button(imageUploadFile)', function (obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
title: '上传' + explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
onClose: function () {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
if (typeof (uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#' + name).val();
|
||||
for (var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if (files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
initFileList(name, files, function (fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
@ -370,18 +527,18 @@
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(imageRemoveFile)', function(obj) {
|
||||
form.on('button(imageRemoveFile)', function (obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
var files = $('#' + name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
if (files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
if (files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
initFileList(name, files, function (fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
@ -394,54 +551,93 @@
|
||||
initCommunityNameSelect('9999');
|
||||
initMap(centerPoint.lng, centerPoint.lat);
|
||||
}
|
||||
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
form.on('submit(submitForm)', function (formData) {
|
||||
// 设置批量录入房屋信息
|
||||
// 单元集合
|
||||
if (index > 0) {
|
||||
var resultList = [];
|
||||
for (let i = 1; i <= index; i++) {
|
||||
var unitValue = $('#outerDiv_' + i).find('#unitDiv_' + i).find('select option:selected').text();
|
||||
var resultObj = {};
|
||||
resultObj.unitValue = unitValue;
|
||||
|
||||
var floorList = [];
|
||||
for (let j = 1; j <= addFloorIndex; j++) {
|
||||
var floorValue = $('#outerDiv_' + i).find('#floorDiv_' + j).find('select option:selected').text();
|
||||
var floorObj = {};
|
||||
if (floorValue) {
|
||||
floorObj.floorValue = floorValue;
|
||||
floorList.push(floorObj);
|
||||
}
|
||||
|
||||
var houseList = [];
|
||||
for (let k = 1; k <= addHouseIndex; k++) {
|
||||
var houseValue = $('#outerDiv_' + i).find('#floorDiv_' + j).find('#houseDiv_' + k)
|
||||
.find('#houseNum_' + k).val();
|
||||
var houseObj = {};
|
||||
if(houseValue) {
|
||||
houseObj.houseValue = houseValue;
|
||||
houseList.push(houseObj);
|
||||
}
|
||||
}
|
||||
floorObj.houseList = houseList;
|
||||
}
|
||||
resultObj.floorList = floorList;
|
||||
|
||||
resultList.push(resultObj);
|
||||
}
|
||||
|
||||
console.log(resultList)
|
||||
formData.field.resultList = resultList;
|
||||
}
|
||||
|
||||
// 设置所在街道和社区的选中值
|
||||
var streetName = $('#street').find("option:selected").text();
|
||||
var communityName = $('#community').find("option:selected").text();
|
||||
formData.field.streetName = streetName;
|
||||
formData.field.communityName = communityName;
|
||||
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function (index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/building/save', []), formData.field, null, function(code, data) {
|
||||
top.restAjax.post(top.restAjax.path('api/building/saveBatch', []), formData.field, null, function (code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
btn2: function () {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
}, function () {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
}, function () {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
$('.close').on('click', function () {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
$('.homeownerSearch').on('click', function() {
|
||||
homeownerSearch();
|
||||
$('.selUnit').on('click', function () {
|
||||
selUnit();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
form.verify({});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user