btxtgxq-system-population/src/main/resources/templates/house/save.html
2024-01-09 15:26:53 +08:00

1004 lines
55 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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">
<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-xs4">
<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-xs4">
<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-xs4">
<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.unitNum}}_{{item.floorsNum}}">{{item.name}}</option>
{{# } }}
</select>
</script>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-xs4">
<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-xs4">
<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-xs4">
<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 class="layui-form-item layui-row">
<div class="layui-col-xs4">
<label class="layui-form-label">房屋类别</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-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-xs4">
<label class="layui-form-label">房屋性质</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-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-xs4">
<label class="layui-form-label">房屋种类</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-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-xs4">
<label class="layui-form-label">房屋结构</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-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-xs4">
<label class="layui-form-label">建筑用途</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-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-xs4">
<label class="layui-form-label">房屋用途</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-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-xs4">
<label class="layui-form-label">隐患类型</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-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-xs4">
<label class="layui-form-label">房间数量</label>
<div class="layui-input-block">
<input type="number" id="roomNum" name="roomNum" class="layui-input" value="" placeholder="请输入房间数量">
</div>
</div>
<div class="layui-col-xs4">
<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-xs4">
<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-xs4">
<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-xs4">
<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-xs4 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-xs4 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 class="layui-col-xs4 layui-form-pane">
<label class="layui-form-label">是否自住房</label>
<div class="layui-input-block">
<input type="radio" name="isSelf" lay-filter="isSelf" value="1" title="是">
<input type="radio" name="isSelf" lay-filter="isSelf" 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-xs6">
<label class="layui-form-label">租住类型</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-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-xs6">
<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="layui-col-xs1">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn homeownerSearch">搜索</button>
</div>
</div>
<div class="layui-col-xs1">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn clearOwner">清除数据</button>
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-xs6">
<label class="layui-form-label">房主名称</label>
<div class="layui-input-block">
<input type="hidden" id="ownerPopulationId" name="ownerPopulationId" class="layui-input" value="" maxlength="255">
<input type="text" id="homeowner" name="homeowner" class="layui-input" value="" placeholder="请输入房主名称" maxlength="255">
</div>
</div>
<div class="layui-col-xs6">
<label class="layui-form-label">证件种类</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-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-xs6">
<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-xs6">
<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="layui-col-xs1">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn custodianSearch">搜索</button>
</div>
</div>
<div class="layui-col-xs1">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn clearCustodian">清除数据</button>
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-xs6">
<label class="layui-form-label">托管人姓名</label>
<div class="layui-input-block">
<input type="hidden" id="custodianPopulationId" name="custodianPopulationId" class="layui-input" value="" maxlength="255">
<input type="text" id="custodian" name="custodian" class="layui-input" value="" placeholder="请输入托管人姓名" maxlength="255">
</div>
</div>
<div class="layui-col-xs6">
<label class="layui-form-label">证件种类</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-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-xs6">
<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-xs6">
<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="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 cohabitSearch">搜索添加同住人</button>
</div>
</div>
</div>
<div id="tongZhuRen"></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 id="tongZhuRenTemplate" type="text/html">
{{# for(var j = 0, item; item = d[j++];) { }}
{{# if(item.outHouse == '0') { }}
<div class="layui-form-item layui-row" style="margin-bottom:5px !important;" >
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">姓名</label>
<div class="layui-input-block">
<input type="hidden" class="layui-input" value="{{item.populationInfoId}}" maxLength="255">
<input type="text" readonly class="layui-input" value="{{item.name}}" placeholder="请输入姓名" maxLength="255">
</div>
</div>
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">证件号码</label>
<div class="layui-input-block">
<input type="text" readonly class="layui-input" value="{{item.cardNum}}" placeholder="请输入证件号码" maxLength="255">
</div>
</div>
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">联系电话</label>
<div class="layui-input-block">
<input type="text" readonly class="layui-input" value="{{item.phone}}" placeholder="请输入联系电话" maxLength="11">
</div>
</div>
<div class="layui-col-md3 layui-col-xs3" style="text-align: center;">
<div class="layui-form-item" style="height: 33px;padding-top: 3px;" pane="">
<!--<button type="button" class="layui-btn layui-btn-sm out-population" data-population="{{item.populationInfoId}}">搬离房屋</button>-->
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger delete-population" data-population="{{item.populationInfoId}}">录错删除</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger view-population" data-population="{{item.populationInfoId}}">查看卡片</button>
</div>
</div>
</div>
{{# } }}
{{# } }}
</script>
<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;
var renderBuildInfo = function() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/building/get/{buildingId}', [buildingId]), {}, null, function (code, data) {
var dataFormData = {};
for (var i in data) {
dataFormData[i] = data[i] + '';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initAffiliationUnit(data.unitNum);
initAffiliationFloors(data.floorsNum);
initBuildingNameSelect(data['residentialId'], `${buildingId}_${data.unitNum}_${data.floorsNum}`);
initResidentialNameSelect(data['street'], data['community'], data['residentialId']);
initStreetNameSelect(data['street']);
initCommunityNameSelect(data['street'], data['community']);
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(loadLayerIndex);
});
}
form.on('select(street)', function(data){
if(data.value) {
initCommunityNameSelect(data.value);
initResidentialNameSelect(data.value, '');
initAffiliationUnit('0');
initAffiliationFloors('0');
}else {
initCommunityNameSelect('9999');
initResidentialNameSelect('', '');
initAffiliationUnit('0');
initAffiliationFloors('0');
}
});
// 社区change事件
form.on('select(community)', function(data){
var streetValue = $("#street").val();
if(data.value) {
initResidentialNameSelect(streetValue, data.value);
}else {
initResidentialNameSelect(streetValue, '');
}
});
// 初始化社区下拉选择
function initCommunityNameSelect(areaId, selectedValue) {
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');
if(selectedValue) {
var selectObj = {};
selectObj['community'] = selectedValue;
form.val('dataForm', selectObj);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化街道下拉选择
initStreetNameSelect();
function initStreetNameSelect(selectedValue) {
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');
if(selectedValue) {
var selectObj = {};
selectObj['street'] = selectedValue;
form.val('dataForm', selectObj);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 房主搜索
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');
$('#documentName').val('居民身份证');
$('#documentNum').val(popuData.idcard);
$('#phone').val(popuData.phone);
$('#ownerPopulationId').val(popuData.populationInfoId);
}
});
}
function clearOwner() {
$('#homeowner').val('');
$('#documentId').val('');
$('#documentName').val('');
$('#documentNum').val('');
$('#phone').val('');
$('#ownerPopulationId').val('');
}
var cohabitArray = new Array();
// 同住人搜索
function cohabitSearch() {
top.dialog.open({
url: top.restAjax.path('route/populationinfo/query-multiple', []),
title: '人员选择',
width: '80%',
height: '80%',
onClose: function(data1) {
var data = top.window.localStorage.getItem("tempQueryMultiplePopulationInfo");
if(data != null && data != undefined && data != 'null') {
var list = eval("(" + data + ")");
// 判断是否已选择
for(var i = 0 ; i < list.length ; i++){
var exists = false;
for(var j = 0 ; j < cohabitArray.length ; j++) {
if(list[i].populationInfoId == cohabitArray[j].populationInfoId) {
exists = true;
break;
}
}
if (!exists) {
cohabitArray.push({populationId: "", populationInfoId: list[i].populationInfoId, cardNum: list[i].idcard, phone: list[i].phone, name: list[i].name, outHouse: "0"});
}
}
reloadCohabit();
}
}
});
}
// 房屋人员重新渲染
function reloadCohabit() {
laytpl(document.getElementById('tongZhuRenTemplate').innerHTML).render(cohabitArray, function(html) {
document.getElementById('tongZhuRen').innerHTML = html;
});
form.render();
}
// 房屋人员搬出房屋
$(document).on("click", ".out-population" , function () {
var populationInfoId = $(this).data("population");
for (var i = 0; i < cohabitArray.length; i++) {
if (cohabitArray[i].populationInfoId == populationInfoId) {
cohabitArray[i].outHouse = "1";
}
}
reloadCohabit();
});
function removeAaary(array, objKey, objValue) {
var length = array.length;
for (var i = 0; i < length; i++) {
if (array[i][objKey] == objValue) {
if (i == 0) {
array.shift(); //删除并返回数组的第一个元素
return array;
} else if (i == length - 1) {
array.pop(); //删除并返回数组的最后一个元素
return array;
} else {
array.splice(i, 1); //删除下标为i的元素
return array;
}
}
}
}
// 房屋人员录错删除
$(document).on("click", ".delete-population" , function () {
var populationInfoId = $(this).data("population");
removeAaary(cohabitArray, "populationInfoId", populationInfoId);
reloadCohabit();
});
// 房屋人员人口查看
$(document).on("click", ".view-population" , function () {
var populationInfoId = $(this).data("population");
top.dialog.open({
url: top.restAjax.path('pages/housepopulation/index.html#/population-info?populationInfoId=' + populationInfoId, []),
title: '个人信息卡片',
width: '80%',
height: '80%',
onClose: function() {
}
});
});
// 托管人搜索
function custodianSearch() {
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');
$('#custodianDocumentName').val('居民身份证');
$('#custodianDocumentNum').val(popuData.idcard);
$('#custodianPhone').val(popuData.phone);
$('#custodianPopulationId').val(popuData.populationInfoId);
}
});
}
function clearCustodian() {
$('#custodian').val('');
$('#custodianDocumentId').val('');
$('#custodianDocumentName').val('');
$('#custodianDocumentNum').val('');
$('#custodianPhone').val('');
$('#custodianPopulationId').val('');
}
// 初始化单元/列数下拉列表
function initAffiliationUnit(num) {
var html = '<option></option>';
$('#affiliationUnitDiv').find('select').html(html);
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) {
var html = '<option></option>';
$('#affiliationFloorsDiv').find('select').html(html);
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, selectedValue) {
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) {
document.getElementById('residentialNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'residentialNameSelectTemplateBox');
if(selectedValue) {
var selectObj = {};
selectObj['residentialId'] = selectedValue;
form.val('dataForm', selectObj);
}
}, 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, selectedValue) {
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');
if(selectedValue) {
var selectObj = {};
selectObj['buildingId'] = selectedValue;
form.val('dataForm', selectObj);
}
}, 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() {
if(buildingId) {
renderBuildInfo();
} else {
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];
}
// 设置所在街道和社区的选中值
var streetName = $('#street').find("option:selected").text();
var communityName = $('#community').find("option:selected").text();
var residentialName = $('#residentialId').find("option:selected").text();
var buildingName = $('#buildingId').find("option:selected").text();
formData.field.streetName = streetName;
formData.field.communityName = communityName;
formData.field.residentialName = residentialName;
formData.field.buildingName = buildingName;
formData.field.populationVOList = cohabitArray;
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();
});
// 清除数据
$('.clearOwner').on('click', function() {
clearOwner();
});
$('.custodianSearch').on('click', function() {
custodianSearch();
});
$('.clearCustodian').on('click', function() {
clearCustodian();
});
$('.cohabitSearch').on('click', function() {
cohabitSearch();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>