diff --git a/electron/main/item/ipcEvent.ts b/electron/main/item/ipcEvent.ts index 7a6e4e5..8bab56c 100644 --- a/electron/main/item/ipcEvent.ts +++ b/electron/main/item/ipcEvent.ts @@ -179,6 +179,13 @@ export default function () { // 组装菜单 if (!batchOperation) { if (item) { + // 查询页面分类信息 + let pageClassification = selectClassificationById( + args.pageClassificationId + ); + if (!pageClassification && type === "main") { + return; + } // 后缀 let ext: string | null = null; // 排除 @@ -306,7 +313,8 @@ export default function () { if ( type === "main" && (item.type === 0 || item.type === 1) && - classification.type === 0 + classification.type === 0 && + pageClassification.type === 0 ) { menuList.push( new MenuItem({ @@ -337,7 +345,11 @@ export default function () { if (pathMenu) { menuList.push(new MenuItem({ type: "separator" })); } - if (type === "main") { + if ( + type === "main" && + classification.type === 0 && + pageClassification.type === 0 + ) { // "图标"菜单 let existPasteIcon = false; // 获取剪切板图片文件 @@ -373,7 +385,9 @@ export default function () { if ( type === "main" && (item.type === 0 || item.type === 1) && - !item.data.fixedIcon + !item.data.fixedIcon && + classification.type === 0 && + pageClassification.type === 0 ) { menuList.push( new MenuItem({ @@ -384,7 +398,11 @@ export default function () { }) ); } - if (type === "main" && classification.type === 0) { + if ( + type === "main" && + classification.type === 0 && + pageClassification.type === 0 + ) { menuList.push(new MenuItem({ type: "separator" })); menuList.push( new MenuItem({ diff --git a/src/pages/item/components/Content.vue b/src/pages/item/components/Content.vue index 8c37d21..aa0d1ba 100644 --- a/src/pages/item/components/Content.vue +++ b/src/pages/item/components/Content.vue @@ -623,6 +623,14 @@ async function contextmenu(e: any) { // 记录右键选中的ID store.itemRightMenuItemId = id; } + // 获取当前项目在页面的所属分类 + let pageClassificationId = null; + let itemListElement = getClassElement(e, "item-list"); + if (itemListElement) { + pageClassificationId = parseInt( + itemListElement.getAttribute("classification-id") + ); + } // 弹出菜单 window.item.showRightMenu({ classificationId: getSelectedClassificationId(), @@ -633,6 +641,7 @@ async function contextmenu(e: any) { x: e.screenX, y: e.screenY, type: "main", + pageClassificationId, }); } // beforeMount