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