210 lines
6.7 KiB
JavaScript
210 lines
6.7 KiB
JavaScript
let form, table, laydate;
|
||
let tableIns;
|
||
let pageNum = 1; // 定义分页
|
||
layui.use(["form", "table", 'laydate'], function () {
|
||
form = layui.form;
|
||
table = layui.table;
|
||
laydate = layui.laydate;
|
||
laydate.render({
|
||
elem: '#ID-laydate-rangeLinked',
|
||
range: ['#startDay', '#endDay'],
|
||
rangeLinked: true
|
||
});
|
||
initTable();
|
||
});
|
||
|
||
// 查询/重置
|
||
function queryTable(type) {
|
||
if (type === 1) {
|
||
reloadTable(1);
|
||
} else if (type === 2) {
|
||
$('#keyWord').val('');
|
||
$('#startDate').val('');
|
||
$('#endDate').val('');
|
||
layui.form.render();
|
||
reloadTable(1);
|
||
}
|
||
}
|
||
|
||
// 刷新页面数据
|
||
function reloadData() {
|
||
reloadData(pageNum);
|
||
}
|
||
|
||
// 重载表格
|
||
function reloadTable(pageNum) {
|
||
table.reload("currentTableId", {
|
||
page: {
|
||
curr: pageNum ? pageNum : 1,
|
||
},
|
||
where: {
|
||
encryptedData: JSON.stringify({
|
||
'keyWord': $('#keyWord').val(),
|
||
'startDate': $('#startDate').val(),
|
||
'endDate': $('#endDate').val()
|
||
}),
|
||
},
|
||
},
|
||
);
|
||
}
|
||
|
||
// 初始化表格
|
||
function initTable() {
|
||
tableIns = table.render({
|
||
elem: "#currentTableId",
|
||
id: 'currentTableId',
|
||
headers: {
|
||
authorization: sessionStorage.getItem("gz-token"),
|
||
},
|
||
height: "full-170",
|
||
url: dataUrl + "backstage/partInput/findByPage",
|
||
where: {
|
||
encryptedData: JSON.stringify({
|
||
'keyWord': $('#keyWord').val(),
|
||
'startDate': $('#startDate').val(),
|
||
'endDate': $('#endDate').val()
|
||
}),
|
||
},
|
||
request: {
|
||
pageName: 'pageNum',
|
||
limitName: 'pageSize'
|
||
},
|
||
parseData: function (res) { // res 即为原始返回的数据
|
||
return {
|
||
"code": 0, // 解析接口状态
|
||
"msg": '获取成功', // 解析提示文本
|
||
"count": res.total, // 解析数据长度
|
||
"data": res.list // 解析数据列表
|
||
};
|
||
},
|
||
cols: [
|
||
[
|
||
{
|
||
width: '6.9%',
|
||
title: "序号",
|
||
align: "center",
|
||
templet: function (d) {
|
||
return d.LAY_NUM;
|
||
},
|
||
},
|
||
{
|
||
field: "code",
|
||
width: '15%',
|
||
title: "工程名称",
|
||
unresize: true,
|
||
align: "center",
|
||
},
|
||
{
|
||
field: "inputUser",
|
||
width: '8%',
|
||
title: "工程状态",
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return setProStatus('1');
|
||
},
|
||
},
|
||
{
|
||
field: "inputNum",
|
||
width: '10%',
|
||
title: "维修单数量",
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<span style="color:#ff9900;font-weight:bold;">1</span>';
|
||
},
|
||
},
|
||
{
|
||
field: "allPrice",
|
||
width: '10%',
|
||
title: "配件领料单数量",
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<span style="color:#409eff;font-weight:bold;">1</span>';
|
||
},
|
||
},
|
||
{
|
||
field: "allPrice",
|
||
width: '10%',
|
||
title: "配件退回单数量",
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<span style="color:#f56c6c;font-weight:bold;">1</span>';
|
||
},
|
||
},
|
||
{
|
||
field: "remark",
|
||
width: '15%',
|
||
title: "领用/使用/退回配件数量",
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<p style="color:#409eff;">领:2,563 </p>';
|
||
// return '<p style="color:#409eff;">领:2,563 </p><p style="color:#19be6b;">用:2,000 </p><p style="color:#f56c6c;">退:563</p>';
|
||
},
|
||
|
||
},
|
||
{
|
||
field: "remark",
|
||
width: '15%',
|
||
title: "领用/使用/退回配件金额",
|
||
unresize: true,
|
||
align: "center",
|
||
templet: function (d) {
|
||
return '<p style="color:#409eff;">领:2,563 </p>';
|
||
// return '<p style="color:#409eff;">领:2,563 </p><p style="color:#19be6b;">用:2,000 </p><p style="color:#f56c6c;">退:563</p>';
|
||
},
|
||
},
|
||
{
|
||
title: "操作",
|
||
width: '10%',
|
||
align: "center",
|
||
unresize: true,
|
||
templet: function (d) {
|
||
let html = "";
|
||
html += "<a onclick='proCountDetail(" + JSON.stringify(d) + ")'>详情</a>";
|
||
return html;
|
||
},
|
||
},
|
||
],
|
||
],
|
||
limits: [10, 15, 20, 25, 50, 100],
|
||
limit: 10,
|
||
page: true,
|
||
done: function (res, curr, count) {
|
||
pageNum = tableIns.config.page.curr;
|
||
table.resize("currentTableId");
|
||
},
|
||
});
|
||
}
|
||
|
||
// 导出
|
||
function exportExcel() {
|
||
let params = {
|
||
'proName': $('#proName').val(),
|
||
'status': $('#status').val()
|
||
}
|
||
let url = dataUrl + "backstage/export/exportFhList";
|
||
exportExcelUtil(url, '配件入库数据', JSON.stringify(params));
|
||
}
|
||
|
||
// 配件退料详情
|
||
function proCountDetail(obj) {
|
||
openIframeByParamObj("pro_count_detail", "详情", "./child/pro_count_detail.html", "92%", "95%", obj);
|
||
}
|
||
|
||
// 工程状态
|
||
function setProStatus(status) {
|
||
if (status === '1') {
|
||
return "<span style='color:#19BE6B;margin:0 5px 0 5px;font-size:16px'>●</span>在建";
|
||
} else if (status === '2') {
|
||
return "<span style='color:#999;margin:0 5px 0 5px;font-size:16px;'>●</span>完工";
|
||
}
|
||
}
|
||
|
||
// 查询流程
|
||
function showProcess(){
|
||
openIframeByParamObj("show_process", "流程说明", "./child/show_process.html", "70%", "65%", null);
|
||
} |