feat(退火模块): 新增退火报表页面并优化现有功能
新增退火报表页面,支持按时间、炉号等条件查询统计信息 优化退火计划和性能页面,增加当前钢卷号和逻辑库区筛选 改进KLPTable浮层组件,支持嵌套属性访问和更智能的定位 重构退火计划控制页面布局和交互,提升用户体验
This commit is contained in:
@@ -41,7 +41,20 @@ export default {
|
||||
computed: {
|
||||
// 一个列要同时有用 label 和 prop 才显示在浮层中, 并且prop有值时才显示
|
||||
visibleColumns() {
|
||||
return this.columns.filter(field => field.label && field.prop && this.data[field.prop])
|
||||
// 辅助函数:递归/迭代获取多层嵌套的属性值
|
||||
const getNestedValue = (obj, path) => {
|
||||
if (!obj || !path) return undefined;
|
||||
const pathArr = Array.isArray(path) ? path : path.split('.');
|
||||
return pathArr.reduce((current, key) => {
|
||||
return current === null || current === undefined ? undefined : current[key];
|
||||
}, obj);
|
||||
};
|
||||
|
||||
return this.columns.filter(field => {
|
||||
if (!field.label || !field.prop) return false;
|
||||
const value = getNestedValue(this.data, field.prop);
|
||||
return value !== null && value !== undefined && value !== '';
|
||||
})
|
||||
},
|
||||
// 修正后的tooltipStyle / 其实tooltipStyle只包含两个属性:top, left, 当在屏幕中无法完全展示时,需要根据实际情况调整位置
|
||||
adjustedTooltipStyle() {
|
||||
@@ -51,31 +64,44 @@ export default {
|
||||
|
||||
let adjustedTop = parseInt(top);
|
||||
let adjustedLeft = parseInt(left);
|
||||
const offset = 16;
|
||||
const offset = 20;
|
||||
const scrollY = window.pageYOffset || document.documentElement.scrollTop;
|
||||
|
||||
// 考虑页面滚动的影响
|
||||
adjustedTop += scrollY;
|
||||
|
||||
// 检查是否超出底部边界 - 如果超出,将浮层显示在鼠标上方
|
||||
if (adjustedTop + tooltipRect.height > window.innerHeight) {
|
||||
adjustedTop = adjustedTop - tooltipRect.height - offset;
|
||||
// 先尝试显示在右下方
|
||||
let finalTop = adjustedTop;
|
||||
let finalLeft = adjustedLeft;
|
||||
|
||||
// 检查是否超出右边界,如果超出则显示在左方
|
||||
if (finalLeft + tooltipRect.width > window.innerWidth + (window.pageXOffset || 0)) {
|
||||
finalLeft = adjustedLeft - tooltipRect.width - offset;
|
||||
}
|
||||
|
||||
// 检查是否超出右侧边界 - 如果超出,将浮层显示在鼠标左侧
|
||||
if (adjustedLeft + tooltipRect.width > window.innerWidth) {
|
||||
adjustedLeft = adjustedLeft - tooltipRect.width - offset;
|
||||
// 检查是否超出下边界,如果超出则显示在上方
|
||||
if (finalTop + tooltipRect.height > window.innerHeight + scrollY) {
|
||||
finalTop = adjustedTop - tooltipRect.height - offset;
|
||||
}
|
||||
|
||||
// 检查是否超出顶部边界
|
||||
if (adjustedTop < 0) {
|
||||
adjustedTop = offset;
|
||||
// 确保浮层不会超出上边界
|
||||
if (finalTop < scrollY) {
|
||||
finalTop = scrollY + offset;
|
||||
}
|
||||
|
||||
// 检查是否超出左侧边界
|
||||
if (adjustedLeft < 0) {
|
||||
adjustedLeft = offset;
|
||||
// 确保浮层不会超出左边界
|
||||
if (finalLeft < 0) {
|
||||
finalLeft = offset;
|
||||
}
|
||||
|
||||
// 再次检查并调整右边界
|
||||
if (finalLeft + tooltipRect.width > window.innerWidth + (window.pageXOffset || 0)) {
|
||||
finalLeft = Math.max(offset, (window.innerWidth - tooltipRect.width) / 2);
|
||||
}
|
||||
|
||||
return {
|
||||
top: `${adjustedTop}px`,
|
||||
left: `${adjustedLeft}px`
|
||||
top: `${finalTop}px`,
|
||||
left: `${finalLeft}px`
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -117,32 +143,39 @@ export default {
|
||||
position: absolute;
|
||||
background: #ffffff;
|
||||
border: 1px solid #dcdcdc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
|
||||
padding: 16px 18px;
|
||||
pointer-events: none;
|
||||
z-index: 9999;
|
||||
overflow: auto;
|
||||
transition: all 0.3s ease-in-out;
|
||||
transition: all 0.25s ease-out;
|
||||
max-height: 75vh;
|
||||
min-width: 420px;
|
||||
}
|
||||
|
||||
.tooltip-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
gap: 10px 16px;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.tooltip-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.tooltip-item .label {
|
||||
flex-shrink: 0;
|
||||
color: #666;
|
||||
color: #909399;
|
||||
font-weight: 500;
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
.tooltip-item .value {
|
||||
color: #333;
|
||||
color: #303133;
|
||||
word-break: break-word;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user