-
-
-
-
@@ -151,6 +155,13 @@
var resizeTimeout = null;
var tableUrl = 'api/populationinfo/listpage?[[${params}]]';
+ // 初始化街道下拉选择
+ var jiedao = "[[${jiedao}]]";
+ initStreetNameSelect();
+ initResidentialNameSelect('9999', '9999');
+ initBuildingNameSelect("9999");
+ initHouseNameSelect("9999");
+
// 初始化街道下拉选择
function initStreetNameSelect(selectedValue) {
$.ajax({
@@ -158,7 +169,7 @@
type: 'get',
dataType: 'json',
success: function (data) {
- laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render(data, function(html) {
+ laytpl(document.getElementById('streetNameSelectTemplate').innerHTML).render({jiedao: jiedao , list: data}, function(html) {
document.getElementById('streetNameSelectTemplateBox').innerHTML = html;
});
form.render('select', 'streetNameSelectTemplateBox');
@@ -168,13 +179,16 @@
selectObj['street'] = selectedValue;
form.val('dataForm', selectObj);
}
+ if (jiedao) {
+ $("#creatorArea1").val(jiedao);
+ initCommunityNameSelect($("#street").val());
+ }else{
+ initCommunityNameSelect('9999');
+ }
}
});
}
- // 初始化街道下拉选择
- initStreetNameSelect();
-
// 初始化街道变化
form.on('select(street)', function(data){
var selectedText = data.elem[data.elem.selectedIndex].text;
@@ -184,7 +198,6 @@
}else {
initCommunityNameSelect('9999');
}
- reloadTable();
});
// 初始化社区变化
@@ -197,44 +210,9 @@
}else {
initResidentialNameSelect(streetValue, '');
}
- reloadTable();
});
- // 初始化小区变化
- form.on('select(residentialId)', function(data){
- $("#residential").val(data.value);
- if(data.value) {
- initBuildingNameSelect(data.value);
- }else {
- initBuildingNameSelect('9999');
- }
- reloadTable();
- });
-
- // 初始化小区下拉选择
- initResidentialNameSelect('9999', '9999');
- function initResidentialNameSelect(street, community, selectedValue) {
- $.ajax({
- url: 'api/residential/list?street=' + street + '&community=' + community,
- type: 'get',
- dataType: 'json',
- success: function (data) {
- 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);
- }
- }
- });
- }
-
// 初始化社区下拉选择
- initCommunityNameSelect('9999');
function initCommunityNameSelect(areaId, selectedValue) {
$.ajax({
url: 'api/residential/getCommunityList?areaId=' + areaId,
@@ -251,24 +229,69 @@
selectObj['community'] = selectedValue;
form.val('dataForm', selectObj);
}
+
+ initResidentialNameSelect('9999', '9999');
+ initBuildingNameSelect("9999");
+ initHouseNameSelect("9999");
}
});
}
// 初始化小区变化
+ form.on('select(residentialId)', function(data){
+ $("#residential").val(data.value);
+ if(data.value) {
+ initBuildingNameSelect(data.value);
+ }else {
+ initBuildingNameSelect('9999');
+ }
+ });
+
+ // 初始化小区下拉选择
+ function initResidentialNameSelect(street, community, selectedValue) {
+ $.ajax({
+ url: 'api/residential/list?street=' + street + '&community=' + community,
+ type: 'get',
+ dataType: 'json',
+ success: function (data) {
+ 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);
+ }
+
+ initBuildingNameSelect("9999");
+ initHouseNameSelect("9999");
+ }
+ });
+ }
+
+ // 初始化楼栋变化
form.on('select(buildingId)', function(data){
$("#building").val(data.value);
- reloadTable();
+ if(data.value) {
+ initHouseNameSelect(data.value);
+ }else {
+ initHouseNameSelect('9999');
+ }
});
// 初始化楼/排下拉选择
- initBuildingNameSelect("9999");
function initBuildingNameSelect(residentialId, selectedValue) {
$.ajax({
url: 'api/building/list?residentialId=' + residentialId,
type: 'get',
dataType: 'json',
success: function (data) {
+ if(data.length < 1 && residentialId != 9999) {
+ layer.msg("该小区暂无录入楼/排");
+ }
+
laytpl(document.getElementById('buildingNameSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('buildingNameSelectTemplateBox').innerHTML = html;
});
@@ -279,10 +302,41 @@
selectObj['buildingId'] = selectedValue;
form.val('dataForm', selectObj);
}
+
+ initHouseNameSelect("9999");
}
});
}
+ // 初始化房屋下拉选择
+ function initHouseNameSelect(buildingId, selectedValue) {
+ $.ajax({
+ url: 'api/house/list?buildingId=' + buildingId,
+ type: 'get',
+ dataType: 'json',
+ success: function (data) {
+ if(data.length < 1 && buildingId != 9999) {
+ layer.msg("该楼/排暂无录入房屋");
+ }
+ laytpl(document.getElementById('houseNameSelectTemplate').innerHTML).render(data, function(html) {
+ document.getElementById('houseNameSelectTemplateBox').innerHTML = html;
+ });
+ form.render('select', 'houseNameSelectTemplateBox');
+
+ if(selectedValue) {
+ var selectObj = {};
+ selectObj['houseId'] = selectedValue;
+ form.val('dataForm', selectObj);
+ }
+ }
+ });
+ }
+
+ // 初始化楼栋变化
+ form.on('select(houseId)', function(data){
+ $("#house").val(data.value);
+ });
+
// 初始化证件类型下拉选择
function initIdcardTypeSelect() {
$.ajax({
@@ -412,14 +466,7 @@
function reloadTable(currentPage) {
table.reload('dataTable', {
url: tableUrl,
- where: {
- name: $('#name').val(),
- idcardType: $('#idcardType').val(),
- idcard: $('#idcard').val(),
- creatorArea1: $("#creatorArea1").val() == undefined || $("#creatorArea1").val() == "" ? "" : $("#creatorArea1").val(),
- creatorArea2: $("#creatorArea2").val() == undefined || $("#creatorArea2").val() == "" ? "" : $("#creatorArea2").val(),
- residential: $("#residential").val() == undefined || $("#residential").val() == "" ? "" : $("#residential").val(),
- },
+ where: getParams(),
page: {
curr: currentPage
},
@@ -427,6 +474,39 @@
});
}
+ var getParams = function() {
+ var data = {name: $('#name').val(), idcardType: $('#idcardType').val(), idcard: $('#idcard').val()};
+ if ($("#creatorArea1").val() == undefined || $("#creatorArea1").val() == "" ) {
+ return data;
+ }else{
+ data.creatorArea1 = $("#creatorArea1").val();
+ }
+ if ($("#creatorArea2").val() == undefined || $("#creatorArea2").val() == "" ) {
+ return data;
+ }else{
+ data.creatorArea2 = $("#creatorArea2").val();
+ }
+ if ($("#residential").val() == undefined || $("#residential").val() == "" ) {
+ return data;
+ }else{
+ data.residential = $("#residential").val();
+ }
+ if ($("#building").val() == undefined || $("#building").val() == "" ) {
+ return data;
+ }else{
+ data.residential = "";
+ data.building = $("#building").val();
+ }
+ if ($("#house").val() == undefined || $("#house").val() == "" ) {
+ return data;
+ }else{
+ data.residential = "";
+ data.building = "";
+ data.house = $("#house").val();
+ }
+ return data;
+ }
+
initTable();
// 事件 - 页面变化
$win.on('resize', function() {