This commit is contained in:
cwchen 2025-01-17 14:24:54 +08:00
parent 75f607d239
commit e3ec5e643f
4 changed files with 237 additions and 226 deletions

View File

@ -1,235 +1,247 @@
initTable(); initTable();
// 查询/重置 // 查询/重置
function queryTable(type) { function queryTable(type) {
if (type === 1) { if (type === 1) {
let proName = $('#proName').val(); let code = $('#code').val();
let flag = checkValue(proName); let flag = checkValue(code);
if (flag) { if (flag) {
$('#proName').val(''); $('#code').val('');
return layer.msg('工程名称查询包含特殊字符,请重新输入', { icon: 2 }); return layer.msg('计划编号查询包含特殊字符,请重新输入', { icon: 2 });
} }
reloadTable(1); let name = $('#name').val();
} else if (type === 2) { let flag2 = checkValue(name);
if (flag2) {
$('#name').val('');
return layer.msg('名称查询包含特殊字符,请重新输入', { icon: 2 });
}
let model = $('#model').val();
let flag3 = checkValue(model);
if (flag3) {
$('#model').val('');
return layer.msg('规格查询包含特殊字符,请重新输入', { icon: 2 });
}
let supName = $('#supName').val();
let flag4 = checkValue(supName);
if (flag4) {
$('#supName').val('');
return layer.msg('供应商查询包含特殊字符,请重新输入', { icon: 2 });
}
let proName = $('#proName').val();
let flag5 = checkValue(proName);
if (flag5) {
$('#proName').val(''); $('#proName').val('');
$('#planStatus').val(''); return layer.msg('工程名称查询包含特殊字符,请重新输入', { icon: 2 });
layui.form.render();
reloadTable(1);
} }
}
// 刷新页面数据
function reloadData() {
reloadTable(1); reloadTable(1);
getProStatisticsDetails(); } else if (type === 2) {
$('#code').val('');
$('#name').val('');
$('#model').val('');
$('#supName').val('');
$('#proName').val('');
layui.form.render();
reloadTable(1);
} }
}
// 重载表格
function reloadTable(pageNum) { // 刷新页面数据
table.reload("currentTableId", { function reloadData() {
page: { reloadTable(1);
curr: pageNum ? pageNum : 1, }
},
where: { // 获取筛选条件
encryptedData: JSON.stringify({ function getFilterParams() {
'proName': $('#proName').val(), let filterParams = {};
'planStatus': $('#planStatus').val() $('#delDemo .tag-item').each(function () {
}), let layId = $(this).attr('lay-id');
}, let strArr = layId.split('-');
if (strArr[0] === 'type') {
filterParams.type = strArr[1];
} else if (strArr[0] === 'year') {
filterParams.year = strArr[1];
} else if (strArr[0] === 'month') {
filterParams.month = strArr[1];
} else if (strArr[0] === 'pay') {
filterParams.payStatus = strArr[1];
}
})
filterParams.code = $('#code').val();
filterParams.name = $('#name').val();
filterParams.model = $('#model').val();
filterParams.supName = $('#supName').val();
filterParams.proName = $('#proName').val();
return filterParams;
}
// 重载表格
function reloadTable(pageNum) {
let params = getFilterParams();
table.reload("currentTableId", {
page: {
curr: pageNum ? pageNum : 1,
}, },
); where: {
} encryptedData: JSON.stringify(params),
},
// 初始化表格 },
function initTable() { );
tableIns = table.render({ }
elem: "#currentTableId",
id: 'currentTableId', // 初始化表格
headers: { function initTable() {
authorization: sessionStorage.getItem("gz-token"), let params = getFilterParams();
}, tableIns = table.render({
height: "full-360", elem: "#currentTableId",
url: dataUrl + "backstage/dispatchCar/getProStatisticsList", id: 'currentTableId',
where: { headers: {
encryptedData: JSON.stringify({ authorization: sessionStorage.getItem("gz-token"),
'proName': $('#proName').val(), },
'planStatus': $('#planStatus').val() height: "full-370",
}), url: dataUrl + "backstage/dispatchCar/getProStatisticsList",
}, where: {
request: { encryptedData: JSON.stringify(params),
pageName: 'pageNum', },
limitName: 'pageSize' request: {
}, pageName: 'pageNum',
parseData: function (res) { // res 即为原始返回的数据 limitName: 'pageSize'
if (res.code === 401) { },
closeWindowOpen(); parseData: function (res) { // res 即为原始返回的数据
} if (res.code === 401) {
return { closeWindowOpen();
"code": 0, // 解析接口状态 }
"msg": '获取成功', // 解析提示文本 return {
"count": res.total, // 解析数据长度 "code": 0, // 解析接口状态
"data": res.list // 解析数据列表 "msg": '获取成功', // 解析提示文本
}; "count": res.total, // 解析数据长度
}, "data": res.list // 解析数据列表
cols: [ };
[ },
{ cols: [
width: '5%', [
title: "序号", {
align: "center", width: '5%',
templet: function (d) { title: "序号",
return d.LAY_NUM; align: "center",
}, templet: function (d) {
return d.LAY_NUM;
}, },
{ },
field: "proName", {
width: '8.9%', field: "name",
title: "名称", width: '8.9%',
unresize: true, title: "名称",
align: "center", unresize: true,
align: "center",
},
{
field: "model",
width: '8%',
title: "规格",
unresize: true,
align: "center"
},
{
field: "unit",
width: '8%',
title: "单位",
unresize: true,
align: "center",
},
{
field: "remark",
width: '20%',
title: "说明(根据车辆/吊车自动生成)",
unresize: true,
align: "center",
},
{
field: "money",
title: "金额",
width: '8%',
unresize: true,
align: "center",
templet: function (d) {
return '<span>¥ ' + d.money + '</span>'
}, },
{ },
field: "planNum", {
width: '8%', field: "payStatus",
title: "规格", width: '8%',
unresize: true, title: "付款状态",
align: "center", unresize: true,
templet: function (d) { align: "center",
return '<span style="color:#409Eff;font-weight:bold;">' + d.planNum + '</span>'; },
}, {
field: "code",
width: '10%',
title: "需求计划编号",
unresize: true,
align: "center",
templet: function (d) {
let html = "";
html += "<a onclick='openPlanDetail(" + JSON.stringify(d) + ")'>" + d.code + "</a>";
return html;
}, },
{ },
field: "ypcNum", {
width: '8%', field: "proName",
title: "单位", title: "工程名称",
unresize: true, width: '8%',
align: "center", unresize: true,
templet: function (d) { align: "center",
return '<span style="color:#19be6b;font-weight:bold;">' + d.ypcNum + '</span>'; },
}, {
}, field: "supName",
{ title: "供应商",
field: "dpcNum", width: '8%',
width: '20%', unresize: true,
title: "说明(根据车辆/吊车自动生成)", align: "center",
unresize: true, },
align: "center", {
templet: function (d) { field: "dispatchDay",
return '<span style="color:#ff9900;font-weight:bold;">' + d.dpcNum + '</span>'; title: "派车日期",
}, width: '8%',
}, unresize: true,
{ align: "center",
field: "planStatus", },
title: "金额",
width: '8%',
unresize: true,
align: "center",
templet: function (d) {
return setStatusColor(d.planStatus);
},
},
{
field: "lastDay",
width: '8%',
title: "付款状态",
unresize: true,
align: "center",
},
{
field: "progress",
width: '10%',
title: "需求计划编号",
unresize: true,
align: "center",
},
{
field: "needNum",
title: "工程名称",
width: '8%',
unresize: true,
align: "center",
},
{
field: "dispatchNum",
title: "供应商",
width: '8%',
unresize: true,
align: "center",
},
{
field: "noDispatchNum",
title: "派车日期",
width: '8%',
unresize: true,
align: "center",
},
],
], ],
limits: [10, 15, 20, 25, 50, 100], ],
limit: 10, limits: [10, 15, 20, 25, 50, 100],
page: true, limit: 10,
done: function (res, curr, count) { page: true,
pageNum = tableIns.config.page.curr; done: function (res, curr, count) {
element.render(); pageNum = tableIns.config.page.curr;
table.resize("currentTableId"); element.render();
}, table.resize("currentTableId");
}); },
});
}
// 发货状态颜色
function setStatusColor(value) {
let color = "#409Eff";
let name = ''
if (value === '未派车') {
color = "#f56c6c";
name = '未派车';
} else if (value === '部分派车') {
color = "#ff9900";
name = '部分派车'
} else if (value === '全部派车') {
color = "#19be6b";
name = '全部派车'
} }
return '<span style="color:' + color + '">' + name + "</span>";
// 数量颜色 }
function setNumColor(value) {
return '<span style="color:#409Eff;font-weight:bold;">' + value + "</span>"; // 导出
} function exportExcel() {
let params = getFilterParams();
// 发货状态颜色 let url = dataUrl + "backstage/homeIndex/exportDispatchDetails";
function setStatusColor(value) { exportExcelUtil(url, '派车详情', JSON.stringify(params));
let color = "#409Eff"; }
let name = ''
if (value === '未派车') { // 工程详情
color = "#f56c6c"; function dispatchCarProDetail(obj) {
name = '未派车'; openIframeByParamObj("dispatchCarProDetail", "工程详情", "./child/dispatch_car_pro_detail.html", "92%", "95%", obj, 1);
} else if (value === '部分派车') { }
color = "#ff9900";
name = '部分派车'
} else if (value === '全部派车') {
color = "#19be6b";
name = '全部派车'
}
return '<span style="color:' + color + '">' + name + "</span>";
}
// 设置进度值
function schedule(d) {
d.progress = d.process;
d.progress = parseFloat(d.progress ? d.progress : 0);
d.filter == undefined ? (d.filter = d.LAY_NUM) : d.filter;
d.progress == undefined ? (d.progress = 100) : d.progress;
var color = "layui-bg-orange";
if (d.progress < 100) {
color = "layui-bg-orange";
} else if (d.progress === 100) {
color = "layui-bg-primary";
} else if (d.progress > 100) {
color = "layui-bg-blue";
}
//设置页面进度条
return (
'<div class="layui-progress layui-progress-big" lay-showpercent="true" id="' + d.filter + '" lay-filter="progress' + d.filter + '">' +
'<div class="layui-progress-bar ' + color + '" lay-percent="' + d.progress + '%">' +
"</div></div>"
);
}
// 导出
function exportExcel() {
let params = {
'proName': $('#proName').val(),
'planStatus': $('#planStatus').val()
}
let url = dataUrl + "backstage/dispatchCar/export";
exportExcelUtil(url, '派车管理', JSON.stringify(params));
}
// 工程详情
function dispatchCarProDetail(obj) {
openIframeByParamObj("dispatchCarProDetail", "工程详情", "./child/dispatch_car_pro_detail.html", "92%", "95%", obj, 1);
}

View File

@ -33,7 +33,6 @@ function queryTable(type) {
// 刷新页面数据 // 刷新页面数据
function reloadData() { function reloadData() {
reloadTable(1); reloadTable(1);
getProStatisticsDetails();
} }
// 获取筛选条件 // 获取筛选条件

View File

@ -345,7 +345,7 @@ function setSearch(type) {
"</div>" + "</div>" +
"<div class='layui-inline'>" + "<div class='layui-inline'>" +
"<div class='layui-input-inline' style='width: 200px;'>" + "<div class='layui-input-inline' style='width: 200px;'>" +
"<input type='text' name='name' id='name' autocomplete='off' class='layui-input' lay-affix='clear' placeholder='输入物品名称' maxlength='30'>" + "<input type='text' name='name' id='name' autocomplete='off' class='layui-input' lay-affix='clear' placeholder='输入名称' maxlength='30'>" +
"</div>" + "</div>" +
"</div>" + "</div>" +
"<div class='layui-inline'>" + "<div class='layui-inline'>" +
@ -355,7 +355,7 @@ function setSearch(type) {
"</div>" + "</div>" +
"<div class='layui-inline'>" + "<div class='layui-inline'>" +
"<div class='layui-input-inline' style='width: 200px;'>" + "<div class='layui-input-inline' style='width: 200px;'>" +
"<input type='text' name='supName' id='supName' autocomplete='off' class='layui-input' lay-affix='clear' placeholder='输入厂家名称' maxlength='30'>" + "<input type='text' name='supName' id='supName' autocomplete='off' class='layui-input' lay-affix='clear' placeholder='输入供应商' maxlength='30'>" +
"</div>" + "</div>" +
"</div>" + "</div>" +
"<div class='layui-inline'>" + "<div class='layui-inline'>" +

View File

@ -55,7 +55,7 @@
<div class="layui-inline"> <div class="layui-inline">
<div class="layui-input-inline" style="width: 200px;"> <div class="layui-input-inline" style="width: 200px;">
<select class="layui-select" id="status"> <select class="layui-select" id="status">
<option value="">请选择</option> <option value="">请选择状态</option>
<option value="0">生效</option> <option value="0">生效</option>
<option value="1">失效</option> <option value="1">失效</option>
</select> </select>