Merge remote-tracking branch 'origin/main'

This commit is contained in:
haozq 2026-02-06 14:24:15 +08:00
commit 9a536a4ddb
5 changed files with 674 additions and 11 deletions

View File

@ -0,0 +1,334 @@
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<%@include file="../baseset.jsp" %>
<%@include file="../systemset.jsp" %>
<meta charset="UTF-8">
<title>入库占比</title>
<!-- Layui CSS -->
<link href="${bonuspath}/static/js/index/layui.css" rel="stylesheet">
<script src="${bonuspath}/static/js/index/crypto-js.min.js"></script>
<style>
.equipment-types-container {
padding: 15px;
}
.filter-section {
margin-bottom: 15px;
padding: 15px;
background-color: #f8f8f8;
border-radius: 4px;
}
.layui-table-view {
overflow-x: auto !important;
}
/* 添加 Layui 字体图标路径 */
@font-face {
font-family: 'layui-icon';
src: url('${bonuspath}/static/js/index/font/iconfont.eot');
src: url('${bonuspath}/static/js/index/font/iconfont.eot?#iefix') format('embedded-opentype'),
url('${bonuspath}/static/js/index/font/iconfont.woff2') format('woff2'),
url('${bonuspath}/static/js/index/font/iconfont.woff') format('woff'),
url('${bonuspath}/static/js/index/font/iconfont.ttf') format('truetype'),
url('${bonuspath}/static/js/index/font/iconfont.svg#layui-icon') format('svg');
}
</style>
</head>
<body>
<div class="equipment-types-container">
<!-- 筛选区域 -->
<div class="filter-section">
<form class="layui-form" lay-filter="equipmentTypesFilter">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline">
<select name="isCount" lay-filter="isCount">
<option value="">机具类型</option>
<option value="0">设备</option>
<option value="1">机具</option>
</select>
</div>
</div>
<%-- <div class="layui-inline">--%>
<%-- <div class="layui-input-inline">--%>
<%-- <select name="quantityFilter" lay-filter="quantityFilter">--%>
<%-- <option value="">数量筛选</option>--%>
<%-- <option value="1">只看保有量>0</option>--%>
<%-- <option value="2">只看库存量>0</option>--%>
<%-- <option value="3">只看在用量>0</option>--%>
<%-- <option value="4">只看报废量>0</option>--%>
<%-- </select>--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="maName" class="layui-input" placeholder="请输入机具名称">
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="maType" class="layui-input" placeholder="请输入规格型号">
</div>
</div>
<div class="layui-inline">
<button type="button" class="layui-btn" lay-submit lay-filter="equipmentTypesSearch">搜索</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="equipmentTypesExport">导出</button>
</div>
</div>
</form>
</div>
<!-- 表格区域 -->
<table id="equipmentTypesTable" lay-filter="equipmentTypesTable"></table>
<p id="type" hidden>${type}</p>
</div>
<script src="${bonuspath}/static/js/index/layui.min.js"></script>
<!-- 操作列模板 -->
<script type="text/html" id="operationBar">
<a class="layui-btn layui-btn-xs" lay-event="detail">明细</a>
</script>
<script>
layui.use(['table', 'form'], function(){
var table = layui.table;
var form = layui.form;
var type=1;
var typed=5;
var urld='${bonuspath}/backstage/indexHomeDetails/getNewlyStored';
var colsd=[[
{type: 'numbers', title: '序号', width: 100},
{field: 'isCount', title: '机具类别', width: 200, templet: function(d) {
return d.isCount === '0' ? '设备' : '机具';
}},
{field: 'maType', title: '机具名称', width: 450},
{field: 'maName', title: '规格型号', width: 300},
{field: 'maUnit', title: '单位', width: 150},
{field: 'storageNum', title: '新购入库量', width: 200},
]];
// 渲染表单
form.render('select');
type=$("#type").html();
if(type==2){
typed=3;
colsd=[[
{type: 'numbers', title: '序号', width: 100},
{field: 'isCount', title: '机具类别', width: 200, templet: function(d) {
return d.isCount === '0' ? '设备' : '机具';
}},
{field: 'maType', title: '机具名称', width: 450},
{field: 'maName', title: '规格型号', width: 300},
{field: 'maUnit', title: '单位', width: 150},
{field: 'storageNum', title: '修试后入库量', width: 200},
]];
}else if(type==4){
typed=3;
colsd=[[
{type: 'numbers', title: '序号', width: 100},
{field: 'isCount', title: '机具类别', width: 200, templet: function(d) {
return d.isCount === '0' ? '设备' : '机具';
}},
{field: 'maType', title: '机具名称', width: 450},
{field: 'maName', title: '规格型号', width: 300},
{field: 'maUnit', title: '单位', width: 150},
{field: 'storageNum', title: '退料入库量', width: 200}
]];
}else if(type==1){
typed=5;
colsd=[[
{type: 'numbers', title: '序号', width: 100},
{field: 'isCount', title: '机具类别', width: 200, templet: function(d) {
return d.isCount === '0' ? '设备' : '机具';
}},
{field: 'maType', title: '机具名称', width: 450},
{field: 'maName', title: '规格型号', width: 300},
{field: 'maUnit', title: '单位', width: 150},
{field: 'storageNum', title: '新购入库量', width: 200},
]];
}else if(type==3){
urld='${bonuspath}/backstage/indexHomeDetails/getInventoryStored';
colsd=[[
{type: 'numbers', title: '序号', width: 100},
{field: 'isCount', title: '机具类别', width: 200, templet: function(d) {
return d.isCount === '0' ? '设备' : '机具';
}},
{field: 'maType', title: '机具名称', width: 450},
{field: 'maName', title: '规格型号', width: 300},
{field: 'maUnit', title: '单位', width: 150},
{field: 'storageNum', title: '盘点入库量', width: 200},
]];
}
// 监听数量筛选下拉框
// form.on('select(quantityFilter)', function(data){
// table.reload('equipmentTypesTable', {
// where: {
// quantityFilter: data.value
// }
// });
// });
// 监听机具类型下拉框
// form.on('select(deviceType)', function(data){
// table.reload('equipmentTypesTable', {
// where: {
// deviceType: data.value
// }
// });
// });
// 初始化表格
table.render({
elem: '#equipmentTypesTable',
url: urld,
where: { // 这里的 where 对象会被自动转换为查询字符串,附加到 URL 上
type: typed
},
method: 'post', // 设置请求方法为 POST
page: false,
width: 1460, // 设置表格总宽度
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
dataType: 'text', // 将响应类型设置为text而不是json
parseData: function(res) {
console.log('开始解析数据');
console.log("type",$("#type").html());
console.log(res);
try {
console.log('收到的原始响应数据:', res);
if (!res) {
throw new Error('响应数据为空');
}
try {
res = JSON.parse(res);
return {
"code": 0,
"msg": res.resMsg || '',
"count": res.obj ? res.obj.length : 0,
"data": res.obj || []
};
} catch (decryptError) {
console.error('转换失败:', decryptError);
throw new Error('转换失败');
}
} catch (e) {
console.error('数据处理失败:', e);
console.error('原始数据:', res);
layer.msg('数据处理失败,请检查网络连接或联系管理员', {icon: 2});
return {
"code": -1,
"msg": "数据处理失败: " + e.message,
"count": 0,
"data": []
};
}
},
request: {
pageName: 'page',
limitName: 'limit'
},
response: {
statusName: 'code',
statusCode: 0,
msgName: 'msg',
countName: 'count',
dataName: 'data'
},
cols: colsd,
done: function(res, curr, count) {
console.log('表格渲染完成,结果:', res);
if (res.code === -1) {
layer.msg(res.msg);
}
}
});
// 监听工具条事件
table.on('tool(equipmentTypesTable)', function(obj){
var data = obj.data;
if(obj.event === 'detail'){
localStorage.setItem('equipmentViewTypeId', data.typeId);
// 打开明细弹窗
layer.open({
zIndex: 20001014,
type: 2,
title: '机具类别详细信息',
area: ['80%', '95%'],
content: '${bonuspath}/backstage/indexHome/dataOverview/equipment/detail',
success: function(layero, index){
// 可以在这里对弹出的iframe进行一些操作
}
});
}
});
// 监听搜索表单提交
form.on('submit(equipmentTypesSearch)', function(data){
console.log(data.field);
table.reload('equipmentTypesTable', {
where: data.field
});
return false;
});
// 导出--事件监听
form.on('submit(equipmentTypesExport)', function(data){
var loadIndex = layer.msg('正在导出数据,请稍候...', {
icon: 16,
shade: 0.3,
time: 0
});
try {
if (!table.cache.equipmentTypesTable || table.cache.equipmentTypesTable.length === 0) {
layer.msg('暂无数据可导出', {icon: 2});
return false;
}
setTimeout(function() {
table.exportFile(
'equipmentTypesTable',
table.cache.equipmentTypesTable,
{
type: 'xlsx',
title: '机具类别明细_' + new Date().toLocaleDateString().replace(/\//g, '-'),
head: [
['机具类别', '机具名称', '规格型号', '单位', '保有量', '库存量', '在用量',
'在修在检量', '报废量', '在用工程数量', '盘点记录', '累计领用量', '累计退还量']
],
filter: function(item, index) {
return [
item.isCount === '0' ? '设备' : '机具',
item.maType,
item.maName,
item.maUnit,
item.maTotal,
item.storageNum,
item.inuseNum,
item.repairNum,
item.scrapNum,
item.projectNum,
'盘盈:' + item.pyNum + ' 盘亏:' + item.pkNum,
item.inuseCount,
item.backCount
];
}
}
);
layer.close(loadIndex);
layer.msg('导出成功', {icon: 1});
}, 100);
} catch (e) {
console.error('导出失败:', e);
layer.msg('导出失败,请稍后重试', {icon: 2});
layer.close(loadIndex);
}
return false;
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,298 @@
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<%@include file="../baseset.jsp" %>
<%@include file="../systemset.jsp" %>
<meta charset="UTF-8">
<title>机具类别</title>
<!-- Layui CSS -->
<link href="${bonuspath}/static/js/index/layui.css" rel="stylesheet">
<script src="${bonuspath}/static/js/index/crypto-js.min.js"></script>
<style>
.equipment-types-container {
padding: 15px;
}
.filter-section {
margin-bottom: 15px;
padding: 15px;
background-color: #f8f8f8;
border-radius: 4px;
}
.layui-table-view {
overflow-x: auto !important;
}
/* 添加 Layui 字体图标路径 */
@font-face {
font-family: 'layui-icon';
src: url('${bonuspath}/static/js/index/font/iconfont.eot');
src: url('${bonuspath}/static/js/index/font/iconfont.eot?#iefix') format('embedded-opentype'),
url('${bonuspath}/static/js/index/font/iconfont.woff2') format('woff2'),
url('${bonuspath}/static/js/index/font/iconfont.woff') format('woff'),
url('${bonuspath}/static/js/index/font/iconfont.ttf') format('truetype'),
url('${bonuspath}/static/js/index/font/iconfont.svg#layui-icon') format('svg');
}
</style>
</head>
<body>
<div class="equipment-types-container">
<!-- 筛选区域 -->
<div class="filter-section">
<form class="layui-form" lay-filter="equipmentTypesFilter">
<div class="layui-form-item">
<%-- <div class="layui-inline">--%>
<%-- <div class="layui-input-inline">--%>
<%-- <select name="isCount" lay-filter="isCount">--%>
<%-- <option value="">机具类型</option>--%>
<%-- <option value="0">设备</option>--%>
<%-- <option value="1">机具</option>--%>
<%-- </select>--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="layui-inline">
<div class="layui-input-inline">
<select name="quantityFilter" lay-filter="quantityFilter">
<option value="">数量筛选</option>
<option value="1">只看保有量>0</option>
<option value="2">只看库存量>0</option>
<option value="3">只看在用量>0</option>
<option value="4">只看报废量>0</option>
</select>
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="maName" class="layui-input" placeholder="请输入机具名称">
</div>
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="maType" class="layui-input" placeholder="请输入规格型号">
</div>
</div>
<div class="layui-inline">
<button type="button" class="layui-btn" lay-submit lay-filter="equipmentTypesSearch">搜索</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
<button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="equipmentTypesExport">导出</button>
</div>
</div>
</form>
</div>
<!-- 表格区域 -->
<table id="equipmentTypesTable" lay-filter="equipmentTypesTable"></table>
<p id="type" hidden>${type}</p>
</div>
<script src="${bonuspath}/static/js/index/layui.min.js"></script>
<!-- 操作列模板 -->
<script type="text/html" id="operationBar">
<a class="layui-btn layui-btn-xs" lay-event="detail">明细</a>
</script>
<script>
layui.use(['table', 'form'], function(){
var table = layui.table;
var form = layui.form;
var type=1;
var isCount=1;
// 渲染表单
form.render('select');
type=$("#type").html();
if(type==5){
isCount=1;
}else if(type==6){
isCount=0;
}
// 监听数量筛选下拉框
// form.on('select(quantityFilter)', function(data){
// table.reload('equipmentTypesTable', {
// where: {
// quantityFilter: data.value
// }
// });
// });
// 监听机具类型下拉框
// form.on('select(deviceType)', function(data){
// table.reload('equipmentTypesTable', {
// where: {
// deviceType: data.value
// }
// });
// });
// 初始化表格
table.render({
elem: '#equipmentTypesTable',
url: '${bonuspath}/backstage/indexHomeDetails/getMaTypeDetail',
method: 'post', // 设置请求方法为 POST
where: { // 这里的 where 对象会被自动转换为查询字符串,附加到 URL 上
isCount: isCount
},
page: false,
width: 1460, // 设置表格总宽度
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
dataType: 'text', // 将响应类型设置为text而不是json
parseData: function(res) {
console.log('开始解析数据');
console.log(res);
try {
console.log('收到的原始响应数据:', res);
if (!res) {
throw new Error('响应数据为空');
}
try {
res = JSON.parse(res);
return {
"code": 0,
"msg": res.resMsg || '',
"count": res.obj ? res.obj.length : 0,
"data": res.obj || []
};
} catch (decryptError) {
console.error('转换失败:', decryptError);
throw new Error('转换失败');
}
} catch (e) {
console.error('数据处理失败:', e);
console.error('原始数据:', res);
layer.msg('数据处理失败,请检查网络连接或联系管理员', {icon: 2});
return {
"code": -1,
"msg": "数据处理失败: " + e.message,
"count": 0,
"data": []
};
}
},
request: {
pageName: 'page',
limitName: 'limit'
},
response: {
statusName: 'code',
statusCode: 0,
msgName: 'msg',
countName: 'count',
dataName: 'data'
},
cols: [[
{type: 'numbers', title: '序号', width: 50},
{field: 'isCount', title: '机具类别', width: 90, templet: function(d) {
return d.isCount === '0' ? '设备' : '机具';
}},
{field: 'maType', title: '机具名称', width: 100},
{field: 'maName', title: '规格型号', width: 160},
{field: 'maUnit', title: '单位', width: 90},
{field: 'maTotal', title: '保有量', width: 90},
{field: 'storageNum', title: '库存量', width: 80},
{field: 'inuseNum', title: '在用量', width: 80},
{field: 'repairNum', title: '在修在检量', width: 90},
{field: 'scrapNum', title: '报废量', width: 80},
{field: 'projectNum', title: '在用工程数量', width: 120},
{field: 'pdContent', title: '盘点记录', width: 150, templet: function(d) {
return '盘盈:' + d.pyNum + '盘亏:' + d.pkNum;
}},
{field: 'inuseCount', title: '累计领用量', width: 110},
{field: 'backCount', title: '累计退还量', width: 110},
{title: '操作', width: 60, fixed: 'right', toolbar: '#operationBar'}
]],
done: function(res, curr, count) {
console.log('表格渲染完成,结果:', res);
if (res.code === -1) {
layer.msg(res.msg);
}
}
});
// 监听工具条事件
table.on('tool(equipmentTypesTable)', function(obj){
var data = obj.data;
if(obj.event === 'detail'){
localStorage.setItem('equipmentViewTypeId', data.typeId);
// 打开明细弹窗
layer.open({
zIndex: 20001014,
type: 2,
title: '机具类别详细信息',
area: ['80%', '95%'],
content: '${bonuspath}/backstage/indexHome/dataOverview/equipment/detail',
success: function(layero, index){
// 可以在这里对弹出的iframe进行一些操作
}
});
}
});
// 监听搜索表单提交
form.on('submit(equipmentTypesSearch)', function(data){
console.log(data.field);
table.reload('equipmentTypesTable', {
where: data.field
});
return false;
});
// 导出--事件监听
form.on('submit(equipmentTypesExport)', function(data){
var loadIndex = layer.msg('正在导出数据,请稍候...', {
icon: 16,
shade: 0.3,
time: 0
});
try {
if (!table.cache.equipmentTypesTable || table.cache.equipmentTypesTable.length === 0) {
layer.msg('暂无数据可导出', {icon: 2});
return false;
}
setTimeout(function() {
table.exportFile(
'equipmentTypesTable',
table.cache.equipmentTypesTable,
{
type: 'xlsx',
title: '机具类别明细_' + new Date().toLocaleDateString().replace(/\//g, '-'),
head: [
['机具类别', '机具名称', '规格型号', '单位', '保有量', '库存量', '在用量',
'在修在检量', '报废量', '在用工程数量', '盘点记录', '累计领用量', '累计退还量']
],
filter: function(item, index) {
return [
item.isCount === '0' ? '设备' : '机具',
item.maType,
item.maName,
item.maUnit,
item.maTotal,
item.storageNum,
item.inuseNum,
item.repairNum,
item.scrapNum,
item.projectNum,
'盘盈:' + item.pyNum + ' 盘亏:' + item.pkNum,
item.inuseCount,
item.backCount
];
}
}
);
layer.close(loadIndex);
layer.msg('导出成功', {icon: 1});
}, 100);
} catch (e) {
console.error('导出失败:', e);
layer.msg('导出失败,请稍后重试', {icon: 2});
layer.close(loadIndex);
}
return false;
});
});
</script>
</body>
</html>

View File

@ -810,12 +810,12 @@
<div class="overview-card">
<div class="section-title">入库占比&nbsp; &nbsp;&nbsp; / &nbsp;&nbsp;&nbsp;机具类别</div>
<div class="chart-grid">
<div id="storageChart1" class="chart-item" onclick="showEquipmentTypes()"></div>
<div id="storageChart2" class="chart-item" onclick="showEquipmentTypes()"></div>
<div id="storageChart3" class="chart-item" onclick="showEquipmentTypes()"></div>
<div id="storageChart4" class="chart-item" onclick="showEquipmentTypes()"></div>
<div id="storageChart5" class="chart-item" onclick="showEquipmentTypes()"></div>
<div id="storageChart6" class="chart-item" onclick="showEquipmentTypes()"></div>
<div id="storageChart1" class="chart-item" onclick="showEquipmentTypes1('入库占比','1')"></div>
<div id="storageChart2" class="chart-item" onclick="showEquipmentTypes1('入库占比','2')"></div>
<div id="storageChart3" class="chart-item" onclick="showEquipmentTypes1('入库占比','3')"></div>
<div id="storageChart4" class="chart-item" onclick="showEquipmentTypes1('入库占比','4')"></div>
<div id="storageChart5" class="chart-item" onclick="showEquipmentTypes2('机具占比','5')"></div>
<div id="storageChart6" class="chart-item" onclick="showEquipmentTypes2('编码占比','6')"></div>
</div>
</div>
</div>
@ -931,7 +931,7 @@
function showEquipmentTypes() {
layer.open({
type: 2,
title: '机具类别明细',
title: '入库占比',
area: ['1500px', '700px'],
content: '${bonuspath}/backstage/indexHome/dataOverview/equipment/index',
btn: ['关闭'], // 添加关闭按钮
@ -941,6 +941,32 @@
});
}
function showEquipmentTypes1(name,type) {
layer.open({
type: 2,
title: ''+name,
area: ['1500px', '700px'],
content: '${bonuspath}/backstage/indexHome/dataOverview/equipmentProportion/index?type='+type,
btn: ['关闭'], // 添加关闭按钮
yes: function(index, layero) {
layer.close(index); // 关闭当前弹窗
}
});
}
function showEquipmentTypes2(name,type) {
layer.open({
type: 2,
title: ''+name,
area: ['1500px', '700px'],
content: '${bonuspath}/backstage/indexHome/dataOverview/equipmentType/index?type='+type,
btn: ['关闭'], // 添加关闭按钮
yes: function(index, layero) {
layer.close(index); // 关闭当前弹窗
}
});
}
function showProjectDetail() {
layer.open({
type: 2,

View File

@ -1230,6 +1230,7 @@ $(function() {
{ key: 'repairStorage', index: 2, title: '修试后入库', color: '#36cfc9' },
{ key: 'inventoryStorage', index: 3, title: '盘点入库', color: '#73d13d' },
{ key: 'returnStorage', index: 4, title: '退料入库', color: '#ffc53d' },
// { key: 'repairStorage', index: 4, title: '退料入库', color: '#ffc53d' },
{ key: 'equipmentCount', index: 5, title: '机具数量', color: '#ff7a45' },
{ key: 'deviceCount', index: 6, title: '编码数量', color: '#722ed1' }
];
@ -1241,7 +1242,10 @@ $(function() {
continue;
}
const chartData = data[config.key] || { value: 0, total: 100 };
let chartData = data[config.key] || { value: 0, total: 100 };
if(config.key=='returnStorage'){
chartData=data['repairStorage'] || { value: 0, total: 100 };
}
const option = createCircleChartOption(chartData, config.title, config.color);
try {

View File

@ -272,9 +272,7 @@
<if test="maType != null and maType != ''">
and mat2.`NAME` like concat ('%',#{maType},'%')
</if>
<if test="isCount != null and isCount != ''">
and rs.isCount = #{isCount}
</if>
</where>
GROUP BY rs.typeId
) a WHERE
@ -287,6 +285,9 @@
mt.`LEVEL` = 4
AND mt.IS_ACTIVE = 1
)
<if test="isCount != null and isCount != ''">
and a.isCount = #{isCount}
</if>
</select>