頁面代碼:
姓名學歷技能經驗住址聯系方式
${res}${data}于千萬年之中時間的無涯的荒野里…時間的無涯的荒野里…--%>
js代碼
//加載完成
$(function(){
var sherchkey='${positioninfo.name}';
savePosition();//保存修改方法
getPeopleList(1,5,sherchkey);//獲取人才列表
// getPageList(); //分頁方法
});
//自己封裝獲取數據方法
function getPeopleList(crr,lmt,searchKey){
//獲取人才列表
$.ajax({
url:'${ctx}/recruit/peoplelist',
type:'post',
data:{
"curr":crr||1,
"pageSize":lmt||5,
"searchKey":searchKey
},
dataType:'json',
success:function(res){
if(res.success=="success"){
console.log(res);
count=res.data.totalElements;//總記錄
curr=res.data.number; //當前頁
limit=res.data.size; //每頁幾個
var rclist=res.data.content;
var html='';
var len=rclist.length;
for (var i=0; i
var htmlbuf='
'+'
'+rclist[i].name+''+'
'+rclist[i].edu+''+'
'+rclist[i].skill+''+'
'+rclist[i].exp+''+'
'+rclist[i].add+''+'
'+rclist[i].tel+''+'
';html=html+htmlbuf;
}
$("#rcktb").html(html);
//調用分頁方法
getPageList(count,curr,limit,searchKey);
}else {
layer.alert(res.message);
}
},
error:function(){
layer.msg("網絡故障");
}
})
}
//自己封裝分頁方法
function getPageList(count,curr,limit,searchKey){
//分頁方法
layui.use(['laypage', 'layer'], function(){
var laypage = layui.laypage
,layer = layui.layer;
//完整功能
laypage.render({
elem: 'pagefenye',
count: count||0,
theme: '#009587',
limit : limit||3,
limits:[5, 10, 20, 30, 40],
curr : curr||1,
layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip'],
jump: function(obj,first){
//debugger;
if(!first){
//window.location.href = "?curr="+obj.curr+"&pageSize="+obj.limit+"&enterId="+'${enterId}';
getPeopleList (obj.curr,obj.limit,searchKey);
}
}
});
});
}
后臺代碼
/**
*
* @param curr
* @param pageSize
* @param searchKey
* @param enterId
* @param model
* @return
*/
@RequestMapping("/peoplelist")
@ResponseBody
public ResultEntity peopleList(@RequestParam(value = "curr", defaultValue = "1") int curr,
@RequestParam(value = "pageSize", defaultValue = "5") int pageSize,String searchKey,Model model){
ResultEntity res = new ResultEntity();
try {
PageUtils pageUtils = new PageUtils(curr, pageSize, "", "");
Page>> list = recruitService.getPeopleList(searchKey, pageUtils);
List> dataList = (List>) list.getData();
PageVo pageVo = new PageVo(list.getCurrentPageNo() - 1, dataList, pageSize, list.getTotalPageCount(),
list.getTotalCount());
pageVo.setNumber(curr);
res.setData(pageVo);
//res.setData(curr);
//res.setData(enterId);
res.setSuccess("success");
res.setMessage("獲取成功");
} catch (Exception e) {
e.printStackTrace();
res.setSuccess("false");
res.setMessage("獲取失敗");
}
return res;
}