IntelligentRecognition/ah-jjsp-web/.svn/pristine/94/94623b1315d442539fcad5ac2aa...

297 lines
9.4 KiB
Plaintext
Raw Permalink 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, laypage;
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为
layui.use(['form', 'layer', 'table', 'laypage'], function () {
form = layui.form;
table = layui.table;
laypage = layui.laypage;
layer = layui.layer;
layui.form.render();
pages(1, 10, 1);
})
function reloadData() {
pages(1, limitSize);
}
function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize, typeNum);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + "proteam/pot/tysj/getSjNumList?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) {
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) {
table.render({
elem: "#table",
id: "table",
height: "full-180",
data: dataList,
limit: limit,
cols: [
[
//表头
{
title: "序号", width: 100, unresize: true, align: "center", templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{
field: "org",
title: "省公司",
unresize: true,
width: 120,
align: "center",
},
{
field: "proName",
title: "输变电工程名称",
unresize: true,
width: 200,
align: "center",
},
{
field: "signName",
title: "单项工程名称",
unresize: true,
width: 200,
align: "center",
},
{
field: "voltage",
title: "输变电工程电压等级(kV)",
unresize: true,
width: 200,
align: "center",
},
{
field: "proType",
title: "工程类型",
unresize: true,
width: 200,
align: "center",
},
{
field: "sjUnit",
title: "设计单位",
unresize: true,
width: 200,
align: "center",
},
{
field: "psUnit",
title: "评审单位",
unresize: true,
width: 200,
align: "center",
},
{
field: "psYjTime",
title: "评审意见印发时间",
unresize: true,
width: 200,
align: "center",
},
{
field: "isSjzlQ",
title: "是否发生设计质量问题",
unresize: true,
width: 200,
align: "center",
},
{
field: "isQ",
title: "是否问题库内问题",
unresize: true,
width: 200,
align: "center",
},
{
field: "sjzlQName",
title: "设计质量问题名称",
unresize: true,
width: 200,
align: "center",
},
{
field: "wtkNum",
title: "问题库编号",
unresize: true,
width: 200,
align: "center",
},
{
field: "wtType",
title: "问题类别",
unresize: true,
width: 200,
align: "center",
},
{
field: "wtXz",
title: "问题性质",
unresize: true,
width: 200,
align: "center",
},
{
field: "sjjd",
title: "设计阶段",
unresize: true,
width: 200,
align: "center",
},
{
field: "sszy",
title: "所属专业",
unresize: true,
width: 200,
align: "center",
},
{
field: "sfzg",
title: "是否整改",
unresize: true,
width: 200,
align: "center",
},
{
field: "wtjs",
title: "问题简述",
unresize: true,
width: 200,
align: "center",
templet: function (d) {
if (d.wtjs) {
if (d.wtjs.length > 60) {
return '<span title="' + d.wtjs + '">' + d.wtjs.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.wtjs + '">' + d.wtjs + '</span>'
}
} else {
return '';
}
}
},
{
title: "问题分析",
unresize: true,
width: 200,
align: "center",
templet: function (d) {
if (d.wtfx) {
if (d.wtfx.length > 60) {
return '<span title="' + d.wtfx + '">' + d.wtfx.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.wtfx + '">' + d.wtfx + '</span>'
}
} else {
return '';
}
}
},
{
field: "jycqcs",
title: "建议采取措施",
unresize: true,
width: 200,
align: "center",
templet: function (d) {
if (d.jycqcs) {
if (d.jycqcs.length > 60) {
return '<span title="' + d.jycqcs + '">' + d.jycqcs.substring(0, 60) + '...</span>'
} else {
return '<span title="' + d.jycqcs + '">' + d.jycqcs + '</span>'
}
} else {
return '';
}
}
}
],
],
done: function (res, curr, count) {
table.resize("table");
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");
},
});
}
// 获取参数
function getReqParams(page, limit, type) {
let obj = {};
if (!type) {
obj = {
page: page + "",
limit: limit + "",
keyWord: $('#keyWord').val(),
isSjzlQ: $('#isSjzlQ').val()
};
} else {
obj = {
page: '1',
limit: '10',
keyWord: '',
isSjzlQ: '是'
};
}
return obj;
}
// 查询
function query(type) {
let pattern = new RegExp("[%_<>]");
if (pattern.test($("#keyWord").val())) {
$("#keyWord").val('');
return layer.msg('关键字查询包含特殊字符,请重新输入', {
icon: 2,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
pages(1, limitSize)
}
// 关闭页面
function closePage(type) {
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index); //再执行关闭
}