회로있을때 모듈 수정 불가하게 제한
This commit is contained in:
parent
ea8c3bdd71
commit
7f90a9f18a
@ -706,12 +706,68 @@ export function useContextMenu() {
|
|||||||
{
|
{
|
||||||
id: 'moduleVerticalCenterAlign',
|
id: 'moduleVerticalCenterAlign',
|
||||||
name: getMessage('contextmenu.module.vertical.align'),
|
name: getMessage('contextmenu.module.vertical.align'),
|
||||||
fn: () => alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData ?? [currentObject]),
|
fn: () => {
|
||||||
|
if (currentObject.arrayData) {
|
||||||
|
let existCircuit = false
|
||||||
|
currentObject.arrayData.forEach((surface) => {
|
||||||
|
surface.modules.forEach((module) => {
|
||||||
|
if (module.circuit) existCircuit = true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (existCircuit) {
|
||||||
|
swalFire({
|
||||||
|
title: getMessage('can.not.move.module'),
|
||||||
|
icon: 'error',
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const allocatedModules = currentObject.modules.filter((module) => module.circuit !== null)
|
||||||
|
if (allocatedModules.length > 0) {
|
||||||
|
swalFire({
|
||||||
|
title: getMessage('can.not.move.module'),
|
||||||
|
icon: 'error',
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData ?? [currentObject])
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'moduleHorizonCenterAlign',
|
id: 'moduleHorizonCenterAlign',
|
||||||
name: getMessage('contextmenu.module.horizon.align'),
|
name: getMessage('contextmenu.module.horizon.align'),
|
||||||
fn: () => alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData ?? [currentObject]),
|
fn: () => {
|
||||||
|
if (currentObject.arrayData) {
|
||||||
|
let existCircuit = false
|
||||||
|
currentObject.arrayData.forEach((surface) => {
|
||||||
|
surface.modules.forEach((module) => {
|
||||||
|
if (module.circuit) existCircuit = true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (existCircuit) {
|
||||||
|
swalFire({
|
||||||
|
title: getMessage('can.not.move.module'),
|
||||||
|
icon: 'error',
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const allocatedModules = currentObject.modules.filter((module) => module.circuit !== null)
|
||||||
|
if (allocatedModules.length > 0) {
|
||||||
|
swalFire({
|
||||||
|
title: getMessage('can.not.move.module'),
|
||||||
|
icon: 'error',
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData ?? [currentObject])
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'moduleRemove',
|
id: 'moduleRemove',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user