-회로 미할당 모듈 삭제 추가

This commit is contained in:
김민식 2025-02-04 15:52:46 +09:00
parent bc06d35bcf
commit 71be077b2b

View File

@ -95,6 +95,7 @@ export default function CircuitTrestleSetting({ id }) {
return {
...model,
id: uuidv4(),
isUsed: false,
}
})
const pcsVoltageChkParams = {
@ -252,36 +253,6 @@ export default function CircuitTrestleSetting({ id }) {
return moduleList
}
const onAutoAllocation = () => {
let moduleStdQty = 0
let moduleMaxQty = 0
const selectedModels = models.filter((m) => m.selected)
if (selectedModels.length === 0) {
onAutoRecommend()
} else {
moduleStdQty = selectedModels.reduce((acc, model) => {
return acc + parseInt(model.moduleStdQty)
}, 0)
moduleMaxQty = selectedModels.reduce((acc, model) => {
return acc + parseInt(model.moduleMaxQty)
}, 0)
}
// const target = pcsCheck.max ? moduleMaxQty : moduleStdQty
// const placementModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
// if (placementModules.length > target) {
// swalFire({
// title: ' . .',
// type: 'alert',
// })
// return
// }
// setAllocationType(ALLOCATION_TYPE.AUTO)
// setTabNum(2)
}
const onPassivityAllocation = () => {
if (selectedModels.length === 0) {
const params = {
@ -364,10 +335,16 @@ export default function CircuitTrestleSetting({ id }) {
obj.pcses = getStepUpListData()
})
console.log(canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE))
removeNotAllocationModules()
apply()
}
const removeNotAllocationModules = () => {
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
canvas.remove(...notAllocationModules)
canvas.renderAll()
}
const onClickPrev = () => {
setAllocationType(ALLOCATION_TYPE.AUTO)
swalFire({
@ -478,7 +455,7 @@ export default function CircuitTrestleSetting({ id }) {
{tabNum === 2 && <StepUp {...stepUpProps} onInitialize={handleStepUpInitialize} />}
{tabNum === 1 && allocationType === ALLOCATION_TYPE.AUTO && (
<div className="grid-btn-wrap">
<button className="btn-frame modal mr5" onClick={() => onAutoAllocation()}>
<button className="btn-frame modal mr5" onClick={() => onAutoRecommend()}>
{getMessage('modal.circuit.trestle.setting.circuit.allocation.auto')}
</button>
<button className="btn-frame modal act" onClick={() => onPassivityAllocation()}>