From ccbceb020ed4d27ed773317857dca2af7e0da8c1 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 5 Feb 2025 16:54:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/popup/DocDownOptionPop.jsx | 6 +++--- src/components/estimate/popup/EstimateCopyPop.jsx | 2 +- src/components/estimate/popup/ProductFeaturesPop.jsx | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/estimate/popup/DocDownOptionPop.jsx b/src/components/estimate/popup/DocDownOptionPop.jsx index 25461dc6..13477b63 100644 --- a/src/components/estimate/popup/DocDownOptionPop.jsx +++ b/src/components/estimate/popup/DocDownOptionPop.jsx @@ -18,7 +18,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown //다운로드 파일 EXCEL const [schUnitPriceFlg, setSchUnitPriceFlg] = useState('0') //견적제출서 표시명 - const [schDisplayFlg, setSchSchDisplayFlg] = useState('0') + const [schDisplayFlg, setSchDisplayFlg] = useState('0') //가대 중량표 포함(포함:1 미포함 : 0) const [schWeightFlg, setSchWeightFlg] = useState('1') //도면/시뮬레이션 파일 포함 @@ -208,7 +208,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown value={'0'} checked={schDisplayFlg === '0'} onChange={(e) => { - setSchSchDisplayFlg(e.target.value) + setSchDisplayFlg(e.target.value) }} /> @@ -221,7 +221,7 @@ export default function DocDownOptionPop({ planNo, setEstimatePopupOpen, docDown value={'1'} checked={schDisplayFlg === '1'} onChange={(e) => { - setSchSchDisplayFlg(e.target.value) + setSchDisplayFlg(e.target.value) }} /> diff --git a/src/components/estimate/popup/EstimateCopyPop.jsx b/src/components/estimate/popup/EstimateCopyPop.jsx index 001de6e9..35d8d54b 100644 --- a/src/components/estimate/popup/EstimateCopyPop.jsx +++ b/src/components/estimate/popup/EstimateCopyPop.jsx @@ -69,7 +69,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) { get({ url: url }).then((res) => { if (!isEmptyArray(res)) { res.map((row) => { - row.value == row.saleStoreId + row.value = row.saleStoreId row.label = row.saleStoreName }) otherList = res diff --git a/src/components/estimate/popup/ProductFeaturesPop.jsx b/src/components/estimate/popup/ProductFeaturesPop.jsx index f2d98800..b6b02c64 100644 --- a/src/components/estimate/popup/ProductFeaturesPop.jsx +++ b/src/components/estimate/popup/ProductFeaturesPop.jsx @@ -7,16 +7,16 @@ export default function ProductFeaturesPop({ popShowSpecialNoteList, showProduct useEffect(() => { let pushData = [] - popShowSpecialNoteList.map((row) => { + popShowSpecialNoteList.forEach((row) => { let option = showProductFeatureData.split('、') - option.map((row2) => { + option.forEach((row2) => { if (row.code === row2) { pushData.push(row) } }) }) setShowSpecialNoteList(pushData) - }, [popShowSpecialNoteList]) + }, [popShowSpecialNoteList, showProductFeatureData]) return (
From 65fd3d348f23b33d39f9c4a65566b185f02a9f19 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Wed, 5 Feb 2025 16:57:45 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EC=9D=BC=EA=B4=84=20=EB=B3=B5=EC=82=AC,=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/modal/module/PanelEdit.jsx | 4 +- src/hooks/module/useModule.js | 181 +++++++++--------- src/hooks/module/useModuleBasicSetting.js | 2 +- src/hooks/useContextMenu.js | 14 +- src/locales/ko.json | 3 +- 5 files changed, 107 insertions(+), 97 deletions(-) diff --git a/src/components/floor-plan/modal/module/PanelEdit.jsx b/src/components/floor-plan/modal/module/PanelEdit.jsx index 8e1f9fac..c324fab8 100644 --- a/src/components/floor-plan/modal/module/PanelEdit.jsx +++ b/src/components/floor-plan/modal/module/PanelEdit.jsx @@ -57,13 +57,13 @@ export default function PanelEdit(props) { moduleMove(length, direction) break case PANEL_EDIT_TYPE.MOVE_ALL: - moduleMoveAll(length, direction) + moduleMoveAll(length, direction, props.arrayData) break case PANEL_EDIT_TYPE.COPY: moduleCopy(length, direction) break case PANEL_EDIT_TYPE.COPY_ALL: - moduleCopyAll(length, direction) + moduleCopyAll(length, direction, props.arrayData) break case PANEL_EDIT_TYPE.COLUMN_MOVE: moduleMultiMove('column', length, direction) diff --git a/src/hooks/module/useModule.js b/src/hooks/module/useModule.js index 7f7c981c..53d3b897 100644 --- a/src/hooks/module/useModule.js +++ b/src/hooks/module/useModule.js @@ -145,104 +145,113 @@ export function useModule() { } } - const moduleMoveAll = (length, direction) => { - const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0] - const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE) - const objects = getObjects() + const moduleMoveAll = (length, direction, surfaceArray) => { + surfaceArray.forEach((surface) => { + const modules = canvas + .getObjects() + .filter((module) => module.name === POLYGON_TYPE.MODULE) + .filter((module) => module.surfaceId === surface.id) + const objects = getObjects() - let isWarning = false + let isWarning = false - modules.forEach((module) => { - const { top, left } = getPosotion(module, direction, length, false) - module.originPos = { - top: module.top, - left: module.left, - fill: module.fill, - } + modules.forEach((module) => { + const { top, left } = getPosotion(module, direction, length, false) + module.originPos = { + top: module.top, + left: module.left, + fill: module.fill, + } + + module.set({ top, left }) + module.setCoords() + canvas.renderAll() + + if (isOverlapObjects(module, objects) || isOutsideSurface(module, surface)) { + isWarning = true + module.set({ fill: 'red' }) + } + }) - module.set({ top, left }) - module.setCoords() canvas.renderAll() - - if (isOverlapObjects(module, objects) || isOutsideSurface(module, moduleSetupSurface)) { - isWarning = true - module.set({ fill: 'red' }) + if (isWarning) { + swalFire({ + title: getMessage('can.not.move.module'), + icon: 'error', + type: 'alert', + confirmFn: () => { + modules.forEach((module) => { + module.set({ top: module.originPos.top, left: module.originPos.left, fill: module.originPos.fill }) + module.setCoords() + }) + canvas.renderAll() + }, + }) } }) - - canvas.renderAll() - if (isWarning) { - swalFire({ - title: getMessage('can.not.move.module'), - icon: 'error', - type: 'alert', - confirmFn: () => { - modules.forEach((module) => { - module.set({ top: module.originPos.top, left: module.originPos.left, fill: module.originPos.fill }) - module.setCoords() - }) - canvas.renderAll() - }, - }) - } } - const moduleCopyAll = (length, direction) => { - const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0] - const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE) - const objects = getObjects() - const copyModules = [] - let copyModule = null - let isWarning = false - let moduleLength = 0 - if (['up', 'down'].includes(direction)) { - modules.sort((a, b) => a.top - b.top) - moduleLength = Number(modules[modules.length - 1].top) + Number(modules[modules.length - 1].height) - Number(modules[0].top) - } else if (['left', 'right'].includes(direction)) { - modules.sort((a, b) => a.left - b.left) - moduleLength = Number(modules[modules.length - 1].left) + Number(modules[modules.length - 1].width) - Number(modules[0].left) - } + const moduleCopyAll = (length, direction, surfaceArray) => { + surfaceArray.forEach((surface) => { + const modules = canvas + .getObjects() + .filter((module) => module.name === POLYGON_TYPE.MODULE) + .filter((module) => module.surfaceId === surface.id) + const objects = getObjects() + const copyModules = [] - modules.forEach((module) => { - const { top, left } = getPosotion(module, direction, Number(length) + Number(moduleLength), false) - module.clone((obj) => { - obj.set({ - parentId: module.parentId, - initOptions: module.initOptions, - direction: module.direction, - arrow: module.arrow, - name: module.name, - type: module.type, - length: module.length, - points: module.points, - surfaceId: module.surfaceId, - left, - top, - id: uuidv4(), - }) - copyModule = obj - canvas.add(obj) - copyModules.push(obj) - obj.setCoords() - }) - if (isOverlapObjects(copyModule, objects) || isOutsideSurface(copyModule, moduleSetupSurface)) { - isWarning = true - copyModule.set({ fill: 'red' }) + let copyModule = null + let isWarning = false + let moduleLength = 0 + if (['up', 'down'].includes(direction)) { + modules.sort((a, b) => a.top - b.top) + moduleLength = Number(modules[modules.length - 1].top) + Number(modules[modules.length - 1].height) - Number(modules[0].top) + } else if (['left', 'right'].includes(direction)) { + modules.sort((a, b) => a.left - b.left) + moduleLength = Number(modules[modules.length - 1].left) + Number(modules[modules.length - 1].width) - Number(modules[0].left) } - canvas.renderAll() - }) - if (isWarning) { - swalFire({ - title: getMessage('can.not.copy.module'), - icon: 'error', - type: 'alert', - confirmFn: () => { - canvas.remove(...copyModules) - canvas.renderAll() - }, + modules.forEach((module) => { + const { top, left } = getPosotion(module, direction, Number(length) + Number(moduleLength), false) + module.clone((obj) => { + obj.set({ + parentId: module.parentId, + initOptions: module.initOptions, + direction: module.direction, + arrow: module.arrow, + name: module.name, + type: module.type, + length: module.length, + points: module.points, + surfaceId: module.surfaceId, + left, + top, + id: uuidv4(), + }) + copyModule = obj + canvas.add(obj) + copyModules.push(obj) + obj.setCoords() + }) + if (isOverlapObjects(copyModule, objects) || isOutsideSurface(copyModule, surface)) { + isWarning = true + copyModule.set({ fill: 'red' }) + } + canvas.renderAll() }) - } + + if (isWarning) { + swalFire({ + title: getMessage('can.not.copy.module'), + icon: 'error', + type: 'alert', + confirmFn: () => { + canvas.remove(...copyModules) + canvas.renderAll() + }, + }) + } + }) } const moduleCopy = (length, direction) => { diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 29f7f308..b6e0dad3 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -123,7 +123,7 @@ export function useModuleBasicSetting(tabNum) { makeModuleInstArea(roof, detail.data) //surface에 상세 데이터 추가 } else { - console.log('가대 데이터가 없네요...') + swalFire({ text: getMessage('module.roof.not.exist'), icon: 'warning' }) } } }) diff --git a/src/hooks/useContextMenu.js b/src/hooks/useContextMenu.js index 4235d8db..9892788a 100644 --- a/src/hooks/useContextMenu.js +++ b/src/hooks/useContextMenu.js @@ -747,18 +747,18 @@ export function useContextMenu() { { id: 'moduleMove', name: getMessage('contextmenu.module.move'), - component: , + component: , }, { id: 'moduleCopy', name: getMessage('contextmenu.module.copy'), - component: , - }, - { - id: 'moduleCircuitNumberEdit', - name: getMessage('contextmenu.module.circuit.number.edit'), - component: , + component: , }, + // { + // id: 'moduleCircuitNumberEdit', + // name: getMessage('contextmenu.module.circuit.number.edit'), + // component: , + // }, ], ]) break diff --git a/src/locales/ko.json b/src/locales/ko.json index 507f5415..e6d5290a 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -998,5 +998,6 @@ "menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.", "batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.", "batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다.", - "module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다." + "module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다.", + "module.trestleDetail.not.exist": "가대 상세 정보가 없습니다." }