Merge branch 'qcast-pub' into dev
# Conflicts: # src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx # src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx # src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx
This commit is contained in:
commit
3a7e206f27
@ -359,7 +359,7 @@ export default function CanvasMenu(props) {
|
|||||||
}, [basicSetting])*/
|
}, [basicSetting])*/
|
||||||
|
|
||||||
const checkMenuState = (menu) => {
|
const checkMenuState = (menu) => {
|
||||||
return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && menu.index === 2)
|
return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && [1, 2].includes(menu.index))
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkMenuAndCanvasState = () => {
|
const checkMenuAndCanvasState = () => {
|
||||||
@ -493,7 +493,7 @@ export default function CanvasMenu(props) {
|
|||||||
className={`canvas-menu-item ${menuNumber === menu.index ? 'active' : ''}`}
|
className={`canvas-menu-item ${menuNumber === menu.index ? 'active' : ''}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) return
|
if (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) return
|
||||||
if (menuNumber === 4 && menu.index === 2) return
|
if (menuNumber === 4 && [1, 2].includes(menu.index)) return
|
||||||
onClickNav(menu)
|
onClickNav(menu)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -94,14 +94,14 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
// 시리즈중 자동으로 추천 PCS 정보 조회
|
// 시리즈중 자동으로 추천 PCS 정보 조회
|
||||||
getPcsAutoRecommendList(params).then((res) => {
|
getPcsAutoRecommendList(params).then((res) => {
|
||||||
if (res.data?.pcsItemList) {
|
if (res.data?.pcsItemList) {
|
||||||
const itemList = models.filter((model) => {
|
let pcsItemList = []
|
||||||
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
res.data?.pcsItemList.forEach((item) => {
|
||||||
})
|
if (models.map((model) => model.itemId).includes(item.itemId)) {
|
||||||
const selectedModels = itemList.map((model) => {
|
pcsItemList.push({
|
||||||
return {
|
...item,
|
||||||
...model,
|
id: uuidv4(),
|
||||||
id: uuidv4(),
|
isUsed: false,
|
||||||
isUsed: false,
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 회로 구성 가능 여부 체크 요청 파라미터
|
// 회로 구성 가능 여부 체크 요청 파라미터
|
||||||
@ -112,7 +112,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: getPcsItemList(),
|
||||||
}
|
}
|
||||||
// 추천 목록 선택
|
// 추천 목록 선택
|
||||||
setSelectedModels(selectedModels)
|
setSelectedModels(pcsItemList)
|
||||||
// 회로 구성 가능 여부 체크
|
// 회로 구성 가능 여부 체크
|
||||||
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
||||||
if (res.resultCode === 'S') {
|
if (res.resultCode === 'S') {
|
||||||
@ -205,24 +205,26 @@ 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)
|
||||||
return roofSurfaceList.map((obj) => {
|
return roofSurfaceList
|
||||||
return {
|
.map((obj) => {
|
||||||
roofSurfaceId: obj.id,
|
return {
|
||||||
roofSurface: canvas
|
roofSurfaceId: obj.id,
|
||||||
.getObjects()
|
roofSurface: canvas
|
||||||
.filter((o) => o.id === obj.parentId)[0]
|
.getObjects()
|
||||||
.directionText.replace(/[0-9]/g, ''),
|
.filter((o) => o.id === obj.parentId)[0]
|
||||||
roofSurfaceIncl: canvas.getObjects().filter((o) => o.id === obj.parentId)[0].roofMaterial.pitch,
|
.directionText.replace(/[0-9]/g, ''),
|
||||||
moduleList: getModuleList(obj).map((module) => {
|
roofSurfaceIncl: canvas.getObjects().filter((o) => o.id === obj.parentId)[0].roofMaterial.pitch,
|
||||||
return {
|
moduleList: getModuleList(obj).map((module) => {
|
||||||
itemId: module.moduleInfo.itemId,
|
return {
|
||||||
circuit: module.circuitNumber ? module.circuitNumber : null,
|
itemId: module.moduleInfo.itemId,
|
||||||
pcsItemId: module.circuit ? module.circuit?.pcsItemId : null,
|
circuit: module.circuitNumber ? module.circuitNumber : null,
|
||||||
uniqueId: module.id ? module.id : null,
|
pcsItemId: module.circuit ? module.circuit?.pcsItemId : null,
|
||||||
}
|
uniqueId: module.id ? module.id : null,
|
||||||
}),
|
}
|
||||||
}
|
}),
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
.filter((surface) => surface.moduleList.length > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 모듈 목록
|
// 모듈 목록
|
||||||
@ -338,7 +340,18 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const params = {
|
const params = {
|
||||||
...getOptYn(),
|
...getOptYn(),
|
||||||
useModuleItemList: getUseModuleItemList(),
|
useModuleItemList: getUseModuleItemList(),
|
||||||
roofSurfaceList: getRoofSurfaceList(),
|
roofSurfaceList: getRoofSurfaceList().map((surface) => {
|
||||||
|
console.log(surface.moduleList)
|
||||||
|
return {
|
||||||
|
...surface,
|
||||||
|
moduleList: surface.moduleList.map((module) => {
|
||||||
|
return {
|
||||||
|
itemId: module.itemId,
|
||||||
|
uniqueId: module.uniqueId,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}),
|
||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: getPcsItemList(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,19 +361,34 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const itemList = models.filter((model) => {
|
const itemList = models.filter((model) => {
|
||||||
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
||||||
})
|
})
|
||||||
const selectedModels = itemList.map((model) => {
|
|
||||||
return {
|
let pcsItemList = []
|
||||||
...model,
|
let pcsObj = {}
|
||||||
id: uuidv4(),
|
models.forEach((model) => {
|
||||||
|
pcsObj[model.itemId] = model
|
||||||
|
})
|
||||||
|
res.data?.pcsItemList.forEach((item) => {
|
||||||
|
if (pcsObj[item.itemId]) {
|
||||||
|
pcsItemList.push({
|
||||||
|
...pcsObj[item.itemId],
|
||||||
|
isUsed: false,
|
||||||
|
id: uuidv4(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const pcsVoltageChkParams = {
|
const pcsVoltageChkParams = {
|
||||||
...getOptYn(),
|
...getOptYn(),
|
||||||
useModuleItemList: getUseModuleItemList(),
|
useModuleItemList: getUseModuleItemList(),
|
||||||
roofSurfaceList: getRoofSurfaceList(),
|
roofSurfaceList: getRoofSurfaceList(),
|
||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: pcsItemList.map((item) => {
|
||||||
|
return {
|
||||||
|
itemId: item.itemId,
|
||||||
|
pcsMkrCd: item.pcsMkrCd,
|
||||||
|
pcsSerCd: item.pcsSerCd,
|
||||||
|
}
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
setSelectedModels(selectedModels)
|
setSelectedModels(pcsItemList)
|
||||||
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
||||||
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
||||||
})
|
})
|
||||||
@ -536,37 +564,21 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
|
|
||||||
// 닫기 버튼 클릭 시 처리하는 함수 추가
|
// 닫기 버튼 클릭 시 처리하는 함수 추가
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
swalFire({
|
// // 회로 번호 텍스트 제거
|
||||||
title: '변경사항을 저장하시겠습니까?',
|
const circuitTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
|
||||||
//text: '저장하지 않은 변경사항은 모두 사라집니다.',
|
canvas.remove(...circuitTexts)
|
||||||
type: 'confirm',
|
// 모듈의 회로 정보 초기화
|
||||||
confirmButtonText: '저장',
|
canvas
|
||||||
cancelButtonText: '취소',
|
.getObjects()
|
||||||
icon: 'warning',
|
.filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
confirmFn: async () => {
|
.forEach((obj) => {
|
||||||
// 저장 로직 실행
|
obj.circuit = null
|
||||||
await onApply()
|
obj.pcsItemId = null
|
||||||
closePopup(id)
|
obj.circuitNumber = null
|
||||||
},
|
})
|
||||||
denyFn: () => {
|
|
||||||
// 회로 번호 텍스트 제거
|
|
||||||
const circuitTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
|
|
||||||
canvas.remove(...circuitTexts)
|
|
||||||
|
|
||||||
// 모듈의 회로 정보 초기화
|
canvas.renderAll()
|
||||||
canvas
|
closePopup(id)
|
||||||
.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 (
|
||||||
|
|||||||
@ -91,7 +91,6 @@ 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,
|
||||||
@ -99,12 +98,10 @@ 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 = (selectedSeries) => {
|
const handleSetmodels = (selectedSeries) => {
|
||||||
console.log('series', selectedSeries)
|
|
||||||
if (selectedSeries.length === 0) {
|
if (selectedSeries.length === 0) {
|
||||||
setModels([])
|
setModels([])
|
||||||
setSelectedModels([])
|
setSelectedModels([])
|
||||||
@ -149,7 +146,7 @@ export default function PowerConditionalSelect(props) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }])
|
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4(), isUsed: false }])
|
||||||
setSelectedRow(null)
|
setSelectedRow(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +160,6 @@ export default function PowerConditionalSelect(props) {
|
|||||||
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 }
|
||||||
|
|||||||
@ -79,36 +79,36 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
const setSurfaceInfo = () => {
|
const setSurfaceInfo = () => {
|
||||||
const surfaces = canvas.getObjects().filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name)
|
const surfaces = canvas.getObjects().filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name)
|
||||||
// setHeaders([header[0], { name: '회로', prop: 'circuit' }, ...header.slice(1)])
|
// setHeaders([header[0], { name: '회로', prop: 'circuit' }, ...header.slice(1)])
|
||||||
setRows(
|
// setRows(
|
||||||
rows.map((row) => {
|
// rows.map((row) => {
|
||||||
return {
|
// return {
|
||||||
...row,
|
// ...row,
|
||||||
circuit: '',
|
// circuit: '',
|
||||||
}
|
// }
|
||||||
}),
|
// }),
|
||||||
)
|
// )
|
||||||
let totals = {}
|
// let totals = {}
|
||||||
|
|
||||||
rows.forEach((row) => {
|
// rows.forEach((row) => {
|
||||||
if (header.length === 4) {
|
// if (header.length === 4) {
|
||||||
if (!totals[header[2].prop]) totals[header[2].prop] = 0
|
// if (!totals[header[2].prop]) totals[header[2].prop] = 0
|
||||||
totals[header[2].prop] += +row[header[2].prop]
|
// totals[header[2].prop] += +row[header[2].prop]
|
||||||
} else if (header.length === 5) {
|
// } else if (header.length === 5) {
|
||||||
if (!totals[header[2].prop]) totals[header[2].prop] = 0
|
// if (!totals[header[2].prop]) totals[header[2].prop] = 0
|
||||||
totals[header[2].prop] += +row[header[2].prop]
|
// totals[header[2].prop] += +row[header[2].prop]
|
||||||
if (!totals[header[3].prop]) totals[header[3].prop] = 0
|
// if (!totals[header[3].prop]) totals[header[3].prop] = 0
|
||||||
totals[header[3]] += +row[header[3]]
|
// totals[header[3]] += +row[header[3]]
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
setFooter([
|
// setFooter([
|
||||||
...['합계', ''],
|
// ...['합계', ''],
|
||||||
...Object.keys(totals).map((key) => {
|
// ...Object.keys(totals).map((key) => {
|
||||||
return totals[key]
|
// return totals[key]
|
||||||
}),
|
// }),
|
||||||
Object.keys(totals).reduce((acc, key) => {
|
// Object.keys(totals).reduce((acc, key) => {
|
||||||
return acc + totals[key]
|
// return acc + totals[key]
|
||||||
}, 0),
|
// }, 0),
|
||||||
])
|
// ])
|
||||||
// let totalWpout = 0
|
// let totalWpout = 0
|
||||||
// const rows = surfaces.map((surface) => {
|
// const rows = surfaces.map((surface) => {
|
||||||
// let wpOut = 0
|
// let wpOut = 0
|
||||||
@ -226,10 +226,23 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
setSelectedPcs(tempSelectedPcs)
|
setSelectedPcs(tempSelectedPcs)
|
||||||
canvas.add(moduleCircuitText)
|
canvas.add(moduleCircuitText)
|
||||||
})
|
})
|
||||||
|
console.log('🚀 ~ handleCircuitNumberFix ~ selectedModels:', selectedModels)
|
||||||
|
|
||||||
|
// let pcsList = [...selectedModels.map((model) => ({ ...model }))]
|
||||||
|
let pcsList = JSON.parse(JSON.stringify(selectedModels))
|
||||||
|
pcsList = pcsList.map((model) => {
|
||||||
|
console.log('🚀 ~ handleCircuitNumberFix ~ pcsList:', pcsList)
|
||||||
|
if (model.id === selectedPcs.id) {
|
||||||
|
model.isUsed = true
|
||||||
|
}
|
||||||
|
return model
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('🚀 ~ handleCircuitNumberFix ~ pcsList:', pcsList)
|
||||||
|
|
||||||
const roofSurfaceList = canvas
|
const roofSurfaceList = canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
.filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name)
|
.filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name && obj?.modules.length > 0)
|
||||||
.map((surface) => {
|
.map((surface) => {
|
||||||
return {
|
return {
|
||||||
roofSurfaceId: surface.id,
|
roofSurfaceId: surface.id,
|
||||||
@ -246,45 +259,25 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
console.log('uniqueCircuitNumbers', uniqueCircuitNumbers)
|
console.log('uniqueCircuitNumbers', uniqueCircuitNumbers)
|
||||||
const usedPcses = selectedModels.filter((model) => model.isUsed)
|
const usedPcses = pcsList.filter((model) => model.isUsed)
|
||||||
const pcsItemList =
|
const pcsItemList = usedPcses.map((model, index) => {
|
||||||
usedPcses.length === 0
|
return {
|
||||||
? [
|
pcsMkrCd: model.pcsMkrCd,
|
||||||
{
|
pcsSerCd: model.pcsSerCd,
|
||||||
pcsMkrCd: selectedPcs.pcsMkrCd,
|
itemId: model.itemId,
|
||||||
pcsSerCd: selectedPcs.pcsSerCd,
|
itemNm: model.itemNm,
|
||||||
itemId: selectedPcs.itemId,
|
goodsNo: model.goodsNo,
|
||||||
itemNm: selectedPcs.itemNm,
|
serQtyList: [
|
||||||
goodsNo: selectedPcs.goodsNo,
|
{
|
||||||
serQtyList: [
|
serQty: targetModules.length,
|
||||||
{
|
paralQty: uniqueCircuitNumbers.length,
|
||||||
serQty: targetModules.length,
|
rmdYn: 'Y',
|
||||||
paralQty: uniqueCircuitNumbers.length,
|
usePossYn: 'Y',
|
||||||
rmdYn: 'Y',
|
roofSurfaceList: roofSurfaceList,
|
||||||
usePossYn: 'Y',
|
},
|
||||||
roofSurfaceList: roofSurfaceList,
|
],
|
||||||
},
|
}
|
||||||
],
|
})
|
||||||
},
|
|
||||||
]
|
|
||||||
: selectedModels.map((model, index) => {
|
|
||||||
return {
|
|
||||||
pcsMkrCd: model.pcsMkrCd,
|
|
||||||
pcsSerCd: model.pcsSerCd,
|
|
||||||
itemId: model.itemId,
|
|
||||||
itemNm: model.itemNm,
|
|
||||||
goodsNo: model.goodsNo,
|
|
||||||
serQtyList: [
|
|
||||||
{
|
|
||||||
serQty: targetModules.length,
|
|
||||||
paralQty: uniqueCircuitNumbers.length,
|
|
||||||
rmdYn: 'Y',
|
|
||||||
usePossYn: 'Y',
|
|
||||||
roofSurfaceList: roofSurfaceList,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...getApiProps(),
|
...getApiProps(),
|
||||||
@ -318,17 +311,15 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedModels(
|
setSelectedModels(pcsList)
|
||||||
selectedModels.map((model) => {
|
|
||||||
return { ...model, isUsed: model.id === selectedPcs.id ? true : model.isUsed }
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
setTargetModules([])
|
setTargetModules([])
|
||||||
setCircuitNumber(+circuitNumber + 1)
|
setCircuitNumber(+circuitNumber + 1)
|
||||||
setModuleStatisticsData()
|
setModuleStatisticsData()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
console.log('🚀 ~ handleCircuitNumberFix ~ selectedModels:', selectedModels)
|
||||||
|
console.log('🚀 ~ handleCircuitNumberFix ~ selectedModels:', selectedModels)
|
||||||
|
|
||||||
const getCircuitNumber = () => {
|
const getCircuitNumber = () => {
|
||||||
if (selectedModels.length === 1) {
|
if (selectedModels.length === 1) {
|
||||||
|
|||||||
@ -116,22 +116,25 @@ export default function ContextRoofAllocationSetting(props) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="block-box">
|
{roof.raftAuth && (
|
||||||
<div className="flex-ment">
|
<div className="block-box">
|
||||||
<span>{getMessage('slope')}</span>
|
<div className="flex-ment">
|
||||||
<div className="input-grid">
|
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
||||||
<input
|
{raftCodes.length > 0 && (
|
||||||
type="text"
|
<div className="grid-select">
|
||||||
className="input-origin block"
|
<QSelectBox
|
||||||
onChange={(e) => {
|
options={raftCodes}
|
||||||
handleChangePitch(e, index)
|
value={roof}
|
||||||
}}
|
showKey={'clCodeNm'}
|
||||||
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
sourceKey={'clCode'}
|
||||||
/>
|
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<span className="absol">{pitchText}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
|
|
||||||
{(roof.widAuth || roof.lenAuth) && (
|
{(roof.widAuth || roof.lenAuth) && (
|
||||||
<>
|
<>
|
||||||
{roof.widAuth && (
|
{roof.widAuth && (
|
||||||
@ -156,43 +159,37 @@ export default function ContextRoofAllocationSetting(props) {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(roof.raftAuth || roof.roofPchAuth) && (
|
{roof.roofPchAuth && (
|
||||||
<>
|
<div className="block-box">
|
||||||
{roof.raftAuth && (
|
<div className="flex-ment">
|
||||||
<div className="block-box">
|
<span>{getMessage('hajebichi')}</span>
|
||||||
<div className="flex-ment">
|
<div className="input-grid">
|
||||||
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
<input
|
||||||
{raftCodes.length > 0 && (
|
type="text"
|
||||||
<div className="grid-select">
|
className="input-origin block"
|
||||||
<QSelectBox
|
value={parseInt(roof.hajebichi)}
|
||||||
options={raftCodes}
|
readOnly={roof.roofPchAuth === 'R'}
|
||||||
value={roof}
|
/>
|
||||||
showKey={'clCodeNm'}
|
|
||||||
sourceKey={'clCode'}
|
|
||||||
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
{roof.roofPchAuth && (
|
</div>
|
||||||
<div className="block-box">
|
|
||||||
<div className="flex-ment">
|
|
||||||
<span>{getMessage('hajebichi')}</span>
|
|
||||||
<div className="input-grid">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-origin block"
|
|
||||||
value={parseInt(roof.hajebichi)}
|
|
||||||
readOnly={roof.roofPchAuth === 'R'}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
<div className="block-box">
|
||||||
|
<div className="flex-ment">
|
||||||
|
<span>{getMessage('slope')}</span>
|
||||||
|
<div className="input-grid">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-origin block"
|
||||||
|
onChange={(e) => {
|
||||||
|
handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index)
|
||||||
|
}}
|
||||||
|
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span className="absol">{pitchText}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="block-box">
|
<div className="block-box">
|
||||||
<div className="icon-btn-wrap">
|
<div className="icon-btn-wrap">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -33,7 +33,6 @@ export default function RoofAllocationSetting(props) {
|
|||||||
handleChangeLayout,
|
handleChangeLayout,
|
||||||
currentRoofList,
|
currentRoofList,
|
||||||
handleChangeInput,
|
handleChangeInput,
|
||||||
handleChangePitch,
|
|
||||||
} = useRoofAllocationSetting(id)
|
} = useRoofAllocationSetting(id)
|
||||||
const pitchText = useRecoilValue(pitchTextSelector)
|
const pitchText = useRecoilValue(pitchTextSelector)
|
||||||
const { findCommonCode } = useCommonCode()
|
const { findCommonCode } = useCommonCode()
|
||||||
@ -118,22 +117,27 @@ export default function RoofAllocationSetting(props) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="block-box">
|
|
||||||
<div className="flex-ment">
|
{roof.raftAuth && (
|
||||||
<span>{getMessage('slope')}</span>
|
<div className="block-box">
|
||||||
<div className="input-grid">
|
<div className="flex-ment">
|
||||||
<input
|
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
||||||
type="text"
|
{raftCodes.length > 0 && (
|
||||||
className="input-origin block"
|
<div className="grid-select">
|
||||||
onChange={(e) => {
|
<QSelectBox
|
||||||
handleChangePitch(e, index)
|
options={raftCodes}
|
||||||
}}
|
value={roof}
|
||||||
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
showKey={'clCodeNm'}
|
||||||
/>
|
sourceKey={'clCode'}
|
||||||
|
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
|
||||||
|
onChange={(e) => handleChangeRaft(e, index)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<span className="absol">{pitchText}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
|
|
||||||
{(roof.widAuth || roof.lenAuth) && (
|
{(roof.widAuth || roof.lenAuth) && (
|
||||||
<>
|
<>
|
||||||
{roof.widAuth && (
|
{roof.widAuth && (
|
||||||
@ -170,45 +174,38 @@ export default function RoofAllocationSetting(props) {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(roof.raftAuth || roof.roofPchAuth) && (
|
{roof.roofPchAuth && (
|
||||||
<>
|
<div className="block-box">
|
||||||
{roof.raftAuth && (
|
<div className="flex-ment">
|
||||||
<div className="block-box">
|
<span>{getMessage('hajebichi')}</span>
|
||||||
<div className="flex-ment">
|
<div className="input-grid">
|
||||||
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
<input
|
||||||
{raftCodes.length > 0 && (
|
type="text"
|
||||||
<div className="grid-select">
|
className="input-origin block"
|
||||||
<QSelectBox
|
onChange={(e) => handleChangeInput(e, 'hajebichi', index)}
|
||||||
options={raftCodes}
|
value={parseInt(roof.hajebichi)}
|
||||||
value={roof}
|
readOnly={roof.roofPchAuth === 'R'}
|
||||||
showKey={'clCodeNm'}
|
/>
|
||||||
sourceKey={'clCode'}
|
|
||||||
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
|
|
||||||
onChange={(e) => handleChangeRaft(e, index)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
{roof.roofPchAuth && (
|
</div>
|
||||||
<div className="block-box">
|
|
||||||
<div className="flex-ment">
|
|
||||||
<span>{getMessage('hajebichi')}</span>
|
|
||||||
<div className="input-grid">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-origin block"
|
|
||||||
onChange={(e) => handleChangeInput(e, 'hajebichi', index)}
|
|
||||||
value={parseInt(roof.hajebichi)}
|
|
||||||
readOnly={roof.roofPchAuth === 'R'}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
<div className="block-box">
|
||||||
|
<div className="flex-ment">
|
||||||
|
<span>{getMessage('slope')}</span>
|
||||||
|
<div className="input-grid">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-origin block"
|
||||||
|
onChange={(e) => {
|
||||||
|
handleChangePitch(e, index)
|
||||||
|
}}
|
||||||
|
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span className="absol">{pitchText}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="block-box">
|
<div className="block-box">
|
||||||
<div className="icon-btn-wrap">
|
<div className="icon-btn-wrap">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -243,6 +243,7 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleCopy = (length, direction) => {
|
const moduleCopy = (length, direction) => {
|
||||||
@ -303,6 +304,7 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleMultiCopy = (type, length, direction) => {
|
const moduleMultiCopy = (type, length, direction) => {
|
||||||
@ -377,6 +379,7 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleColumnRemove = (type) => {
|
const moduleColumnRemove = (type) => {
|
||||||
@ -491,6 +494,7 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleRowRemove = (type) => {
|
const moduleRowRemove = (type) => {
|
||||||
@ -606,6 +610,7 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleColumnInsert = (type) => {
|
const moduleColumnInsert = (type) => {
|
||||||
@ -701,6 +706,8 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
moduleSetupSurface.set({ modules: [...moduleSetupSurface.modules, ...copyModules] })
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const muduleRowInsert = (type) => {
|
const muduleRowInsert = (type) => {
|
||||||
@ -798,6 +805,9 @@ export function useModule() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
moduleSetupSurface.set({ modules: [...moduleSetupSurface.modules, ...copyModules] })
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const alignModule = (type, surfaceArray) => {
|
const alignModule = (type, surfaceArray) => {
|
||||||
@ -870,6 +880,7 @@ export function useModule() {
|
|||||||
surface.set({ modules: modules })
|
surface.set({ modules: modules })
|
||||||
canvas.remove(activeModule)
|
canvas.remove(activeModule)
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
setModuleStatisticsData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleRoofRemove = (surfaceArray) => {
|
const moduleRoofRemove = (surfaceArray) => {
|
||||||
@ -965,7 +976,7 @@ export function useModule() {
|
|||||||
]
|
]
|
||||||
const surfaceObjects = {}
|
const surfaceObjects = {}
|
||||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
const rows = surfaces.map((surface) => {
|
surfaces.forEach((surface) => {
|
||||||
surfaceObjects[surface.id] = {
|
surfaceObjects[surface.id] = {
|
||||||
roofSurface: canvas.getObjects().filter((obj) => obj.id === surface.parentId)[0].directionText,
|
roofSurface: canvas.getObjects().filter((obj) => obj.id === surface.parentId)[0].directionText,
|
||||||
circuit: '-',
|
circuit: '-',
|
||||||
@ -1002,11 +1013,12 @@ export function useModule() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
let tempRows = []
|
let tempRows = []
|
||||||
|
console.log('surfaceObjects', surfaceObjects)
|
||||||
Object.keys(surfaceObjects).forEach((key) => {
|
Object.keys(surfaceObjects).forEach((key) => {
|
||||||
let tempRow = {
|
let tempRow = {
|
||||||
name: surfaceObjects[key].roofSurface,
|
name: surfaceObjects[key].roofSurface,
|
||||||
circuit: surfaceObjects[key].circuit,
|
circuit: surfaceObjects[key].circuit,
|
||||||
wpOut: parseInt((surfaceObjects[key].wpOut / 1000).toFixed(3)),
|
wpOut: parseFloat(surfaceObjects[key].wpOut / 1000),
|
||||||
}
|
}
|
||||||
selectedModules.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
tempRow[module.itemId] = surfaceObjects[key][module.itemId]
|
tempRow[module.itemId] = surfaceObjects[key][module.itemId]
|
||||||
@ -1017,7 +1029,7 @@ export function useModule() {
|
|||||||
let row = {
|
let row = {
|
||||||
name: surfaceObjects[key].roofSurface,
|
name: surfaceObjects[key].roofSurface,
|
||||||
circuit: surfaceObjects[key].circuits[circuit].circuit,
|
circuit: surfaceObjects[key].circuits[circuit].circuit,
|
||||||
wpOut: parseInt((surfaceObjects[key].circuits[circuit].circuits.wpOut / 1000).toFixed(3)),
|
wpOut: parseFloat(surfaceObjects[key].circuits[circuit].circuits.wpOut / 1000),
|
||||||
}
|
}
|
||||||
selectedModules.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
row[module.itemId] = surfaceObjects[key].circuits[circuit].circuits[module.itemId]
|
row[module.itemId] = surfaceObjects[key].circuits[circuit].circuits[module.itemId]
|
||||||
@ -1025,14 +1037,14 @@ export function useModule() {
|
|||||||
tempRows.push(row)
|
tempRows.push(row)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
console.log('tempRows', tempRows)
|
||||||
const tempFooter = {
|
const tempFooter = {
|
||||||
name: getMessage('modal.panel.batch.statistic.total'),
|
name: getMessage('modal.panel.batch.statistic.total'),
|
||||||
circuit: '-',
|
circuit: '-',
|
||||||
wpOut: tempRows.reduce((acc, row) => acc + row.wpOut, 0),
|
wpOut: tempRows.reduce((acc, row) => acc + row.wpOut, 0),
|
||||||
}
|
}
|
||||||
selectedModules.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + row[module.itemId], 0)
|
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + (row[module.itemId] ? parseFloat(row[module.itemId]) : 0), 0)
|
||||||
})
|
})
|
||||||
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user