This commit is contained in:
cwchen 2024-11-09 21:08:52 +08:00
parent c828c1a0d2
commit 3f711a262f
5 changed files with 459 additions and 46 deletions

View File

@ -32,6 +32,7 @@
.common-style {
width: 100%;
justify-content: space-between;
cursor: pointer;
}
.num-style {

View File

@ -0,0 +1,301 @@
let form, table, element, tableIns;
let typeParam;
let pageNum = 1;
function setParams(type) {
typeParam = type;
layui.use(["form", "table", 'element'], function () {
form = layui.form;
table = layui.table;
element = layui.element;
// tab 切换事件
element.on('tab(demo-filter-tab)', function (data) {
let value = $(this).attr('value');
typeParam = value;
// table.destroy('currentTableId');
table.destroy(document.getElementById('currentTableId'));
initTable(typeParam);
});
$('.layui-tab-title li').eq(typeParam - 1).addClass('layui-this');
initTable(typeParam);
});
}
// 查询/重置
function queryTable(type) {
if (type === 1) {
reloadTable(1);
} else if (type === 2) {
$('#name').val('');
$('#module').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({
'name': $('#name').val(),
'module': $('#module').val(),
'type': typeParam
}),
},
},
);
}
// 初始化表格
function initTable(type) {
tableIns = table.render({
elem: "#currentTableId",
id: 'currentTableId',
headers: {
authorization: sessionStorage.getItem("gz-token"),
},
height: "full-210",
url: dataUrl + "backstage/planOut/getProPlanPage",
where: {
encryptedData: JSON.stringify({
'name': $('#name').val(),
'module': $('#module').val(),
'type': typeParam
}),
},
request: {
pageName: 'pageNum',
limitName: 'pageSize'
},
parseData: function (res) { // res 即为原始返回的数据
return {
"code": 0, // 解析接口状态
"msg": '获取成功', // 解析提示文本
"count": res.total, // 解析数据长度
"data": res.list // 解析数据列表
};
},
cols: [
setTableCols(type)
],
limits: [10, 15, 20, 25, 50, 100],
limit: 10,
page: true,
done: function (res, curr, count) {
pageNum = tableIns.config.page.curr;
element.render();
},
});
}
function setTableCols(type) {
if (type === 1) {
return [
{
width: '9.9%',
title: "序号",
align: "center",
templet: function (d) {
return d.LAY_NUM;
},
},
{
field: "type",
width: '10%',
title: "物机类型 ",
unresize: true,
align: "center",
},
{
field: "name",
width: '15%',
title: "物机名称",
unresize: true,
align: "center",
},
{
field: "module",
width: '15%',
title: "规格 ",
unresize: true,
},
{
field: "unit",
title: "单位",
width: '10%',
unresize: true,
align: "center",
},
{
field: "needNum",
title: "需要量",
width: '10%',
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.needNum,1);
},
},
{
field: "needNum",
title: "库存量",
width: '10%',
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.needNum,2);
},
},
{
field: "needNum",
title: "超出量",
width: '10%',
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.needNum,3);
},
},
{
title: "来源工程",
width: '10%',
align: "center",
unresize: true,
templet: function (d) {
let html = "";
html += "<a onclick=\"viewSource('" + d.proId + "',1)\">查看来源</a>";
return html;
},
},
]
} else if (type === 2) {
return [
{
width: '9.9%',
title: "序号",
align: "center",
templet: function (d) {
return d.LAY_NUM;
},
},
{
field: "type",
width: '15%',
title: "物机类型 ",
unresize: true,
align: "center",
},
{
field: "name",
width: '15%',
title: "物机名称",
unresize: true,
align: "center",
},
{
field: "module",
width: '10%',
title: "规格 ",
unresize: true,
align: "center",
},
{
field: "unit",
title: "单位",
width: '10%',
unresize: true,
align: "center",
},
{
field: "needNum",
title: "计划外发货量",
width: '10%',
unresize: true,
align: "center",
templet: function (d) {
return setNumColor(d.needNum,4);
},
},
{
field: "status",
title: "需要日期",
width: '10%',
unresize: true,
align: "center",
},
{
field: "status",
title: "工程名称",
width: '10%',
unresize: true,
align: "center",
},
{
title: "来源查询",
width: '10%',
align: "center",
unresize: true,
templet: function (d) {
let html = "";
html += "<a onclick=\"viewSource('" + d.proId + "',2)\">来源查询</a>";
return html;
},
},
]
}
}
// 设置字体加粗
function setFontBold(value) {
return '<span style="font-weight:bold">' + value + "</span>";
}
// 数量颜色 1.需要量 2.库存量 3.超出量 4.计划外发货量
function setNumColor(value, type) {
let color = "#409Eff";
if (type === 1) {
color = "#409Eff";
} else if (type === 2) {
color = "#19be6b";
} else if (type === 3) {
color = "#f56c6c";
}else if (type === 4) {
color = "#f56c6c";
}
return '<span style="color:' + color + '">' + value + "</span>";
}
// 导出
function exportExcel() {
let encryptedData = JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
});
let url = dataUrl + "backstage/planOut/exportExcel?encryptedData=" + encryptedData;
exportExcelUtil(url, '机具公司发货数据');
}
// 打印
function print() {
Print('#body', {
onStart: function () {
console.log('onStart', new Date())
},
onEnd: function () {
console.log('onEnd', new Date())
}
})
}
// 查看来源
function viewSource(id) {
openIframeByParam("viewSource", "未发货机具设备超出库存数量-数据来源", "./view_resource_list.html", "92%", "95%", id);
}

