From 3f711a262fbf18dc0d48d43fbf69ae4f84b9ed66 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Sat, 9 Nov 2024 21:08:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E8=B4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/demandPlan/delivery_list.css | 1 + js/demandPlan/child/early_info_list.js | 301 +++++++++++++++++++++ js/demandPlan/delivery_list.js | 107 +++++--- page/demandPlan/child/early_info_list.html | 82 ++++++ page/demandPlan/delivery_list.html | 14 +- 5 files changed, 459 insertions(+), 46 deletions(-) create mode 100644 js/demandPlan/child/early_info_list.js create mode 100644 page/demandPlan/child/early_info_list.html diff --git a/css/demandPlan/delivery_list.css b/css/demandPlan/delivery_list.css index 2ea7e77..04e4a85 100644 --- a/css/demandPlan/delivery_list.css +++ b/css/demandPlan/delivery_list.css @@ -32,6 +32,7 @@ .common-style { width: 100%; justify-content: space-between; + cursor: pointer; } .num-style { diff --git a/js/demandPlan/child/early_info_list.js b/js/demandPlan/child/early_info_list.js new file mode 100644 index 0000000..ef6ccb5 --- /dev/null +++ b/js/demandPlan/child/early_info_list.js @@ -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 += "查看来源"; + 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 += "来源查询"; + return html; + }, + }, + ] + } +} + +// 设置字体加粗 +function setFontBold(value) { + return '' + value + ""; +} + +// 数量颜色 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 '' + value + ""; +} + +// 导出 +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); +} \ No newline at end of file diff --git a/js/demandPlan/delivery_list.js b/js/demandPlan/delivery_list.js index 29fcfbc..f00bb6a 100644 --- a/js/demandPlan/delivery_list.js +++ b/js/demandPlan/delivery_list.js @@ -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 += "详情"; - html += "