恢复刀具房样式和编码

This commit is contained in:
guyaodong
2025-06-19 16:18:04 +08:00
parent 8b66fda899
commit aec2d1c516
4 changed files with 56 additions and 12 deletions

View File

@@ -28,8 +28,18 @@ class CustomKanbanController extends KanbanController {
isBaseStyle: true
});
let self = this;
// 获取货架分层数据
onWillStart(async () => {
try {
this.preproductionShelfIds = await this.orm.call(
'sf.shelf.location',
'get_preproduction_shelf_ids',
[]
);
} catch (error) {
this.preproductionShelfIds = [];
}
this.searchModel.on('update', self, self._onUpdate);
await this.loadShelfLayersData();
});
@@ -50,7 +60,11 @@ class CustomKanbanController extends KanbanController {
let domain = this.searchModel.domain;
if (domain.length > 0) {
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
this.onShelfChange(shelfDomain[2]);
if (shelfDomain && shelfDomain[2] && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
this.onShelfChange(shelfDomain[2]);
} else {
this.setKanbanStyle('sf_kanban_location_style');
}
} else {
this.setKanbanStyle('sf_kanban_location_style');
}
@@ -63,8 +77,7 @@ class CustomKanbanController extends KanbanController {
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
if (shelfDomain) {
let shelfId = shelfDomain[2];
// 如果货架ID存在则设置相应的样式
if (shelfId) {
if (shelfId && this.preproductionShelfIds.includes(shelfId)) {
this.onShelfChange(shelfId);
return;
}
@@ -75,7 +88,6 @@ class CustomKanbanController extends KanbanController {
this.setKanbanStyle('sf_kanban_location_style');
} catch (error) {
}
}
// 加载所有货架的层数数据
@@ -107,10 +119,18 @@ class CustomKanbanController extends KanbanController {
// 添加新类
if (isHave) kanbanViewEl.classList.add(style);
}
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
ghostCards.forEach(card => {
card.remove();
});
// 获取当前的搜索域
let domain = this.searchModel.domain;
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
// 只有当shelf_id在preproductionShelfIds中时才删除幽灵看板
if (shelfDomain && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
ghostCards.forEach(card => {
card.remove();
});
}
}
updatePagerLimit(limit) {