This commit is contained in:
cwchen 2025-01-17 10:48:00 +08:00
parent a07924f2e3
commit 13a347a461
3 changed files with 229 additions and 224 deletions

View File

@ -139,7 +139,7 @@ function submitApply(data) {
supId: item.supId, supId: item.supId,
proId: item.proId, proId: item.proId,
money: item.cost, money: item.cost,
outId: item.carOutId outId: item.outId
}; };
detailsList.push(obj); detailsList.push(obj);
}) })

View File

@ -1,235 +1,240 @@
initTable(); initTable();
// 查询/重置 // 查询/重置
function queryTable(type) { function queryTable(type) {
if (type === 1) { if (type === 1) {
let proName = $('#proName').val(); let proName = $('#proName').val();
let flag = checkValue(proName); let flag = checkValue(proName);
if (flag) { if (flag) {
$('#proName').val('');
return layer.msg('工程名称查询包含特殊字符,请重新输入', { icon: 2 });
}
reloadTable(1);
} else if (type === 2) {
$('#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) {
$('#proName').val('');
layui.form.render();
reloadTable(1);
} }
}
// 重载表格
function reloadTable(pageNum) { // 获取筛选条件
table.reload("currentTableId", { function getFilterParams() {
page: { let filterParams = {};
curr: pageNum ? pageNum : 1, $('#delDemo .tag-item').each(function () {
}, let layId = $(this).attr('lay-id');
where: { let strArr = layId.split('-');
encryptedData: JSON.stringify({ if (strArr[0] === 'company') {
'proName': $('#proName').val(), let name = replaceChinese($(this).html());
'planStatus': $('#planStatus').val() filterParams.companyName = name;
}), } else if (strArr[0] === 'dispatch') {
}, filterParams.dispatchStatus = strArr[1];
} else if (strArr[0] === 'year') {
filterParams.year = strArr[1];
} else if (strArr[0] === 'month') {
filterParams.month = strArr[1];
}
})
filterParams.proName = $('#proName').val();
return filterParams;
}
// 刷新页面数据
function reloadData() {
reloadTable(1);
}
// 重载表格
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();
}, console.error(params);
height: "full-400",
url: dataUrl + "backstage/dispatchCar/getProStatisticsList", tableIns = table.render({
where: { elem: "#currentTableId",
encryptedData: JSON.stringify({ id: 'currentTableId',
'proName': $('#proName').val(), headers: {
'planStatus': $('#planStatus').val() authorization: sessionStorage.getItem("gz-token"),
}), },
}, height: "full-400",
request: { url: dataUrl + "backstage/homeIndex/getProDetails",
pageName: 'pageNum', where: {
limitName: 'pageSize' encryptedData: JSON.stringify(params),
}, },
parseData: function (res) { // res 即为原始返回的数据 request: {
if (res.code === 401) { pageName: 'pageNum',
closeWindowOpen(); limitName: 'pageSize'
} },
return { parseData: function (res) { // res 即为原始返回的数据
"code": 0, // 解析接口状态 if (res.code === 401) {
"msg": '获取成功', // 解析提示文本 closeWindowOpen();
"count": res.total, // 解析数据长度 }
"data": res.list // 解析数据列表 return {
}; "code": 0, // 解析接口状态
}, "msg": '获取成功', // 解析提示文本
cols: [ "count": res.total, // 解析数据长度
[ "data": res.list // 解析数据列表
{ };
width: '5%', },
title: "序号", cols: [
align: "center", [
templet: function (d) { {
return d.LAY_NUM; width: '5%',
}, title: "序号",
align: "center",
templet: function (d) {
return d.LAY_NUM;
}, },
{ },
field: "proName", {
width: '11%', field: "proName",
title: "工程名称", width: '11%',
unresize: true, title: "工程名称",
align: "center", unresize: true,
align: "center",
},
{
field: "planNum",
width: '6%',
title: "计划数",
unresize: true,
align: "center",
},
{
field: "dispatchPlanNum",
width: '9%',
title: "已派车计划",
unresize: true,
align: "center",
},
{
field: "noDispatchPlanNum",
width: '9%',
title: "待派车计划",
unresize: true,
align: "center",
},
{
field: "dispatchStatus",
title: "派车状态",
width: '8%',
unresize: true,
align: "center",
templet: function (d) {
return setStatusColor(d.dispatchStatus);
}, },
{ },
field: "planNum", {
width: '6%', field: "shouldDispatchNum",
title: "计划数", width: '10%',
unresize: true, title: "应派车数量",
align: "center", unresize: true,
templet: function (d) { align: "center",
return '<span style="color:#409Eff;font-weight:bold;">' + d.planNum + '</span>'; },
}, {
}, field: "dispatchNum",
{ width: '11.9%',
field: "ypcNum", title: "已派车数量",
width: '9%', unresize: true,
title: "已派车计划", align: "center",
unresize: true, },
align: "center", {
templet: function (d) { field: "noDispatchNum",
return '<span style="color:#19be6b;font-weight:bold;">' + d.ypcNum + '</span>'; title: "待派车数量",
}, width: '10%',
}, unresize: true,
{ align: "center",
field: "dpcNum", },
width: '9%', {
title: "待派车计划", field: "money",
unresize: true, title: "已派车金额",
align: "center", width: '10%',
templet: function (d) { unresize: true,
return '<span style="color:#ff9900;font-weight:bold;">' + d.dpcNum + '</span>'; align: "center",
}, },
}, {
{ field: "companyName",
field: "planStatus", title: "所属分公司",
title: "派车状态", width: '10%',
width: '8%', unresize: true,
unresize: true, align: "center",
align: "center", },
templet: function (d) {
return setStatusColor(d.planStatus);
},
},
{
field: "lastDay",
width: '10%',
title: "应派车数量",
unresize: true,
align: "center",
},
{
field: "progress",
width: '11.9%',
title: "已派车数量",
unresize: true,
align: "center",
},
{
field: "needNum",
title: "待派车数量",
width: '10%',
unresize: true,
align: "center",
},
{
field: "dispatchNum",
title: "已派车金额",
width: '10%',
unresize: true,
align: "center",
},
{
field: "noDispatchNum",
title: "所属分公司",
width: '10%',
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 setNumColor(value) {
return '<span style="color:#409Eff;font-weight:bold;">' + value + "</span>";
}
// 发货状态颜色
function setStatusColor(value) {
let color = "#409Eff";
let name = ''
if (value === '2') {
color = "#f56c6c";
name = '未派车';
} else if (value === '1') {
color = "#ff9900";
name = '部分派车'
} else if (value === '3') {
color = "#19be6b";
name = '全部派车'
} }
return '<span style="color:' + color + '"> ● ' + name + "</span>";
// 数量颜色 }
function setNumColor(value) {
return '<span style="color:#409Eff;font-weight:bold;">' + value + "</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 (
function setStatusColor(value) { '<div class="layui-progress layui-progress-big" lay-showpercent="true" id="' + d.filter + '" lay-filter="progress' + d.filter + '">' +
let color = "#409Eff"; '<div class="layui-progress-bar ' + color + '" lay-percent="' + d.progress + '%">' +
let name = '' "</div></div>"
if (value === '未派车') { );
color = "#f56c6c"; }
name = '未派车';
} else if (value === '部分派车') { // 导出
color = "#ff9900"; function exportExcel() {
name = '部分派车' let params = getFilterParams();
} else if (value === '全部派车') { let url = dataUrl + "backstage/homeIndex/exportProDetails";
color = "#19be6b"; exportExcelUtil(url, '工程详情', JSON.stringify(params));
name = '全部派车' }
}
return '<span style="color:' + color + '">' + name + "</span>"; // 工程详情
} function dispatchCarProDetail(obj) {
openIframeByParamObj("dispatchCarProDetail", "工程详情", "./child/dispatch_car_pro_detail.html", "92%", "95%", obj, 1);
// 设置进度值 }
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

@ -23,7 +23,7 @@ function loadCompanyData() {
// 派车状态 // 派车状态
function loadDispatchStatusData() { function loadDispatchStatusData() {
const list = [{ id: 'dispatch-1', labelName: '全部' }, { id: 'dispatch-2', labelName: '部分派车' }, { id: 'dispatch-3', labelName: '未派车' }, { id: 'dispatch-4', labelName: '已派车' }]; const list = [{ id: 'dispatch-0', labelName: '全部' }, { id: 'dispatch-1', labelName: '部分派车' }, { id: 'dispatch-2', labelName: '未派车' }, { id: 'dispatch-3', labelName: '全部派车' }];
setTagData(list, 'demo2'); setTagData(list, 'demo2');
} }