IntelligentRecognition/ah-jjsp-web/.svn/pristine/b7/b717f02f750735ed0dc025d2349...

110 lines
3.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let form, layer, table, tableIns;
let pageNum = 1, limitSize = 10; // 默认第一页分页数量为10
let id;
function setParams(obj) {
id=obj;
layui.use(['form','layer', 'table'], function () {
form = layui.form;
layer = layui.layer;
table = layui.table;
pages(1, 10, 1);
})
}
function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize, typeNum);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + "proteam/pot/proInfo/getProEditHistoryList?token=" + token,
data: params,
type: 'POST',
async: false,
success: function (result) {
if (result.code === 200) {
if (result.data) {
initTable(result.data, result.limit, result.curr)
laypages(result.count, result.curr, result.limit)
}
} else if (result.code === 500) {
layer.alert(result.msg, {icon: 2})
} else if (result.code === 401) {
logout(1);
}
}, error: function () {
}
});
}
function laypages(total, page, limit) {
layui.use(['laypage'], function () {
let laypage = layui.laypage;
laypage.render({
elem: 'voi-page',
count: total,
curr: page,
limit: limit,
limits: [10,20,50,100,200,500],
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
groups: 5,
jump: function (obj, first) {
if (!first) {
pageNum = obj.curr, limitSize = obj.limit;
pages(obj.curr, obj.limit, null);
}
}
});
})
}
/*初始化表格*/
function initTable(dataList, limit, page) {
tableIns = table.render({
elem: "#proEditHistory",
id: "proEditHistory",
height: "full-100",
data: dataList,
limit: limit,
cols: [
[
//表头
{title: "序号", width: '10%', unresize: true, align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{field: "proName", title: "工程名称", width: '30%', unresize: true, align: "center", sort:false},
{field: "updateUser", title: "修改人", width: '30%', unresize: true, align: "center", sort:false},
{field: "updateTime", title: "修改时间", width: '30%', unresize: true, align: "center", sort:false},
],
],
done: function (res, curr, count) {
table.resize("proEditHistory");
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
$(".layui-laypage-skip").css("display", "none");
},
});
}
// 获取参数
function getReqParams(page, limit, type) {
let obj = {};
if (!type) {
obj = {
page: page + "",
limit: limit + "",
id:id
};
} else {
obj = {
page: '1',
limit: '10',
id:id
};
}
return obj;
}