From ca85f92ccc496c7d6ac96a365d3ca3d5469d16b3 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 2 Jan 2025 11:35:17 +0900 Subject: [PATCH 1/3] =?UTF-8?q?contextmenu=20=EC=A7=80=EB=B6=95=EC=9E=AC?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EC=8B=9C=20=EC=9D=BC=EB=B0=98=20?= =?UTF-8?q?=EC=A7=80=EB=B6=95=EB=A9=B4=20=ED=95=A0=EB=8B=B9=EC=9D=B4?= =?UTF-8?q?=EB=9E=91=20=EA=B0=99=EC=9D=80=20=EA=B8=B0=EB=8A=A5=20=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/roofcover/useRoofAllocationSetting.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 6c1ace5c..fbff6cdb 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -108,6 +108,14 @@ export function useRoofAllocationSetting(id) { // 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우 const handleSaveContext = () => { + setBasicSetting((prev) => { + return { + ...prev, + selectedRoofMaterial: currentRoofList.find((roof) => roof.selected), + } + }) + + setRoofList(currentRoofList) const selectedRoofMaterial = currentRoofList.find((roof) => roof.selected) setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial) closeAll() From 88e2f8423c83738971e8fe64ab031f3af2c5902f Mon Sep 17 00:00:00 2001 From: changkyu choi Date: Thu, 2 Jan 2025 11:36:00 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EB=B0=B0=EC=B9=98=EB=A9=B4=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placementShape/PlacementShapeSetting.jsx | 186 +++++++++++------- src/hooks/option/useCanvasSetting.js | 58 +++--- 2 files changed, 145 insertions(+), 99 deletions(-) diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index 7ed4e56e..db98cdc5 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -10,11 +10,12 @@ import WithDraggable from '@/components/common/draggable/WithDraggable' import { useCanvasSetting } from '@/hooks/option/useCanvasSetting' import { useRecoilValue } from 'recoil' import { roofMaterialsAtom } from '@/store/settingAtom' -import { isObjectNotEmpty } from '@/util/common-utils' import { useCommonCode } from '@/hooks/common/useCommonCode' import QSelectBox from '@/components/common/select/QSelectBox' import { globalLocaleStore } from '@/store/localeAtom' +import { onlyNumberInputChange } from '@/util/input-utils' + export const ROOF_MATERIAL_LAYOUT = { PARALLEL: 'P', STAIRS: 'S', @@ -29,10 +30,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set const globalLocale = useRecoilValue(globalLocaleStore) const { basicSetting, setBasicSettings, fetchBasicSettings, basicSettingSave, addedRoofs, setAddedRoofs } = useCanvasSetting() const { findCommonCode } = useCommonCode() - const [raftCodes, setRaftCodes] = useState([]) - //const [currentRoofMaterial, setCurrentRoofMaterial] = useState(basicSetting.selectedRoofMaterial) - const [currentRoofMaterial, setCurrentRoofMaterial] = useState(addedRoofs[0]) // 지붕재 정보 - const [roofLayout, setRoofLayout] = useState(addedRoofs[0].layout) // 지붕 레이아웃 + const [raftCodes, setRaftCodes] = useState([]) //서까래 정보 const roofRef = { roofCd: useRef(null), @@ -47,52 +45,77 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set fetchBasicSettings() const raftCodeList = findCommonCode('203800') setRaftCodes(raftCodeList) - console.log('raftCodeList', raftCodeList) }, []) useEffect(() => { - //console.log('currentRoofMaterial >>>>>>>>>>>>>>>>>>> ', currentRoofMaterial) - - console.log(' basicSetting.roofs[0] >>>>>>>>>>>>>>>>>>> ', basicSetting.roofs[0]) - //console.log('basicSetting >>>>>>>>>>>>>>>>>>> ', basicSetting) - console.log('roofLayout >>>>>>>>>>>>>>>>>>> ', roofLayout) + if (basicSetting.roofs.length > 0) { + setBasicSettings({ + ...basicSetting, + roofsData: { + roofApply: true, + roofSeq: 1, + roofMatlCd: basicSetting.roofs[0].roofMatlCd, + roofWidth: basicSetting.roofs[0].width, + roofHeight: basicSetting.roofs[0].length, + roofHajebichi: basicSetting.roofs[0].hajebichi, + roofGap: basicSetting.roofs[0].raft, + roofLayout: basicSetting.roofs[0].layout, + }, + }) + } + }, [basicSetting.roofs, basicSetting.roofSizeSet, basicSetting.roofAngleSet]) + const changeInput = (value, e) => { + const { name } = e.target + console.log('🚀 ~ changeInput ~ value name :', value, name) setBasicSettings({ ...basicSetting, - roofsData: { - roofApply: true, - roofSeq: 1, - roofMatlCd: currentRoofMaterial.roofMatlCd === null ? 'ROOF_ID_WA_53A' : currentRoofMaterial.roofMatlCd, - roofWidth: currentRoofMaterial.width === null ? 0 : currentRoofMaterial.width, - roofHeight: currentRoofMaterial.length === null ? 0 : currentRoofMaterial.length, - roofHajebichi: currentRoofMaterial.hajebichi === null ? 0 : currentRoofMaterial.hajebichi, - roofGap: currentRoofMaterial.raftBaseCd === null ? 'HEI_455' : currentRoofMaterial.raftBaseCd, - roofLayout: roofLayout, - }, - }) - }, [currentRoofMaterial, roofLayout, basicSetting.roofSizeSet, basicSetting.roofAngleSet]) + roofs: basicSetting.roofs.map((roof) => ({ + ...roof, + [name]: Number(value), + })), + }); + } // Function to update the roofType and corresponding values const handleRoofTypeChange = (value) => { const selectedRoofMaterial = roofMaterials.find((roof) => roof.roofMatlCd === value) - setCurrentRoofMaterial(selectedRoofMaterial) + setBasicSettings({ + ...basicSetting, + roofs: [selectedRoofMaterial], // 선택된 데이터로 roofs 배열 초기화 + }); } const handleRafterChange = (value) => { - const selectedRafter = raftCodes.find((raft) => raft.clCode === value) - setCurrentRoofMaterial({ ...currentRoofMaterial, raft: selectedRafter.clCode }) + setBasicSettings({ + ...basicSetting, + roofs: basicSetting.roofs.map((roof) => ({ + ...roof, + raft: value, + })), + }); + } + + const handleRoofLayoutChange = (value) => { + setBasicSettings({ + ...basicSetting, + roofs: basicSetting.roofs.map((roof) => ({ + ...roof, + layout: value, + })), + }); } const handleSaveBtn = () => { - const roofInfo = { - ...currentRoofMaterial, + const roofInfo = { + ...basicSetting.roofs, roofCd: roofRef.roofCd.current?.value, width: roofRef.width.current?.value, length: roofRef.length.current?.value, hajebichi: roofRef.hajebichi.current?.value, - // raft: roofRef.rafter.current?.value, + //raft: roofRef.rafter.current?.value, selected: true, - layout: roofLayout, + layout: basicSetting.roofs[0].layout, index: 0, } @@ -107,17 +130,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set selectedRoofMaterial: { // 선택된 지붕재 정보 roofInfo, - }, - roofsData: { - roofApply: true, - roofSeq: 1, - roofMatlCd: currentRoofMaterial.roofMatlCd === null ? 'ROOF_ID_WA_53A' : currentRoofMaterial.roofMatlCd, - roofWidth: currentRoofMaterial.width === null ? 0 : currentRoofMaterial.width, - roofHeight: currentRoofMaterial.length === null ? 0 : currentRoofMaterial.length, - roofHajebichi: currentRoofMaterial.hajebichi === null ? 0 : currentRoofMaterial.hajebichi, - roofGap: currentRoofMaterial.raftBaseCd === null ? 'HEI_455' : currentRoofMaterial.raftBaseCd, - roofLayout: roofLayout, - }, + } }) setBasicSettings({ @@ -127,6 +140,16 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set ...roofInfo, }, roofs: addedRoofs, + roofsData: { + roofApply: true, + roofSeq: 1, + roofMatlCd: basicSetting.roofs[0].roofMatlCd, + roofWidth: basicSetting.roofs[0].width, + roofHeight: basicSetting.roofs[0].length, + roofHajebichi: basicSetting.roofs[0].hajebichi, + roofGap: basicSetting.roofs[0].raft, + roofLayout: basicSetting.roofs[0].layout, + }, }) basicSettingSave() @@ -238,17 +261,19 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
{ return { ...roof, name: globalLocale === 'ko' ? roof.roofMatlNm : roof.roofMatlNmJp } })} - value={basicSetting.roofSizeSet === '3' ? null : currentRoofMaterial} + //value={roofMaterials.find((r) => r.roofMatlCd === basicSetting.roofs[0]?.roofMatlCd)} + //title={basicSetting.roofs[0]?.roofMatlNm} + value={basicSetting.roofSizeSet == 3 ? null : basicSetting.roofs[0]?.roofMatlCd} onChange={(e) => handleRoofTypeChange(e.roofMatlCd)} - sourceKey="id" - targetKey="id" - showKey="name" - disabled={basicSetting.roofSizeSet === '3'} + //sourceKey="id" + //targetKey="id" + //showKey="name" + disabled={basicSetting.roofSizeSet == 3} /> {/* setCurrentRoofMaterial({ ...currentRoofMaterial, width: e.target.value })} - readOnly={currentRoofMaterial.widAuth === 'R'} + value={parseInt(basicSetting.roofs[0]?.width)} + onChange={(e) => onlyNumberInputChange(e, changeInput)} + readOnly={basicSetting.roofs[0]?.widAuth === 'R'} + disabled={basicSetting.roofSizeSet == 3} />
{/*
@@ -291,17 +318,19 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
*/}
)} - {currentRoofMaterial && ['R', 'C'].includes(currentRoofMaterial.lenAuth) && ( + {basicSetting && ['R', 'C'].includes(basicSetting.roofs[0]?.lenAuth) && (
L
setCurrentRoofMaterial({ ...currentRoofMaterial, length: e.target.value })} - readOnly={currentRoofMaterial.lenAuth === 'R'} + value={parseInt(basicSetting.roofs[0]?.length)} + onChange={(e) => onlyNumberInputChange(e, changeInput)} + readOnly={basicSetting.roofs[0]?.lenAuth === 'R'} + disabled={basicSetting.roofSizeSet == 3} />
{/*
@@ -314,21 +343,22 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
*/}
)} - {currentRoofMaterial && ['C', 'R'].includes(currentRoofMaterial.raftAuth) && ( + {basicSetting && ['C', 'R'].includes(basicSetting.roofs[0]?.raftAuth) && (
{getMessage('modal.placement.initial.setting.rafter')} {raftCodes.length > 0 && ( -
- handleRafterChange(e.clCode)} - sourceKey="clCode" - targetKey={currentRoofMaterial.raft ? 'raft' : 'raftBaseCd'} - showKey="clCodeNm" - disabled={basicSetting.roofSizeSet === '3'} - /> - {/* {raftCodes.map((raft, index) => { return (
+
)} )} - {currentRoofMaterial && ['C', 'R'].includes(currentRoofMaterial.roofPchAuth) && ( + {basicSetting && ['C', 'R'].includes(basicSetting.roofs[0]?.roofPchAuth) && (
{getMessage('hajebichi')}
setCurrentRoofMaterial({ ...currentRoofMaterial, hajebichi: e.target.value })} - readOnly={currentRoofMaterial.roofPchAuth === 'R'} + value={parseInt(basicSetting.roofs[0]?.hajebichi)} + onChange={(e) => onlyNumberInputChange(e, changeInput)} + readOnly={basicSetting.roofs[0]?.roofPchAuth === 'R'} + disabled={basicSetting.roofSizeSet == 3} />
@@ -360,15 +392,17 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js index 1c1dca34..7362fe03 100644 --- a/src/hooks/option/useCanvasSetting.js +++ b/src/hooks/option/useCanvasSetting.js @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil' import { adsorptionPointModeState, @@ -19,7 +19,6 @@ import { settingModalSecondOptionsState, settingModalGridOptionsState, basicSettingState, - settingsState, roofMaterialsAtom, selectedRoofMaterialSelector, addedRoofsState, @@ -30,7 +29,6 @@ import { dimensionLineSettingsState } from '@/store/commonUtilsAtom' import { gridColorState } from '@/store/gridAtom' import { useColor } from 'react-color-palette' import { useMasterController } from '@/hooks/common/useMasterController' -import { isObjectNotEmpty } from '@/util/common-utils' import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting' const defaultDotLineGridSetting = { @@ -144,7 +142,7 @@ export function useCanvasSetting() { newAddedRoofs.push({ ...selectedRoofMaterial, selected: true, index: 0 }) setAddedRoofs(newAddedRoofs) } - setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial }) + setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial, roofMaterials: selectedRoofMaterial }) } useEffect(() => { @@ -270,6 +268,18 @@ export function useCanvasSetting() { roofAngleSet: item.roofAngleSet, } }) + roofsArray = res.map((item) => { + return { + roofApply: true, + roofSeq: 1, + roofMatlCd: item.roofMatlCd, + roofWidth: item.roofWidth, + roofHeight: item.roofHeight, + roofHajebichi: item.roofHajebichi, + roofGap: item.roofGap, + roofLayout: item.roofLayout, + } + }) } else { roofsRow = [ { @@ -299,7 +309,7 @@ export function useCanvasSetting() { roofs: roofsArray, // 만들어진 roofs 배열 } - console.log('patternData', patternData) + console.log('fetchBasicSettings patternData', patternData) // 데이터 설정 //setBasicSettings({ ...basicSetting, roofSizeSet: roofsRow[0].roofSizeSet, roofAngleSet: roofsRow[0].roofAngleSet, roofsData: roofsArray}) @@ -307,20 +317,22 @@ export function useCanvasSetting() { roofMaterials.map((material) => { if (material.id === roofsArray[0].roofMatlCd) { //setRoofMaterials({ ...roofMaterials, layout: roofsArray[0].roofLayout }) - addRoofs.push({ ...material, selected: true, layout: roofsArray[0].roofLayout }) - setBasicSettings({ - ...basicSetting, - roofMaterials: material, - roofs: addRoofs, - roofSizeSet: roofsRow[0].roofSizeSet, - roofAngleSet: roofsRow[0].roofAngleSet, - roofsData: roofsArray, - }) + addRoofs.push({ ...material, selected: true + , width: roofsArray[0].roofWidth + , length: roofsArray[0].roofHeight + , hajebichi: roofsArray[0].roofHajebichi + , raft: roofsArray[0].roofGap + , layout: roofsArray[0].roofLayout + }) + setBasicSettings({ ...basicSetting, roofMaterials: material + , roofs: addRoofs + , roofSizeSet: roofsRow[0].roofSizeSet + , roofAngleSet: roofsRow[0].roofAngleSet + , roofsData: roofsArray + , selectedRoofMaterial: material }) } }) - - // 데이터 설정 - setBasicSettings({ ...basicSetting, roofSizeSet: roofsRow[0].roofSizeSet, roofAngleSet: roofsRow[0].roofAngleSet, roofsData: roofsArray }) + }) } catch (error) { console.error('Data fetching error:', error) @@ -343,17 +355,17 @@ export function useCanvasSetting() { { roofApply: true, roofSeq: 1, - roofMatlCd: basicSetting.roofsData.roofMatlCd === null ? 'ROOF_ID_WA_53A' : basicSetting.roofsData.roofMatlCd, - roofWidth: basicSetting.roofsData.roofWidth === null ? 0 : basicSetting.roofsData.roofWidth, - roofHeight: basicSetting.roofsData.roofHeight === null ? 0 : basicSetting.roofsData.roofHeight, - roofHajebichi: basicSetting.roofsData.roofHajebichi === null ? 0 : basicSetting.roofsData.roofHajebichi, - roofGap: basicSetting.roofsData.roofGap === null ? 'HEI_455' : basicSetting.roofsData.roofGap, + roofMatlCd: basicSetting.roofsData.roofMatlCd === null || basicSetting.roofsData.roofMatlCd === undefined ? 'ROOF_ID_WA_53A' : basicSetting.roofsData.roofMatlCd, + roofWidth: basicSetting.roofsData.roofWidth === null || basicSetting.roofsData.roofWidth === undefined ? 0 : basicSetting.roofsData.roofWidth, + roofHeight: basicSetting.roofsData.roofHeight === null || basicSetting.roofsData.roofHeight === undefined ? 0 : basicSetting.roofsData.roofHeight, + roofHajebichi: basicSetting.roofsData.roofHajebichi === null || basicSetting.roofsData.roofHajebichi === undefined ? 0 : basicSetting.roofsData.roofHajebichi, + roofGap: basicSetting.roofsData.roofGap === null || basicSetting.roofsData.roofGap === undefined ? 'HEI_455' : basicSetting.roofsData.roofGap, roofLayout: basicSetting.roofsData.roofLayout, }, ], } - console.log('patternData 55', patternData) + console.log('basicSettingSave patternData ', patternData) await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData }).then((res) => { swalFire({ text: getMessage(res.returnMessage) }) From f57c2559686611af9ce465e826df78bc7e660048 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 2 Jan 2025 14:46:18 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Qcast=20=EB=AC=BC=EA=B1=B4=EC=83=81?= =?UTF-8?q?=EC=84=B8=20surface=20=EC=BD=94=EB=93=9C=20value=20=EA=B0=92=20?= =?UTF-8?q?=20GlobalDataProvider=EC=97=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/management/StuffDetail.jsx | 8 +++++++- src/components/management/popup/PlanRequestPop.jsx | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 001530a8..c16219bd 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -319,7 +319,13 @@ export default function StuffDetail() { promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => { if (res.status === 200) { if (isObjectNotEmpty(res.data)) { - setManagementState(res.data) + let surfaceTypeValue + if (res.data.surfaceType === 'Ⅲ・Ⅳ') { + surfaceTypeValue = '3' + } else if (res.data.surfaceType === 'Ⅱ') { + surfaceTypeValue = '2' + } + setManagementState({ ...res.data, surfaceTypeValue: surfaceTypeValue }) } else { setManagementState({}) alert(getMessage('stuff.detail.header.notExistObjectNo')) diff --git a/src/components/management/popup/PlanRequestPop.jsx b/src/components/management/popup/PlanRequestPop.jsx index c7a3f7cd..aa415edd 100644 --- a/src/components/management/popup/PlanRequestPop.jsx +++ b/src/components/management/popup/PlanRequestPop.jsx @@ -87,7 +87,7 @@ export default function PlanRequestPop(props) { const onSubmit = (page, type) => { //2차점 테스트 201X112 const params = { - // saleStoreId: 'T100', + // saleStoreId: 'X112', // saleStoreLevel: '1', saleStoreId: props?.otherSaleStoreId ? props.otherSaleStoreId : props.saleStoreId, saleStoreLevel: props?.otherSaleStoreLevel ? props.otherSaleStoreLevel : props.saleStoreLevel,