人口基本信息-房屋中同住人的新增与修改

人口基本信息-人口选择页面的去脱敏Bug修改
人口基本信息-人口选择页面增加新增人员功能
This commit is contained in:
java_cuibaocheng@163.com 2023-11-16 14:51:04 +08:00
parent f2e4f0cbf2
commit 12e10ecd2c
12 changed files with 607 additions and 43 deletions

View File

@ -482,7 +482,6 @@ public class PopulationInfoController extends AbstractController {
Map<String, Object> params = requestParams();
return populationInfoService.list(params);
}
@ApiOperation(value = "基础人口信息分页列表", notes = "基础人口信息分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),

View File

@ -57,6 +57,11 @@ public class PopulationInfoRouteController extends AbstractController {
return new ModelAndView("populationinfo/query");
}
@GetMapping("query-multiple")
public ModelAndView queryMultiple() {
return new ModelAndView("populationinfo/query-multiple");
}
@GetMapping("bind")
public ModelAndView bind() {
ModelAndView mv = new ModelAndView("populationinfo/bind");

View File

@ -2,6 +2,7 @@ package com.cm.population.service.populationinfo.impl;
import com.cm.common.base.AbstractService;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.plugin.pojo.bos.UserResourceBO;
import com.cm.common.plugin.pojo.dtos.dataarea.DataAreaDTO;
@ -437,12 +438,19 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
@Override
public List<PopulationInfoDTO> list(Map<String, Object> params) {
if(params.get("populationInfoIds") != null) {
List<String> list = Arrays.asList(params.get("populationInfoIds").toString().split("\\_"));
if (list.size() > 100) {
throw new SearchException("单次最多选择100个");
}
params.put("populationInfoIds", list);
}
List<PopulationInfoDTO> listList = populationInfoDao.list(params);
ArrayList<String> arr = new ArrayList();
for(PopulationInfoDTO dto : listList) {
arr.add(dto.getCreator());
}
// 查询用户
// 查询创建人用户
List<UserResourceBO> jsonArray = iUserService.listUserResourceByIds(arr);
UserResourceBO bo1 = new UserResourceBO();
bo1.setUserId("1");
@ -450,12 +458,14 @@ public class PopulationInfoServiceImpl extends AbstractService implements IPopul
jsonArray.add(bo1);
List<DataDictionaryDTO> list = iDataDictionaryService.listDictionaryByParentId("5ea50f00-3d76-492c-8680-9c30d50cce21");
for(PopulationInfoDTO populationInfoDTO : listList) {
// 封装创建人姓名回显
for(UserResourceBO bo : jsonArray) {
if (bo.getUserId().equals(populationInfoDTO.getCreator())) {
populationInfoDTO.setCreatorName(bo.getUserName());
break;
}
}
// 封装标签回显
if (populationInfoDTO != null && !StringUtil.isEmpty(populationInfoDTO.getLabel()) && populationInfoDTO.getLabel().length() > 0) {
List<PopulationInfoLabelDTO> dataList = new ArrayList<>();
for(DataDictionaryDTO dto : list) {

View File

@ -371,10 +371,10 @@ public class PopulationLogServiceImpl extends AbstractService implements IPopula
throw new SaveException("请先登录");
}
List<PopulationLogDTO> list = populationLogDao.list(params);
if (!creator.equals("1")) {
//if (!creator.equals("1")) {
for(PopulationLogDTO dto : list) {
dto.setPopulationInfoData(""); // 不给返回操作的数据
String populationInfoContent = dto.getPopulationInfoContent().replace("超级管理员[1]", "超级管理员");
String populationInfoContent = dto.getPopulationInfoContent().replace("超级管理员[1]", "超级管理员[***]");
Pattern pattern = Pattern.compile("[a-zA-Z0-9-]{36}");
Matcher matcher = pattern.matcher(populationInfoContent);
while(matcher.find()) {
@ -402,7 +402,7 @@ public class PopulationLogServiceImpl extends AbstractService implements IPopula
}
dto.setPopulationInfoContent(populationInfoContent);
}
}
// }
return list;
}

View File

@ -1,6 +1,6 @@
server:
port: 7023
url: http://192.168.0.9:7023/population
url: http://192.168.0.115:7023/population
title: population
servlet:
context-path: /population
@ -74,8 +74,8 @@ security:
oauth-server: http://192.168.0.15:7021/usercenter
oauth-logout: ${security.oauth2.oauth-server}/logout?redirect_uri=${server.url}
client:
client-id: 00b49298399641448405170d55a3614b
client-secret: Z0RQUmZTdENUckprWVRtdGQ3Sm5ldmlCZFJKT1NBNHJZWnNrM1RSSWU3NG1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
client-id: b7eadbbb122044ecb4761db0b98ade3a
client-secret: Z3A3a1AvTHRZeCtPWXVkOXJaeGFYWGp5Q2F1VlhPYVY0Q0hFMCtuQ0tkVW1ac2wwZTJHWk5NbXh3L3h3U2c4Rg==
user-authorization-uri: ${security.oauth2.oauth-server}/oauth_client/authorize
access-token-uri: ${security.oauth2.oauth-server}/oauth_client/token
grant-type: authorization_code
@ -121,4 +121,7 @@ logging:
com.cm: debug
server-other:
area-url: http://192.168.0.15:7022/servicecity
area-url: http://192.168.0.15:7022/servicecity
population-update-log: true
population-insert-log: true
population-delete-log: false

View File

@ -63,6 +63,7 @@
t1.population_info_id = #{populationInfoId}
ORDER BY
t1.gmt_create DESC
LIMIT 50
</select>
<select id="count" parameterType="map" resultType="Integer">

View File

@ -46,6 +46,9 @@
<button type="button" class="layui-btn layui-btn-sm" lay-event="determineEvent">
<i class="fa fa-lg fa-plus"></i> 确定
</button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增人员
</button>
</div>
</script>
</div>
@ -100,6 +103,7 @@
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
defaultToolbar: [],
height: $win.height() - 60,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
@ -206,28 +210,7 @@
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/populationinfo/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
initDate();
// 事件 - 页面变化
@ -246,10 +229,35 @@
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'determineEvent') {
top.dialog.dialogData.popuData = checkDatas[0];
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index);
if(layEvent === 'saveEvent') {
top.layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['90%', '90%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/populationinfo/save', []),
end: function() {
reloadTable();
}
});
}else if(layEvent === 'determineEvent') {
// 因为列表是脱敏数据 , 所以需要此处需要再次请求
var data = checkDatas[0];
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/populationinfo/get/{populationInfoId}', [data.populationInfoId]), {}, null, function(code, data) {
top.dialog.dialogData.popuData = checkDatas[0];
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
});
});

