This commit is contained in:
hyojun.choi 2025-03-14 17:07:08 +09:00
commit 5eb70a176e
12 changed files with 79 additions and 81 deletions

View File

@ -3,16 +3,7 @@
import { useState } from 'react'
import Draggable from 'react-draggable'
export default function WithDraggable({
isShow,
children,
pos = { x: 0, y: 0 },
handle = '',
className = '',
isModal = true,
hasFooter = true,
isHidden = false,
}) {
export default function WithDraggable({ isShow, children, pos = { x: 0, y: 0 }, handle = '', className = '', hasFooter = true, isHidden = false }) {
const [position, setPosition] = useState(pos)
const handleOnDrag = (e, data) => {
@ -31,14 +22,10 @@ export default function WithDraggable({
onDrag={(e, data) => handleOnDrag(e, data)}
handle={handle === '' ? '.modal-handle' : handle}
>
{isModal ? (
<div className={`modal-pop-wrap ${className}`} style={{ visibility: isHidden ? 'hidden' : 'visible' }}>
{children}
{hasFooter && <WithDraggableFooter />}
</div>
) : (
<>{children}</>
)}
<div className={`modal-pop-wrap ${className}`} style={{ visibility: isHidden ? 'hidden' : 'visible' }}>
{children}
{hasFooter && <WithDraggableFooter />}
</div>
</Draggable>
)}
</>
@ -68,15 +55,10 @@ function WithDraggableBody({ children }) {
)
}
function WithDraggablePanel({ children }) {
return <>{children}</>
}
function WithDraggableFooter() {
return <div className="modal-foot modal-handle"></div>
}
WithDraggable.Header = WithDraggableHeader
WithDraggable.Body = WithDraggableBody
WithDraggable.Panel = WithDraggablePanel
WithDraggable.Footer = WithDraggableFooter

View File

@ -165,6 +165,15 @@ export default function PowerConditionalSelect(props) {
return
}
if (selectedRow.pcsSerParallelYn === 'Y' && selectedModels.length === 0 && selectedMaker.pcsMkrMultiType === PCS_MKR_MULTI_TYPE.SINGLE_P) {
swalFire({
title: getMessage('modal.module.pcs.error1'),
icon: 'warning',
})
return
}
if (selectedMaker.pcsMkrMultiType === PCS_MKR_MULTI_TYPE.MULTI) {
setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }])
} else if (!selectedModels.find((m) => m.itemId === selectedRow.itemId)) {
@ -174,6 +183,11 @@ export default function PowerConditionalSelect(props) {
}
const onRemoveSelectedModel = (model) => {
const tempModels = selectedModels.filter((m) => m.id !== model.id)
if (tempModels.length === 1 && tempModels[0].pcsSerParallelYn === 'Y') {
setSelectedModels([])
return
}
setSelectedModels(selectedModels.filter((m) => m.id !== model.id))
}
@ -282,14 +296,6 @@ export default function PowerConditionalSelect(props) {
</label>
</div>
</div>
{/* <div className="grid-btn-wrap">
<button className="btn-frame modal mr5" onClick={() => setTabNum(2)}>
{getMessage('modal.circuit.trestle.setting.circuit.allocation.auto')}
</button>
<button className="btn-frame modal act" onClick={() => setTabNum(tabNum + 1)}>
{getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity')}
</button>
</div> */}
</>
)
}

View File

