-회로 미할당 모듈 삭제 추가
This commit is contained in:
parent
bc06d35bcf
commit
71be077b2b
@ -95,6 +95,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
return {
|
return {
|
||||||
...model,
|
...model,
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
|
isUsed: false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const pcsVoltageChkParams = {
|
const pcsVoltageChkParams = {
|
||||||
@ -252,36 +253,6 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
return moduleList
|
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 = () => {
|
const onPassivityAllocation = () => {
|
||||||
if (selectedModels.length === 0) {
|
if (selectedModels.length === 0) {
|
||||||
const params = {
|
const params = {
|
||||||
@ -364,10 +335,16 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
obj.pcses = getStepUpListData()
|
obj.pcses = getStepUpListData()
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE))
|
removeNotAllocationModules()
|
||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeNotAllocationModules = () => {
|
||||||
|
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
|
||||||
|
canvas.remove(...notAllocationModules)
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
|
||||||
const onClickPrev = () => {
|
const onClickPrev = () => {
|
||||||
setAllocationType(ALLOCATION_TYPE.AUTO)
|
setAllocationType(ALLOCATION_TYPE.AUTO)
|
||||||
swalFire({
|
swalFire({
|
||||||
@ -478,7 +455,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
{tabNum === 2 && <StepUp {...stepUpProps} onInitialize={handleStepUpInitialize} />}
|
{tabNum === 2 && <StepUp {...stepUpProps} onInitialize={handleStepUpInitialize} />}
|
||||||
{tabNum === 1 && allocationType === ALLOCATION_TYPE.AUTO && (
|
{tabNum === 1 && allocationType === ALLOCATION_TYPE.AUTO && (
|
||||||
<div className="grid-btn-wrap">
|
<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')}
|
{getMessage('modal.circuit.trestle.setting.circuit.allocation.auto')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn-frame modal act" onClick={() => onPassivityAllocation()}>
|
<button className="btn-frame modal act" onClick={() => onPassivityAllocation()}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user