$(function() {
function renderTable(jsonRes){
var productList = jsonRes.pageList;
var tbodyArray = [];
$('#listBody').html('');
if(null != productList && productList){
$.each(productList, function (index, item) {
tbodyArray.push('<tr>');
tbodyArray.push('<td>' + item.merchantName + '</td>');
tbodyArray.push('<td>' + item.merchantProName + '</td>');
tbodyArray.push('<td>' + item.projectName + '</td>');
tbodyArray.push('<td>' + item.pafProName + '</td>');
tbodyArray.push("<td><a href='" + "/admin/executeprocess/updateExecuteProcess/" + item.exeProcessId + "'>编辑</a></td>");
tbodyArray.push('</tr>');
});
$('#listBody').append(tbodyArray.join(''));
}
var totalpage=jsonRes.totalPage;
// 渲染分页插件
renderPage(jsonRes.currentPage, totalpage);
}
function renderPage(currentPage, maxPage){
$('.pagination').jqPagination('destroy');
$('.pagination').jqPagination({
page_string : '{current_page} / {max_page}',
current_page : currentPage,
max_page : maxPage,
paged: function(page) {
// do something with the page variable
/* var projectName=$("#projectName").val();
console.log(projectName+"a12312");*/
var jsonReq = {"bgPage" : page, "pageSize" : 10, "projectName" : projectName};
queryExecuteProcessList(jsonReq);
}
});
}
function queryExecuteProcessList(jsonReq){
$.ajax({
type : 'POST',
url : '/admin/executeprocess/queryExecuteProcessList',
data : JSON.stringify(jsonReq),
dataType : 'json',
contentType : "application/json",
success : function(data) {
if ('000000' == data.resultCode) {
//渲染表格
renderTable(data);
} else {
EPU.util.layerDialog(data.resultCode,
data.resultMsg);
}
}
});
}
//分页函数
$('.pagination').jqPagination({
/*page_string : '{current_page} / {max_page}',
paged: function(page) {
// do something with the page variable
var projectName=$("#projectName").value;
console.log(projectName+"12312");
var jsonReq = {"bgPage" : page, "pageSize" : 10};
queryExecuteProcessList(jsonReq);
}*/
});
// executeprocess
$('#add').click(function() {
window.location.href = '/admin/executeprocess/addExecuteProcess';
});
$('#search').click(
function() {
/*var projectName=$("#projectName").val();
console.log(projectName+"a12312");*/
var jsonData = $('#formId').serializeObject();
queryExecuteProcessList(jsonData);
// stop the form from submitting and refreshing
event.preventDefault();
});
function initTable(){
var jsonReq = {"bgPage" : 1, "pageSize" : 10};
queryExecuteProcessList(jsonReq);
}
function init(){
initTable();
}
init();
});
function renderTable(jsonRes){
var productList = jsonRes.pageList;
var tbodyArray = [];
$('#listBody').html('');
if(null != productList && productList){
$.each(productList, function (index, item) {
tbodyArray.push('<tr>');
tbodyArray.push('<td>' + item.merchantName + '</td>');
tbodyArray.push('<td>' + item.merchantProName + '</td>');
tbodyArray.push('<td>' + item.projectName + '</td>');
tbodyArray.push('<td>' + item.pafProName + '</td>');
tbodyArray.push("<td><a href='" + "/admin/executeprocess/updateExecuteProcess/" + item.exeProcessId + "'>编辑</a></td>");
tbodyArray.push('</tr>');
});
$('#listBody').append(tbodyArray.join(''));
}
var totalpage=jsonRes.totalPage;
// 渲染分页插件
renderPage(jsonRes.currentPage, totalpage);
}
function renderPage(currentPage, maxPage){
$('.pagination').jqPagination('destroy');
$('.pagination').jqPagination({
page_string : '{current_page} / {max_page}',
current_page : currentPage,
max_page : maxPage,
paged: function(page) {
// do something with the page variable
/* var projectName=$("#projectName").val();
console.log(projectName+"a12312");*/
var jsonReq = {"bgPage" : page, "pageSize" : 10, "projectName" : projectName};
queryExecuteProcessList(jsonReq);
}
});
}
function queryExecuteProcessList(jsonReq){
$.ajax({
type : 'POST',
url : '/admin/executeprocess/queryExecuteProcessList',
data : JSON.stringify(jsonReq),
dataType : 'json',
contentType : "application/json",
success : function(data) {
if ('000000' == data.resultCode) {
//渲染表格
renderTable(data);
} else {
EPU.util.layerDialog(data.resultCode,
data.resultMsg);
}
}
});
}
//分页函数
$('.pagination').jqPagination({
/*page_string : '{current_page} / {max_page}',
paged: function(page) {
// do something with the page variable
var projectName=$("#projectName").value;
console.log(projectName+"12312");
var jsonReq = {"bgPage" : page, "pageSize" : 10};
queryExecuteProcessList(jsonReq);
}*/
});
// executeprocess
$('#add').click(function() {
window.location.href = '/admin/executeprocess/addExecuteProcess';
});
$('#search').click(
function() {
/*var projectName=$("#projectName").val();
console.log(projectName+"a12312");*/
var jsonData = $('#formId').serializeObject();
queryExecuteProcessList(jsonData);
// stop the form from submitting and refreshing
event.preventDefault();
});
function initTable(){
var jsonReq = {"bgPage" : 1, "pageSize" : 10};
queryExecuteProcessList(jsonReq);
}
function init(){
initTable();
}
init();
});