@ -11,60 +11,64 @@ import { canvasState } from '@/store/canvasAtom'
import { POLYGON_TYPE } from '@/common/common'
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import Draggable from 'react-draggable'
export default function PanelBatchStatistics() {
const { getMessage } = useMessage()
const [isFold, setIsFold] = useState(false)
const [pos, setPos] = useState({
x: 0,
y: 30,
})
const canvas = useRecoilValue(canvasState)
const { header, rows, footer } = useRecoilValue(moduleStatisticsState)
const { setModuleStatisticsData } = useCircuitTrestle(true)
const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState)
const [position, setPosition] = useState({
x: 0,
y: 30,
})
const handleOnDrag = (e, data) => {
e.stopPropagation()
setPosition({ x: data.x, y: data.y })
}
useEffect(() => {
if (moduleSelectionDataStore && moduleSelectionDataStore.module) setModuleStatisticsData()
}, [])
return (
<WithDraggable isShow={true} handle=".penal-wrap" pos={pos} isModal={false}>
<WithDraggable.Panel>
<div className={`penal-wrap ${!isFold ? 'act' : ''}`}>
<h2>{getMessage('modal.panel.batch.statistic')}</h2>
<button className="penal-arr" onClick={() => setIsFold(!isFold)}></button>
<div className="penal-table-wrap">
<table className="penal-table">
<thead>
<tr>
{header.map((item, index) => (
<th key={`statistic-hd-${index}`}>{item.name}</th>
))}
</tr>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={`statistic-row-${index}`}>
{header.map((item, i) => (
<td key={`statistic-col-${i}`}>{row[item.prop] ?? 0}</td>
))}
</tr>
<Draggable position={{ x: position.x, y: position.y }} onDrag={(e, data) => handleOnDrag(e, data)} handle=".penal-wrap">
<div className={`penal-wrap ${!isFold ? 'act' : ''}`}>
<h2>{getMessage('modal.panel.batch.statistic')}</h2>
<button className="penal-arr" onClick={() => setIsFold(!isFold)}></button>
<div className="penal-table-wrap">
<table className="penal-table">
<thead>
<tr>
{header.map((item, index) => (
<th key={`statistic-hd-${index}`}>{item.name}</th>
))}
<tr>
{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>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={`statistic-row-${index}`}>
{header.map((item, i) => (
<td key={`statistic-col-${i}`}>{row[item.prop] ?? 0}</td>
))}
</tr>
</tbody>
</table>
</div>
))}
<tr>
{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>
</table>
</div>
</WithDraggable.Panel>
</WithDraggable>
</div>
</Draggable>
)
}

View File

