diff --git a/src/main/resources/templates/building/list-myself.html b/src/main/resources/templates/building/list-myself.html index def3098..864fc66 100644 --- a/src/main/resources/templates/building/list-myself.html +++ b/src/main/resources/templates/building/list-myself.html @@ -9,11 +9,63 @@ +
-
-
+
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
@@ -61,7 +113,7 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'common', 'select'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; @@ -69,8 +121,443 @@ var laydate = layui.laydate; var common = layui.common; var resizeTimeout = null; + var select = layui.select; var tableUrl = 'api/building/listpage?myself={myself}'; + var selectedRelation = { + street: '', + community: '', + housingEstate: '', + buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', + } + + var initStreetSelect = function() { + select.dataDynamic({ + url: 'api/residential/getStreetList', + name: 'streetId', + valueKey: 'id', + nameKey: 'name', + formFilter: 'dataForm', + where: {}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.street = data.value; + if(data.value) { + $('#streetName').val(option.innerHTML); + } else { + $('#streetName').val(''); + } + initCommunitySelect(); + var url = 'api/building/listpage?myself={myself}&street={street}'; + newInitTableStreet(url); + } + }) + } + + var initCommunitySelect = function() { + selectedRelation.community = ''; + var $communityBox = $('#communityBox'); + if(!selectedRelation.street) { + $communityBox.hide(); + return; + } + $communityBox.show(); + select.dataDynamic({ + url: 'api/residential/getCommunityList', + name: 'communityId', + valueKey: 'communityId', + nameKey: 'communityName', + formFilter: 'dataForm', + where: {areaId: selectedRelation.street}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.community = data.value; + if(data.value) { + $('#communityName').val(option.innerHTML); + } else { + $('#communityName').val(''); + } + var url = 'api/building/listpage?myself={myself}&street={street}&community={community}'; + newInitTableCommunity(url); + + initHousingEstateSelect(); + } + }) + } + + var initHousingEstateSelect = function() { + selectedRelation.housingEstate = ''; + var $housingEstateBox = $('#housingEstateBox'); + if(!selectedRelation.community) { + $housingEstateBox.hide(); + return; + } + $housingEstateBox.show(); + select.dataDynamic({ + url: 'api/residential/list', + name: 'housingEstateId', + valueKey: 'residentialId', + nameKey: 'name', + formFilter: 'dataForm', + where: {street: selectedRelation.street, community: selectedRelation.community}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.housingEstate = data.value; + if(data.value) { + $('#housingEstateName').val(option.innerHTML); + } else { + $('#housingEstateName').val(''); + } + var url = 'api/building/listpage?myself={myself}&street={street}&community={community}&residentialId={residentialId}'; + newInitTableResidential(url); + } + }) + } + + var newInitTableResidential = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community, selectedRelation.housingEstate]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'name', width: 180, title: '楼排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildNum', width: 180, title: '楼/排号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'floorsNum', width: 180, title: '楼层数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'unitNum', width: 180, title: '单元/排数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableStreet = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'name', width: 180, title: '楼排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildNum', width: 180, title: '楼/排号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'floorsNum', width: 180, title: '楼层数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'unitNum', width: 180, title: '单元/排数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableCommunity = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'name', width: 180, title: '楼排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildNum', width: 180, title: '楼/排号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'floorsNum', width: 180, title: '楼层数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'unitNum', width: 180, title: '单元/排数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + // 初始化表格 function initTable() { table.render({ @@ -312,6 +799,13 @@ } } }); + + var init = function(){ + initStreetSelect(); + initCommunitySelect(); + } + init(); + }); diff --git a/src/main/resources/templates/building/list.html b/src/main/resources/templates/building/list.html index 67e5024..a4be33e 100644 --- a/src/main/resources/templates/building/list.html +++ b/src/main/resources/templates/building/list.html @@ -9,11 +9,63 @@ +
-
-
+
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
@@ -58,7 +110,7 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'common', 'select'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; @@ -66,8 +118,443 @@ var laydate = layui.laydate; var common = layui.common; var resizeTimeout = null; + var select = layui.select; var tableUrl = 'api/building/listpage'; + var selectedRelation = { + street: '', + community: '', + housingEstate: '', + buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', + } + + var initStreetSelect = function() { + select.dataDynamic({ + url: 'api/residential/getStreetList', + name: 'streetId', + valueKey: 'id', + nameKey: 'name', + formFilter: 'dataForm', + where: {}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.street = data.value; + if(data.value) { + $('#streetName').val(option.innerHTML); + } else { + $('#streetName').val(''); + } + initCommunitySelect(); + var url = 'api/building/listpage?street={street}'; + newInitTableStreet(url); + } + }) + } + + var initCommunitySelect = function() { + selectedRelation.community = ''; + var $communityBox = $('#communityBox'); + if(!selectedRelation.street) { + $communityBox.hide(); + return; + } + $communityBox.show(); + select.dataDynamic({ + url: 'api/residential/getCommunityList', + name: 'communityId', + valueKey: 'communityId', + nameKey: 'communityName', + formFilter: 'dataForm', + where: {areaId: selectedRelation.street}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.community = data.value; + if(data.value) { + $('#communityName').val(option.innerHTML); + } else { + $('#communityName').val(''); + } + var url = 'api/building/listpage?street={street}&community={community}'; + newInitTableCommunity(url); + + initHousingEstateSelect(); + } + }) + } + + var initHousingEstateSelect = function() { + selectedRelation.housingEstate = ''; + var $housingEstateBox = $('#housingEstateBox'); + if(!selectedRelation.community) { + $housingEstateBox.hide(); + return; + } + $housingEstateBox.show(); + select.dataDynamic({ + url: 'api/residential/list', + name: 'housingEstateId', + valueKey: 'residentialId', + nameKey: 'name', + formFilter: 'dataForm', + where: {street: selectedRelation.street, community: selectedRelation.community}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.housingEstate = data.value; + if(data.value) { + $('#housingEstateName').val(option.innerHTML); + } else { + $('#housingEstateName').val(''); + } + var url = 'api/building/listpage?street={street}&community={community}&residentialId={housingEstate}'; + newInitTableResidential(url); + } + }) + } + + var newInitTableResidential = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street, selectedRelation.community, selectedRelation.housingEstate]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'name', width: 180, title: '楼排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildNum', width: 180, title: '楼/排号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'floorsNum', width: 180, title: '楼层数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'unitNum', width: 180, title: '单元/排数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableStreet = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'name', width: 180, title: '楼排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildNum', width: 180, title: '楼/排号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'floorsNum', width: 180, title: '楼层数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'unitNum', width: 180, title: '单元/排数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableCommunity = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street, selectedRelation.community]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'name', width: 180, title: '楼排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildNum', width: 180, title: '楼/排号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'floorsNum', width: 180, title: '楼层数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'unitNum', width: 180, title: '单元/排数', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + // 初始化表格 function initTable() { table.render({ @@ -295,6 +782,13 @@ } } }); + + var init = function(){ + initStreetSelect(); + initCommunitySelect(); + } + init(); + }); diff --git a/src/main/resources/templates/house/list-myself.html b/src/main/resources/templates/house/list-myself.html index b84d893..f304722 100644 --- a/src/main/resources/templates/house/list-myself.html +++ b/src/main/resources/templates/house/list-myself.html @@ -9,11 +9,69 @@ +
-
-
+
+
+
+
+
+
+ + +
+
+ + +
+
+
+ +
+
+
@@ -58,7 +116,7 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'common', 'select'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; @@ -66,8 +124,1456 @@ var laydate = layui.laydate; var common = layui.common; var resizeTimeout = null; + var select = layui.select; var tableUrl = 'api/house/listpage?myself={myself}'; + var event = function() { + $(document).on('click', '#treeBody ul li', function () { + var $lis = $('#treeBody ul li'); + $lis.filter('.active').removeClass('active'); + $(this).addClass('active'); + selectedRelation.buildingId = this.dataset.id; + selectedRelation.buildingFloorsNum = this.dataset.floorsNum; + selectedRelation.buildingUnitNum = this.dataset.unitNum; + var url = 'api/house/listpage?myself={myself}&street={street}&community={community}&residentialId={residentialId}&buildingId={buildingId}'; + newInitTableBuilding(url); + }); + $(document).on('click', '#nextBuildingPageBtn', function () { + if (buildingPager.currentPage <= 1) { + return; + } + buildingPager.currentPage -= 1; + initBuilding(); + }); + $(document).on('click', '#prevBuildingPageBtn', function () { + if (buildingPager.currentPage >= buildingPager.totalPage) { + return; + } + buildingPager.currentPage += 1; + initBuilding(); + }); + } + + var buildingPager = { + currentPage: 1, + rows: 10, + total: 0, + totalPage: 1, + data: [] + } + + var selectedRelation = { + street: '', + community: '', + housingEstate: '', + buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', + } + + var initStreetSelect = function() { + select.dataDynamic({ + url: 'api/residential/getStreetList', + name: 'streetId', + valueKey: 'id', + nameKey: 'name', + formFilter: 'dataForm', + where: {}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.street = data.value; + if(data.value) { + $('#streetName').val(option.innerHTML); + } else { + $('#streetName').val(''); + } + initCommunitySelect(); + var url = 'api/house/listpage?myself={myself}&street={street}'; + newInitTableStreet(url); + } + }) + } + + var initCommunitySelect = function() { + selectedRelation.community = ''; + var $communityBox = $('#communityBox'); + if(!selectedRelation.street) { + $communityBox.hide(); + return; + } + $communityBox.show(); + select.dataDynamic({ + url: 'api/residential/getCommunityList', + name: 'communityId', + valueKey: 'communityId', + nameKey: 'communityName', + formFilter: 'dataForm', + where: {areaId: selectedRelation.street}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.community = data.value; + if(data.value) { + $('#communityName').val(option.innerHTML); + } else { + $('#communityName').val(''); + } + var url = 'api/house/listpage?myself={myself}&street={street}&community={community}'; + newInitTableCommunity(url); + + initHousingEstateSelect(); + } + }) + } + + var initHousingEstateSelect = function() { + selectedRelation.housingEstate = ''; + var $housingEstateBox = $('#housingEstateBox'); + if(!selectedRelation.community) { + $housingEstateBox.hide(); + return; + } + $housingEstateBox.show(); + select.dataDynamic({ + url: 'api/residential/list', + name: 'housingEstateId', + valueKey: 'residentialId', + nameKey: 'name', + formFilter: 'dataForm', + where: {street: selectedRelation.street, community: selectedRelation.community}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.housingEstate = data.value; + if(data.value) { + $('#housingEstateName').val(option.innerHTML); + } else { + $('#housingEstateName').val(''); + } + var url = 'api/house/listpage?myself={myself}&street={street}&community={community}&residentialId={residentialId}'; + newInitTableResidential(url); + + initBuilding(); + } + }) + } + + var initBuilding = function() { + selectedRelation.buildingId = ''; + top.restAjax.get(top.restAjax.path('api/building/listpage', []), { + page: buildingPager.currentPage, + rows: buildingPager.rows, + street: selectedRelation.street, + community: selectedRelation.community, + residentialId: selectedRelation.housingEstate + }, null, function(code, data) { + buildingPager.currentPage = data.page; + buildingPager.datas = data.rows; + buildingPager.total = data.total; + buildingPager.totalPage = buildingPager.total % buildingPager.rows === 0? buildingPager.total / buildingPager.rows : Math.floor(buildingPager.total / buildingPager.rows) + 1; + renderBuilding(); + }, function(code, data) { + top.dialog.msg(data.msg); + }) + } + + var renderBuilding = function() { + var renderBuildingLise = function() { + var lis = ''; + $.each(buildingPager.datas, function(index, item) { + lis += `
  • ${item.name}
  • `; + }); + var $treeBody = $('#treeBody'); + $treeBody.empty(); + if(lis) { + $treeBody.append(`楼/排列表
      ${lis}
    `); + } else { + $treeBody.append('
    暂无数据
    ') + } + } + + var renderPageBtn = function() { + var $buildingPageBtnGroup = $('#buildingPageBtnGroup'); + if(buildingPager.totalPage > 1) { + $buildingPageBtnGroup.show(); + } else { + $buildingPageBtnGroup.hide(); + } + } + + renderBuildingLise(); + renderPageBtn(); + } + + var newInitTableResidential = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community, selectedRelation.housingEstate]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableStreet = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableCommunity = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableBuilding = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community, selectedRelation.housingEstate, selectedRelation.buildingId]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + // 初始化表格 function initTable() { table.render({ @@ -522,6 +2028,14 @@ } } }); + + var init = function(){ + initStreetSelect(); + initCommunitySelect(); + event(); + } + init(); + }); diff --git a/src/main/resources/templates/house/list.html b/src/main/resources/templates/house/list.html index 2d3b246..e360919 100644 --- a/src/main/resources/templates/house/list.html +++ b/src/main/resources/templates/house/list.html @@ -9,11 +9,69 @@ +
    -
    -
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    + +
    +
    +
    @@ -58,7 +116,7 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'common', 'select'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; @@ -66,8 +124,1456 @@ var laydate = layui.laydate; var common = layui.common; var resizeTimeout = null; + var select = layui.select; var tableUrl = 'api/house/listpage'; + var event = function() { + $(document).on('click', '#treeBody ul li', function () { + var $lis = $('#treeBody ul li'); + $lis.filter('.active').removeClass('active'); + $(this).addClass('active'); + selectedRelation.buildingId = this.dataset.id; + selectedRelation.buildingFloorsNum = this.dataset.floorsNum; + selectedRelation.buildingUnitNum = this.dataset.unitNum; + var url = 'api/house/listpage?street={street}&community={community}&residentialId={residentialId}&buildingId={buildingId}'; + newInitTableBuilding(url); + }); + $(document).on('click', '#nextBuildingPageBtn', function () { + if (buildingPager.currentPage <= 1) { + return; + } + buildingPager.currentPage -= 1; + initBuilding(); + }); + $(document).on('click', '#prevBuildingPageBtn', function () { + if (buildingPager.currentPage >= buildingPager.totalPage) { + return; + } + buildingPager.currentPage += 1; + initBuilding(); + }); + } + + var selectedRelation = { + street: '', + community: '', + housingEstate: '', + buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', + } + + var buildingPager = { + currentPage: 1, + rows: 10, + total: 0, + totalPage: 1, + data: [] + } + + var initStreetSelect = function() { + select.dataDynamic({ + url: 'api/residential/getStreetList', + name: 'streetId', + valueKey: 'id', + nameKey: 'name', + formFilter: 'dataForm', + where: {}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.street = data.value; + if(data.value) { + $('#streetName').val(option.innerHTML); + } else { + $('#streetName').val(''); + } + initCommunitySelect(); + var url = 'api/house/listpage?street={street}'; + newInitTableStreet(url); + } + }) + } + + var initCommunitySelect = function() { + selectedRelation.community = ''; + var $communityBox = $('#communityBox'); + if(!selectedRelation.street) { + $communityBox.hide(); + return; + } + $communityBox.show(); + select.dataDynamic({ + url: 'api/residential/getCommunityList', + name: 'communityId', + valueKey: 'communityId', + nameKey: 'communityName', + formFilter: 'dataForm', + where: {areaId: selectedRelation.street}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.community = data.value; + if(data.value) { + $('#communityName').val(option.innerHTML); + } else { + $('#communityName').val(''); + } + var url = 'api/house/listpage?street={street}&community={community}'; + newInitTableCommunity(url); + + initHousingEstateSelect(); + } + }) + } + + var initHousingEstateSelect = function() { + selectedRelation.housingEstate = ''; + var $housingEstateBox = $('#housingEstateBox'); + if(!selectedRelation.community) { + $housingEstateBox.hide(); + return; + } + $housingEstateBox.show(); + select.dataDynamic({ + url: 'api/residential/list', + name: 'housingEstateId', + valueKey: 'residentialId', + nameKey: 'name', + formFilter: 'dataForm', + where: {street: selectedRelation.street, community: selectedRelation.community}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.housingEstate = data.value; + if(data.value) { + $('#housingEstateName').val(option.innerHTML); + } else { + $('#housingEstateName').val(''); + } + var url = 'api/house/listpage?street={street}&community={community}&residentialId={residentialId}'; + newInitTableResidential(url); + + initBuilding(); + } + }) + } + + var initBuilding = function() { + selectedRelation.buildingId = ''; + top.restAjax.get(top.restAjax.path('api/building/listpage', []), { + page: buildingPager.currentPage, + rows: buildingPager.rows, + street: selectedRelation.street, + community: selectedRelation.community, + residentialId: selectedRelation.housingEstate + }, null, function(code, data) { + buildingPager.currentPage = data.page; + buildingPager.datas = data.rows; + buildingPager.total = data.total; + buildingPager.totalPage = buildingPager.total % buildingPager.rows === 0? buildingPager.total / buildingPager.rows : Math.floor(buildingPager.total / buildingPager.rows) + 1; + renderBuilding(); + }, function(code, data) { + top.dialog.msg(data.msg); + }) + } + + var renderBuilding = function() { + var renderBuildingLise = function() { + var lis = ''; + $.each(buildingPager.datas, function(index, item) { + lis += `
  • ${item.name}
  • `; + }); + var $treeBody = $('#treeBody'); + $treeBody.empty(); + if(lis) { + $treeBody.append(`楼/排列表
      ${lis}
    `); + } else { + $treeBody.append('
    暂无数据
    ') + } + } + + var renderPageBtn = function() { + var $buildingPageBtnGroup = $('#buildingPageBtnGroup'); + if(buildingPager.totalPage > 1) { + $buildingPageBtnGroup.show(); + } else { + $buildingPageBtnGroup.hide(); + } + } + + renderBuildingLise(); + renderPageBtn(); + } + + var newInitTableResidential = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street, selectedRelation.community, selectedRelation.housingEstate]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableStreet = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableCommunity = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street, selectedRelation.community]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableBuilding = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, [selectedRelation.street, selectedRelation.community, selectedRelation.housingEstate, selectedRelation.buildingId]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'communityName', width: 180, title: '社区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialName', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingName', width: 180, title: '楼/排名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationUnit', width: 180, title: '所在单元/列', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliationFloors', width: 180, title: '所在层/院', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseNum', width: 180, title: '门牌号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'categoryName', width: 180, title: '房屋类别', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'natureName', width: 180, title: '房屋性质', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'typeName', width: 180, title: '房屋种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'structureName', width: 180, title: '房屋结构', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'buildingPurposeName', width: 180, title: '建筑用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomNum', width: 180, title: '房间数量', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomArea', width: 180, title: '房屋面积', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'roomUseName', width: 180, title: '房屋用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'dangerName', width: 180, title: '隐患类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'certificateNum', width: 180, title: '产权证号', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'registrationDate', width: 180, title: '登记日期', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'affiliatedUnit', width: 180, title: '所属单位', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isRental', width: 180, title: '是否出租屋', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'isVacant', width: 180, title: '是否空置房', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'lodgeTypeName', width: 180, title: '租住类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'rentalPurposes', width: 180, title: '出租用途', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'homeowner', width: 180, title: '房主名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'documentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'phone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodian', width: 180, title: '托管人姓名', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentName', width: 180, title: '证件种类', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianDocumentNum', width: 180, title: '证件号码', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'custodianPhone', width: 180, title: '联系电话', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'relationshipHomeowner', width: 180, title: '与房主关系', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'houseStatus', fixed: 'right', width: 150, title: '入住人员', align:'center', + templet: function(row) { + var rowData = '入住人员';; + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + // 初始化表格 function initTable() { table.render({ @@ -521,6 +2027,14 @@ } } }); + + var init = function(){ + initStreetSelect(); + initCommunitySelect(); + event(); + } + init(); + }); diff --git a/src/main/resources/templates/residential/list-myself.html b/src/main/resources/templates/residential/list-myself.html index 610bd94..6641fce 100644 --- a/src/main/resources/templates/residential/list-myself.html +++ b/src/main/resources/templates/residential/list-myself.html @@ -9,11 +9,63 @@ +
    -
    -
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    @@ -58,7 +110,7 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'common', 'select'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; @@ -66,8 +118,244 @@ var laydate = layui.laydate; var common = layui.common; var resizeTimeout = null; + var select = layui.select; var tableUrl = 'api/residential/listpage?myself={myself}'; + var selectedRelation = { + street: '', + community: '', + housingEstate: '', + buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', + } + + var initStreetSelect = function() { + select.dataDynamic({ + url: 'api/residential/getStreetList', + name: 'streetId', + valueKey: 'id', + nameKey: 'name', + formFilter: 'dataForm', + where: {}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.street = data.value; + if(data.value) { + $('#streetName').val(option.innerHTML); + } else { + $('#streetName').val(''); + } + initCommunitySelect(); + var url = 'api/residential/listpage?myself={myself}&street={street}'; + newInitTableStreet(url); + } + }) + } + + var initCommunitySelect = function() { + selectedRelation.community = ''; + var $communityBox = $('#communityBox'); + if(!selectedRelation.street) { + $communityBox.hide(); + return; + } + $communityBox.show(); + select.dataDynamic({ + url: 'api/residential/getCommunityList', + name: 'communityId', + valueKey: 'communityId', + nameKey: 'communityName', + formFilter: 'dataForm', + where: {areaId: selectedRelation.street}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.community = data.value; + if(data.value) { + $('#communityName').val(option.innerHTML); + } else { + $('#communityName').val(''); + } + var url = 'api/residential/listpage?myself={myself}&street={street}&community={community}'; + newInitTableCommunity(url); + } + }) + } + + var newInitTableStreet = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'name', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'communityName', width: 180, title: '所在社区', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialTypeName', width: 180, title: '类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableCommunity = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'name', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'communityName', width: 180, title: '所在社区', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialTypeName', width: 180, title: '类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + // 初始化表格 function initTable() { table.render({ @@ -268,6 +556,12 @@ } } }); + + var init = function(){ + initStreetSelect(); + initCommunitySelect(); + } + init(); }); diff --git a/src/main/resources/templates/residential/list.html b/src/main/resources/templates/residential/list.html index 24a4010..5a1f39c 100644 --- a/src/main/resources/templates/residential/list.html +++ b/src/main/resources/templates/residential/list.html @@ -9,11 +9,63 @@ +
    -
    -
    +
    +
    +
    +
    +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    @@ -58,7 +110,7 @@ base: 'assets/layuiadmin/' }).extend({ index: 'lib/index' - }).use(['index', 'table', 'laydate', 'common'], function() { + }).use(['index', 'table', 'laydate', 'common', 'select'], function() { var $ = layui.$; var $win = $(window); var table = layui.table; @@ -66,8 +118,244 @@ var laydate = layui.laydate; var common = layui.common; var resizeTimeout = null; + var select = layui.select; var tableUrl = 'api/residential/listpage'; + var selectedRelation = { + street: '', + community: '', + housingEstate: '', + buildingId: '', + buildingFloorsNum: '', + buildingUnitNum: '', + } + + var initStreetSelect = function() { + select.dataDynamic({ + url: 'api/residential/getStreetList', + name: 'streetId', + valueKey: 'id', + nameKey: 'name', + formFilter: 'dataForm', + where: {}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.street = data.value; + if(data.value) { + $('#streetName').val(option.innerHTML); + } else { + $('#streetName').val(''); + } + initCommunitySelect(); + var url = 'api/residential/listpage?myself={myself}&street={street}'; + newInitTableStreet(url); + } + }) + } + + var initCommunitySelect = function() { + selectedRelation.community = ''; + var $communityBox = $('#communityBox'); + if(!selectedRelation.street) { + $communityBox.hide(); + return; + } + $communityBox.show(); + select.dataDynamic({ + url: 'api/residential/getCommunityList', + name: 'communityId', + valueKey: 'communityId', + nameKey: 'communityName', + formFilter: 'dataForm', + where: {areaId: selectedRelation.street}, + selectedValue: '', + optionDatasetKeyArray: [], + onSelect: function(data, option) { + selectedRelation.community = data.value; + if(data.value) { + $('#communityName').val(option.innerHTML); + } else { + $('#communityName').val(''); + } + var url = 'api/residential/listpage?myself={myself}&street={street}&community={community}'; + newInitTableCommunity(url); + } + }) + } + + var newInitTableStreet = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'name', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'communityName', width: 180, title: '所在社区', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialTypeName', width: 180, title: '类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + + var newInitTableCommunity = function(url) { + table.render({ + elem: '#dataTable', + id: 'dataTable', + url: top.restAjax.path(url, ['yes', selectedRelation.street, selectedRelation.community]), + width: admin.screen() > 1 ? '100%' : '', + height: $win.height() - 90, + limit: 20, + limits: [20, 40, 60, 80, 100, 200], + toolbar: '#headerToolBar', + request: { + pageName: 'page', + limitName: 'rows' + }, + cols: [ + [ + {type:'checkbox', fixed: 'left'}, + {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {field: 'name', width: 180, title: '小区名称', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'communityName', width: 180, title: '所在社区', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'residentialTypeName', width: 180, title: '类型', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'address', width: 180, title: '详细地址', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'longitude', width: 180, title: '经度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + }, + {field: 'latitude', width: 180, title: '纬度', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData; + } + } + ] + ], + page: true, + parseData: function(data) { + return { + 'code': 0, + 'msg': '', + 'count': data.total, + 'data': data.rows + }; + } + }); + } + // 初始化表格 function initTable() { table.render({ @@ -268,6 +556,13 @@ } } }); + + var init = function(){ + initStreetSelect(); + initCommunitySelect(); + } + init(); + });