diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 256d51c6..08a06320 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -2288,22 +2288,26 @@ export function useModuleBasicSetting() { let moduleInfo = {} const rows = surfaces.map((surface) => { let wpOut = 0 - + moduleInfo = {} surface.modules.forEach((module) => { - wpOut += +module.moduleInfo.wpOut if (!moduleInfo[module.moduleInfo.itemId]) { - moduleInfo[module.moduleInfo.itemId] = 0 + moduleInfo[module.moduleInfo.itemId] = { name: module.moduleInfo.itemNm, amount: 0, id: module.moduleInfo.itemId } } + wpOut += +module.moduleInfo.wpOut - moduleInfo[module.moduleInfo.itemId]++ + moduleInfo[module.moduleInfo.itemId].amount++ }) totalWpout += wpOut console.log('πŸš€ ~ moduleData.rows=surfaces.map ~ module:', module) + const rowObject = {} + Object.keys(moduleInfo).forEach((key) => { + rowObject[key] = moduleInfo[key].amount + }) return { - name: canvas.getObjects().filter((obj) => obj.id === surface.parentId)[0].directionText, + ...rowObject, // 총 λ°œμ „λŸ‰ = λ°œμ „λŸ‰ * λͺ¨λ“ˆ 개수 + name: canvas.getObjects().filter((obj) => obj.id === surface.parentId)[0].directionText, // μ§€λΆ•λ©΄ // powerGeneration: wpOut.toLocaleString('ko-KR', { maximumFractionDigits: 4 }), - amount: wpOut, - ...moduleInfo, + wpOut: wpOut, } }) @@ -2311,9 +2315,9 @@ export function useModuleBasicSetting() { const header = [ { name: getMessage('modal.panel.batch.statistic.roof.shape'), prop: 'name' }, ...Object.keys(moduleInfo).map((key) => { - return { name: moduleInfo[key], prop: key } + return { name: moduleInfo[key].name, prop: key } }), - { name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'amount' }, + { name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'wpOut' }, ] let footer = ['합계'] let footerData = {} diff --git a/src/store/circuitTrestleAtom.js b/src/store/circuitTrestleAtom.js index 2ba3963b..86836b48 100644 --- a/src/store/circuitTrestleAtom.js +++ b/src/store/circuitTrestleAtom.js @@ -1,3 +1,4 @@ +import { useMessage } from '@/hooks/useMessage' import { atom } from 'recoil' export const makerState = atom({ @@ -23,5 +24,15 @@ export const pcsCheckState = atom({ export const moduleStatisticsState = atom({ key: 'moduleStatisticsState', - default: { header: [], rows: [], footer: [] }, + default: { + header: [ + { name: 'μ§€λΆ•λ©΄', prop: 'name' }, + { name: `λ°œμ „λŸ‰(kW)`, prop: 'amount' }, + ], + rows: [], + footer: [ + { name: '합계', prop: 'name' }, + { name: `λ°œμ „λŸ‰(kW)`, prop: 'amount' }, + ], + }, })