btxtgxq-system-population/src/main/resources/templates/house/save.html

744 lines
43 KiB
HTML
Raw Normal View History

2023-10-27 11:34:23 +08:00
<!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-fluid 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">
<blockquote class="layui-elem-quote">基础信息</blockquote>
<div class="layui-form-item">
<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>
<script id="streetNameSelectTemplate" type="text/html">
<select id="street" name="street" lay-filter="street" lay-verify="required" lay-search>
<option value="">请选择街道</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg4">
<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>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.communityId}}">{{item.communityName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<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>
<script id="residentialNameSelectTemplate" type="text/html">
<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>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">楼/排<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="buildingName" name="buildingName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="buildingNameSelectTemplateBox" lay-filter="buildingNameSelectTemplateBox"></div>
<script id="buildingNameSelectTemplate" type="text/html">
<select id="buildingId" name="buildingId" lay-filter="buildingId" lay-verify="required" lay-search>
<option value="">请选择楼/排</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.buildingId}}_{{item.nuitNum}}_{{item.floorsNum}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg4">
<label class="layui-form-label">所在单元/列</label>
<div class="layui-input-block" id="affiliationUnitDiv">
<select id="affiliationUnit" name="affiliationUnit"></select>
</div>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">所在层/院</label>
<div class="layui-input-block" id="affiliationFloorsDiv">
<select id="affiliationFloors" name="affiliationFloors"></select>
</div>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">门牌号</label>
<div class="layui-input-block">
<input type="number" id="houseNum" name="houseNum" class="layui-input" value="" placeholder="请输入门牌号" lay-verify="required">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg4">
<label class="layui-form-label">房屋类别<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="categoryName" name="categoryName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="categoryNameSelectTemplateBox" lay-filter="categoryNameSelectTemplateBox"></div>
<script id="categoryNameSelectTemplate" type="text/html">
<select id="categoryId" name="categoryId" lay-filter="categoryId" lay-verify="required" lay-search>
<option value="">请选择房屋类别</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">房屋性质<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="natureName" name="natureName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="natureNameSelectTemplateBox" lay-filter="natureNameSelectTemplateBox"></div>
<script id="natureNameSelectTemplate" type="text/html">
<select id="natureId" name="natureId" lay-filter="natureId" lay-verify="required" lay-search>
<option value="">请选择房屋性质</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">房屋种类<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="typeName" name="typeName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="typeNameSelectTemplateBox" lay-filter="typeNameSelectTemplateBox"></div>
<script id="typeNameSelectTemplate" type="text/html">
<select id="typeId" name="typeId" lay-filter="typeId" lay-verify="required" lay-search>
<option value="">请选择房屋种类</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg4">
<label class="layui-form-label">房屋结构<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="structureName" name="structureName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="structureNameSelectTemplateBox" lay-filter="structureNameSelectTemplateBox"></div>
<script id="structureNameSelectTemplate" type="text/html">
<select id="structureId" name="structureId" lay-filter="structureId" lay-verify="required" lay-search>
<option value="">请选择房屋结构</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">建筑用途<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="buildingPurposeName" name="buildingPurposeName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="buildingPurposeNameSelectTemplateBox" lay-filter="buildingPurposeNameSelectTemplateBox"></div>
<script id="buildingPurposeNameSelectTemplate" type="text/html">
<select id="buildingPurposeId" name="buildingPurposeId" lay-filter="buildingPurposeId" lay-verify="required" lay-search>
<option value="">请选择建筑用途</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">房屋用途<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="roomUseName" name="roomUseName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="roomUseNameSelectTemplateBox" lay-filter="roomUseNameSelectTemplateBox"></div>
<script id="roomUseNameSelectTemplate" type="text/html">
<select id="roomUseId" name="roomUseId" lay-filter="roomUseId" lay-verify="required" lay-search>
<option value="">请选择房屋用途</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg4">
<label class="layui-form-label">隐患类型<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="dangerName" name="dangerName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="dangerNameSelectTemplateBox" lay-filter="dangerNameSelectTemplateBox"></div>
<script id="dangerNameSelectTemplate" type="text/html">
<select id="dangerId" name="dangerId" lay-filter="dangerId" lay-verify="required" lay-search>
<option value="">请选择隐患类型</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">房间数量</label>
<div class="layui-input-block">
<input type="number" id="roomNum" name="roomNum" class="layui-input" value="" placeholder="请输入房间数量" lay-verify="required">
</div>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">房屋面积</label>
<div class="layui-input-block">
<input type="text" id="roomArea" name="roomArea" class="layui-input" value="" placeholder="请输入房屋面积" maxlength="255">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg4">
<label class="layui-form-label">产权证号</label>
<div class="layui-input-block">
<input type="text" id="certificateNum" name="certificateNum" class="layui-input" value="" placeholder="请输入产权证号" maxlength="255">
</div>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">登记日期</label>
<div class="layui-input-block">
<input type="text" id="registrationDate" name="registrationDate" class="layui-input" value="" placeholder="请输入登记日期" maxlength="255">
</div>
</div>
<div class="layui-col-lg4">
<label class="layui-form-label">所属单位</label>
<div class="layui-input-block">
<input type="text" id="affiliatedUnit" name="affiliatedUnit" class="layui-input" value="" placeholder="请输入所属单位" maxlength="255">
</div>
</div>
</div>
<div class="layui-form-item layui-row" pane>
<div class="layui-col-lg6 layui-form-pane">
<label class="layui-form-label">是否出租屋</label>
<div class="layui-input-block">
<input type="radio" name="isRental" lay-filter="isRental" value="1" title="是">
<input type="radio" name="isRental" lay-filter="isRental" value="0" title="否" checked>
</div>
</div>
<div class="layui-col-lg6 layui-form-pane">
<label class="layui-form-label">是否空置房</label>
<div class="layui-input-block">
<input type="radio" name="isVacant" lay-filter="isVacant" value="1" title="是">
<input type="radio" name="isVacant" lay-filter="isVacant" value="0" title="否" checked>
</div>
</div>
</div>
</div>
<div class="div-base-population-info">
<blockquote class="layui-elem-quote">租住情况</blockquote>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">租住类型<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="lodgeTypeName" name="lodgeTypeName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="lodgeTypeNameSelectTemplateBox" lay-filter="lodgeTypeNameSelectTemplateBox"></div>
<script id="lodgeTypeNameSelectTemplate" type="text/html">
<select id="lodgeTypeId" name="lodgeTypeId" lay-filter="lodgeTypeId" lay-verify="required" lay-search>
<option value="">请选择租住类型</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">出租用途</label>
<div class="layui-input-block">
<input type="text" id="rentalPurposes" name="rentalPurposes" class="layui-input" value="" placeholder="请输入出租用途" maxlength="255">
</div>
</div>
</div>
</div>
<div class="div-base-population-info">
<blockquote class="layui-elem-quote">房主</blockquote>
<div class="layui-form-item layui-row">
<div class="">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn homeownerSearch">搜索</button>
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">房主名称</label>
<div class="layui-input-block">
<input type="text" id="homeowner" name="homeowner" class="layui-input" value="" placeholder="请输入房主名称" maxlength="255">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">证件种类<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="documentName" name="documentName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="documentNameSelectTemplateBox" lay-filter="documentNameSelectTemplateBox"></div>
<script id="documentNameSelectTemplate" type="text/html">
<select id="documentId" name="documentId" lay-filter="documentId" lay-verify="required" lay-search>
<option value="">请选择证件种类</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">证件号码</label>
<div class="layui-input-block">
<input type="text" id="documentNum" name="documentNum" class="layui-input" value="" placeholder="请输入证件号码" maxlength="255">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">联系电话</label>
<div class="layui-input-block">
<input type="text" id="phone" name="phone" class="layui-input" value="" placeholder="请输入联系电话" maxlength="11">
</div>
</div>
</div>
</div>
<div class="div-base-population-info">
<blockquote class="layui-elem-quote">托管人</blockquote>
<div class="layui-form-item layui-row">
<div class="">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn custodianSearch">搜索</button>
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">托管人姓名</label>
<div class="layui-input-block">
<input type="text" id="custodian" name="custodian" class="layui-input" value="" placeholder="请输入托管人姓名" maxlength="255">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">证件种类<span style="color: red;vertical-align: middle;">*</span></label>
<input type="hidden" id="custodianDocumentName" name="custodianDocumentName" class="layui-input" value="" maxlength="36">
<div class="layui-input-block layui-form" id="custodianDocumentNameSelectTemplateBox" lay-filter="custodianDocumentNameSelectTemplateBox"></div>
<script id="custodianDocumentNameSelectTemplate" type="text/html">
<select id="custodianDocumentId" name="custodianDocumentId" lay-filter="custodianDocumentId" lay-verify="required" lay-search>
<option value="">请选择证件种类</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label">证件号码</label>
<div class="layui-input-block">
<input type="text" id="custodianDocumentNum" name="custodianDocumentNum" class="layui-input" value="" placeholder="请输入证件号码" maxlength="255">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label">联系电话</label>
<div class="layui-input-block">
<input type="text" id="custodianPhone" name="custodianPhone" class="layui-input" value="" placeholder="请输入联系电话" maxlength="11">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">与房主关系</label>
<div class="layui-input-block">
<input type="text" id="relationshipHomeowner" name="relationshipHomeowner" class="layui-input" value="" placeholder="请输入与房主关系" maxlength="255">
</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;
form.on('select(street)', function(data){
if(data.value) {
initCommunityNameSelect(data.value);
initResidentialNameSelect(data.value, '');
2023-10-27 11:34:23 +08:00
}else {
initCommunityNameSelect('9999');
initResidentialNameSelect('', '');
}
});
// 社区change事件
form.on('select(community)', function(data){
var streetValue = $("#street").val();
if(data.value) {
initResidentialNameSelect(streetValue, data.value);
}else {
initResidentialNameSelect(streetValue, '');
2023-10-27 11:34:23 +08:00
}
});
// 初始化社区下拉选择
function initCommunityNameSelect(areaId) {
top.restAjax.get(top.restAjax.path('api/residential/getCommunityList?areaId=' + areaId, []), {}, null, function(code, data, args) {
console.log(data)
laytpl(document.getElementById('communityNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('communityNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'communityNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化街道下拉选择
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) {
document.getElementById('streetNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'streetNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 房主搜索
function homeownerSearch() {
2023-10-27 17:12:11 +08:00
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);
2023-10-27 11:34:23 +08:00
}
});
}
// 托管人搜索
function custodianSearch() {
2023-10-27 17:12:11 +08:00
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;
$('#custodian').val(popuData.name);
$('#custodianDocumentId').val('b7d74045-d984-4822-b0f3-711b15b933ca');
$('#custodianDocumentNum').val(popuData.idcard);
$('#custodianPhone').val(popuData.phone);
}
});
2023-10-27 11:34:23 +08:00
}
// 初始化单元/列数下拉列表
function initAffiliationUnit(num) {
if(num > 0) {
for(var i=1; i<=num; i++) {
var html = '<option value="' + i + '">' + i + '</option>';
$('#affiliationUnitDiv').find('select').append(html);
}
}else {
var html = '<option></option>'
$('#affiliationUnitDiv').find('select').html(html);
}
form.render(null, 'dataForm');
}
// 初始化所在层/院数下拉列表
function initAffiliationFloors(num) {
if(num > 0) {
for(var i=1; i<=num; i++) {
var html = '<option value="' + i + '">' + i + '</option>';
$('#affiliationFloorsDiv').find('select').append(html);
}
}else {
var html = '<option></option>'
$('#affiliationFloorsDiv').find('select').html(html);
}
form.render(null, 'dataForm');
}
// 初始化所在小区下拉选择
initResidentialNameSelect('9999', '9999');
function initResidentialNameSelect(street, community) {
top.restAjax.get(top.restAjax.path('api/residential/list?street={street}&community={community}',
[street, community]), {}, null, function(code, data, args) {
2023-10-27 11:34:23 +08:00
laytpl(document.getElementById('residentialNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('residentialNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'residentialNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 小区名称change事件
form.on('select(residentialId)', function(data){
if(data.value) {
initBuildingNameSelect(data.value);
}else {
initBuildingNameSelect('9999');
}
});
// 初始化楼/排下拉选择
function initBuildingNameSelect(residentialId) {
top.restAjax.get(top.restAjax.path('api/building/list?residentialId=' + residentialId, []), {}, null, function(code, data, args) {
laytpl(document.getElementById('buildingNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('buildingNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'buildingNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 楼/排change事件
form.on('select(buildingId)', function(data){
if(data.value) {
var unitNum = data.value.split("_");
initAffiliationUnit(unitNum[1]);
initAffiliationFloors(unitNum[2]);
}else {
initAffiliationUnit('0');
initAffiliationFloors('0');
}
});
// 初始化房屋类别下拉选择
initCategoryNameSelect();
function initCategoryNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/d6cceb30-cbb9-4c77-9139-38d4849d1580', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('categoryNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('categoryNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'categoryNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化房屋性质下拉选择
initNatureNameSelect();
function initNatureNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/79f90a8c-f94f-4381-b484-bf02d5b9bfd4', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('natureNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('natureNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'natureNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化房屋种类下拉选择
initTypeNameSelect();
function initTypeNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/934bb545-cb49-4efe-8cb2-63af41d7b68d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('typeNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('typeNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'typeNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化房屋结构下拉选择
initStructureNameSelect();
function initStructureNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/bad48aba-472e-43de-8a79-5bc47886a8b5', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('structureNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('structureNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'structureNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化建筑用途下拉选择
initBuildingPurposeNameSelect();
function initBuildingPurposeNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/c1d5ea4f-a6ff-4201-ab2c-674df8fea0be', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('buildingPurposeNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('buildingPurposeNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'buildingPurposeNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化房屋用途下拉选择
initRoomUseNameSelect();
function initRoomUseNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/175af8a5-d0fc-46c1-90a7-420179faadbb', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('roomUseNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('roomUseNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'roomUseNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化隐患类型下拉选择
initDangerNameSelect();
function initDangerNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/34950d66-88dc-4028-9c40-8e580bf24f1a', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('dangerNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('dangerNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'dangerNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化租住类型下拉选择
initLodgeTypeNameSelect();
function initLodgeTypeNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/df35f694-dc5d-4224-b64a-a381249b325d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('lodgeTypeNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('lodgeTypeNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'lodgeTypeNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化房主证件种类下拉选择
initDocumentNameSelect();
function initDocumentNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('documentNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('documentNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'documentNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化托管人证件种类下拉选择
initCustodianDocumentNameSelect();
function initCustodianDocumentNameSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('custodianDocumentNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('custodianDocumentNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'custodianDocumentNameSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
// 初始化内容
function initData() {
initBuildingNameSelect('9999');
initCommunityNameSelect('9999');
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
// 删除楼排的多余数据因为在渲染页面的时候它的结构是id_单元数_楼层数需要去掉_单元数_楼层数
if(formData.field.buildingId) {
var buildingId = formData.field.buildingId;
formData.field.buildingId = buildingId.split("_")[0];
}
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/house/save', []), 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) {
top.dialog.close(index);
window.location.reload();
},
btn2: 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();
});
$('.homeownerSearch').on('click', function() {
homeownerSearch();
});
$('.custodianSearch').on('click', function() {
custodianSearch();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>