123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <%@ page contentType="text/html;charset=UTF-8" %>
- <script>
- var pageSize = 6;
- var searchParam = $("#searchForm").serializeJSON();
- var flow ;
- $(document).ready(function() {
- /*$('#leaderInfoTable').bootstrapTable({
- //请求方法
- method: 'post',
- //类型json
- dataType: "json",
- contentType: "application/x-www-form-urlencoded",
- //显示检索按钮
- showSearch: true,
- //显示刷新按钮
- showRefresh: true,
- //显示切换手机试图按钮
- showToggle: true,
- //显示 内容列下拉框
- showColumns: true,
- //显示到处按钮
- showExport: true,
- //显示切换分页按钮
- showPaginationSwitch: true,
- //最低显示2行
- minimumCountColumns: 2,
- //是否显示行间隔色
- striped: true,
- //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
- cache: false,
- //是否显示分页(*)
- pagination: true,
- //排序方式
- sortOrder: "asc",
- //初始化加载第一页,默认第一页
- pageNumber:1,
- //每页的记录行数(*)
- pageSize: 10,
- //可供选择的每页的行数(*)
- pageList: [10, 25, 50, 100],
- //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
- url: "${ctx}/leader/info/leaderInfo/data",
- //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
- //queryParamsType:'',
- ////查询参数,每次调用是会带上这个参数,可自定义
- queryParams : function(params) {
- var searchParam = $("#searchForm").serializeJSON();
- searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
- searchParam.pageSize = params.limit === undefined? -1 : params.limit;
- searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
- return searchParam;
- },
- //分页方式:client客户端分页,server服务端分页(*)
- sidePagination: "server",
- contextMenuTrigger:"right",//pc端 按右键弹出菜单
- contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
- contextMenu: '#context-menu',
- onContextMenuItem: function(row, $el){
- if($el.data("item") == "edit"){
- edit(row.id);
- }else if($el.data("item") == "view"){
- view(row.id);
- } else if($el.data("item") == "delete"){
- jp.confirm('确认要删除该党员信息记录吗?', function(){
- jp.loading();
- jp.get("${ctx}/leader/info/leaderInfo/delete?id="+row.id, function(data){
- if(data.success){
- $('#leaderInfoTable').bootstrapTable('refresh');
- jp.success(data.msg);
- }else{
- jp.error(data.msg);
- }
- })
- });
- }
- },
- onClickRow: function(row, $el){
- },
- onShowSearch: function () {
- $("#search-collapse").slideToggle();
- },
- columns: [{
- checkbox: true
- }
- ,{
- field: 'name',
- title: '姓名',
- sortable: true,
- sortName: 'name'
- ,formatter:function(value, row , index){
- value = jp.unescapeHTML(value);
- <c:choose>
- <c:when test="${fns:hasPermission('leader:info:leaderInfo:edit')}">
- return "<a href='javascript:edit(\""+row.id+"\")'>"+value+"</a>";
- </c:when>
- <c:when test="${fns:hasPermission('leader:info:leaderInfo:view')}">
- return "<a href='javascript:view(\""+row.id+"\")'>"+value+"</a>";
- </c:when>
- <c:otherwise>
- return value;
- </c:otherwise>
- </c:choose>
- }
- }
- ,{
- field: 'sex',
- title: '性别',
- sortable: true,
- sortName: 'sex',
- formatter:function(value, row , index){
- return jp.getDictLabel(${fns:toJson(fns:getDictList('sex'))}, value, "-");
- }
- }
- ,{
- field: 'nation',
- title: '民族',
- sortable: true,
- sortName: 'nation',
- formatter:function(value, row , index){
- return jp.getDictLabel(${fns:toJson(fns:getDictList('nation'))}, value, "-");
- }
- }
- ,{
- field: 'degree',
- title: '学历',
- sortable: true,
- sortName: 'degree',
- formatter:function(value, row , index){
- return jp.getDictLabel(${fns:toJson(fns:getDictList('degree'))}, value, "-");
- }
- }
- ,{
- field: 'lead',
- title: '所在党支部',
- sortable: true,
- sortName: 'lead'
- }
- ,{
- field: 'phone',
- title: '联系电话(手机号)',
- sortable: true,
- sortName: 'phone'
- }
- ,{
- field: 'leaderStatus',
- title: '党籍状态',
- sortable: true,
- sortName: 'leaderStatus',
- formatter:function(value, row , index){
- return jp.getDictLabel(${fns:toJson(fns:getDictList(''))}, value, "-");
- }
- }
- ,{
- field: 'updateDate',
- title: '更新时间',
- sortable: true,
- sortName: 'updateDate'
- }
- ]
- });*/
- $("#export").click(function(){//导出Excel文件
- jp.downloadFile('${ctx}/leader/info/leaderInfo/export');
- });
- layui.use('flow', function(){
- flow = layui.flow;
- loadData();
- });
- $("#search").click("click", function() {// 绑定查询按扭
- $('#lay_local').html('');
- searchParam = $("#searchForm").serializeJSON();
- loadData();
- });
- $("#reset").click("click", function() {// 绑定查询按扭
- $("#searchForm input").val("");
- $("#searchForm select").val("");
- $("#searchForm .select-item").html("");
- $("#search").click();
- });
- });
- function loadData() {
- flow.load({
- elem: '#lay_local' //流加载容器
- ,scrollElem: '#lay_local' //滚动条所在元素,一般不用填,此处只是演示需要。
- ,done: function(page, next){ //执行下一页的回调
- var photo = "${ctxStatic}/common/images/default.jpg";
- var lis = [];
- $.post("${ctx}/leader/info/leaderInfo/data",
- {
- 'pageNo':page,
- 'pageSize':pageSize,
- 'name':searchParam.name,
- 'sex':searchParam.sex,
- 'lead':searchParam.lead,
- 'nation':searchParam.nation
- },function(res){
- //假设你的列表返回在data集合中
- layui.each(res.rows, function(index, item){
- //console.log();
- if(item.photo!=undefined && item.photo !=''){
- photo = item.photo;
- }else{
- if(item.sex == '1'){
- photo = "${ctxStatic}/common/images/default.jpg";
- }else{
- photo = "${ctxStatic}/common/images/default.jpg";
- }
- }
- var html = '<li><table class="table" width="100%" >'+
- '<tr>'+
- '<td width="18%" rowspan="3" align="center" valign="center"><img name="img" src="'+photo+'" height="180" width="152" /></td>'+
- '<td width="68%" align="left" style="vertical-align:middle;" colspan="2"><font size="4"><b>'+ item.name +'</b></font>' +
- ' '+jp.getDictLabel(${fns:toJson(fns:getDictList('sex'))}, item.sex, "-")+
- ' '+jp.getDictLabel(${fns:toJson(fns:getDictList('nation'))}, item.nation, "-")+' </td>'+
- '</tr>'+
- '<tr>'+
- '<td align="left" style="vertical-align:middle;">出生年月:'+ item.birth +'</td>'+
- '<td> </td>'+
- '</tr>'+
- '<tr>'+
- '<td align="left" style="vertical-align:middle;" >所在党组织:'+ item.allName +'</td>'+
- '<td> </td>'+
- '</tr>'+
- '<tr>'+
- '<td colspan="2" align="right" style="vertical-align:bottom;">';
- <c:if test="${fns:hasPermission('leader:info:leaderInfo:edit')}">
- html += '<a href="javascript:edit(\''+ item.id +'\')" style="margin:4px; line-height:24px;">' +
- '<img src="${ctxStatic}/common/images/xg.png" width="16" height="16" />修改</a>';
- </c:if>
- <c:if test="${fns:hasPermission('leader:info:leaderInfo:del')}">
- html += '<a href="javascript:del(\''+ item.id +'\')" style="margin:4px;line-height:24px;">' +
- '<img src="${ctxStatic}/common/images/delete.png" width="16" height="16" />删除</a>';
- </c:if>
- html +='<a href="javascript:view(\''+ item.id +'\')" style="margin:4px;line-height:24px;">' +
- '<img src="${ctxStatic}/common/images/look.png" width="16" height="16" />查看</a>';
- html += '</td></tr></table></li>';
- lis.push(html);
- });
- //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
- //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
- next(lis.join(''), page < res.pagesize);
- });
- }
- });
- }
- function del(id){
- jp.confirm('确认要删除该党员信息记录吗?', function(){
- jp.loading();
- jp.get("${ctx}/leader/info/leaderInfo/deleteAll?ids=" + id, function(data){
- if(data.success){
- loadData();
- jp.success(data.msg);
- }else{
- jp.error(data.msg);
- }
- })
- })
- }
- function add(){
- jp.go("${ctx}/leader/info/leaderInfo/form/add");
- }
- function edit(id){
- jp.go("${ctx}/leader/info/leaderInfo/form/edit?id=" + id);
- }
- function view(id) {
- jp.go("${ctx}/leader/info/leaderInfo/form/view?oprType=view&id=" + id);
- }
- function onShowSearch() {
- $("#search-collapse").slideToggle();
- }
- </script>
|