@ -23,7 +23,7 @@ export default function Offset({ length1Ref, arrow1Ref, currentWallLineRef }) {
const keyDown = (e) => {
if (currentWallLineRef.current === null) {
alert('보조선을 먼저 선택하세요')
// alert(' ')
return
}

View File

@ -140,6 +140,7 @@ export default function StuffDetail() {
headerName: getMessage('stuff.detail.planGridHeader.moduleModel'),
flex: 1,
wrapText: true,
autoHeight: true,
cellStyle: { alignItems: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
cellRenderer: (params) => {
let origin = params.value

View File

@ -22,6 +22,7 @@ import { useSwal } from '@/hooks/useSwal'
import { usePopup } from '@/hooks/usePopup'
import { calculateAngle, isSamePoint } from '@/util/qpolygon-utils'
import { POLYGON_TYPE } from '@/common/common'
import { useMessage } from '../useMessage'
// 보조선 작성
export function useAuxiliaryDrawing(id, isUseEffect = true) {
@ -34,6 +35,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
const { swalFire } = useSwal()
const { getAdsorptionPoints } = useAdsorptionPoint()
const { closePopup } = usePopup()
const { getMessage } = useMessage()
const adsorptionRange = useRecoilValue(adsorptionRangeState)
@ -411,7 +413,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
const length1Value = length1Ref.current.value
if (diagonalLength <= length1Value) {
alert('대각선 길이는 직선 길이보다 길어야 합니다.')
// alert('대각선 길이는 직선 길이보다 길어야 합니다.')
return
}
@ -832,7 +834,8 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
}
const handleFix = () => {
if (!confirm('보조선 작성을 완료하시겠습니까?')) {
// if (!confirm('보조선 작성을 완료하시겠습니까?')) {
if (!confirm(getMessage('want.to.complete.auxiliary.creation'))) {
return
}

View File

@ -567,7 +567,7 @@ export function useOuterLineWall(id, propertiesId) {
const length1Value = length1Ref.current.value
if (diagonalLength <= length1Value) {
alert('대각선 길이는 직선 길이보다 길어야 합니다.')
// alert('대각선 길이는 직선 길이보다 길어야 합니다.')
return
}
@ -890,7 +890,7 @@ export function useOuterLineWall(id, propertiesId) {
})
if (isAllRightAngle) {
alert('부정확한 다각형입니다.')
// alert('부정확한 다각형입니다.')
return
}

View File

@ -192,7 +192,7 @@ export function useWallLineOffsetSetting(id) {
const handleSave = () => {
if (currentWallLineRef.current === null) {
alert('보조선을 먼저 선택하세요')
// alert('보조선을 먼저 선택하세요')
return
}
switch (type) {

View File

@ -564,7 +564,7 @@ export function usePlacementShapeDrawing(id) {
const length1Value = length1Ref.current.value
if (diagonalLength <= length1Value) {
alert('대각선 길이는 직선 길이보다 길어야 합니다.')
// alert('대각선 길이는 직선 길이보다 길어야 합니다.')
return
}
@ -886,7 +886,7 @@ export function usePlacementShapeDrawing(id) {
})
if (isAllRightAngle) {
alert('부정확한 다각형입니다.')
// alert('부정확한 다각형입니다.')
return
}

View File

@ -1033,5 +1033,6 @@
"canvas.infomation.text": "数字は [半角] 入力のみ可能です。",
"roof.exceed.count": "屋根材は4つまで選択可能です。",
"outerLine.property.fix": "外壁線の属性設定 を完了しますか?",
"outerLine.property.close": "外壁線の属性設定 を終了しますか?"
"outerLine.property.close": "外壁線の属性設定 を終了しますか?",
"want.to.complete.auxiliary.creation": "보補助線の作成を完了しますか?"
}

View File

@ -1033,5 +1033,6 @@
"canvas.infomation.text": "숫자는 [반각] 입력만 가능합니다.",
"roof.exceed.count": "지붕재는 4개까지 선택 가능합니다.",
"outerLine.property.fix": "외벽선 속성 설정을 완료하시겠습니까?",
"outerLine.property.close": "외벽선 속성 설정을 종료하시겠습니까?"
"outerLine.property.close": "외벽선 속성 설정을 종료하시겠습니까?",
"want.to.complete.auxiliary.creation": "보조선 작성을 완료하시겠습니까?"
}

View File

@ -320,7 +320,7 @@ export const drawGabledRoof = (roofId, canvas, textMode) => {
const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines
const hasNonParallelLines = roofLines.filter((line) => line.x1 !== line.x2 && line.y1 !== line.y2)
if (hasNonParallelLines.length > 0) {
alert('대각선이 존재합니다.')
// alert('대각선이 존재합니다.')
return
}
@ -648,7 +648,7 @@ export const drawShedRoof = (roofId, canvas, textMode) => {
const roof = canvas?.getObjects().find((object) => object.id === roofId)
const hasNonParallelLines = roof.lines.filter((line) => Math.abs(line.x1 - line.x2) > 1 && Math.abs(line.y1 - line.y2) > 1)
if (hasNonParallelLines.length > 0) {
alert('대각선이 존재합니다.')
// alert('대각선이 존재합니다.')
return
}
@ -739,7 +739,7 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
//Math.abs(line.x1 - line.x2) > 1 && Math.abs(line.y1 - line.y2) > 1
const hasNonParallelLines = roof.lines.filter((line) => Big(line.x1).minus(Big(line.x2)).gt(1) && Big(line.y1).minus(Big(line.y2)).gt(1))
if (hasNonParallelLines.length > 0) {
alert('대각선이 존재합니다.')
// alert('대각선이 존재ㄴ합니다.')
return
}