This commit is contained in:
jiask 2026-02-06 15:08:19 +08:00
parent 9a536a4ddb
commit bbc5634ed9
4 changed files with 140 additions and 126 deletions

View File

@ -63,12 +63,12 @@
<%-- </div>--%>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="maName" class="layui-input" placeholder="请输入机具名称">
<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="请输入规格型号">
<input type="text" name="maType" class="layui-input" placeholder="请输入机具名称">
</div>
</div>
<div class="layui-inline">
@ -91,11 +91,11 @@
<a class="layui-btn layui-btn-xs" lay-event="detail">明细</a>
</script>
<script>
var typed=5;
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},
@ -268,6 +268,7 @@
// 监听搜索表单提交
form.on('submit(equipmentTypesSearch)', function(data){
console.log(data.field);
data.field.type=typed;
table.reload('equipmentTypesTable', {
where: data.field
});

View File

@ -63,12 +63,12 @@
</div>
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="maName" class="layui-input" placeholder="请输入机具名称">
<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="请输入规格型号">
<input type="text" name="maType" class="layui-input" placeholder="请输入机具名称">
</div>
</div>
<div class="layui-inline">
@ -91,11 +91,11 @@
<a class="layui-btn layui-btn-xs" lay-event="detail">明细</a>
</script>
<script>
var isCount=1;
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();
@ -232,6 +232,7 @@
// 监听搜索表单提交
form.on('submit(equipmentTypesSearch)', function(data){
console.log(data.field);
data.field.isCount=isCount;
table.reload('equipmentTypesTable', {
where: data.field
});

View File

@ -6,11 +6,11 @@ function checkDependencies() {
layui: typeof layui !== 'undefined',
layer: typeof layer !== 'undefined'
};
const missing = Object.entries(deps)
.filter(([, loaded]) => !loaded)
.map(([name]) => name);
if (missing.length > 0) {
console.error('Missing dependencies:', missing.join(', '));
return false;
@ -85,7 +85,7 @@ window.loadMenuSettings = async function() {
console.log('准备请求菜单数据');
const data = await window.request(window.API.getAllMenus);
console.log('获取到的菜单数据:', data);
// ... 其他代码
} catch (error) {
console.error('加载菜单设置失败:', error);
@ -208,7 +208,7 @@ $(function() {
try {
console.log('开始初始化流程...');
performanceMonitor.mark('Init Start');
// 添加初始化常用功能
console.log('0. 开始初始化常用功能...');
try {
@ -217,7 +217,7 @@ $(function() {
} catch (error) {
console.error('常用功能初始化失败:', error);
}
// 1. 更新数据概览
console.log('1. 开始更新数据概览...');
try {
@ -226,7 +226,7 @@ $(function() {
} catch (error) {
console.error('数据概览更新失败:', error);
}
// 2. 初始化图表
console.log('2. 开始初始化图表...');
try {
@ -235,7 +235,7 @@ $(function() {
} catch (error) {
console.error('图表初始化失败:', error);
}
// 3. 初始化预警信息
console.log('3. 开始初始化预警信息...');
try {
@ -244,7 +244,7 @@ $(function() {
} catch (error) {
console.error('预警信息初始化失败:', error);
}
// 4. 更新排名列表
console.log('4. 开始更新排名列表...');
try {
@ -253,7 +253,7 @@ $(function() {
} catch (error) {
console.error('排名列表更新失败:', error);
}
// 5. 启动排名自动滚动
console.log('5. 开始启动排名自动滚动...');
try {
@ -262,7 +262,7 @@ $(function() {
} catch (error) {
console.error('排名自动滚动启动失败:', error);
}
// 6. 获取待办事项
console.log('6. 开始获取待办事项...');
try {
@ -271,7 +271,7 @@ $(function() {
} catch (error) {
console.error('待办事项统计获取失败:', error);
}
// 6.1. 获取待办事项详细列表
console.log('6.1. 开始获取待办事项详细列表...');
try {
@ -280,7 +280,7 @@ $(function() {
} catch (error) {
console.error('待办事项详细列表获取失败:', error);
}
// 7. 初始化日历
console.log('7. 开始初始化日历...');
if ($('#equipmentCalendar').length) {
@ -404,26 +404,26 @@ $(function() {
}
// 清空现有内容
rankingBody.innerHTML = '';
fetchRankData();
} catch (error) {
console.error('更新排名列表时出错:', error);
}
}
// 添加获取入库占比数据的方法
async function fetchRankData() {
try {
const data =await request(API.rankList);
console.log(data)
// 创建并加载行
data.forEach((item,index) => {
const tr = document.createElement('tr');
tr.className = 'ranking-item';
tr.innerHTML = `
<td><span class="rank-number">${index + 1}</span></td>
<td><span class="project-name">${item.projectName}</span></td>
@ -431,15 +431,15 @@ $(function() {
<td><span class="count-number">${item.returnCount}</span></td>
<td><span class="count-number">${item.diffCount}</span></td>
`;
rankingBody.appendChild(tr);
});
} catch (error) {
console.error('获取差缺排名数据失败:', error);
}
}
// 自动滚动排名列表
function autoScrollRanking() {
@ -447,14 +447,14 @@ $(function() {
const tbody = rankingList.querySelector('tbody');
let isScrolling = true;
let scrollSpeed = 1; // 控制滚动速度
// 克隆表格行用于无缝滚动
const cloneRows = () => {
const rows = tbody.querySelectorAll('tr:not(.clone-row)');
// 清除之前的克隆行
const existingClones = tbody.querySelectorAll('.clone-row');
existingClones.forEach(clone => clone.remove());
// 只有当有原始行时才进行克隆
if (rows.length > 0) {
rows.forEach(row => {
@ -464,47 +464,47 @@ $(function() {
});
}
};
// 初始化克隆
cloneRows();
// 滚动动画
const scroll = () => {
if (!isScrolling) return;
const originalRows = tbody.querySelectorAll('tr:not(.clone-row)');
const rowHeight = originalRows[0]?.offsetHeight || 0;
const totalHeight = originalRows.length * rowHeight;
// 增加滚动位置
rankingList.scrollTop += scrollSpeed;
// 当滚动到克隆行的末尾时重置
if (rankingList.scrollTop >= totalHeight) {
// 立即重置到顶部,实现无缝循环效果
rankingList.scrollTop = 0;
}
requestAnimationFrame(scroll);
};
// 开始滚动
if (tbody.querySelectorAll('tr:not(.clone-row)').length > 0) {
// 确保初始滚动位置为0
rankingList.scrollTop = 0;
scroll();
}
// 鼠标悬停时暂停滚动
rankingList.addEventListener('mouseenter', () => {
isScrolling = false;
});
rankingList.addEventListener('mouseleave', () => {
isScrolling = true;
scroll();
});
// 监听窗口大小变化,重新计算克隆
window.addEventListener('resize', () => {
if (isScrolling) {
@ -515,7 +515,7 @@ $(function() {
rankingList.scrollTop = scrollPercentage * (tbody.clientHeight / 2);
}
});
// 定期重新克隆以保持最新数据
setInterval(() => {
if (isScrolling) {
@ -533,7 +533,7 @@ $(function() {
const partOne = data[0].partOne;
const updates = [];
console.log(partOne)
// 定义需要更新的字段
const fields = [
'projectCount', // 工程数量
@ -550,12 +550,12 @@ $(function() {
const element = document.getElementById(field);
if (element) {
// animateNumber(element, partOne[field] || 0);
const targetValue = partOne[field];
updates.push({ element, targetValue });
}
});
/* for (let key in mockData.overview) {
const element = document.getElementById(key);
if (element) {
@ -580,16 +580,16 @@ $(function() {
});
});
}
// 更新数据概览
async function initWarning() {
const data =await request(API.warning);
console.log(data)
const partFour = data[0].partFour;
console.log(partFour)
// 定义需要更新的字段
const fields = [
'storageNum', // 库存
@ -612,21 +612,21 @@ $(function() {
try {
// 显示加载状态
$('#equipmentCalendar').addClass('loading');
// 准备请求参数
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0');
const defaultTime = `${year}-${month}`;
// 构造请求参数
const params = {
time: time ? time.time : defaultTime
};
const data = await request(API.calendarList, params);
const calendarData = {};
// 添加月度统计对象
const monthStats = {
leaseNum: 0, // 领料出库总数
@ -715,7 +715,7 @@ $(function() {
const $item = $(this);
const label = $item.find('.month-stat-label').text().trim();
let value = 0;
// 根据标签文本匹配对应的统计值
switch(label) {
case '领料出库':
@ -740,7 +740,7 @@ $(function() {
value = monthStats.bdNum;
break;
}
// 更新统计值
$item.find('.month-stat-value').text(value);
});
@ -754,7 +754,7 @@ $(function() {
// 初始化或更新日历
layui.use(['laydate'], function() {
const laydate = layui.laydate;
// 如果已存在实例,先销毁
if (calendarInstance) {
try {
@ -765,7 +765,7 @@ $(function() {
console.error('销毁旧日历实例失败:', error);
}
}
// 创建新实例
const config = {
elem: '#equipmentCalendar',
@ -783,32 +783,32 @@ $(function() {
ready: function(date) {
console.log('日历准备完成:', date);
$('.layui-laydate-content').addClass('work-calendar');
// 监听左右箭头点击事件
$('.laydate-prev-m, .laydate-next-m, .laydate-prev-y, .laydate-next-y').off('click').on('click', function() {
setTimeout(() => {
const layDateContent = $('.layui-laydate-content');
const currentHeader = $('.layui-laydate-header');
// 获取当前显示的年月
const yearText = currentHeader.find('.laydate-set-ym span').first().text().replace(/年/, '');
const monthText = currentHeader.find('.laydate-set-ym span').last().text().replace(/月/, '');
const year = parseInt(yearText);
const month = parseInt(monthText);
// 验证年月的有效性
if (!isNaN(year) && !isNaN(month) && month >= 1 && month <= 12) {
const formattedMonth = month.toString().padStart(2, '0');
const currentDate = `${year}-${formattedMonth}`;
console.log('切换到:', currentDate);
// 防止重复触发
const lastUpdate = layDateContent.data('lastUpdate');
if (lastUpdate !== currentDate) {
layDateContent.data('lastUpdate', currentDate);
// 更新日历数据
updateCalendarData({time: currentDate}).catch(error => {
console.error('更新日历数据失败:', error);
@ -827,10 +827,10 @@ $(function() {
done: function(value, date, endDate) {
// 获取选中日期的完整格式 yyyy-MM-dd
const selectedDate = value + '-' + (date.date < 10 ? '0' + date.date : date.date);
// 从 calendarData 中获取选中日期的数据
const selectedData = calendarData[selectedDate];
// 解析数据,提取各个值
const dayData = {
date: selectedDate,
@ -842,18 +842,18 @@ $(function() {
newNum: 0,
bdNum: 0
};
// 如果有数据解析HTML字符串中的值
if (selectedData) {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = selectedData;
// 获取所有数值
const values = tempDiv.querySelectorAll('.data-value');
values.forEach(value => {
const text = value.previousElementSibling.textContent.trim();
const num = parseInt(value.textContent);
switch(text) {
case '领料出库': dayData.leaseNum = num; break;
case '退料接收': dayData.backNum = num; break;
@ -865,24 +865,24 @@ $(function() {
}
});
}
// 将数据存储到 localStorage
localStorage.setItem('calendarDate', selectedDate);
localStorage.setItem('calendarDayData', JSON.stringify(dayData));
let layerIndex = layer.open({
type: 2,
title: "机具日历详情",
// btn:['保存','取消'],
shade: [0],
area: ['80%', '80%'],
scrollbar: true,
move:false,
anim: 2,
yes:function(index,layero){
},
content: [bonuspath +'/backstage/indexHome/calendarDetail'],
success: function (layero, index) {
},
type: 2,
title: "机具日历详情",
// btn:['保存','取消'],
shade: [0],
area: ['80%', '80%'],
scrollbar: true,
move:false,
anim: 2,
yes:function(index,layero){
},
content: [bonuspath +'/backstage/indexHome/calendarDetail'],
success: function (layero, index) {
},
});
// 当用户点击日期时触发
/*layer.open({
@ -894,7 +894,7 @@ $(function() {
});*/
}
};
// 保存实例引用
calendarInstance = laydate.render(config);
console.log('日历实例创建完成:', calendarInstance);
@ -915,12 +915,12 @@ $(function() {
$('.todo-tab').click(function() {
$('.todo-tab').removeClass('active');
$(this).addClass('active');
const type = $(this).data('type');
// 这里可以根据类型加载不同的数据
if(type === 'mine') {
fetchTodoList(type);
// 加载我的待办
} else {
// 加载全部待办
@ -938,12 +938,12 @@ $(function() {
console.error('获取待办数据失败:', error);
}
}
// 获取待办事项详细列表
async function fetchTodoDetails() {
try {
console.log('准备请求待办详情URL:', bonuspath + API.todoDetails);
// 显示加载状态
const tableBody = document.querySelector('table tbody');
if (tableBody) {
@ -953,7 +953,7 @@ $(function() {
</tr>
`;
}
const data = await request(API.todoDetails);
console.log('获取到的待办详情:', data);
updateTodoDetailList(data);
@ -963,13 +963,13 @@ $(function() {
updateTodoDetailList([]);
}
}
function updateTodoList(data) {
// 这个函数现在只更新统计数据(如果需要的话)
// 因为我们现在显示的是详细列表而不是统计数据
console.log('待办统计数据:', data);
}
// 格式化日期时间
function formatDateTime(dateTimeStr) {
if (!dateTimeStr) return '';
@ -995,28 +995,28 @@ $(function() {
function updateTodoDetailList(todoData) {
// 缓存数据
todoDataCache = todoData || [];
// 初始化分页
initTodoPagination();
// 渲染当前页数据
renderTodoPage();
}
// 初始化分页控件
function initTodoPagination() {
const total = todoDataCache.length;
const totalPages = Math.ceil(total / pageSize);
// 更新分页信息
document.getElementById('todoTotal').textContent = total;
document.getElementById('todoPageSize').textContent = pageSize;
document.getElementById('todoPageInfo').textContent = `${currentPage} / ${totalPages}`;
// 更新按钮状态
const prevBtn = document.getElementById('todoPrevBtn');
const nextBtn = document.getElementById('todoNextBtn');
if (prevBtn) {
prevBtn.disabled = currentPage <= 1;
prevBtn.onclick = () => {
@ -1027,7 +1027,7 @@ $(function() {
}
};
}
if (nextBtn) {
nextBtn.disabled = currentPage >= totalPages;
nextBtn.onclick = () => {
@ -1038,7 +1038,7 @@ $(function() {
}
};
}
// 绑定页面大小选择器
const pageSizeSelect = document.getElementById('todoPageSizeSelect');
if (pageSizeSelect) {
@ -1051,7 +1051,7 @@ $(function() {
};
}
}
// 渲染当前页的待办事项
function renderTodoPage() {
// 使用更通用的选择器,不依赖于特定的类名
@ -1060,10 +1060,10 @@ $(function() {
console.error('表格tbody不存在');
return;
}
// 清空现有内容
tableBody.innerHTML = '';
if (todoDataCache.length === 0) {
tableBody.innerHTML = `
<tr>
@ -1072,12 +1072,12 @@ $(function() {
`;
return;
}
// 计算当前页显示的数据范围
const startIndex = (currentPage - 1) * pageSize;
const endIndex = Math.min(startIndex + pageSize, todoDataCache.length);
const displayTasks = todoDataCache.slice(startIndex, endIndex);
// 渲染数据行
displayTasks.forEach(task => {
// 根据任务类型设置不同的图标颜色
@ -1091,17 +1091,17 @@ $(function() {
} else {
iconClass += ' other';
}
const taskName = task.taskName || task.taskType || '待办任务';
const taskCode = task.taskCode || '无';
const userName = task.userName || '无';
const time = formatDateTime(task.time) || '无';
const row = document.createElement('tr');
row.setAttribute('data-task-id', task.id || '');
row.setAttribute('data-link-url', task.linkUrl || '');
row.style.cursor = 'pointer';
row.innerHTML = `
<td>
<span class="${iconClass}"></span>
@ -1120,34 +1120,34 @@ $(function() {
<span class="todo-time" title="${task.time || '无'}">${time}</span>
</td>
`;
// 添加点击事件
row.addEventListener('click', function() {
const taskId = this.getAttribute('data-task-id');
const linkUrl = this.getAttribute('data-link-url');
const taskName = this.querySelector('.todo-task-name').textContent;
console.log('点击待办事项:', { taskId, linkUrl, taskName });
// 如果有linkUrl使用linkUrl跳转
if (linkUrl && window.parent && typeof window.parent.TabControlAppend === 'function') {
window.parent.TabControlAppend(
taskId || 'todo_' + Date.now(),
taskName || '待办事项',
taskId || 'todo_' + Date.now(),
taskName || '待办事项',
bonuspath + linkUrl
);
} else {
// 默认跳转到待办事项列表页面
if (window.parent && typeof window.parent.TabControlAppend === 'function') {
window.parent.TabControlAppend(
'todoList',
'待办事项',
'todoList',
'待办事项',
bonuspath + '/backstage/indexHome/todo/index'
);
}
}
});
tableBody.appendChild(row);
});
}
@ -1173,11 +1173,11 @@ $(function() {
if (container) {
const chart = echarts.init(container);
charts[`chart${index + 1}`] = chart;
// 设置一个初始的空配置,避免白屏
const emptyOption = createCircleChartOption(
{value: 0, total: 100},
config.title,
{value: 0, total: 100},
config.title,
config.color
);
chart.setOption(emptyOption);
@ -1189,7 +1189,7 @@ $(function() {
// 获取并更新数据
await fetchStorageData();
} catch (error) {
console.error('初始化图表时出错:', error);
throw error;
@ -1201,10 +1201,10 @@ $(function() {
try {
// 显示加载状态
$('.chart-grid').addClass('loading');
const data = await request(API.storage);
console.log('获取到的存储数据:', data);
if (!data || !data[0] || !data[0].partTwo) {
console.warn('存储数据格式不正确');
return;
@ -1212,7 +1212,7 @@ $(function() {
const partTwo = data[0].partTwo;
await updateStorageCharts(partTwo);
} catch (error) {
console.error('获取入库占比数据失败:', error);
throw error;
@ -1247,7 +1247,7 @@ $(function() {
chartData=data['repairStorage'] || { value: 0, total: 100 };
}
const option = createCircleChartOption(chartData, config.title, config.color);
try {
chart.setOption(option);
} catch (err) {
@ -1277,12 +1277,12 @@ $(function() {
// 最多显示10个功能
const functions = data.slice(0, 10);
// 渲染功能按钮
functions.forEach(func => {
const functionItem = document.createElement('div');
functionItem.className = 'function-item';
// 修改点击事件处理
functionItem.onclick = (e) => {
e.preventDefault();
@ -1300,8 +1300,8 @@ $(function() {
// 修改 innerHTML 为字符串拼接
const iconClass = func.rsIcon || 'layui-icon-app';
functionItem.innerHTML = '<i class="' + iconClass + '"></i>' +
'<span>' + func.rsName + '</span>';
'<span>' + func.rsName + '</span>';
functionList.appendChild(functionItem);
});
@ -1318,7 +1318,7 @@ $(function() {
const parentWindow = window.parent || window.top;
console.log('Parent window:', parentWindow);
console.log('TabControlAppend exists:', typeof parentWindow.TabControlAppend === 'function');
if (!parentWindow) {
console.error('无法获取父窗口');
return;

View File

@ -1604,6 +1604,12 @@
left join mm_type mt on wir.MODEL_ID = mt.ID
left join mm_type mt2 on mt.PARENT_ID = mt2.ID
where wir.TYPE = #{type}
<if test="maType != null and maType != ''">
and mt2.NAME like concat('%', #{maType}, '%')
</if>
<if test="maName != null and maName != ''">
and mt.NAME like concat('%', #{maName}, '%')
</if>
</select>
<select id="getInventoryStored" resultType="com.bonus.index.beans.IndexStorageWarnBean">
select mt2.NAME as maType,
@ -1614,5 +1620,11 @@
left join mm_type mt on wir.MODEL_ID = mt.ID
left join mm_type mt2 on mt.PARENT_ID = mt2.ID
where wir.INVENTORY_TYPE = "盘盈"
<if test="maType != null and maType != ''">
and mt2.NAME like concat('%', #{maType}, '%')
</if>
<if test="maName != null and maName != ''">
and mt.NAME like concat('%', #{maName}, '%')
</if>
</select>
</mapper>