Merge branch 'dev' into dev-yj
This commit is contained in:
commit
d9f782639f
@ -18,6 +18,7 @@ import { canvasState } from '@/store/canvasAtom'
|
|||||||
|
|
||||||
import { useTrestle } from '@/hooks/module/useTrestle'
|
import { useTrestle } from '@/hooks/module/useTrestle'
|
||||||
import { selectedModuleState } from '@/store/selectedModuleOptions'
|
import { selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
const ALLOCATION_TYPE = {
|
const ALLOCATION_TYPE = {
|
||||||
AUTO: 'auto',
|
AUTO: 'auto',
|
||||||
@ -43,29 +44,6 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const { getPcsAutoRecommendList } = useMasterController()
|
const { getPcsAutoRecommendList } = useMasterController()
|
||||||
const powerConditionalSelectProps = {
|
|
||||||
tabNum,
|
|
||||||
setTabNum,
|
|
||||||
makers,
|
|
||||||
setMakers,
|
|
||||||
selectedMaker,
|
|
||||||
setSelectedMaker,
|
|
||||||
series,
|
|
||||||
setSeries,
|
|
||||||
models,
|
|
||||||
setModels,
|
|
||||||
selectedModels,
|
|
||||||
setSelectedModels,
|
|
||||||
managementState,
|
|
||||||
}
|
|
||||||
|
|
||||||
const passivityProps = {
|
|
||||||
tabNum,
|
|
||||||
setTabNum,
|
|
||||||
pcsCheck,
|
|
||||||
selectedModels,
|
|
||||||
setSelectedModels,
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!managementState) {
|
if (!managementState) {
|
||||||
@ -73,6 +51,14 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (allocationType === ALLOCATION_TYPE.PASSIVITY && tabNum === 2) {
|
||||||
|
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
|
||||||
|
canvas.remove(...notAllocationModules)
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}, [tabNum])
|
||||||
|
|
||||||
const onAutoRecommend = () => {
|
const onAutoRecommend = () => {
|
||||||
if (series.filter((s) => s.selected).length === 0) {
|
if (series.filter((s) => s.selected).length === 0) {
|
||||||
swalFire({
|
swalFire({
|
||||||
@ -91,7 +77,14 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
|
|
||||||
getPcsAutoRecommendList(params).then((res) => {
|
getPcsAutoRecommendList(params).then((res) => {
|
||||||
if (res.data?.pcsItemList) {
|
if (res.data?.pcsItemList) {
|
||||||
setModels(res.data.pcsItemList)
|
setModels(
|
||||||
|
res.data.pcsItemList.map((model) => {
|
||||||
|
return {
|
||||||
|
...model,
|
||||||
|
id: uuidv4(),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
setTabNum(2)
|
setTabNum(2)
|
||||||
} else {
|
} else {
|
||||||
// 데이터가 없는 경우 오류 메시지 확인 필요
|
// 데이터가 없는 경우 오류 메시지 확인 필요
|
||||||
@ -152,6 +145,8 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
moduleList: obj.modules.map((module) => {
|
moduleList: obj.modules.map((module) => {
|
||||||
return {
|
return {
|
||||||
itemId: module.moduleInfo.itemId,
|
itemId: module.moduleInfo.itemId,
|
||||||
|
circuit: module.circuitNumber ? module.circuitNumber : null,
|
||||||
|
pcsItemId: module.circuit ? module.circuit?.pcsItemId : null,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
@ -190,11 +185,33 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
|
|
||||||
const onPassivityAllocation = () => {
|
const onPassivityAllocation = () => {
|
||||||
if (selectedModels.length === 0) {
|
if (selectedModels.length === 0) {
|
||||||
swalFire({
|
const params = {
|
||||||
title: '파워 컨디셔너를 추가해 주세요.',
|
...getOptYn(),
|
||||||
type: 'alert',
|
useModuleItemList: getUseModuleItemList(),
|
||||||
|
roofSurfaceList: getRoofSurfaceList(),
|
||||||
|
pcsItemList: getPcsItemList(),
|
||||||
|
}
|
||||||
|
|
||||||
|
getPcsAutoRecommendList(params).then((res) => {
|
||||||
|
if (res.data?.pcsItemList) {
|
||||||
|
const itemList = models.filter((model) => {
|
||||||
|
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
||||||
|
})
|
||||||
|
setSelectedModels(
|
||||||
|
itemList.map((model) => {
|
||||||
|
return {
|
||||||
|
...model,
|
||||||
|
id: uuidv4(),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
swalFire({
|
||||||
|
title: '파워컨디셔너를 추가해 주세요.',
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return
|
|
||||||
} else if (pcsCheck.max) {
|
} else if (pcsCheck.max) {
|
||||||
const moduleStdQty = selectedModels.reduce((acc, model) => {
|
const moduleStdQty = selectedModels.reduce((acc, model) => {
|
||||||
return acc + parseInt(model.moduleStdQty)
|
return acc + parseInt(model.moduleStdQty)
|
||||||
@ -218,6 +235,52 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onClickPrev = () => {
|
||||||
|
setAllocationType(ALLOCATION_TYPE.AUTO)
|
||||||
|
swalFire({
|
||||||
|
text: '할당한 회로 번호가 초기화됩니다.',
|
||||||
|
type: 'alert',
|
||||||
|
icon: 'warning',
|
||||||
|
confirmFn: () => {
|
||||||
|
const circuitModules = canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => obj.name === 'module' && selectedModels.map((model) => model.id).includes(obj.circuit?.circuitInfo?.id))
|
||||||
|
canvas.remove(...circuitModules.map((module) => module.circuit))
|
||||||
|
circuitModules.forEach((obj) => {
|
||||||
|
obj.circuit = null
|
||||||
|
obj.pcsItemId = null
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const powerConditionalSelectProps = {
|
||||||
|
tabNum,
|
||||||
|
setTabNum,
|
||||||
|
makers,
|
||||||
|
setMakers,
|
||||||
|
selectedMaker,
|
||||||
|
setSelectedMaker,
|
||||||
|
series,
|
||||||
|
setSeries,
|
||||||
|
models,
|
||||||
|
setModels,
|
||||||
|
selectedModels,
|
||||||
|
setSelectedModels,
|
||||||
|
managementState,
|
||||||
|
}
|
||||||
|
|
||||||
|
const passivityProps = {
|
||||||
|
tabNum,
|
||||||
|
setTabNum,
|
||||||
|
pcsCheck,
|
||||||
|
selectedModels,
|
||||||
|
setSelectedModels,
|
||||||
|
getOptYn,
|
||||||
|
getUseModuleItemList,
|
||||||
|
getRoofSurfaceList,
|
||||||
|
}
|
||||||
|
|
||||||
const stepUpProps = {
|
const stepUpProps = {
|
||||||
tabNum,
|
tabNum,
|
||||||
setTabNum,
|
setTabNum,
|
||||||
@ -231,8 +294,6 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
getPcsItemList, // PCS 아이템 목록
|
getPcsItemList, // PCS 아이템 목록
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('🚀 ~ stepUpProps ~ stepUpProps:', stepUpProps)
|
|
||||||
|
|
||||||
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`}>
|
||||||
|
|||||||
@ -64,6 +64,7 @@ export default function PowerConditionalSelect(props) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (makers.length === 0) {
|
if (makers.length === 0) {
|
||||||
getPcsMakerList().then((res) => {
|
getPcsMakerList().then((res) => {
|
||||||
|
console.log('getPcsMakerList', res.data)
|
||||||
setMakers(res.data)
|
setMakers(res.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -90,6 +91,7 @@ export default function PowerConditionalSelect(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onCheckSeries = (data) => {
|
const onCheckSeries = (data) => {
|
||||||
|
console.log('data', data)
|
||||||
const copySeries = series.map((s) => {
|
const copySeries = series.map((s) => {
|
||||||
return {
|
return {
|
||||||
...s,
|
...s,
|
||||||
@ -97,12 +99,19 @@ export default function PowerConditionalSelect(props) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
setSeries(copySeries)
|
setSeries(copySeries)
|
||||||
|
console.log('copySeries', copySeries)
|
||||||
handleSetmodels(copySeries.filter((s) => s.selected))
|
handleSetmodels(copySeries.filter((s) => s.selected))
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSetmodels = (series) => {
|
const handleSetmodels = (selectedSeries) => {
|
||||||
const pcsMkrCd = series[0]?.pcsMkrCd
|
console.log('series', selectedSeries)
|
||||||
const pcsSerList = series.map((series) => {
|
if (selectedSeries.length === 0) {
|
||||||
|
setModels([])
|
||||||
|
setSelectedModels([])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const pcsMkrCd = selectedSeries[0]?.pcsMkrCd
|
||||||
|
const pcsSerList = selectedSeries.map((series) => {
|
||||||
return { pcsSerCd: series.pcsSerCd }
|
return { pcsSerCd: series.pcsSerCd }
|
||||||
})
|
})
|
||||||
const moduleItemList = selectedModules.itemList?.map((module) => {
|
const moduleItemList = selectedModules.itemList?.map((module) => {
|
||||||
@ -123,11 +132,10 @@ export default function PowerConditionalSelect(props) {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
return
|
} else {
|
||||||
|
setModels([])
|
||||||
|
setSelectedModels([])
|
||||||
}
|
}
|
||||||
|
|
||||||
setModels([])
|
|
||||||
setSelectedModels([])
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,15 +154,16 @@ export default function PowerConditionalSelect(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onRemoveSelectedModel = (model) => {
|
const onRemoveSelectedModel = (model) => {
|
||||||
setModels(models.map((m) => ({ ...m, selected: m.code !== model.code ? m.selected : false })))
|
setSelectedModels(selectedModels.filter((m) => m.id !== model.id))
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeMaker = (option) => {
|
const onChangeMaker = (option) => {
|
||||||
if (option) {
|
if (option) {
|
||||||
setModels(null)
|
setModels([])
|
||||||
setSelectedMaker(option)
|
setSelectedMaker(option)
|
||||||
|
|
||||||
getPcsMakerList(option).then((res) => {
|
getPcsMakerList(option).then((res) => {
|
||||||
|
console.log('getPcsMakerList(series)', res.data)
|
||||||
setSeries(
|
setSeries(
|
||||||
res.data.map((series) => {
|
res.data.map((series) => {
|
||||||
return { ...series, selected: false }
|
return { ...series, selected: false }
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -147,7 +147,7 @@ export function useMasterController() {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
return await post({ url: '/api/v1/master/getPcsSeriesItemList', data: test }).then((res) => {
|
return await post({ url: '/api/v1/master/getPcsSeriesItemList', data: params }).then((res) => {
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -163,13 +163,12 @@ export function useMasterController() {
|
|||||||
*/
|
*/
|
||||||
const getPcsAutoRecommendList = async (params = null) => {
|
const getPcsAutoRecommendList = async (params = null) => {
|
||||||
return await post({ url: '/api/v1/master/getPcsAutoRecommendList', data: params }).then((res) => {
|
return await post({ url: '/api/v1/master/getPcsAutoRecommendList', data: params }).then((res) => {
|
||||||
console.log('🚀🚀 ~ getPcsAutoRecommendList ~ res:', res)
|
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const pcsMaualConfChk = async (params = null) => {
|
const getPcsManualConfChk = async (params = null) => {
|
||||||
return await post({ url: '/api/v1/master/pcsMaualConfChk', data: params }).then((res) => {
|
return await post({ url: '/api/v1/master/getPcsMenualConfChk', data: params }).then((res) => {
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -213,7 +212,7 @@ export function useMasterController() {
|
|||||||
getPcsMakerList,
|
getPcsMakerList,
|
||||||
getPcsModelList,
|
getPcsModelList,
|
||||||
getPcsAutoRecommendList,
|
getPcsAutoRecommendList,
|
||||||
pcsMaualConfChk,
|
getPcsManualConfChk,
|
||||||
getPcsVoltageStepUpList,
|
getPcsVoltageStepUpList,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user