Merge branch 'dev' into dev-yj
This commit is contained in:
commit
716410008a
@ -47,7 +47,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const [circuitAllocationType, setCircuitAllocationType] = useState(1)
|
const [circuitAllocationType, setCircuitAllocationType] = useState(1)
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const { getPcsAutoRecommendList, getPcsVoltageChk } = useMasterController()
|
const { getPcsAutoRecommendList, getPcsVoltageChk, getPcsVoltageStepUpList } = useMasterController()
|
||||||
|
|
||||||
// 회로할당(승합설정)에서 선택된 값들을 저장할 상태 추가
|
// 회로할당(승합설정)에서 선택된 값들을 저장할 상태 추가
|
||||||
const [selectedStepUpValues, setSelectedStepUpValues] = useState({})
|
const [selectedStepUpValues, setSelectedStepUpValues] = useState({})
|
||||||
@ -63,6 +63,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// 수동할당 시 모듈 삭제
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (allocationType === ALLOCATION_TYPE.PASSIVITY && tabNum === 2) {
|
if (allocationType === ALLOCATION_TYPE.PASSIVITY && tabNum === 2) {
|
||||||
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
|
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
|
||||||
@ -71,6 +72,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
}, [tabNum])
|
}, [tabNum])
|
||||||
|
|
||||||
|
// 시리즈중 자동으로 추천 PCS 정보 조회
|
||||||
const onAutoRecommend = () => {
|
const onAutoRecommend = () => {
|
||||||
if (series.filter((s) => s.selected).length === 0) {
|
if (series.filter((s) => s.selected).length === 0) {
|
||||||
swalFire({
|
swalFire({
|
||||||
@ -87,7 +89,9 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: getPcsItemList(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 파워컨디셔너 추천 목록 조회
|
||||||
if (selectedModels.length === 0) {
|
if (selectedModels.length === 0) {
|
||||||
|
// 시리즈중 자동으로 추천 PCS 정보 조회
|
||||||
getPcsAutoRecommendList(params).then((res) => {
|
getPcsAutoRecommendList(params).then((res) => {
|
||||||
if (res.data?.pcsItemList) {
|
if (res.data?.pcsItemList) {
|
||||||
const itemList = models.filter((model) => {
|
const itemList = models.filter((model) => {
|
||||||
@ -100,15 +104,25 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
isUsed: false,
|
isUsed: false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// 회로 구성 가능 여부 체크 요청 파라미터
|
||||||
const pcsVoltageChkParams = {
|
const pcsVoltageChkParams = {
|
||||||
...getOptYn(),
|
...getOptYn(),
|
||||||
useModuleItemList: getUseModuleItemList(),
|
useModuleItemList: getUseModuleItemList(),
|
||||||
roofSurfaceList: getRoofSurfaceList(),
|
roofSurfaceList: getRoofSurfaceList(),
|
||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: getPcsItemList(),
|
||||||
}
|
}
|
||||||
|
// 추천 목록 선택
|
||||||
setSelectedModels(selectedModels)
|
setSelectedModels(selectedModels)
|
||||||
|
// 회로 구성 가능 여부 체크
|
||||||
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
||||||
setTabNum(2)
|
if (res.resultCode === 'S') {
|
||||||
|
setTabNum(2)
|
||||||
|
} else {
|
||||||
|
swalFire({
|
||||||
|
title: res.resultMsg,
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 데이터가 없는 경우 오류 메시지 확인 필요
|
// 데이터가 없는 경우 오류 메시지 확인 필요
|
||||||
@ -126,12 +140,27 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
getPcsVoltageChk(params).then((res) => {
|
// 회로 구성 가능 여부 체크
|
||||||
setTabNum(2)
|
getPcsVoltageChk({ ...params, pcsItemList: getSelectedPcsItemList() }).then((res) => {
|
||||||
|
if (res.resultCode === 'S') {
|
||||||
|
// 회로 구성 가능 여부 체크 통과 시 승압설정 정보 조회
|
||||||
|
getPcsVoltageStepUpList({
|
||||||
|
...params,
|
||||||
|
pcsItemList: getSelectedPcsItemList(),
|
||||||
|
}).then((res) => {
|
||||||
|
setTabNum(2)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
swalFire({
|
||||||
|
title: res.resultMsg,
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 옵션 Y/N
|
||||||
const getOptYn = () => {
|
const getOptYn = () => {
|
||||||
return {
|
return {
|
||||||
maxConnYn: pcsCheck.max ? 'Y' : 'N',
|
maxConnYn: pcsCheck.max ? 'Y' : 'N',
|
||||||
@ -140,6 +169,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PCS 아이템 목록
|
||||||
const getPcsItemList = () => {
|
const getPcsItemList = () => {
|
||||||
return models.map((model) => {
|
return models.map((model) => {
|
||||||
return {
|
return {
|
||||||
@ -150,6 +180,18 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 선택된 PCS 아이템 목록
|
||||||
|
const getSelectedPcsItemList = () => {
|
||||||
|
return selectedModels.map((model) => {
|
||||||
|
return {
|
||||||
|
itemId: model.itemId,
|
||||||
|
pcsMkrCd: model.pcsMkrCd,
|
||||||
|
pcsSerCd: model.pcsSerCd,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 사용된 모듈아이템 목록
|
||||||
const getUseModuleItemList = () => {
|
const getUseModuleItemList = () => {
|
||||||
return selectedModules.itemList.map((m) => {
|
return selectedModules.itemList.map((m) => {
|
||||||
return {
|
return {
|
||||||
@ -159,6 +201,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 지붕면 목록
|
||||||
const getRoofSurfaceList = () => {
|
const getRoofSurfaceList = () => {
|
||||||
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
roofSurfaceList.sort((a, b) => a.left - b.left || b.top - a.top)
|
roofSurfaceList.sort((a, b) => a.left - b.left || b.top - a.top)
|
||||||
@ -182,6 +225,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 모듈 목록
|
||||||
const getModuleList = (surface) => {
|
const getModuleList = (surface) => {
|
||||||
let moduleList = []
|
let moduleList = []
|
||||||
let [xObj, yObj] = [{}, {}]
|
let [xObj, yObj] = [{}, {}]
|
||||||
@ -255,6 +299,40 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
return moduleList
|
return moduleList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 자동할당 버튼 클릭 시
|
||||||
|
const onAutoAllocation = () => {
|
||||||
|
let moduleStdQty = 0
|
||||||
|
let moduleMaxQty = 0
|
||||||
|
const selectedModels = models.filter((m) => m.selected)
|
||||||
|
|
||||||
|
// 시리즈중 자동으로 추천 PCS 정보 조회
|
||||||
|
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 = {
|
||||||
@ -264,6 +342,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: getPcsItemList(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 파워컨디셔너 추천 목록 조회
|
||||||
getPcsAutoRecommendList(params).then((res) => {
|
getPcsAutoRecommendList(params).then((res) => {
|
||||||
if (res.data?.pcsItemList) {
|
if (res.data?.pcsItemList) {
|
||||||
const itemList = models.filter((model) => {
|
const itemList = models.filter((model) => {
|
||||||
@ -350,6 +429,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 이전 버튼 클릭 시
|
||||||
const onClickPrev = () => {
|
const onClickPrev = () => {
|
||||||
setAllocationType(ALLOCATION_TYPE.AUTO)
|
setAllocationType(ALLOCATION_TYPE.AUTO)
|
||||||
swalFire({
|
swalFire({
|
||||||
@ -371,6 +451,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 파워컨디셔너 컴포넌트 속성
|
||||||
const powerConditionalSelectProps = {
|
const powerConditionalSelectProps = {
|
||||||
tabNum,
|
tabNum,
|
||||||
setTabNum,
|
setTabNum,
|
||||||
@ -387,6 +468,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
managementState,
|
managementState,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 수동할당 컴포넌트 속성
|
||||||
const passivityProps = {
|
const passivityProps = {
|
||||||
tabNum,
|
tabNum,
|
||||||
setTabNum,
|
setTabNum,
|
||||||
@ -398,13 +480,18 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
getRoofSurfaceList,
|
getRoofSurfaceList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 승압설정 컴포넌트 속성
|
||||||
const stepUpProps = {
|
const stepUpProps = {
|
||||||
tabNum,
|
tabNum,
|
||||||
setTabNum,
|
setTabNum,
|
||||||
models,
|
models,
|
||||||
setModels,
|
setModels,
|
||||||
|
allocationType,
|
||||||
circuitAllocationType,
|
circuitAllocationType,
|
||||||
setCircuitAllocationType,
|
setCircuitAllocationType,
|
||||||
|
selectedModels,
|
||||||
|
setSelectedModels,
|
||||||
|
getSelectedPcsItemList,
|
||||||
getOptYn, // 옵션 Y/N
|
getOptYn, // 옵션 Y/N
|
||||||
getUseModuleItemList, // 사용된 모듈아이템 List
|
getUseModuleItemList, // 사용된 모듈아이템 List
|
||||||
getRoofSurfaceList, // 지붕면 목록
|
getRoofSurfaceList, // 지붕면 목록
|
||||||
@ -414,8 +501,10 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
setStepUpListData,
|
setStepUpListData,
|
||||||
seletedOption,
|
seletedOption,
|
||||||
setSeletedOption,
|
setSeletedOption,
|
||||||
|
getModuleList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 승압설정 목록 조회
|
||||||
const getStepUpListData = () => {
|
const getStepUpListData = () => {
|
||||||
return stepUpListData[0].pcsItemList.map((item) => {
|
return stepUpListData[0].pcsItemList.map((item) => {
|
||||||
return item.serQtyList
|
return item.serQtyList
|
||||||
@ -426,7 +515,6 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
pcsSerCd: item.pcsSerCd,
|
pcsSerCd: item.pcsSerCd,
|
||||||
pcsItemId: item.itemId,
|
pcsItemId: item.itemId,
|
||||||
pscOptCd: seletedOption.code,
|
pscOptCd: seletedOption.code,
|
||||||
// pcsOptCd: 'CLC_RMC',
|
|
||||||
paralQty: serQty.paralQty,
|
paralQty: serQty.paralQty,
|
||||||
connections: [
|
connections: [
|
||||||
{
|
{
|
||||||
@ -438,12 +526,65 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 닫기 버튼 클릭 시 처리하는 함수 추가
|
||||||
|
const handleClose = () => {
|
||||||
|
// // 회로 번호 텍스트 제거
|
||||||
|
// const circuitTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
|
||||||
|
// canvas.remove(...circuitTexts)
|
||||||
|
|
||||||
|
// // 모듈의 회로 정보 초기화
|
||||||
|
// canvas
|
||||||
|
// .getObjects()
|
||||||
|
// .filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
// .forEach((obj) => {
|
||||||
|
// obj.circuit = null
|
||||||
|
// obj.pcsItemId = null
|
||||||
|
// obj.circuitNumber = null
|
||||||
|
// })
|
||||||
|
|
||||||
|
// canvas.renderAll()
|
||||||
|
// closePopup(id)
|
||||||
|
|
||||||
|
swalFire({
|
||||||
|
title: '변경사항을 저장하시겠습니까?',
|
||||||
|
//text: '저장하지 않은 변경사항은 모두 사라집니다.',
|
||||||
|
type: 'confirm',
|
||||||
|
confirmButtonText: '저장',
|
||||||
|
cancelButtonText: '취소',
|
||||||
|
icon: 'warning',
|
||||||
|
confirmFn: async () => {
|
||||||
|
// 저장 로직 실행
|
||||||
|
await onApply()
|
||||||
|
closePopup(id)
|
||||||
|
},
|
||||||
|
denyFn: () => {
|
||||||
|
// 회로 번호 텍스트 제거
|
||||||
|
const circuitTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
|
||||||
|
canvas.remove(...circuitTexts)
|
||||||
|
|
||||||
|
// 모듈의 회로 정보 초기화
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
.forEach((obj) => {
|
||||||
|
obj.circuit = null
|
||||||
|
obj.pcsItemId = null
|
||||||
|
obj.circuitNumber = null
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
closePopup(id)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={true} pos={{ x: 50, y: 230 }}>
|
<WithDraggable isShow={true} pos={{ x: 50, y: 230 }}>
|
||||||
<div className={`modal-pop-wrap l-2`}>
|
<div className={`modal-pop-wrap l-2`}>
|
||||||
<div className="modal-head modal-handle">
|
<div className="modal-head modal-handle">
|
||||||
<h1 className="title">{getMessage('modal.circuit.trestle.setting')} </h1>
|
<h1 className="title">{getMessage('modal.circuit.trestle.setting')} </h1>
|
||||||
<button className="modal-close" onClick={() => closePopup(id)}>
|
{/* <button className="modal-close" onClick={() => closePopup(id)}> */}
|
||||||
|
<button className="modal-close" onClick={handleClose}>
|
||||||
닫기
|
닫기
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -10,16 +10,29 @@ import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupSta
|
|||||||
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
||||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
|
|
||||||
export default function StepUp(props) {
|
export default function StepUp(props) {
|
||||||
const { stepUpListData, setStepUpListData, seletedOption, setSeletedOption } = props
|
const {
|
||||||
|
models,
|
||||||
|
allocationType,
|
||||||
|
stepUpListData,
|
||||||
|
setStepUpListData,
|
||||||
|
seletedOption,
|
||||||
|
setSeletedOption,
|
||||||
|
selectedModels,
|
||||||
|
setSelectedModels,
|
||||||
|
getSelectedPcsItemList,
|
||||||
|
getModuleList,
|
||||||
|
} = props
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
|
const globalLocale = useRecoilValue(globalLocaleStore)
|
||||||
const [moduleTab, setModuleTab] = useState(1)
|
const [moduleTab, setModuleTab] = useState(1)
|
||||||
const [moduleTabs, setModuleTabs] = useState({})
|
const [moduleTabs, setModuleTabs] = useState({})
|
||||||
const [arrayLength, setArrayLength] = useState(3) //module-table-inner의 반복 개수
|
const [arrayLength, setArrayLength] = useState(3) //module-table-inner의 반복 개수
|
||||||
const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState)
|
const [pcsCheck, setPcsCheck] = useRecoilState(pcsCheckState)
|
||||||
const { models } = props
|
const { getPcsVoltageStepUpList, getPcsAutoRecommendList, getPcsVoltageChk } = useMasterController()
|
||||||
const { getPcsVoltageStepUpList, getPcsAutoRecommendList } = useMasterController()
|
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
@ -39,34 +52,55 @@ export default function StepUp(props) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// PCS 승압설정 정보 조회
|
// PCS 승압설정 정보 조회
|
||||||
fetchStepUpData()
|
if (allocationType === 'auto') {
|
||||||
|
fetchStepUpData()
|
||||||
|
} else {
|
||||||
|
// 1-1 2-2
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => obj.name === POLYGON_TYPE.MODULE && obj.circuit)
|
||||||
|
.map((module) => module.circuitNumber)
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// PCS 승압설정 정보 조회
|
// PCS 승압설정 정보 조회
|
||||||
const fetchStepUpData = async () => {
|
const fetchStepUpData = async () => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
useYn: props.getOptYn(), // 옵션 Y/N
|
...props.getOptYn(), // 옵션 Y/N
|
||||||
useModuleItemList: props.getUseModuleItemList(), // 사용된 모듈아이템 List
|
useModuleItemList: props.getUseModuleItemList(), // 사용된 모듈아이템 List
|
||||||
roofSurfaceList: props.getRoofSurfaceList(), // 지붕면 목록
|
roofSurfaceList: props.getRoofSurfaceList(), // 지붕면 목록
|
||||||
pcsItemList: props.getPcsItemList(), // PCS 아이템 목록
|
pcsItemList: selectedModels.length === 0 ? props.getPcsItemList() : getSelectedPcsItemList(), // PCS 아이템 목록
|
||||||
}
|
}
|
||||||
|
|
||||||
// PCS 승압설정 정보 조회
|
// 회로 구성 가능 여부 체크
|
||||||
const res = await getPcsVoltageStepUpList(params)
|
getPcsVoltageChk({ ...params, pcsItemList: getSelectedPcsItemList() }).then((res) => {
|
||||||
|
if (res.resultCode === 'S') {
|
||||||
|
// 회로 구성 가능 여부 체크 통과 시 승압설정 정보 조회
|
||||||
|
getPcsVoltageStepUpList(params).then((res) => {
|
||||||
|
if (res?.result.code === 200 && res?.data) {
|
||||||
|
if (selectedModels.length === 0) {
|
||||||
|
setSelectedModels(res.data.pcsItemList)
|
||||||
|
}
|
||||||
|
const dataArray = Array.isArray(res.data) ? res.data : [res.data]
|
||||||
|
const stepUpListData = formatStepUpListData(dataArray)
|
||||||
|
|
||||||
if (res?.result.code === 200 && res?.data) {
|
// PCS 승압설정 정보 SET
|
||||||
const dataArray = Array.isArray(res.data) ? res.data : [res.data]
|
setStepUpListData(stepUpListData)
|
||||||
const stepUpListData = formatStepUpListData(dataArray)
|
|
||||||
|
|
||||||
// PCS 승압설정 정보 SET
|
// PCS 옵션 조회
|
||||||
setStepUpListData(stepUpListData)
|
const formattedOptCodes = formatOptionCodes(res.data.optionList)
|
||||||
|
setOptCodes(formattedOptCodes)
|
||||||
// PCS 옵션 조회
|
setSeletedOption(formattedOptCodes[0])
|
||||||
const formattedOptCodes = formatOptionCodes(res.data.optionList)
|
}
|
||||||
setOptCodes(formattedOptCodes)
|
})
|
||||||
setSeletedOption(formattedOptCodes[0])
|
} else {
|
||||||
}
|
swalFire({
|
||||||
|
title: res.resultMsg,
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching step up data:', error)
|
console.error('Error fetching step up data:', error)
|
||||||
}
|
}
|
||||||
@ -121,6 +155,7 @@ export default function StepUp(props) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 초기 추천 값들을 selectedValues에 저장
|
||||||
setSelectedValues(initialSelectedValues)
|
setSelectedValues(initialSelectedValues)
|
||||||
|
|
||||||
return formattedData
|
return formattedData
|
||||||
@ -212,17 +247,57 @@ export default function StepUp(props) {
|
|||||||
}
|
}
|
||||||
item.selected = index === subIdx
|
item.selected = index === subIdx
|
||||||
})
|
})
|
||||||
|
// 선택된 행 정보 저장
|
||||||
setStepUpListData(tempStepUpListData)
|
setStepUpListData(tempStepUpListData)
|
||||||
|
|
||||||
console.log('🚀 ~ handleRowClick ~ tempStepUpListData:', tempStepUpListData)
|
console.log('🚀 ~ handleRowClick ~ tempStepUpListData:', tempStepUpListData)
|
||||||
console.log('🚀 ~ handleRowClick ~ selectedData:', selectedData)
|
console.log('🚀 ~ handleRowClick ~ selectedData:', selectedData)
|
||||||
|
|
||||||
|
// 파워컨디셔너 옵션 조회 요청 파라미터
|
||||||
|
const params = {
|
||||||
|
...props.getOptYn(), // 옵션 Y/N
|
||||||
|
useModuleItemList: props.getUseModuleItemList(), // 사용된 모듈아이템 List
|
||||||
|
roofSurfaceList: props.getRoofSurfaceList(), // 지붕면 목록
|
||||||
|
pcsItemList: props.getSelectedPcsItemList().map((pcsItem) => {
|
||||||
|
// PCS 아이템 목록
|
||||||
|
// tempStepUpListData에서 해당 PCS 아이템 찾기
|
||||||
|
const matchingPcsItem = tempStepUpListData[0].pcsItemList.find((item) => item.pcsId === pcsItem.pcsId && item.itemId === pcsItem.itemId)
|
||||||
|
|
||||||
|
// 선택된 serQty 찾기
|
||||||
|
const selectedSerQty = matchingPcsItem?.serQtyList.find((serQty) => serQty.selected)?.serQty || 0
|
||||||
|
|
||||||
|
return {
|
||||||
|
...pcsItem,
|
||||||
|
applySerQty: selectedSerQty,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
// PCS 승압설정 정보 조회
|
||||||
|
//const res = await getPcsVoltageStepUpList(params)
|
||||||
|
//getPcsManualConfChk(params).then((res) => {
|
||||||
|
getPcsVoltageStepUpList(params).then((res) => {
|
||||||
|
if (res?.result.code === 200 && res?.data) {
|
||||||
|
const dataArray = Array.isArray(res.data) ? res.data : [res.data]
|
||||||
|
const stepUpListData = formatStepUpListData(dataArray)
|
||||||
|
|
||||||
|
// PCS 승압설정 정보 SET
|
||||||
|
setStepUpListData(stepUpListData)
|
||||||
|
|
||||||
|
// PCS 옵션 조회
|
||||||
|
const formattedOptCodes = formatOptionCodes(res.data.optionList)
|
||||||
|
setOptCodes(formattedOptCodes)
|
||||||
|
setSeletedOption(formattedOptCodes[0])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
selectedData.roofSurfaceList.forEach((roofSurface) => {
|
selectedData.roofSurfaceList.forEach((roofSurface) => {
|
||||||
const targetSurface = canvas.getObjects().filter((obj) => obj.id === roofSurface.roofSurfaceId)[0]
|
const targetSurface = canvas.getObjects().filter((obj) => obj.id === roofSurface.roofSurfaceId)[0]
|
||||||
const moduleIds = targetSurface.modules.map((module) => {
|
const moduleIds = targetSurface.modules.map((module) => {
|
||||||
return module.id
|
return module.id
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 모듈 목록 삭제
|
||||||
canvas
|
canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
.filter((obj) => moduleIds.includes(obj.parentId))
|
.filter((obj) => moduleIds.includes(obj.parentId))
|
||||||
@ -230,7 +305,9 @@ export default function StepUp(props) {
|
|||||||
canvas.remove(text)
|
canvas.remove(text)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 모듈 목록 추가
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
|
||||||
roofSurface.moduleList.forEach((module) => {
|
roofSurface.moduleList.forEach((module) => {
|
||||||
const targetModule = canvas.getObjects().filter((obj) => obj.id === module.uniqueId)[0]
|
const targetModule = canvas.getObjects().filter((obj) => obj.id === module.uniqueId)[0]
|
||||||
const moduleCircuitText = new fabric.Text(module.circuit, {
|
const moduleCircuitText = new fabric.Text(module.circuit, {
|
||||||
@ -415,8 +492,11 @@ export default function StepUp(props) {
|
|||||||
<div className="grid-select mr10">
|
<div className="grid-select mr10">
|
||||||
{/* <QSelectBox title={'電力検出ユニット (モニター付き)'} /> */}
|
{/* <QSelectBox title={'電力検出ユニット (モニター付き)'} /> */}
|
||||||
<QSelectBox
|
<QSelectBox
|
||||||
options={optCodes}
|
//options={optCodes}
|
||||||
title={optCodes[0].name}
|
options={optCodes.map((roof) => {
|
||||||
|
return { ...roof, name: globalLocale === 'ko' ? roof.name : roof.nameJp }
|
||||||
|
})}
|
||||||
|
title={globalLocale === 'ko' ? optCodes[0].name : optCodes[0].nameJp}
|
||||||
value={seletedOption}
|
value={seletedOption}
|
||||||
sourceKey="code"
|
sourceKey="code"
|
||||||
targetKey="code"
|
targetKey="code"
|
||||||
|
|||||||
@ -201,13 +201,22 @@ export function useMasterController() {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const getPcsVoltageStepUpList = async (params2 = null) => {
|
const getPcsVoltageStepUpList = async (params2 = null) => {
|
||||||
|
// roofSurfaceList의 moduleList에서 circuit 속성을 제외
|
||||||
|
const modifiedRoofSurfaceList = params2.roofSurfaceList.map((surface) => ({
|
||||||
|
...surface,
|
||||||
|
moduleList: surface.moduleList.map((module) => ({
|
||||||
|
itemId: module.itemId,
|
||||||
|
uniqueId: module.uniqueId,
|
||||||
|
})),
|
||||||
|
}))
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...params2,
|
...params2,
|
||||||
maxConnYn: params2.useYn.maxConnYn,
|
maxConnYn: params2.maxConnYn,
|
||||||
smpCirYn: params2.useYn.smpCirYn,
|
smpCirYn: params2.smpCirYn,
|
||||||
coldZoneYn: params2.useYn.coldZoneYn,
|
coldZoneYn: params2.coldZoneYn,
|
||||||
useModuleItemList: params2.useModuleItemList,
|
useModuleItemList: params2.useModuleItemList,
|
||||||
roofSurfaceList: params2.roofSurfaceList,
|
roofSurfaceList: modifiedRoofSurfaceList,
|
||||||
pcsItemList: params2.pcsItemList,
|
pcsItemList: params2.pcsItemList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user