View File

@ -368,6 +368,18 @@
</div>
</div>
<div class="div-base-population-info">
<blockquote class="layui-elem-quote">同住人</blockquote>
<div class="layui-form-item layui-row">
<div class="">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn cohabitSearch">搜索添加同步人</button>
</div>
</div>
</div>
<div id="tongZhuRen"></div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
@ -380,6 +392,39 @@
</div>
</div>
</div>
<script id="tongZhuRenTemplate" type="text/html">
{{# for(var j = 0, item; item = d[j++];) { }}
{{# if(item.outHouse == '0') { }}
<div class="layui-form-item layui-row" style="margin-bottom:5px !important;" >
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">姓名</label>
<div class="layui-input-block">
<input type="hidden" class="layui-input" value="{{item.populationInfoId}}" maxLength="255">
<input type="text" readonly class="layui-input" value="{{item.name}}" placeholder="请输入姓名" maxLength="255">
</div>
</div>
<div class="layui-col-md4 layui-col-xs4">
<label class="layui-form-label">证件号码</label>
<div class="layui-input-block">
<input type="text" readonly class="layui-input" value="{{item.cardNum}}" placeholder="请输入证件号码" maxLength="255">
</div>
</div>
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">联系电话</label>
<div class="layui-input-block">
<input type="text" readonly class="layui-input" value="{{item.phone}}" placeholder="请输入联系电话" maxLength="11">
</div>
</div>
<div class="layui-col-md2 layui-col-xs2" style="text-align: center;">
<div class="layui-form-item" style="height: 33px;padding-top: 3px;" pane="">
<!--<button type="button" class="layui-btn layui-btn-sm out-population" data-population="{{item.populationInfoId}}">搬离房屋</button>-->
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger delete-population" data-population="{{item.populationInfoId}}">录错删除</button>
</div>
</div>
</div>
{{# } }}
{{# } }}
</script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
@ -396,13 +441,11 @@
if(data.value) {
initCommunityNameSelect(data.value);
initResidentialNameSelect(data.value, '');
initAffiliationUnit('0');
initAffiliationFloors('0');
}else {
initCommunityNameSelect('9999');
initResidentialNameSelect('', '');
initAffiliationUnit('0');
initAffiliationFloors('0');
}
@ -462,6 +505,78 @@
});
}
var cohabitArray = new Array();
// 同住人搜索
function cohabitSearch() {
top.dialog.open({
url: top.restAjax.path('route/populationinfo/query-multiple', []),
title: '人员选择',
width: '80%',
height: '80%',
onClose: function(data) {
var list = top.dialog.dialogData.populationinfoQueryMultiple;
// 判断是否已选择
for(var i = 0 ; i < list.length ; i++){
var exists = false;
for(var j = 0 ; j < cohabitArray.length ; j++) {
if(list[i].populationInfoId == cohabitArray[j].populationInfoId) {
exists = true;
break;
}
}
if (!exists) {
cohabitArray.push({populationInfoId: list[i].populationInfoId, cardNum: list[i].idcard, phone: list[i].phone, name: list[i].name, outHouse: "0"});
}
}
reloadCohabit();
}
});
}
// 房屋人员重新渲染
function reloadCohabit() {
laytpl(document.getElementById('tongZhuRenTemplate').innerHTML).render(cohabitArray, function(html) {
document.getElementById('tongZhuRen').innerHTML = html;
});
form.render();
}
// 房屋人员搬出房屋
$(document).on("click", ".out-population" , function () {
var populationInfoId = $(this).data("population");
for (var i = 0; i < cohabitArray.length; i++) {
if (cohabitArray[i].populationInfoId == populationInfoId) {
cohabitArray[i].outHouse = "1";
}
}
reloadCohabit();
});
function removeAaary(array, objKey, objValue) {
var length = array.length;
for (var i = 0; i < length; i++) {
if (array[i][objKey] == objValue) {
if (i == 0) {
array.shift(); //删除并返回数组的第一个元素
return array;
} else if (i == length - 1) {
array.pop(); //删除并返回数组的最后一个元素
return array;
} else {
array.splice(i, 1); //删除下标为i的元素
return array;
}
}
}
}
// 房屋人员录错删除
$(document).on("click", ".delete-population" , function () {
var populationInfoId = $(this).data("population");
removeAaary(cohabitArray, "populationInfoId", populationInfoId);
reloadCohabit();
});
// 托管人搜索
function custodianSearch() {
top.dialog.open({
@ -716,6 +831,7 @@
formData.field.communityName = communityName;
formData.field.residentialName = residentialName;
formData.field.buildingName = buildingName;
formData.field.populationVOList = cohabitArray;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
@ -756,6 +872,10 @@
custodianSearch();
});
$('.cohabitSearch').on('click', function() {
cohabitSearch();
});
// 校验
form.verify({
});

View File

@ -368,6 +368,18 @@
</div>
</div>
<div class="div-base-population-info">
<blockquote class="layui-elem-quote">同住人</blockquote>
<div class="layui-form-item layui-row">
<div class="">
<div class="layui-footer" style="left: 98%;">
<button type="button" class="layui-btn cohabitSearch">搜索添加同步人</button>
</div>
</div>
</div>
<div id="tongZhuRen"></div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
@ -380,6 +392,40 @@
</div>
</div>
</div>
<script id="tongZhuRenTemplate" type="text/html">
{{# for(var j = 0, item; item = d[j++];) { }}
{{# if(item.outHouse == '0') { }}
<div class="layui-form-item layui-row" style="margin-bottom:5px !important;" >
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">姓名</label>
<div class="layui-input-block">
<input type="hidden" class="layui-input" value="{{item.populationInfoId}}" maxLength="255">
<input type="text" readonly class="layui-input" value="{{item.name}}" placeholder="请输入姓名" maxLength="255">
</div>
</div>
<div class="layui-col-md4 layui-col-xs4">
<label class="layui-form-label">证件号码</label>
<div class="layui-input-block">
<input type="text" readonly class="layui-input" value="{{item.cardNum}}" placeholder="请输入证件号码" maxLength="255">
</div>
</div>
<div class="layui-col-md3 layui-col-xs3">
<label class="layui-form-label">联系电话</label>
<div class="layui-input-block">
<input type="text" readonly class="layui-input" value="{{item.phone}}" placeholder="请输入联系电话" maxLength="11">
</div>
</div>
<div class="layui-col-md2 layui-col-xs2" style="text-align: center;">
<div class="layui-form-item" style="height: 33px;padding-top: 3px;" pane="">
<button type="button" class="layui-btn layui-btn-sm out-population" data-population="{{item.populationInfoId}}">搬离房屋</button>
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger delete-population" data-population="{{item.populationInfoId}}">录错删除</button>
</div>
</div>
</div>
{{# } }}
{{# } }}
</script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
@ -742,11 +788,85 @@
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
var cohabitArray = new Array();
// 同住人搜索
function cohabitSearch() {
top.dialog.open({
url: top.restAjax.path('route/populationinfo/query-multiple', []),
title: '人员选择',
width: '80%',
height: '80%',
onClose: function(data) {
var list = top.dialog.dialogData.populationinfoQueryMultiple;
// 判断是否已选择
for(var i = 0 ; i < list.length ; i++){
var exists = false;
for(var j = 0 ; j < cohabitArray.length ; j++) {
if(list[i].populationInfoId == cohabitArray[j].populationInfoId) {
exists = true;
break;
}
}
if (!exists) {
cohabitArray.push({populationInfoId: list[i].populationInfoId, cardNum: list[i].idcard, phone: list[i].phone, name: list[i].name, outHouse: "0"});
}
}
reloadCohabit();
}
});
}
// 房屋人员重新渲染
function reloadCohabit() {
laytpl(document.getElementById('tongZhuRenTemplate').innerHTML).render(cohabitArray, function(html) {
document.getElementById('tongZhuRen').innerHTML = html;
});
form.render();
}
// 房屋人员搬出房屋
$(document).on("click", ".out-population" , function () {
var populationInfoId = $(this).data("population");
for (var i = 0; i < cohabitArray.length; i++) {
if (cohabitArray[i].populationInfoId == populationInfoId) {
cohabitArray[i].outHouse = "1";
}
}
reloadCohabit();
});
function removeAaary(array, objKey, objValue) {
var length = array.length;
for (var i = 0; i < length; i++) {
if (array[i][objKey] == objValue) {
if (i == 0) {
array.shift(); //删除并返回数组的第一个元素
return array;
} else if (i == length - 1) {
array.pop(); //删除并返回数组的最后一个元素
return array;
} else {
array.splice(i, 1); //删除下标为i的元素
return array;
}
}
}
}
// 房屋人员录错删除
$(document).on("click", ".delete-population" , function () {
var populationInfoId = $(this).data("population");
removeAaary(cohabitArray, "populationInfoId", populationInfoId);
reloadCohabit();
});
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/house/get/{houseId}', [houseId]), {}, null, function(code, data) {
console.log(data)
cohabitArray = data.populationDTOList ? data.populationDTOList : new Array();
reloadCohabit();
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
@ -799,6 +919,7 @@
formData.field.communityName = communityName;
formData.field.residentialName = residentialName;
formData.field.buildingName = buildingName;
formData.field.populationVOList = cohabitArray;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
@ -839,6 +960,9 @@
custodianSearch();
});
$('.cohabitSearch').on('click', function() {
cohabitSearch();
});
// 校验
form.verify({
});

View File

@ -259,7 +259,7 @@
if(layEvent === 'bindEvent') {
top.layer.open({
type: 2,
title: data.name + "[" + data.idcard + "]",
title: data.name + "[" + data.idcard + "](近50条)",
closeBtn: 1,
offset:"r",
area: ['500px', '100%'],

View File

@ -0,0 +1,264 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<style>
.layui-form-select{
min-width:200px!important;
}
.layui-select-title{
min-width:200px!important;
}
.layui-select-title input{
min-width:200px!important;
}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="name" class="layui-input search-item" placeholder="请输入姓名">
</div>
<div class="layui-inline layui-form search-item" id="idcardTypeSelectTemplateBox" lay-filter="idcardTypeSelectTemplateBox"></div>
<div class="layui-inline">
<input type="text" id="idcard" class="layui-input search-item" placeholder="请输入证件号">
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="queryEvent">
<i class="fa fa-lg fa-check"></i> 选择人员
</button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增人员
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script id="idcardTypeSelectTemplate" type="text/html" lay-search>
<select id="idcardType" name="idcardType">
<option value="">请选择证件类型</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryName}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'form', 'laytpl', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var form = layui.form;
var laytpl = layui.laytpl;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/populationinfo/listpage';
window.sessionStorage.setItem("tempQueryMultiplePopulationInfo", null);
top.dialog.dialogData.populationinfoQueryMultiple = null;
// 初始化证件类型下拉选择
function initIdcardTypeSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/76c5044f-805a-4313-b1e8-79e966b97c0d', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('idcardTypeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('idcardTypeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'idcardTypeSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initIdcardTypeSelect();
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
defaultToolbar: [],
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: '<span>{{d.LAY_INDEX}}</span>'},
{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: 'idcardType', width: 180, title: '证件类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'idcard', width: 180, title: '证件号码', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'birthday', width: 180, title: '出生日期', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'sex', width: 180, title: '性别', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'nation', 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 reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
name: $('#name').val(),
idcardType: $('#idcardType').val(),
idcard: $('#idcard').val()
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
initTable();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
top.layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['90%', '90%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/populationinfo/save', []),
end: function() {
reloadTable();
}
});
}else if(layEvent === 'queryEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else {
// 因为列表是脱敏数据 , 所以需要此处需要再次请求
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['populationInfoId'];
}
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/populationinfo/list', []), {populationInfoIds: ids}, null, function(code, data) {
window.sessionStorage.setItem("tempQueryMultiplePopulationInfo", JSON.stringify(data));// 兼容方式1
top.dialog.dialogData.populationinfoQueryMultiple = data;// 兼容方式2
parent.layer.close(parent.layer.getFrameIndex(window.name));
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, TIME: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
}
});
});
</script>
</body>
</html>

View File

@ -43,9 +43,12 @@
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<button type="button" class="layui-btn layui-btn-sm" lay-event="queryEvent">
<i class="fa fa-lg fa-check"></i> 选择人员
</button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增人员
</button>
</div>
</script>
</div>
@ -79,6 +82,8 @@
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/populationinfo/listpage';
window.sessionStorage.setItem("tempQueryPopulationInfo", null);
top.dialog.dialogData.populationinfoQuery = null;
// 初始化证件类型下拉选择
function initIdcardTypeSelect() {
@ -111,7 +116,7 @@
},
cols: [
[
{type:'checkbox', fixed: 'left'},
{type:'radio', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'name', width: 180, title: '姓名', align:'center',
templet: function(row) {
@ -214,13 +219,38 @@
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
top.layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['90%', '90%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/populationinfo/save', []),
end: function() {
reloadTable();
}
});
}else if(layEvent === 'queryEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
window.sessionStorage.setItem("tempQueryPopulationInfo", JSON.stringify(checkDatas[0]));
parent.layer.close(parent.layer.getFrameIndex(window.name));
// 因为列表是脱敏数据 , 所以需要此处需要再次请求
var data = checkDatas[0];
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/populationinfo/get/{populationInfoId}', [data.populationInfoId]), {}, null, function(code, data) {
window.sessionStorage.setItem("tempQueryPopulationInfo", JSON.stringify(data));// 兼容方式1
top.dialog.dialogData.populationinfoQuery = data;// 兼容方式2
parent.layer.close(parent.layer.getFrameIndex(window.name));
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
}
});