View File

@ -23,13 +23,37 @@ layui.use(["form", "table"], function () {
`);
element.render();
initTable();
getStatistics();
});
// 数据概览
function getStatistics() {
let url = dataUrl + 'backstage/planOut/getStatistics';
ajaxRequest(url, "POST", null, true, function () {
}, function (result) {
console.log(result);
if (result.code === 200) {
setNum(result.data);
}
}, function (xhr, status, error) {
errorFn(xhr, status, error)
}, null);
// 数据概览赋值
function setNum(obj) {
$('#totalNum').html(obj.dfhNum + obj.fhNum);
$('#dfhNum').html(obj.dfhNum);
$('#fhNum').html(obj.fhNum);
$('#overNum').html(obj.overNum);
$('#noPlanNum').html(obj.noPlanNum);
}
}
// 查询/重置
function queryTable(type){
if(type === 1){
function queryTable(type) {
if (type === 1) {
reloadTable(1);
}else if(type === 2){
} else if (type === 2) {
$('#proName').val('');
$('#status').val('0');
layui.form.render();
@ -44,17 +68,17 @@ function reloadData() {
// 重载表格
function reloadTable(pageNum) {
table.reload("currentTableId",{
page: {
curr: pageNum ? pageNum : 1,
},
where: {
encryptedData: JSON.stringify({
'proName':$('#proName').val(),
'status':$('#status').val()
}),
},
table.reload("currentTableId", {
page: {
curr: pageNum ? pageNum : 1,
},
where: {
encryptedData: JSON.stringify({
'proName': $('#proName').val(),
'status': $('#status').val()
}),
},
},
);
}
@ -62,7 +86,7 @@ function reloadTable(pageNum) {
function initTable() {
tableIns = table.render({
elem: "#currentTableId",
id:'currentTableId',
id: 'currentTableId',
headers: {
authorization: sessionStorage.getItem("gz-token"),
},
@ -70,15 +94,15 @@ function initTable() {
url: dataUrl + "backstage/planOut/getProPlanPage",
where: {
encryptedData: JSON.stringify({
'proName':$('#proName').val(),
'status':$('#status').val()
'proName': $('#proName').val(),
'status': $('#status').val()
}),
},
request: {
pageName: 'pageNum',
limitName: 'pageSize'
},
parseData: function(res){ // res 即为原始返回的数据
parseData: function (res) { // res 即为原始返回的数据
return {
"code": 0, // 解析接口状态
"msg": '获取成功', // 解析提示文本
@ -155,8 +179,8 @@ function initTable() {
unresize: true,
templet: function (d) {
let html = "";
html += "<a onclick='deliveryDetail("+JSON.stringify(d)+")'>详情</a>";
html += "<div class='splitLine'>|</div><a onclick='sendGoods("+JSON.stringify(d)+")'>发货</a>";
html += "<a onclick='deliveryDetail(" + JSON.stringify(d) + ")'>详情</a>";
html += "<div class='splitLine'>|</div><a onclick='sendGoods(" + JSON.stringify(d) + ")'>发货</a>";
return html;
},
},
@ -181,18 +205,18 @@ function setNumColor(value) {
// 发货状态颜色
function setStatusColor(value) {
let color = "#409Eff";
let name = ''
if (value === 0) {
color = "#f56c6c";
name = '未发货';
} else if (value === 1) {
color = "#ff9900";
name = '部分发货'
} else if (value === 2) {
color = "#19be6b";
name = '全部发货'
}
return '<span style="color:' + color + '">' + name + "</span>";
let name = ''
if (value === 0) {
color = "#f56c6c";
name = '未发货';
} else if (value === 1) {
color = "#ff9900";
name = '部分发货'
} else if (value === 2) {
color = "#19be6b";
name = '全部发货'
}
return '<span style="color:' + color + '">' + name + "</span>";
}
// 设置进度值
@ -209,8 +233,8 @@ function schedule(d) {
}
//设置页面进度条
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 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>"
);
}
@ -218,24 +242,29 @@ function schedule(d) {
// 导出
function exportExcel() {
let encryptedData = JSON.stringify({
'proName':$('#proName').val(),
'status':$('#status').val()
'proName': $('#proName').val(),
'status': $('#status').val()
});
let url = dataUrl + "backstage/planOut/exportExcel?encryptedData=" + encryptedData;
exportExcelUtil(url,'机具公司发货数据');
exportExcelUtil(url, '机具公司发货数据');
}
// 发货详情
function deliveryDetail(obj) {
openIframeByParamObj("deliveryDetail","详情","./child/delivery_detail_list.html","92%","95%",obj);
openIframeByParamObj("deliveryDetail", "详情", "./child/delivery_detail_list.html", "92%", "95%", obj);
}
// 发货
function sendGoods(obj) {
openIframeByParamObj("sendGoods","发货","./child/send_goods_form.html","92%","95%",obj);
openIframeByParamObj("sendGoods", "发货", "./child/send_goods_form.html", "92%", "95%", obj);
}
// type 1.总需求量 2.待发货量 3.已发货量
function openViewData(type) {
openIframeByParam("viewData","数据概览","./child/view_data_list.html","92%","95%",type);
openIframeByParam("viewData", "数据概览", "./child/view_data_list.html", "92%", "95%", type);
}
// type 1.超库存量 2.计划外量
function earlyInfo(type) {
openIframeByParam("viewData", "预警信息", "./child/early_info_list.html", "92%", "95%", type);
}

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>预警信息</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../../lib/layui-v2.9.18/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../css/font.css" media="all">
<link rel="stylesheet" href="../../../css/public.css" media="all">
<link rel="stylesheet" href="../../../css/demandPlan/view_data_list.css" media="all">
</head>
<style>
body {
margin-top: 0px;
}
.layui-tab {
margin: 0 0 10px 0;
}
.layuimini-container {
height: 92%;
}
</style>
<body>
<div class="layui-tab layui-tab-brief" lay-filter="demo-filter-tab">
<ul class="layui-tab-title">
<li value="1">超库存量</li>
<li value="2">计划外量</li>
</ul>
</div>
<div class="layuimini-container">
<div class="layuimini-main">
<fieldset class="table-search-fieldset">
<legend>搜索信息</legend>
<div style="margin: 10px 10px 10px 10px">
<form class="layui-form layui-form-pane" action="#" onsubmit="return false;">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;">
<input type="text" name="name" id="name" autocomplete="off" class="layui-input"
placeholder="输入物机名称" maxlength="30">
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline" style="width: 300px;">
<input type="text" name="module" id="module" autocomplete="off" class="layui-input"
placeholder="输入规格" maxlength="30">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-bg-blue" onclick="queryTable(1)"><i
class="layui-icon"></i> 搜 索</button>
<button class="layui-btn layui-btn-primary" onclick="queryTable(2)"><i
class="layui-icon layui-icon-refresh"></i> 重 置</button>
<button class="layui-btn layui-btn-primary" onclick="exportExcel()"><i
class="layui-icon layui-icon-download-circle"></i> 下 载</button>
<button class="layui-btn layui-btn-primary" onclick="print()"><i
class="layui-icon layui-icon-print"></i> 打 印</button>
</div>
</div>
</form>
</div>
</fieldset>
<div class="table-box" table-responsive style="z-index: 1;">
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
</div>
</div>
</div>
<script src="../../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="../../../js/public.js" charset="utf-8"></script>
<script src="../../../lib/layui-v2.9.18/layui/layui.js" charset="utf-8"></script>
<script src="../../../js/demandPlan/child/early_info_list.js" charset="utf-8"></script>
<script src="../../../js/openIframe.js" charset="utf-8"></script>
<script src="../../../js/Print.js" charset="utf-8"></script>
</body>
</html>

View File

@ -23,7 +23,7 @@
<div class="layout" style="justify-content: space-between;" id="num-progress">
<div class="layout num-title">
<p>总需求计划量</p>
<p class="num-style">50000</p>
<p class="num-style" id="totalNum">0</p>
</div>
<div>
<img src="../../images/demandPlan/num_icon.png">
@ -34,7 +34,7 @@
<div class="layout" style="justify-content: space-between;" id="num-progress2">
<div class="layout num-title">
<p>待发货量</p>
<p class="num-style">50000</p>
<p class="num-style" id="dfhNum"></p>
<p>10%</p>
</div>
<div>
@ -46,7 +46,7 @@
<div class="layout" style="justify-content: space-between;" id="num-progress3">
<div class="layout num-title">
<p>已发货量</p>
<p class="num-style">50000</p>
<p class="num-style" id="fhNum"></p>
<p>90%</p>
</div>
<div>
@ -56,13 +56,13 @@
</div>
<div class="layout data-detail" style="align-items: flex-start;justify-content: flex-start;">
<p style="font-size: 16px; font-weight: bold;">预警信息</p>
<div class="layout common-style">
<div class="layout common-style" onclick="earlyInfo(1)">
<p>超库存量</p>
<p style="color: #F56C6C; font-weight: 700; font-size: 16px;">0</p>
<p style="color: #F56C6C; font-weight: 700; font-size: 16px;" id="overNum">0</p>
</div>
<div class="layout common-style">
<div class="layout common-style" onclick="earlyInfo(2)">
<p>计划外量</p>
<p style="color: #00BFBF; font-weight: 700; font-size: 16px;">0</p>
<p style="color: #00BFBF; font-weight: 700; font-size: 16px;" id="noPlanNum">0</p>
</div>
<!-- <div class="layout common-style">
<p>据需用日期5日量</p>