2025-11-18 21:05
现象:
用户描述:
"首先交付执行阶段点击 revision-task-list、revision-task-modal 后显示的面板点击教会不了"
用户担心:
"请你检查一下是否修改了原来的报价空间的初始名字"
检查结果:✅ 未被修改
原始z-index层级:
图片库背景遮罩:z-index: 1000
图片库内容:z-index: 1000
工单列表全屏:z-index: 1500 ❌ 被图片库遮罩阻挡
消息发送弹窗:z-index: 2000 ❌ 被图片库遮罩阻挡
工单创建弹窗:z-index: 2100 ❌ 被图片库遮罩阻挡
工单内部弹窗:z-index: 2200 ❌ 被图片库遮罩阻挡
问题:
虽然改图工单弹窗的 z-index 高于图片库,但是:
pointer-events 未正确设置当多个模态框同时存在时:
新的z-index层级(从低到高):
页面内容: z-index: 1 ~ 100
拖拽覆盖层: z-index: 465
空间覆盖层: z-index: 769
图片库背景遮罩: z-index: 1000
图片库内容: z-index: 1000
工单列表全屏: z-index: 2100 ✅ 高于图片库
消息发送弹窗: z-index: 2300 ✅ 高于工单列表
工单创建弹窗: z-index: 2400 ✅ 高于消息弹窗
工单内部弹窗(审批/报价): z-index: 2500 ✅ 最高
层级规则:
修改内容:
// 所有弹窗遮罩层都添加
pointer-events: auto; // ✅ 确保可以接收点击事件
作用:
弹窗内容区域:
<div class="modal-overlay" (click)="closeModal()">
<div class="modal-container" (click)="$event.stopPropagation()">
<!-- 阻止点击事件冒泡到遮罩层 -->
</div>
</div>
stage-delivery-new.component.scss修改位置1:工单列表全屏(第1470行)
.revision-list-fullscreen {
z-index: 2100; // ✅ 从 1500 提升到 2100
pointer-events: auto; // ✅ 新增
}
修改位置2:消息发送弹窗(第1513行)
.message-modal-overlay {
z-index: 2300; // ✅ 从 2000 提升到 2300
pointer-events: auto; // ✅ 新增
}
revision-task-modal.component.scss修改位置:创建工单弹窗(第11行)
.modal-overlay {
z-index: 2400; // ✅ 从 2100 提升到 2400
pointer-events: auto; // ✅ 新增
}
revision-task-list.component.scss修改位置:审批/报价弹窗(第349行)
.modal-overlay {
z-index: 2500; // ✅ 从 2200 提升到 2500
pointer-events: auto; // ✅ 新增
}
空间名字来源(优先级从高到低):
getSpaceDisplayName(product: Project): string {
const data = this.project?.get('data') || {};
const spaces = data?.quotation?.spaces || [];
// 1️⃣ 优先:从报价中匹配的空间名(精确匹配productId)
const matched = spaces.find(s => s?.productId === product.id);
if (matched?.name) return matched.name;
// 2️⃣ 次优:从报价中匹配的空间名(模糊匹配name)
const fuzzyMatch = spaces.find(s =>
(s?.name || '').trim().toLowerCase() ===
(product.name || '').trim().toLowerCase()
);
if (fuzzyMatch?.name) return fuzzyMatch.name;
// 3️⃣ 默认:Product表中的name
if (product.name) return product.name;
// 4️⃣ 兜底:根据type获取默认名称
return this.productSpaceService.getProductTypeName(product.type);
}
数据流向:
订单分配阶段
↓
用户输入空间名(如"主卧")
↓
保存到 Project.data.quotation.spaces[].name
↓
同步创建 Product 记录,name = "主卧"
↓
交付执行阶段
↓
调用 getSpaceDisplayName()
↓
读取 data.quotation.spaces 中的名字 ✅ 保持一致
结论:
在浏览器开发者工具中:
// 打开弹窗后,在控制台运行
const overlays = document.querySelectorAll('[class*="overlay"]');
overlays.forEach(el => {
const zIndex = window.getComputedStyle(el).zIndex;
console.log(el.className, 'z-index:', zIndex);
});
const overlays = document.querySelectorAll('[class*="overlay"]');
overlays.forEach(el => {
const pe = window.getComputedStyle(el).pointerEvents;
console.log(el.className, 'pointer-events:', pe);
});
// 点击弹窗时,查看实际接收点击的元素
document.addEventListener('click', (e) => {
console.log('点击的元素:', e.target);
}, true);
Ctrl + Shift + R 强制刷新问题:日志显示大量 drag-upload-modal ngOnChanges 被调用
🔄 ngOnChanges 被调用 {changes: Array(2), visible: false...}
原因:
优化建议:
OnPush 变更检测策略trackBy 函数优化 @for 循环示例:
@Component({
changeDetection: ChangeDetectionStrategy.OnPush // ✅ 添加
})
export class DragUploadModalComponent {
// ...
}
创建 ModalService 统一管理所有弹窗:
class ModalStack {
private stack: Modal[] = [];
private baseZIndex = 2000;
open(modal: Modal) {
modal.zIndex = this.baseZIndex + this.stack.length * 100;
this.stack.push(modal);
}
close(modal: Modal) {
const index = this.stack.indexOf(modal);
if (index > -1) {
this.stack.splice(index, 1);
}
}
}
修复完成时间:2025-11-18 21:05
修复人:Cascade AI Assistant
状态:✅ 已完成,待用户验证