Merge branch 'qcast-pub' into dev
# Conflicts: # src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx
This commit is contained in:
commit
d056c80379
@ -2,7 +2,7 @@
|
||||
|
||||
import { useContext, useEffect, useRef } from 'react'
|
||||
|
||||
import { useRecoilValue } from 'recoil'
|
||||
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
||||
|
||||
import QContextMenu from '@/components/common/context-menu/QContextMenu'
|
||||
import PanelBatchStatistics from '@/components/floor-plan/modal/panelBatch/PanelBatchStatistics'
|
||||
@ -16,6 +16,7 @@ import { totalDisplaySelector } from '@/store/settingAtom'
|
||||
import { MENU } from '@/common/common'
|
||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
||||
|
||||
export default function CanvasFrame() {
|
||||
const canvasRef = useRef(null)
|
||||
@ -27,7 +28,8 @@ export default function CanvasFrame() {
|
||||
const { currentCanvasPlan } = usePlan()
|
||||
const totalDisplay = useRecoilValue(totalDisplaySelector) // 집계표 표시 여부
|
||||
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||
|
||||
const [moduleStatistics, setModuleStatistics] = useRecoilState(moduleStatisticsState)
|
||||
const reset = useResetRecoilState(moduleStatisticsState)
|
||||
const loadCanvas = () => {
|
||||
if (canvas) {
|
||||
canvas?.clear() // 캔버스를 초기화합니다.
|
||||
@ -43,6 +45,7 @@ export default function CanvasFrame() {
|
||||
|
||||
useEffect(() => {
|
||||
loadCanvas()
|
||||
reset()
|
||||
}, [currentCanvasPlan, canvas])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -163,7 +163,6 @@ export default function CircuitTrestleSetting({ id }) {
|
||||
.getObjects()
|
||||
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||
.map((obj) => {
|
||||
getModuleList(obj)
|
||||
return {
|
||||
roofSurfaceId: obj.id,
|
||||
roofSurface: canvas
|
||||
@ -430,6 +429,8 @@ export default function CircuitTrestleSetting({ id }) {
|
||||
obj.circuit = null
|
||||
obj.pcsItemId = null
|
||||
})
|
||||
setAllocationType(ALLOCATION_TYPE.AUTO)
|
||||
canvas.renderAll()
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -507,7 +508,7 @@ export default function CircuitTrestleSetting({ id }) {
|
||||
)}
|
||||
{tabNum === 1 && allocationType === ALLOCATION_TYPE.PASSIVITY && (
|
||||
<div className="grid-btn-wrap">
|
||||
<button className="btn-frame modal mr5" onClick={() => setAllocationType(ALLOCATION_TYPE.AUTO)}>
|
||||
<button className="btn-frame modal mr5" onClick={() => onClickPrev()}>
|
||||
{getMessage('modal.common.prev')}
|
||||
</button>
|
||||
<button className="btn-frame modal act" onClick={() => setTabNum(2)}>
|
||||
|
||||
@ -7,7 +7,7 @@ import { canvasState } from '@/store/canvasAtom'
|
||||
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
||||
import { selectedModuleState } from '@/store/selectedModuleOptions'
|
||||
import { useContext, useEffect, useState } from 'react'
|
||||
import { useRecoilValue } from 'recoil'
|
||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||
|
||||
export default function PassivityCircuitAllocation(props) {
|
||||
const {
|
||||
@ -25,7 +25,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||
const selectedModules = useRecoilValue(selectedModuleState)
|
||||
const moduleStatistics = useRecoilValue(moduleStatisticsState)
|
||||
const [moduleStatistics, setModuleStatistics] = useRecoilState(moduleStatisticsState)
|
||||
// const [totalWpout, setTotalWpout] = useState(0)
|
||||
const [selectedPcs, setSelectedPcs] = useState(selectedModels[0])
|
||||
// const { header, rows: row } = moduleStatistics
|
||||
@ -157,6 +157,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
}
|
||||
|
||||
const handleCircuitNumberFix = () => {
|
||||
let uniqueCircuitNumbers = null
|
||||
if (!circuitNumber || circuitNumber === 0) {
|
||||
swalFire({
|
||||
text: '회로번호를 1 이상입력해주세요.',
|
||||
@ -172,7 +173,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
})
|
||||
return
|
||||
} else if (selectedModels.length > 1) {
|
||||
const uniqueCircuitNumbers = [
|
||||
uniqueCircuitNumbers = [
|
||||
...new Set(
|
||||
canvas
|
||||
.getObjects()
|
||||
@ -255,7 +256,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
goodsNo: model.goodsNo,
|
||||
serQtyList: [
|
||||
{
|
||||
serQty: 0,
|
||||
serQty: targetModules.length,
|
||||
paralQty: 0,
|
||||
rmdYn: 'Y',
|
||||
usePossYn: 'Y',
|
||||
@ -311,15 +312,15 @@ export default function PassivityCircuitAllocation(props) {
|
||||
|
||||
const setTableData = () => {
|
||||
const tempHeader = [
|
||||
{ name: '지붕면', prop: 'name' },
|
||||
{ name: '회로', prop: 'circuit' },
|
||||
{ name: getMessage('simulator.table.sub1'), prop: 'name' },
|
||||
{ name: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.circuit'), prop: 'circuit' },
|
||||
...selectedModules.itemList.map((module) => {
|
||||
return {
|
||||
name: module.itemNm,
|
||||
prop: module.itemId,
|
||||
}
|
||||
}),
|
||||
{ name: '발전량(kW)', prop: 'wpOut' },
|
||||
{ name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'wpOut' },
|
||||
]
|
||||
|
||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||
@ -396,15 +397,16 @@ export default function PassivityCircuitAllocation(props) {
|
||||
selectedModules.itemList.forEach((module) => {
|
||||
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + row[module.itemId], 0)
|
||||
})
|
||||
console.log('tempHeader, tempRows, tempFooter', tempHeader, tempRows, tempFooter)
|
||||
|
||||
setHeader(tempHeader)
|
||||
setRows(tempRows.filter((row) => row.wpOut !== 0))
|
||||
setFooter(tempFooter)
|
||||
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
||||
}
|
||||
|
||||
const initSelectedPcsCircuitNumber = () => {
|
||||
swalFire({
|
||||
title: '선택된 파워 컨디셔너의 회로할당을 초기화합니다.',
|
||||
title: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.init.info'),
|
||||
type: 'confirm',
|
||||
icon: 'warning',
|
||||
confirmFn: () => {
|
||||
@ -425,7 +427,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
const initAllPcsCircuitNumber = () => {
|
||||
canvas.discardActiveObject()
|
||||
swalFire({
|
||||
title: '회로 할당의 설정을 초기화합니다.',
|
||||
title: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.init.setting.info'),
|
||||
type: 'confirm',
|
||||
icon: 'warning',
|
||||
confirmFn: () => {
|
||||
@ -467,7 +469,9 @@ export default function PassivityCircuitAllocation(props) {
|
||||
<tr key={'row' + index}>
|
||||
{header.map((header, i) => (
|
||||
<td className="al-c" key={'rowcell' + i}>
|
||||
{row[header.prop]}
|
||||
{typeof row[header.prop] === 'number'
|
||||
? row[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 })
|
||||
: row[header.prop]}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
@ -475,7 +479,9 @@ export default function PassivityCircuitAllocation(props) {
|
||||
<tr>
|
||||
{header.map((header, i) => (
|
||||
<td className="al-c" key={'footer' + i}>
|
||||
{footer[header.prop]}
|
||||
{typeof footer[header.prop] === 'number'
|
||||
? footer[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 })
|
||||
: footer[header.prop]}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
|
||||
@ -25,24 +25,27 @@ export default function PanelBatchStatistics() {
|
||||
<thead>
|
||||
<tr>
|
||||
{header.map((item, index) => (
|
||||
<th key={index}>{item.name}</th>
|
||||
<th key={`statistic-hd-${index}`}>{item.name}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row, index) => (
|
||||
<tr key={index}>
|
||||
<tr key={`statistic-row-${index}`}>
|
||||
{header.map((item, i) => (
|
||||
<td key={index}>
|
||||
<td key={`statistic-col-${i}`}>
|
||||
{typeof row[item.prop] === 'number' ? row[item.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 }) : row[item.prop]}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
<tr>
|
||||
{footer.map((item, index) => (
|
||||
<td key={index}>{typeof item === 'number' ? item.toLocaleString('ko-KR', { maximumFractionDigits: 4 }) : item}</td>
|
||||
// <td className="al-r">{item.amount}</td>
|
||||
{header.map((header, index) => (
|
||||
<td key={`statistic-ft-${index}`}>
|
||||
{typeof footer[header.prop] === 'number'
|
||||
? footer[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 })
|
||||
: footer[header.prop]}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@ -149,6 +149,8 @@
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.selected.power.conditional.reset": "選択されたパワーコンディショナーの回路番号の初期化",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.reset": "すべての回路番号の初期化",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "番号確定",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.info": "선택된 파워 컨디셔너의 회로할당을 초기화합니다.(JA)",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.setting.info": "회로 할당의 설정을 초기화합니다.(JA)",
|
||||
"modal.circuit.trestle.setting.step.up.allocation": "昇圧設定",
|
||||
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "シリアル枚数",
|
||||
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "総回路数",
|
||||
|
||||
@ -155,6 +155,8 @@
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.selected.power.conditional.reset": "선택된 파워컨디셔너의 회로번호 초기화",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.reset": "모든 회로번호 초기화",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "번호 확정",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.info": "선택된 파워 컨디셔너의 회로할당을 초기화합니다.",
|
||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.setting.info": "회로 할당의 설정을 초기화합니다.",
|
||||
"modal.circuit.trestle.setting.step.up.allocation": "승압 설정",
|
||||
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "직렬매수",
|
||||
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "총 회로수",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user