Merge branch 'dev' into dev-yj

This commit is contained in:
lelalela 2025-01-10 11:18:49 +09:00
commit a35f79bf94
13 changed files with 234 additions and 79 deletions

View File

@ -23,6 +23,17 @@ const defaultEstimateData = {
priceCd: '', priceCd: '',
} }
/**
* 모듈,회로 구성 상태 데이터
* 설정 팝업 상태를 저장하는 데이터
*/
const defaultProcessStep = {
gnbStep: 0,
processStep: 0,
moduleCofigureData: {},
pcsConfigureData: {},
}
export const FloorPlanContext = createContext({ export const FloorPlanContext = createContext({
floorPlanState: {}, floorPlanState: {},
setFloorPlanState: () => {}, setFloorPlanState: () => {},
@ -57,8 +68,12 @@ const FloorPlanProvider = ({ children }) => {
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData) const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
const [processStepState, setProcessStepState] = useReducer(reducer, defaultProcessStep)
return ( return (
<FloorPlanContext.Provider value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState }}> <FloorPlanContext.Provider
value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState, processStepState, setProcessStepState }}
>
{children} {children}
</FloorPlanContext.Provider> </FloorPlanContext.Provider>
) )

View File

@ -1,9 +1,9 @@
'use client' 'use client'
import { usePathname } from 'next/navigation'
import FloorPlanProvider from './FloorPlanProvider' import FloorPlanProvider from './FloorPlanProvider'
import FloorPlan from '@/components/floor-plan/FloorPlan' import FloorPlan from '@/components/floor-plan/FloorPlan'
import CanvasLayout from '@/components/floor-plan/CanvasLayout' import CanvasLayout from '@/components/floor-plan/CanvasLayout'
import { usePathname } from 'next/navigation'
export default function FloorPlanLayout({ children }) { export default function FloorPlanLayout({ children }) {
console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:') console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:')

View File

@ -993,7 +993,11 @@ export default function Estimate({}) {
<tr> <tr>
{/* 2차 판매점명 */} {/* 2차 판매점명 */}
<th>{getMessage('estimate.detail.otherSaleStoreId')}</th> <th>{getMessage('estimate.detail.otherSaleStoreId')}</th>
<td>{estimateContextState?.agencySaleStoreName}</td> <td>
{session?.storeLvl === '1' && estimateContextState?.saleStoreLevel === '1'
? getMessage('estimate.detail.noOtherSaleStoreId')
: estimateContextState?.agencySaleStoreName}
</td>
{/* 담당자 */} {/* 담당자 */}
<th> <th>
{getMessage('estimate.detail.receiveUser')} <span className="important">*</span> {getMessage('estimate.detail.receiveUser')} <span className="important">*</span>

View File

@ -135,6 +135,15 @@ export default function CanvasMenu(props) {
const onClickNav = (menu) => { const onClickNav = (menu) => {
switch (menu.index) { switch (menu.index) {
case 0:
swalFire({
text: getMessage('stuff.detail.move.confirmMsg'),
type: 'confirm',
confirmFn: () => {
router.push(`/management/stuff/detail?objectNo=${objectNo}`)
},
})
break
case 1: case 1:
setType('placementShape') setType('placementShape')
onClickPlacementInitialMenu() onClickPlacementInitialMenu()
@ -153,6 +162,11 @@ export default function CanvasMenu(props) {
case 4: case 4:
setType('module') setType('module')
break break
case 5:
setMenuNumber(menu.index)
setCurrentMenu(menu.title)
router.push(`/floor-plan/estimate/5?pid=${pid}&objectNo=${objectNo}`)
break
case 6: case 6:
promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => { promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => {
if (res.status === 200) { if (res.status === 200) {
@ -169,12 +183,14 @@ export default function CanvasMenu(props) {
break break
} }
if (menu.index !== 6) { if (menu.index !== 6 && menu.index !== 0) {
setMenuNumber(menu.index) setMenuNumber(menu.index)
setCurrentMenu(menu.title) setCurrentMenu(menu.title)
} }
if (pathname !== '/floor-plan') router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`) if (pathname !== '/floor-plan' && pathname !== '/floor-plan/estimate/5') {
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
}
} }
const changeSelectedRoofMaterial = (e) => { const changeSelectedRoofMaterial = (e) => {
@ -236,6 +252,7 @@ export default function CanvasMenu(props) {
// //
const handleEstimateReset = () => { const handleEstimateReset = () => {
return alert('개발전입니다;;;')
// console.log('estimateRecoilState::', estimateRecoilState) // console.log('estimateRecoilState::', estimateRecoilState)
//objectNo, planNo //objectNo, planNo
swalFire({ swalFire({

View File

@ -11,6 +11,9 @@ import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
import { useCommonCode } from '@/hooks/common/useCommonCode' import { useCommonCode } from '@/hooks/common/useCommonCode'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { useRoofShapeSetting } from '@/hooks/roofcover/useRoofShapeSetting' import { useRoofShapeSetting } from '@/hooks/roofcover/useRoofShapeSetting'
import { currentAngleTypeSelector, pitchTextSelector } from '@/store/canvasAtom'
import { getDegreeByChon } from '@/util/canvas-util'
import { onlyNumberWithDotInputChange } from '@/util/input-utils'
export default function RoofAllocationSetting(props) { export default function RoofAllocationSetting(props) {
const contextPopupPosition = useRecoilValue(contextPopupPositionState) const contextPopupPosition = useRecoilValue(contextPopupPositionState)
@ -29,11 +32,13 @@ export default function RoofAllocationSetting(props) {
handleChangeRaft, handleChangeRaft,
handleChangeLayout, handleChangeLayout,
currentRoofList, currentRoofList,
handleChangeInput,
} = useRoofAllocationSetting(id) } = useRoofAllocationSetting(id)
const { pitchText } = useRoofShapeSetting(id) const pitchText = useRecoilValue(pitchTextSelector)
const { findCommonCode } = useCommonCode() const { findCommonCode } = useCommonCode()
const [raftCodes, setRaftCodes] = useState([]) const [raftCodes, setRaftCodes] = useState([])
const globalLocale = useRecoilValue(globalLocaleStore) const globalLocale = useRecoilValue(globalLocaleStore)
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
useEffect(() => { useEffect(() => {
const raftCodeList = findCommonCode('203800') const raftCodeList = findCommonCode('203800')
setRaftCodes(raftCodeList.map((raft) => ({ ...raft, name: raft.clCodeNm }))) setRaftCodes(raftCodeList.map((raft) => ({ ...raft, name: raft.clCodeNm })))
@ -110,7 +115,14 @@ export default function RoofAllocationSetting(props) {
<div className="flex-ment"> <div className="flex-ment">
<span>{getMessage('slope')}</span> <span>{getMessage('slope')}</span>
<div className="input-grid" style={{ width: '214px' }}> <div className="input-grid" style={{ width: '214px' }}>
<input type="text" className="input-origin block" defaultValue={4} /> <input
type="text"
className="input-origin block"
onChange={(e) => {
handleChangeInput(e, 'pitch', index)
}}
defaultValue={currentAngleType === 'slope' ? roof.pitch : getDegreeByChon(roof.pitch)}
/>
</div> </div>
<span>{pitchText}</span> <span>{pitchText}</span>
</div> </div>
@ -121,7 +133,13 @@ export default function RoofAllocationSetting(props) {
<div className="flex-ment"> <div className="flex-ment">
<span>W</span> <span>W</span>
<div className="input-grid" style={{ width: '100px' }}> <div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={roof.width} readOnly={roof.widAuth === 'R'} /> <input
type="text"
className="input-origin block"
defaultValue={roof.width}
onChange={(e) => handleChangeInput(e, 'width', index)}
readOnly={roof.widAuth === 'R'}
/>
</div> </div>
</div> </div>
)} )}
@ -129,7 +147,13 @@ export default function RoofAllocationSetting(props) {
<div className="flex-ment"> <div className="flex-ment">
<span>L</span> <span>L</span>
<div className="input-grid" style={{ width: '100px' }}> <div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={roof.length} readOnly={roof.lenAuth === 'R'} /> <input
type="text"
className="input-origin block"
defaultValue={roof.length}
onChange={(e) => handleChangeInput(e, 'length', index)}
readOnly={roof.lenAuth === 'R'}
/>
</div> </div>
</div> </div>
)} )}
@ -164,6 +188,7 @@ export default function RoofAllocationSetting(props) {
<input <input
type="text" type="text"
className="input-origin block" className="input-origin block"
onChange={(e) => handleChangeInput(e, 'hajebichi', index)}
value={parseInt(roof.hajebichi)} value={parseInt(roof.hajebichi)}
readOnly={roof.roofPchAuth === 'R'} readOnly={roof.roofPchAuth === 'R'}
/> />

View File

@ -331,7 +331,7 @@ export default function StuffDetail() {
//createUser T01 T01 //createUser T01 T01
setShowButton('none') setShowButton('none')
} }
console.log('상세::', res.data) // console.log('::', res.data)
if (isObjectNotEmpty(res.data)) { if (isObjectNotEmpty(res.data)) {
let surfaceTypeValue let surfaceTypeValue
if (res.data.surfaceType === 'Ⅲ・Ⅳ') { if (res.data.surfaceType === 'Ⅲ・Ⅳ') {

View File

@ -19,7 +19,7 @@ export default function PlanRequestPop(props) {
// //
const { commonCode, findCommonCode } = useCommonCode() const { commonCode, findCommonCode } = useCommonCode()
const [planStatCdList, setPlanStatCdList] = useState([]) // const [planStatCdList, setPlanStatCdList] = useState([])
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
@ -169,13 +169,13 @@ export default function PlanRequestPop(props) {
gridData: [], gridData: [],
isPageable: false, isPageable: false,
gridColumns: [ gridColumns: [
{ // {
field: 'planStatName', // field: 'planStatName',
headerName: getMessage('stuff.planReqPopup.gridHeader.planStatName'), // headerName: getMessage('stuff.planReqPopup.gridHeader.planStatName'),
minWidth: 150, // minWidth: 150,
checkboxSelection: true, // checkboxSelection: true,
showDisabledCheckboxes: true, // showDisabledCheckboxes: true,
}, // },
{ {
field: 'planReqNo', field: 'planReqNo',
headerName: getMessage('stuff.planReqPopup.gridHeader.planReqNo'), headerName: getMessage('stuff.planReqPopup.gridHeader.planReqNo'),
@ -234,12 +234,12 @@ export default function PlanRequestPop(props) {
} }
} }
useEffect(() => { // useEffect(() => {
const code1 = findCommonCode(115800) // // const code1 = findCommonCode(115800) //
if (code1 != null) { // if (code1 != null) {
setPlanStatCdList(code1) // setPlanStatCdList(code1)
} // }
}, [commonCode]) // }, [commonCode])
useEffect(() => { useEffect(() => {
onSubmit(pageNo, 'S') onSubmit(pageNo, 'S')
@ -380,7 +380,7 @@ export default function PlanRequestPop(props) {
/> />
</div> </div>
</td> </td>
<th>{getMessage('stuff.planReqPopup.search.planStatName')}</th> {/* <th>{getMessage('stuff.planReqPopup.search.planStatName')}</th>
<td> <td>
<div className="select-wrap"> <div className="select-wrap">
<Select <Select
@ -398,7 +398,7 @@ export default function PlanRequestPop(props) {
isClearable={true} isClearable={true}
/> />
</div> </div>
</td> </td> */}
</tr> </tr>
<tr> <tr>
<th>{getMessage('stuff.planReqPopup.search.period')}</th> <th>{getMessage('stuff.planReqPopup.search.period')}</th>

View File

@ -3,6 +3,7 @@
import 'chart.js/auto' import 'chart.js/auto'
import { Bar } from 'react-chartjs-2' import { Bar } from 'react-chartjs-2'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { v4 as uuidv4 } from 'uuid'
import { useEffect, useState, useRef, useContext } from 'react' import { useEffect, useState, useRef, useContext } from 'react'
import { useRecoilState } from 'recoil' import { useRecoilState } from 'recoil'
@ -14,11 +15,16 @@ import { useMessage } from '@/hooks/useMessage'
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu' import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
import { convertNumberToPriceDecimal } from '@/util/common-utils' import { convertNumberToPriceDecimal } from '@/util/common-utils'
// import { useSearchParams } from 'next/navigation'
export default function Simulator() { export default function Simulator() {
const { floorPlanState } = useContext(FloorPlanContext) const { floorPlanState } = useContext(FloorPlanContext)
const { objectNo, pid } = floorPlanState const { objectNo, pid } = floorPlanState
// const searchParams = useSearchParams()
// const objectNo = searchParams.get('objectNo')
// const pid = searchParams.get('pid')
const chartRef = useRef(null) const chartRef = useRef(null)
// //
@ -96,6 +102,16 @@ export default function Simulator() {
} }
useEffect(() => { useEffect(() => {
/* 초기화 작업 */
setChartData([])
setObjectDetail({})
setModuleInfoList([])
setPcsInfoList([])
setHatsudenryouAll([])
setHatsudenryouAllSnow([])
setHatsudenryouPeakcutAll([])
setHatsudenryouPeakcutAllSnow([])
if (objectNo) { if (objectNo) {
fetchObjectDetail(objectNo) fetchObjectDetail(objectNo)
fetchSimulatorNotice() fetchSimulatorNotice()
@ -192,7 +208,8 @@ export default function Simulator() {
<div className="estimate-box"> <div className="estimate-box">
<div className="estimate-tit">{getMessage('simulator.title.sub1')}</div> <div className="estimate-tit">{getMessage('simulator.title.sub1')}</div>
<div className="estimate-name"> <div className="estimate-name">
{objectDetail.objectNo} (Plan No: {pid}) {objectDetail.objectNo}
{`${objectDetail.planNo ? `(Plan No: ${objectDetail.planNo})` : ''}`}
</div> </div>
</div> </div>
{/* 작성일 */} {/* 작성일 */}
@ -291,7 +308,7 @@ export default function Simulator() {
{chartData.length > 0 ? ( {chartData.length > 0 ? (
<tr> <tr>
{chartData.map((data) => ( {chartData.map((data) => (
<td key={data}>{data}</td> <td key={uuidv4()}>{data}</td>
))} ))}
</tr> </tr>
) : ( ) : (

View File

@ -1,10 +1,17 @@
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil' import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
import { canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom' import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useAxios } from '@/hooks/useAxios' import { useAxios } from '@/hooks/useAxios'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import { usePolygon } from '@/hooks/usePolygon' import { usePolygon } from '@/hooks/usePolygon'
import { correntObjectNoState, addedRoofsState, basicSettingState, roofDisplaySelector, roofMaterialsSelector, selectedRoofMaterialSelector } from '@/store/settingAtom' import {
correntObjectNoState,
addedRoofsState,
basicSettingState,
roofDisplaySelector,
roofMaterialsSelector,
selectedRoofMaterialSelector,
} from '@/store/settingAtom'
import { usePopup } from '@/hooks/usePopup' import { usePopup } from '@/hooks/usePopup'
import { POLYGON_TYPE } from '@/common/common' import { POLYGON_TYPE } from '@/common/common'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
@ -16,6 +23,7 @@ import { menuTypeState } from '@/store/menuAtom'
import { useRoofFn } from '@/hooks/common/useRoofFn' import { useRoofFn } from '@/hooks/common/useRoofFn'
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting' import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
import { globalLocaleStore } from '@/store/localeAtom' import { globalLocaleStore } from '@/store/localeAtom'
import { getChonByDegree } from '@/util/canvas-util'
// 지붕면 할당 // 지붕면 할당
export function useRoofAllocationSetting(id) { export function useRoofAllocationSetting(id) {
@ -37,6 +45,7 @@ export function useRoofAllocationSetting(id) {
const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열 const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열
const [editingLines, setEditingLines] = useState([]) const [editingLines, setEditingLines] = useState([])
const [currentRoofList, setCurrentRoofList] = useState(roofList) const [currentRoofList, setCurrentRoofList] = useState(roofList)
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
const { get, post } = useAxios(globalLocaleState) const { get, post } = useAxios(globalLocaleState)
@ -110,7 +119,6 @@ export function useRoofAllocationSetting(id) {
} }
}) })
} else { } else {
roofsArray = [ roofsArray = [
{ {
roofApply: true, roofApply: true,
@ -137,21 +145,22 @@ export function useRoofAllocationSetting(id) {
for (let i = 0; i < roofsArray.length; i++) { for (let i = 0; i < roofsArray.length; i++) {
roofMaterials?.map((material) => { roofMaterials?.map((material) => {
if (material.roofMatlCd === roofsArray[i].roofMatlCd) { if (material.roofMatlCd === roofsArray[i].roofMatlCd) {
selectRoofs.push({ ...material selectRoofs.push({
, selected: roofsArray[i].roofApply ...material,
, index: roofsArray[i].roofSeq selected: roofsArray[i].roofApply,
, id: roofsArray[i].roofMatlCd index: roofsArray[i].roofSeq,
, width: roofsArray[i].roofWidth id: roofsArray[i].roofMatlCd,
, length: roofsArray[i].roofHeight width: roofsArray[i].roofWidth,
, hajebichi: roofsArray[i].roofHajebichi length: roofsArray[i].roofHeight,
, raft: roofsArray[i].roofGap hajebichi: roofsArray[i].roofHajebichi,
, layout: roofsArray[i].roofLayout raft: roofsArray[i].roofGap,
}) layout: roofsArray[i].roofLayout,
})
setCurrentRoofList(selectRoofs) setCurrentRoofList(selectRoofs)
} }
}) })
} }
setBasicSetting({ ...basicSetting, roofsData: roofsArray}) setBasicSetting({ ...basicSetting, roofsData: roofsArray })
}) })
} catch (error) { } catch (error) {
console.error('Data fetching error:', error) console.error('Data fetching error:', error)
@ -160,7 +169,6 @@ export function useRoofAllocationSetting(id) {
// 저장 // 저장
const basicSettingSave = async () => { const basicSettingSave = async () => {
const patternData = { const patternData = {
objectNo: correntObjectNo, objectNo: correntObjectNo,
roofSizeSet: basicSetting.roofSizeSet, roofSizeSet: basicSetting.roofSizeSet,
@ -174,24 +182,23 @@ export function useRoofAllocationSetting(id) {
roofHajebichi: item.hajebichi === null || item.hajebichi === undefined ? 0 : item.hajebichi, roofHajebichi: item.hajebichi === null || item.hajebichi === undefined ? 0 : item.hajebichi,
roofGap: item.raft === null || item.raft === undefined ? 'HEI_455' : item.raft, roofGap: item.raft === null || item.raft === undefined ? 'HEI_455' : item.raft,
roofLayout: item.layout === null || item.layout === undefined ? 'P' : item.layout, roofLayout: item.layout === null || item.layout === undefined ? 'P' : item.layout,
})),
}
console.log('🚀 ~ basicSettingSave ~ patternData >>>>>>>>>>>>> :', patternData)
// HTTP POST 요청 보내기
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData })
.then((res) => {
swalFire({ text: getMessage(res.returnMessage) })
//Recoil 설정
// setCanvasSetting({ ...basicSetting })
fetchBasicSettings()
})
.catch((error) => {
swalFire({ text: error.message, icon: 'error' })
}) })
),
}
console.log('🚀 ~ basicSettingSave ~ patternData >>>>>>>>>>>>> :', patternData)
// HTTP POST 요청 보내기
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData })
.then((res) => {
swalFire({ text: getMessage(res.returnMessage) })
//Recoil 설정
// setCanvasSetting({ ...basicSetting })
fetchBasicSettings()
})
.catch((error) => {
swalFire({ text: error.message, icon: 'error' })
})
} }
const onAddRoofMaterial = () => { const onAddRoofMaterial = () => {
@ -222,7 +229,6 @@ export function useRoofAllocationSetting(id) {
// 선택한 지붕재로 할당 // 선택한 지붕재로 할당
const handleSave = () => { const handleSave = () => {
basicSettingSave() basicSettingSave()
// 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정 // 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정
@ -231,7 +237,6 @@ export function useRoofAllocationSetting(id) {
} else { } else {
apply() apply()
} }
} }
// 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우 // 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
@ -417,6 +422,65 @@ export function useRoofAllocationSetting(id) {
setCurrentRoofList(newRoofList) setCurrentRoofList(newRoofList)
} }
const handleChangeInput = (e, type, index) => {
const value = e.target.value
if (type === 'pitch') {
// type이 pitch인 경우 소수점 1자리까지만 입력 가능
const reg = /^[0-9]+(\.[0-9]{0,1})?$/
if (!reg.test(value)) {
e.target.value = value.substring(0, value.length - 1)
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return {
...roof,
[type]: currentAngleType === 'slope' ? value.substring(0, value.length - 1) : getChonByDegree(value.substring(0, value.length - 1)),
}
}
return roof
})
setCurrentRoofList(newRoofList)
return
} else {
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return {
...roof,
[type]: currentAngleType === 'slope' ? value : getChonByDegree(value),
}
}
return roof
})
setCurrentRoofList(newRoofList)
}
return
}
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return { ...roof, [type]: value }
}
return roof
})
setCurrentRoofList(newRoofList)
}
const handleChangePitch = (e, index) => {
const value = e.target.value
const newRoofList = currentRoofList.map((roof, idx) => {
if (idx === index) {
return { ...roof, pitch: value }
}
return roof
})
setCurrentRoofList(newRoofList)
}
return { return {
handleSave, handleSave,
onAddRoofMaterial, onAddRoofMaterial,
@ -435,5 +499,7 @@ export function useRoofAllocationSetting(id) {
handleChangeLayout, handleChangeLayout,
handleSaveContext, handleSaveContext,
currentRoofList, currentRoofList,
handleChangeInput,
handleChangePitch,
} }
} }

View File

@ -1,7 +1,7 @@
'use client' 'use client'
import { useEffect, useState } from 'react' import { useContext, useEffect, useState } from 'react'
import { useRouter } from 'next/navigation' import { usePathname, useRouter } from 'next/navigation'
import { useRecoilState } from 'recoil' import { useRecoilState } from 'recoil'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
@ -13,8 +13,12 @@ import { useSwal } from '@/hooks/useSwal'
import { useCanvas } from '@/hooks/useCanvas' import { useCanvas } from '@/hooks/useCanvas'
import { SAVE_KEY } from '@/common/common' import { SAVE_KEY } from '@/common/common'
import { readImage, removeImage } from '@/lib/fileAction' import { readImage, removeImage } from '@/lib/fileAction'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
export function usePlan(params = {}) { export function usePlan(params = {}) {
const pObjectNo = params.objectNo
const { floorPlanState } = useContext(FloorPlanContext)
const [planNum, setPlanNum] = useState(0) const [planNum, setPlanNum] = useState(0)
const [selectedPlan, setSelectedPlan] = useState(null) const [selectedPlan, setSelectedPlan] = useState(null)
@ -24,6 +28,7 @@ export function usePlan(params = {}) {
const [plans, setPlans] = useRecoilState(plansState) // 전체 plan const [plans, setPlans] = useRecoilState(plansState) // 전체 plan
const router = useRouter() const router = useRouter()
const pathname = usePathname()
const { swalFire } = useSwal() const { swalFire } = useSwal()
const { getMessage } = useMessage() const { getMessage } = useMessage()
@ -199,10 +204,12 @@ export function usePlan(params = {}) {
* 현재 plan의 작업상태를 저장 이동 * 현재 plan의 작업상태를 저장 이동
*/ */
const handleCurrentPlan = async (newCurrentId) => { const handleCurrentPlan = async (newCurrentId) => {
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) { if (pathname === '/floor-plan') {
await saveCanvas() if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
updateCurrentPlan(newCurrentId) await saveCanvas()
}
} }
updateCurrentPlan(newCurrentId)
} }
const updateCurrentPlan = (newCurrentId) => { const updateCurrentPlan = (newCurrentId) => {
@ -219,9 +226,9 @@ export function usePlan(params = {}) {
}, [plans]) }, [plans])
// 현재 plan이 변경될 때 마다 현재 plan의 링크로 이동 // 현재 plan이 변경될 때 마다 현재 plan의 링크로 이동
// useEffect(() => { useEffect(() => {
// handlePlanMove() handlePlanMove()
// }, [currentCanvasPlan]) }, [currentCanvasPlan])
const setBgImage = () => { const setBgImage = () => {
// readImage(selectedPlan?.id) // readImage(selectedPlan?.id)
@ -312,7 +319,7 @@ export function usePlan(params = {}) {
* 현재 plan 이동 -> 새로운 링크로 이동 * 현재 plan 이동 -> 새로운 링크로 이동
*/ */
const handlePlanMove = () => { const handlePlanMove = () => {
router.push(`/floor-plan?objectNo=${params?.objectNo}&pid=${currentCanvasPlan?.ordering}`) router.push(`${pathname}?objectNo=${floorPlanState.objectNo}&pid=${currentCanvasPlan?.ordering}`)
} }
return { return {

View File

@ -268,7 +268,7 @@ export const usePolygon = () => {
surfaceCompass: polygon.surfaceCompass, surfaceCompass: polygon.surfaceCompass,
moduleCompass: polygon.moduleCompass, moduleCompass: polygon.moduleCompass,
visible: isFlowDisplay, visible: isFlowDisplay,
pitch: polygon.pitch, pitch: polygon.roofMaterial.pitch ?? 4,
parentId: polygon.id, parentId: polygon.id,
}) })

View File

@ -687,6 +687,7 @@
"stuff.detail.save.valierror2": "設置高さ0より大きい値を入力してください", "stuff.detail.save.valierror2": "設置高さ0より大きい値を入力してください",
"stuff.detail.save.valierror3": "{0} 必須入力項目です.", "stuff.detail.save.valierror3": "{0} 必須入力項目です.",
"stuff.detail.save.valierror4": "二次販売店名は必須オプションです.", "stuff.detail.save.valierror4": "二次販売店名は必須オプションです.",
"stuff.detail.move.confirmMsg": "商品情報画面に移動します。 [保存]していない図面情報は削除されます。商品情報画面に移動しますか?",
"stuff.planReqPopup.popTitle": "設計依頼検索", "stuff.planReqPopup.popTitle": "設計依頼検索",
"stuff.planReqPopup.btn1": "検索", "stuff.planReqPopup.btn1": "検索",
"stuff.planReqPopup.btn2": "初期化", "stuff.planReqPopup.btn2": "初期化",
@ -844,6 +845,7 @@
"estimate.detail.saleStoreId": "一次販売店名", "estimate.detail.saleStoreId": "一次販売店名",
"estimate.detail.estimateDate": "見積日", "estimate.detail.estimateDate": "見積日",
"estimate.detail.otherSaleStoreId": "二次販売店名", "estimate.detail.otherSaleStoreId": "二次販売店名",
"estimate.detail.noOtherSaleStoreId": "二次点なし",
"estimate.detail.receiveUser": "担当者 ", "estimate.detail.receiveUser": "担当者 ",
"estimate.detail.objectName": "案件名", "estimate.detail.objectName": "案件名",
"estimate.detail.objectRemarks": "メモ", "estimate.detail.objectRemarks": "メモ",

View File

@ -697,7 +697,8 @@
"stuff.detail.save.valierror2": "설치높이는 0보다 큰 값을 입력하세요", "stuff.detail.save.valierror2": "설치높이는 0보다 큰 값을 입력하세요",
"stuff.detail.save.valierror3": "{0} 필수 입력 항목입니다.", "stuff.detail.save.valierror3": "{0} 필수 입력 항목입니다.",
"stuff.detail.save.valierror4": "2차 판매점명은 필수 선택사항입니다.", "stuff.detail.save.valierror4": "2차 판매점명은 필수 선택사항입니다.",
"stuff.planReqPopup.popTitle": "설계 요청 검색", "stuff.detail.move.confirmMsg": "물건정보 화면으로 이동합니다. [저장]하지 않은 도면정보는 삭제됩니다. 물건정보 화면으로 이동하시겠습니까?",
"stuff.planReqPopup.popTitle": "설계 의뢰 검색",
"stuff.planReqPopup.btn1": "검색", "stuff.planReqPopup.btn1": "검색",
"stuff.planReqPopup.btn2": "초기화", "stuff.planReqPopup.btn2": "초기화",
"stuff.planReqPopup.btn3": "닫기", "stuff.planReqPopup.btn3": "닫기",
@ -854,6 +855,7 @@
"estimate.detail.saleStoreId": "1차 판매점명", "estimate.detail.saleStoreId": "1차 판매점명",
"estimate.detail.estimateDate": "견적일", "estimate.detail.estimateDate": "견적일",
"estimate.detail.otherSaleStoreId": "2차 판매점명", "estimate.detail.otherSaleStoreId": "2차 판매점명",
"estimate.detail.noOtherSaleStoreId": "2차점 없음",
"estimate.detail.receiveUser": "담당자", "estimate.detail.receiveUser": "담당자",
"estimate.detail.objectName": "안건명", "estimate.detail.objectName": "안건명",
"estimate.detail.objectRemarks": "메모", "estimate.detail.objectRemarks": "메모",