Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into qcast-pub
This commit is contained in:
commit
3f3bb41d43
@ -3,11 +3,12 @@
|
|||||||
import { createContext, useEffect, useState } from 'react'
|
import { createContext, useEffect, useState } from 'react'
|
||||||
import { useLocalStorage } from 'usehooks-ts'
|
import { useLocalStorage } from 'usehooks-ts'
|
||||||
|
|
||||||
export const GlobalDataContext = createContext({
|
// export const GlobalDataContext = createContext({
|
||||||
managementState: {},
|
// managementState: {},
|
||||||
setManagementState: () => {},
|
// setManagementState: () => {},
|
||||||
managementStateLoaded: null,
|
// managementStateLoaded: null,
|
||||||
})
|
// })
|
||||||
|
export const GlobalDataContext = createContext(null)
|
||||||
|
|
||||||
const GlobalDataProvider = ({ children }) => {
|
const GlobalDataProvider = ({ children }) => {
|
||||||
const [managementState, setManagementState] = useState(null)
|
const [managementState, setManagementState] = useState(null)
|
||||||
|
|||||||
@ -27,12 +27,12 @@ const defaultEstimateData = {
|
|||||||
* 모듈,회로 구성 상태 데이터
|
* 모듈,회로 구성 상태 데이터
|
||||||
* 각 설정 팝업 상태를 저장하는 데이터
|
* 각 설정 팝업 상태를 저장하는 데이터
|
||||||
*/
|
*/
|
||||||
const defaultProcessStep = {
|
// const defaultProcessStep = {
|
||||||
gnbStep: 0,
|
// gnbStep: 0,
|
||||||
processStep: 0,
|
// processStep: 0,
|
||||||
moduleCofigureData: {},
|
// moduleCofigureData: {},
|
||||||
pcsConfigureData: {},
|
// pcsConfigureData: {},
|
||||||
}
|
// }
|
||||||
|
|
||||||
export const FloorPlanContext = createContext({
|
export const FloorPlanContext = createContext({
|
||||||
floorPlanState: {},
|
floorPlanState: {},
|
||||||
@ -49,12 +49,12 @@ const FloorPlanProvider = ({ children }) => {
|
|||||||
const pid = searchParams.get('pid')
|
const pid = searchParams.get('pid')
|
||||||
|
|
||||||
//useEffect(() => { // 오류 발생으로 useEffect 사용
|
//useEffect(() => { // 오류 발생으로 useEffect 사용
|
||||||
if (pathname === '/floor-plan') {
|
if (pathname === '/floor-plan') {
|
||||||
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||||
notFound()
|
notFound()
|
||||||
}
|
|
||||||
setCurrentObjectNo(objectNo)
|
|
||||||
}
|
}
|
||||||
|
setCurrentObjectNo(objectNo)
|
||||||
|
}
|
||||||
//}, [pid, objectNo])
|
//}, [pid, objectNo])
|
||||||
|
|
||||||
const [floorPlanState, setFloorPlanState] = useState({
|
const [floorPlanState, setFloorPlanState] = useState({
|
||||||
@ -70,12 +70,10 @@ const FloorPlanProvider = ({ children }) => {
|
|||||||
|
|
||||||
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
|
const [estimateContextState, setEstimateContextState] = useReducer(reducer, defaultEstimateData)
|
||||||
|
|
||||||
const [processStepState, setProcessStepState] = useReducer(reducer, defaultProcessStep)
|
// const [processStepState, setProcessStepState] = useReducer(reducer, defaultProcessStep)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FloorPlanContext.Provider
|
<FloorPlanContext.Provider value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState }}>
|
||||||
value={{ floorPlanState, setFloorPlanState, estimateContextState, setEstimateContextState, processStepState, setProcessStepState }}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</FloorPlanContext.Provider>
|
</FloorPlanContext.Provider>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -12,7 +12,8 @@ const ManagementProvider = ({ children }) => {
|
|||||||
// }, [managementState])
|
// }, [managementState])
|
||||||
|
|
||||||
// return <ManagementContext.Provider value={{ managementState, setManagementState }}>{children}</ManagementContext.Provider>
|
// return <ManagementContext.Provider value={{ managementState, setManagementState }}>{children}</ManagementContext.Provider>
|
||||||
return <ManagementContext.Provider>{children}</ManagementContext.Provider>
|
// return <ManagementContext.Provider>{children}</ManagementContext.Provider>
|
||||||
|
return <>{children}</>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ManagementProvider
|
export default ManagementProvider
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import useSWR from 'swr'
|
|||||||
import useSWRMutation from 'swr/mutation'
|
import useSWRMutation from 'swr/mutation'
|
||||||
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
||||||
|
import { moduleSelectionDataPlanListState } from '@/store/selectedModuleOptions'
|
||||||
|
|
||||||
export default function Playground() {
|
export default function Playground() {
|
||||||
const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState)
|
const [useCadFile, setUseCadFile] = useRecoilState(useCadFileState)
|
||||||
@ -256,25 +257,25 @@ export default function Playground() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const [callFlag, setCallFlag] = useState(false)
|
// const [callFlag, setCallFlag] = useState(false)
|
||||||
// const { data: tutoData, error, isLoading } = useSWR('http://localhost:8080/api/tutorial', getFetcher)
|
// const { data: tutoData, error, isLoading } = useSWR('http://localhost:8080/api/tutorial', getFetcher)
|
||||||
const { data: tutoData, error, isLoading } = useSWR(callFlag ? 'http://localhost:8080/api/tutorial' : null, getFetcher)
|
// const { data: tutoData, error, isLoading } = useSWR(callFlag ? 'http://localhost:8080/api/tutorial' : null, getFetcher)
|
||||||
const { trigger, isMutating } = useSWRMutation('http://localhost:8080/api/tutorial', postFetcher)
|
// const { trigger, isMutating } = useSWRMutation('http://localhost:8080/api/tutorial', postFetcher)
|
||||||
|
|
||||||
if (isLoading) {
|
// if (isLoading) {
|
||||||
return <div>Loading...</div>
|
// return <div>Loading...</div>
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (error) {
|
// if (error) {
|
||||||
return <div>Error...</div>
|
// return <div>Error...</div>
|
||||||
}
|
// }
|
||||||
|
|
||||||
useCanvasPopupStatusController(1)
|
// const [moduleSelectionDataPlanListStore, setModuleSelectionDataPlanListStore] = useRecoilState(moduleSelectionDataPlanListState)
|
||||||
|
// useEffect(() => {
|
||||||
|
// console.log('🚀 ~ Playground ~ moduleSelectionDataPlanListStore:', moduleSelectionDataPlanListStore)
|
||||||
|
// }, [moduleSelectionDataPlanListStore])
|
||||||
|
// const { trigger: canvasPopupStatusTrigger } = useCanvasPopupStatusController({ objectNo: 'R201T01241120001', planNo: 2, popupType: 2 })
|
||||||
|
|
||||||
const [canvasPopupStatusState, setCanvasPopupStatusState] = useRecoilState(canvasPopupStatusStore)
|
|
||||||
useEffect(() => {
|
|
||||||
console.log('🚀 ~ Playground ~ canvasPopupStatusState:', canvasPopupStatusState)
|
|
||||||
}, [canvasPopupStatusState])
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container mx-auto p-4 m-4 border">
|
<div className="container mx-auto p-4 m-4 border">
|
||||||
@ -579,7 +580,7 @@ export default function Playground() {
|
|||||||
Sweetalert - alert
|
Sweetalert - alert
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="my-2">
|
{/* <div className="my-2">
|
||||||
{tutoData &&
|
{tutoData &&
|
||||||
tutoData.map((item) => (
|
tutoData.map((item) => (
|
||||||
<div key={item.id}>
|
<div key={item.id}>
|
||||||
@ -594,6 +595,301 @@ export default function Playground() {
|
|||||||
<Button disabled={isMutating} onClick={() => trigger({ id: 3, name: 'seulda kim', email: 'seulda.kim@interplug.co.kr' })}>
|
<Button disabled={isMutating} onClick={() => trigger({ id: 3, name: 'seulda kim', email: 'seulda.kim@interplug.co.kr' })}>
|
||||||
insert data
|
insert data
|
||||||
</Button>
|
</Button>
|
||||||
|
</div> */}
|
||||||
|
<div className="my-2">
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
canvasPopupStatusTrigger({
|
||||||
|
common: {
|
||||||
|
illuminationTp: '3',
|
||||||
|
instHt: '10',
|
||||||
|
stdWindSpeed: 'WL_32',
|
||||||
|
stdSnowLd: '5',
|
||||||
|
moduleTpCd: 'A1',
|
||||||
|
moduleItemId: '106796',
|
||||||
|
},
|
||||||
|
roofConstructions: [
|
||||||
|
{
|
||||||
|
roofIndex: 0,
|
||||||
|
addRoof: {
|
||||||
|
roofMatlCd: 'ROOF_ID_WA_53A',
|
||||||
|
roofMatlNm: '일본기와 A',
|
||||||
|
roofMatlNmJp: '和瓦A',
|
||||||
|
widAuth: 'R',
|
||||||
|
widBase: '265.000',
|
||||||
|
lenAuth: 'R',
|
||||||
|
lenBase: '235.000',
|
||||||
|
roofPchAuth: null,
|
||||||
|
roofPchBase: null,
|
||||||
|
raftAuth: 'C',
|
||||||
|
raftBaseCd: 'HEI_455',
|
||||||
|
id: 'ROOF_ID_WA_53A',
|
||||||
|
name: '일본기와 A',
|
||||||
|
selected: true,
|
||||||
|
index: 0,
|
||||||
|
nameJp: '和瓦A',
|
||||||
|
length: 235,
|
||||||
|
width: 265,
|
||||||
|
raft: 'HEI_455',
|
||||||
|
layout: 'P',
|
||||||
|
hajebichi: 0,
|
||||||
|
pitch: 7,
|
||||||
|
angle: 21.8,
|
||||||
|
roofSizeSet: '1',
|
||||||
|
roofAngleSet: 'slope',
|
||||||
|
},
|
||||||
|
trestle: {
|
||||||
|
moduleTpCd: 'A1',
|
||||||
|
moduleTpCdNm: 'A1type',
|
||||||
|
moduleTpCdJp: 'A1type',
|
||||||
|
roofMatlCd: 'ROOF_ID_WA_53A',
|
||||||
|
roofMatlCdNm: '일본기와 A',
|
||||||
|
roofMatlCdJp: '和瓦A',
|
||||||
|
trestleMkrCd: 'ROOF_TECHRI',
|
||||||
|
trestleMkrCdNm: '지붕 기술 연구소',
|
||||||
|
trestleMkrCdJp: '屋根技術研究所',
|
||||||
|
constMthdCd: 'CST026',
|
||||||
|
constMthdCdNm: 'YG 앵커 랙 있음',
|
||||||
|
constMthdCdJp: 'YGアンカー ラック有り',
|
||||||
|
roofBaseCd: 'RFB001',
|
||||||
|
roofBaseCdNm: '구조용 합판 9mm 이상',
|
||||||
|
roofBaseCdJp: '構造用合板9mm以上',
|
||||||
|
rackYn: null,
|
||||||
|
priority: 1,
|
||||||
|
},
|
||||||
|
construction: {
|
||||||
|
constTp: 'WORK_LV_ID_1',
|
||||||
|
constTpNm: '표준 시공',
|
||||||
|
constTpJp: '標準施工',
|
||||||
|
constPossYn: 'Y',
|
||||||
|
plvrYn: 'Y',
|
||||||
|
cvrYn: 'Y',
|
||||||
|
cvrLmtRow: 9999,
|
||||||
|
snowGdPossYn: 'Y',
|
||||||
|
roofIndex: 0,
|
||||||
|
setupCover: true,
|
||||||
|
setupSnowCover: true,
|
||||||
|
selectedIndex: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
roofIndex: 1,
|
||||||
|
addRoof: {
|
||||||
|
roofMatlCd: 'ROOF_ID_WA_53B',
|
||||||
|
roofMatlNm: '일본기와 B',
|
||||||
|
roofMatlNmJp: '和瓦B',
|
||||||
|
widAuth: 'R',
|
||||||
|
widBase: '275.000',
|
||||||
|
lenAuth: 'R',
|
||||||
|
lenBase: '225.000',
|
||||||
|
roofPchAuth: null,
|
||||||
|
roofPchBase: null,
|
||||||
|
raftAuth: 'C',
|
||||||
|
raftBaseCd: 'HEI_455',
|
||||||
|
id: 'ROOF_ID_WA_53B',
|
||||||
|
name: '일본기와 B',
|
||||||
|
selected: true,
|
||||||
|
index: 1,
|
||||||
|
nameJp: '和瓦B',
|
||||||
|
length: 225,
|
||||||
|
width: 275,
|
||||||
|
raft: 'HEI_455',
|
||||||
|
layout: 'P',
|
||||||
|
hajebichi: 0,
|
||||||
|
pitch: 5,
|
||||||
|
angle: 21.8,
|
||||||
|
roofSizeSet: '1',
|
||||||
|
roofAngleSet: 'slope',
|
||||||
|
},
|
||||||
|
trestle: {
|
||||||
|
moduleTpCd: 'A1',
|
||||||
|
moduleTpCdNm: 'A1type',
|
||||||
|
moduleTpCdJp: 'A1type',
|
||||||
|
roofMatlCd: 'ROOF_ID_WA_53B',
|
||||||
|
roofMatlCdNm: '일본기와 B',
|
||||||
|
roofMatlCdJp: '和瓦B',
|
||||||
|
trestleMkrCd: 'DAIDO HUNT',
|
||||||
|
trestleMkrCdNm: '다이도 헌트',
|
||||||
|
trestleMkrCdJp: 'ダイドーハント',
|
||||||
|
constMthdCd: 'CST016',
|
||||||
|
constMthdCdNm: '지지 기와Ⅱ-B 랙 있음',
|
||||||
|
constMthdCdJp: '支持瓦Ⅱ-B ラック有り',
|
||||||
|
roofBaseCd: 'RFB002',
|
||||||
|
roofBaseCdNm: 'OSB12mm 이상',
|
||||||
|
roofBaseCdJp: 'OSB12mm以上',
|
||||||
|
rackYn: null,
|
||||||
|
priority: 95,
|
||||||
|
},
|
||||||
|
construction: {
|
||||||
|
constTp: 'WORK_LV_ID_1',
|
||||||
|
constTpNm: '표준 시공',
|
||||||
|
constTpJp: '標準施工',
|
||||||
|
constPossYn: 'Y',
|
||||||
|
plvrYn: 'Y',
|
||||||
|
cvrYn: 'Y',
|
||||||
|
cvrLmtRow: 9999,
|
||||||
|
snowGdPossYn: 'Y',
|
||||||
|
roofIndex: 1,
|
||||||
|
setupCover: false,
|
||||||
|
setupSnowCover: true,
|
||||||
|
selectedIndex: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
roofIndex: 2,
|
||||||
|
addRoof: {
|
||||||
|
roofMatlCd: 'ROOF_ID_HIRA_C',
|
||||||
|
roofMatlNm: '평판기와 C',
|
||||||
|
roofMatlNmJp: '平板瓦C',
|
||||||
|
widAuth: 'R',
|
||||||
|
widBase: '305.000',
|
||||||
|
lenAuth: 'R',
|
||||||
|
lenBase: '280.000',
|
||||||
|
roofPchAuth: null,
|
||||||
|
roofPchBase: null,
|
||||||
|
raftAuth: 'C',
|
||||||
|
raftBaseCd: 'HEI_455',
|
||||||
|
id: 'ROOF_ID_HIRA_C',
|
||||||
|
name: '평판기와 C',
|
||||||
|
selected: true,
|
||||||
|
index: 2,
|
||||||
|
nameJp: '平板瓦C',
|
||||||
|
length: 280,
|
||||||
|
width: 305,
|
||||||
|
raft: 'HEI_455',
|
||||||
|
layout: 'P',
|
||||||
|
hajebichi: 0,
|
||||||
|
pitch: 4,
|
||||||
|
angle: 21.8,
|
||||||
|
roofSizeSet: '1',
|
||||||
|
roofAngleSet: 'slope',
|
||||||
|
},
|
||||||
|
trestle: {
|
||||||
|
moduleTpCd: 'A1',
|
||||||
|
moduleTpCdNm: 'A1type',
|
||||||
|
moduleTpCdJp: 'A1type',
|
||||||
|
roofMatlCd: 'ROOF_ID_HIRA_C',
|
||||||
|
roofMatlCdNm: '평판기와 C',
|
||||||
|
roofMatlCdJp: '平板瓦C',
|
||||||
|
trestleMkrCd: 'ROOF_TECHRI',
|
||||||
|
trestleMkrCdNm: '지붕 기술 연구소',
|
||||||
|
trestleMkrCdJp: '屋根技術研究所',
|
||||||
|
constMthdCd: 'CST034',
|
||||||
|
constMthdCdNm: '지지 기와 C 랙 있음',
|
||||||
|
constMthdCdJp: '支持瓦C ラック有り',
|
||||||
|
roofBaseCd: 'RFB001',
|
||||||
|
roofBaseCdNm: '구조용 합판 9mm 이상',
|
||||||
|
roofBaseCdJp: '構造用合板9mm以上',
|
||||||
|
rackYn: null,
|
||||||
|
priority: 122,
|
||||||
|
},
|
||||||
|
construction: {
|
||||||
|
constTp: 'WORK_LV_ID_1',
|
||||||
|
constTpNm: '표준 시공',
|
||||||
|
constTpJp: '標準施工',
|
||||||
|
constPossYn: 'Y',
|
||||||
|
plvrYn: 'Y',
|
||||||
|
cvrYn: 'Y',
|
||||||
|
cvrLmtRow: 9999,
|
||||||
|
snowGdPossYn: 'Y',
|
||||||
|
roofIndex: 2,
|
||||||
|
setupCover: false,
|
||||||
|
setupSnowCover: false,
|
||||||
|
selectedIndex: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
roofIndex: 3,
|
||||||
|
addRoof: {
|
||||||
|
roofMatlCd: 'ROOF_ID_HIRA_D',
|
||||||
|
roofMatlNm: '평판기와 D',
|
||||||
|
roofMatlNmJp: '平板瓦D',
|
||||||
|
widAuth: 'R',
|
||||||
|
widBase: '305.000',
|
||||||
|
lenAuth: 'R',
|
||||||
|
lenBase: '280.000',
|
||||||
|
roofPchAuth: null,
|
||||||
|
roofPchBase: null,
|
||||||
|
raftAuth: 'C',
|
||||||
|
raftBaseCd: 'HEI_455',
|
||||||
|
id: 'ROOF_ID_HIRA_D',
|
||||||
|
name: '평판기와 D',
|
||||||
|
selected: true,
|
||||||
|
index: 3,
|
||||||
|
nameJp: '平板瓦D',
|
||||||
|
length: 280,
|
||||||
|
width: 305,
|
||||||
|
raft: 'HEI_455',
|
||||||
|
layout: 'P',
|
||||||
|
hajebichi: 0,
|
||||||
|
pitch: 8,
|
||||||
|
angle: 21.8,
|
||||||
|
roofSizeSet: '1',
|
||||||
|
roofAngleSet: 'slope',
|
||||||
|
},
|
||||||
|
trestle: {
|
||||||
|
moduleTpCd: 'A1',
|
||||||
|
moduleTpCdNm: 'A1type',
|
||||||
|
moduleTpCdJp: 'A1type',
|
||||||
|
roofMatlCd: 'ROOF_ID_HIRA_D',
|
||||||
|
roofMatlCdNm: '평판기와 D',
|
||||||
|
roofMatlCdJp: '平板瓦D',
|
||||||
|
trestleMkrCd: 'DAIDO HUNT',
|
||||||
|
trestleMkrCdNm: '다이도 헌트',
|
||||||
|
trestleMkrCdJp: 'ダイドーハント',
|
||||||
|
constMthdCd: 'CST018',
|
||||||
|
constMthdCdNm: '지지 기와Ⅱ-D 랙 있음',
|
||||||
|
constMthdCdJp: '支持瓦Ⅱ-D ラック有り',
|
||||||
|
roofBaseCd: 'RFB002',
|
||||||
|
roofBaseCdNm: 'OSB12mm 이상',
|
||||||
|
roofBaseCdJp: 'OSB12mm以上',
|
||||||
|
rackYn: null,
|
||||||
|
priority: 203,
|
||||||
|
},
|
||||||
|
construction: {
|
||||||
|
constTp: 'WORK_LV_ID_3',
|
||||||
|
constTpNm: '강화 시공',
|
||||||
|
constTpJp: '強化施工',
|
||||||
|
constPossYn: 'Y',
|
||||||
|
plvrYn: 'Y',
|
||||||
|
cvrYn: 'Y',
|
||||||
|
cvrLmtRow: 9999,
|
||||||
|
snowGdPossYn: 'Y',
|
||||||
|
roofIndex: 3,
|
||||||
|
setupCover: false,
|
||||||
|
setupSnowCover: false,
|
||||||
|
selectedIndex: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
itemId: '106796',
|
||||||
|
itemNm: 'Q.TRON M-G2.4+ 430',
|
||||||
|
goodsNo: 'Q.TRON M-G2.4+ 430',
|
||||||
|
itemTp: 'A1',
|
||||||
|
mixMatlNo: null,
|
||||||
|
mixItemTpYn: 'N',
|
||||||
|
itemList: [
|
||||||
|
{
|
||||||
|
itemId: '106796',
|
||||||
|
itemNm: 'Q.TRON M-G2.4+ 430',
|
||||||
|
goodsNo: 'Q.TRON M-G2.4+ 430',
|
||||||
|
itemTp: 'A1',
|
||||||
|
color: '#BEF781',
|
||||||
|
longAxis: '1722.000',
|
||||||
|
shortAxis: '1134.000',
|
||||||
|
thickness: '30.000',
|
||||||
|
wpOut: '430',
|
||||||
|
mixMatlNo: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
name: 'Q.TRON M-G2.4+ 430',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Test Data insert
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -59,8 +59,6 @@ export default function QSelectBox({
|
|||||||
const ref = useRef(null)
|
const ref = useRef(null)
|
||||||
|
|
||||||
const handleClickSelectOption = (option) => {
|
const handleClickSelectOption = (option) => {
|
||||||
console.log('🚀 ~ handleClickSelectOption ~ option:', option)
|
|
||||||
|
|
||||||
setSelected(showKey !== '' ? option[showKey] : option.name)
|
setSelected(showKey !== '' ? option[showKey] : option.name)
|
||||||
onChange?.(option, params)
|
onChange?.(option, params)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,31 +54,6 @@ export default function ArchiveTable({ clsCode }) {
|
|||||||
fetchData()
|
fetchData()
|
||||||
}, [search.searchValue, search.searchFlag])
|
}, [search.searchValue, search.searchFlag])
|
||||||
|
|
||||||
// 상세 파일 목록 조회
|
|
||||||
const handleDetailFileListDown = async (noticeNo) => {
|
|
||||||
const url = `/api/board/detail`
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
noticeNo: noticeNo,
|
|
||||||
})
|
|
||||||
const apiUrl = `${url}?${params.toString()}`
|
|
||||||
|
|
||||||
const resultData = await get({ url: apiUrl })
|
|
||||||
|
|
||||||
if (resultData) {
|
|
||||||
if (resultData.result.code === 200) {
|
|
||||||
const boardDetailFileList = resultData.data.listFile
|
|
||||||
|
|
||||||
if (boardDetailFileList && Array.isArray(boardDetailFileList)) {
|
|
||||||
boardDetailFileList.forEach((boardFile) => {
|
|
||||||
handleFileDown(boardFile)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alert(resultData.result.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{boardList.length > 0 ? (
|
{boardList.length > 0 ? (
|
||||||
@ -101,7 +76,7 @@ export default function ArchiveTable({ clsCode }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="file-down-box">
|
<div className="file-down-box">
|
||||||
{/* 첨부파일 */}
|
{/* 첨부파일 */}
|
||||||
<button type="button" className="file-down-btn" onClick={() => handleDetailFileListDown(board.noticeNo)}></button>
|
<button type="button" className="file-down-btn" onClick={() => handleFileDown(board.noticeNo, 'Y')}></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ export default function Table({ clsCode }) {
|
|||||||
schTitle: search.searchValue ? search.searchValue : '',
|
schTitle: search.searchValue ? search.searchValue : '',
|
||||||
startRow: startRow,
|
startRow: startRow,
|
||||||
endRow: endRow,
|
endRow: endRow,
|
||||||
|
schMainYn: 'N',
|
||||||
})
|
})
|
||||||
const apiUrl = `${url}?${params.toString()}`
|
const apiUrl = `${url}?${params.toString()}`
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export default function BoardDetailModal({ noticeNo, setOpen }) {
|
|||||||
<dt>{getMessage('board.sub.fileList')}</dt>
|
<dt>{getMessage('board.sub.fileList')}</dt>
|
||||||
{boardDetail.listFile.map((boardFile) => (
|
{boardDetail.listFile.map((boardFile) => (
|
||||||
<dd key={boardFile.encodeFileNo}>
|
<dd key={boardFile.encodeFileNo}>
|
||||||
<button type="button" className="down" onClick={() => handleFileDown(boardFile)}>
|
<button type="button" className="down" onClick={() => handleFileDown(boardFile.fileNo, 'N')}>
|
||||||
{boardFile.srcFileNm}
|
{boardFile.srcFileNm}
|
||||||
</button>
|
</button>
|
||||||
</dd>
|
</dd>
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function FloorPlan({ children }) {
|
|||||||
//const [correntObjectNo, setCorrentObjectNo] = useRecoilState(correntObjectNoState)
|
//const [correntObjectNo, setCorrentObjectNo] = useRecoilState(correntObjectNoState)
|
||||||
const { closeAll } = usePopup()
|
const { closeAll } = usePopup()
|
||||||
const { menuNumber, setMenuNumber } = useCanvasMenu()
|
const { menuNumber, setMenuNumber } = useCanvasMenu()
|
||||||
const { fetchSettings } = useCanvasSetting()
|
const { fetchSettings, fetchBasicSettings } = useCanvasSetting()
|
||||||
|
|
||||||
const modalProps = {
|
const modalProps = {
|
||||||
menuNumber,
|
menuNumber,
|
||||||
@ -26,7 +26,8 @@ export default function FloorPlan({ children }) {
|
|||||||
///setCorrentObjectNo(floorPlanState.objectNo)
|
///setCorrentObjectNo(floorPlanState.objectNo)
|
||||||
//console.log('FloorPlan objectNo ', floorPlanState.objectNo, correntObjectNo)
|
//console.log('FloorPlan objectNo ', floorPlanState.objectNo, correntObjectNo)
|
||||||
setMenuNumber(1)
|
setMenuNumber(1)
|
||||||
fetchSettings()
|
fetchSettings() // Canvas 설정 정보 조회
|
||||||
|
fetchBasicSettings() // 기본 설정 정보 조회
|
||||||
return () => {
|
return () => {
|
||||||
closeAll()
|
closeAll()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,23 @@
|
|||||||
import { useEffect, useState, useReducer } from 'react'
|
import { useEffect, useState, useReducer } from 'react'
|
||||||
import { useRecoilValue, useRecoilState } from 'recoil'
|
import { useRecoilValue, useRecoilState } from 'recoil'
|
||||||
import { addedRoofsState } from '@/store/settingAtom'
|
import { addedRoofsState } from '@/store/settingAtom'
|
||||||
import { canvasSettingState, currentCanvasPlanState, pitchSelector } from '@/store/canvasAtom'
|
import { currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
import { useModuleSelection } from '@/hooks/module/useModuleSelection'
|
import { useModuleSelection } from '@/hooks/module/useModuleSelection'
|
||||||
import ModuleTabContents from './ModuleTabContents'
|
import ModuleTabContents from './ModuleTabContents'
|
||||||
import { useDebounceCallback, useDebounceValue } from 'usehooks-ts'
|
import { useDebounceValue } from 'usehooks-ts'
|
||||||
import { moduleSelectionDataPlanListState, moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
|
|
||||||
export default function Module({ setTabNum }) {
|
export default function Module({ setTabNum }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const addedRoofs = useRecoilValue(addedRoofsState) //지붕재 선택
|
const addedRoofs = useRecoilValue(addedRoofsState) //지붕재 선택
|
||||||
const [roofTab, setRoofTab] = useState(0) //지붕재 탭
|
const [roofTab, setRoofTab] = useState(0) //지붕재 탭
|
||||||
|
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
moduleSelectionInitParams,
|
moduleSelectionInitParams,
|
||||||
selectedModules,
|
selectedModules,
|
||||||
raftCodes,
|
|
||||||
roughnessCodes,
|
roughnessCodes,
|
||||||
windSpeedCodes,
|
windSpeedCodes,
|
||||||
managementState,
|
managementState,
|
||||||
@ -38,19 +38,13 @@ export default function Module({ setTabNum }) {
|
|||||||
const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500)
|
const [debouncedVerticalSnowCover] = useDebounceValue(inputVerticalSnowCover, 500)
|
||||||
|
|
||||||
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
||||||
const [moduleSelectionDataPlanList, setModuleSelectionDataPlanList] = useRecoilState(moduleSelectionDataPlanListState)
|
|
||||||
|
|
||||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
|
||||||
|
|
||||||
const [tempModuleSelectionData, setTempModuleSelectionData] = useReducer((prevState, nextState) => {
|
const [tempModuleSelectionData, setTempModuleSelectionData] = useReducer((prevState, nextState) => {
|
||||||
return { ...prevState, ...nextState }
|
return { ...prevState, ...nextState }
|
||||||
}, moduleSelectionData)
|
}, moduleSelectionData)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (moduleSelectionDataPlanList) {
|
setModuleSelectionData(tempModuleSelectionData)
|
||||||
setModuleSelectionData(moduleSelectionDataPlanList[currentCanvasPlan.id])
|
}, [tempModuleSelectionData])
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleChangeInstallHeight(debouncedInstallHeight)
|
handleChangeInstallHeight(debouncedInstallHeight)
|
||||||
@ -60,11 +54,6 @@ export default function Module({ setTabNum }) {
|
|||||||
handleChangeVerticalSnowCover(debouncedVerticalSnowCover)
|
handleChangeVerticalSnowCover(debouncedVerticalSnowCover)
|
||||||
}, [debouncedVerticalSnowCover])
|
}, [debouncedVerticalSnowCover])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setInputInstallHeight(installHeight)
|
|
||||||
setInputVerticalSnowCover(verticalSnowCover)
|
|
||||||
}, [installHeight, verticalSnowCover])
|
|
||||||
|
|
||||||
const moduleData = {
|
const moduleData = {
|
||||||
header: [
|
header: [
|
||||||
{ name: getMessage('module'), width: 150, prop: 'module', type: 'color-box' },
|
{ name: getMessage('module'), width: 150, prop: 'module', type: 'color-box' },
|
||||||
@ -118,20 +107,18 @@ export default function Module({ setTabNum }) {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{selectedModules.itemList &&
|
{selectedModules.itemList &&
|
||||||
selectedModules.itemList.map((row) => (
|
selectedModules.itemList.map((row, index) => (
|
||||||
<>
|
<tr key={index}>
|
||||||
<tr>
|
<td>
|
||||||
<td>
|
<div className="color-wrap">
|
||||||
<div className="color-wrap">
|
<span className="color-box" style={{ backgroundColor: row.color }}></span>
|
||||||
<span className="color-box" style={{ backgroundColor: row.color }}></span>
|
<span className="name">{row.itemNm}</span>
|
||||||
<span className="name">{row.itemNm}</span>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
<td className="al-r">{Number(row.shortAxis).toFixed(0)}</td>
|
||||||
<td className="al-r">{Number(row.shortAxis).toFixed(0)}</td>
|
<td className="al-r">{Number(row.longAxis).toFixed(0)}</td>
|
||||||
<td className="al-r">{Number(row.longAxis).toFixed(0)}</td>
|
<td className="al-r">{Number(row.wpOut).toFixed(0)}</td>
|
||||||
<td className="al-r">{Number(row.wpOut).toFixed(0)}</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
</>
|
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -238,12 +225,8 @@ export default function Module({ setTabNum }) {
|
|||||||
index={index}
|
index={index}
|
||||||
addRoof={roof}
|
addRoof={roof}
|
||||||
roofTab={index}
|
roofTab={index}
|
||||||
moduleConstructionSelectionData={moduleSelectionData?.roofConstructions[index]}
|
|
||||||
tempModuleSelectionData={tempModuleSelectionData}
|
tempModuleSelectionData={tempModuleSelectionData}
|
||||||
setTempModuleSelectionData={setTempModuleSelectionData}
|
setTempModuleSelectionData={setTempModuleSelectionData}
|
||||||
selectedModule={selectedModules}
|
|
||||||
moduleSelectionDataPlanList={moduleSelectionDataPlanList}
|
|
||||||
setModuleSelectionDataPlanList={setModuleSelectionDataPlanList}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -1,23 +1,14 @@
|
|||||||
import { useEffect, useState, useRef } from 'react'
|
import { useEffect, useState, useRef, useReducer } from 'react'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue, useRecoilState } from 'recoil'
|
||||||
import { currentCanvasPlanState, pitchTextSelector } from '@/store/canvasAtom'
|
import { currentCanvasPlanState, pitchTextSelector } from '@/store/canvasAtom'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
import { moduleSelectionInitParamsState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
import QSelectBox from '@/components/common/select/QSelectBox'
|
import QSelectBox from '@/components/common/select/QSelectBox'
|
||||||
|
|
||||||
export default function ModuleTabContents({
|
export default function ModuleTabContents({ addRoof, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) {
|
||||||
addRoof,
|
|
||||||
roofTab,
|
|
||||||
moduleConstructionSelectionData,
|
|
||||||
tempModuleSelectionData,
|
|
||||||
setTempModuleSelectionData,
|
|
||||||
selectedModule,
|
|
||||||
moduleSelectionDataPlanList,
|
|
||||||
setModuleSelectionDataPlanList,
|
|
||||||
}) {
|
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재`
|
const [roofMaterial, setRoofMaterial] = useState(addRoof) //지붕재`
|
||||||
const globalPitchText = useRecoilValue(pitchTextSelector) //피치 텍스트
|
const globalPitchText = useRecoilValue(pitchTextSelector) //피치 텍스트
|
||||||
@ -25,6 +16,7 @@ export default function ModuleTabContents({
|
|||||||
|
|
||||||
const { findCommonCode } = useCommonCode()
|
const { findCommonCode } = useCommonCode()
|
||||||
const [raftCodes, setRaftCodes] = useState([]) //가대 목록
|
const [raftCodes, setRaftCodes] = useState([]) //가대 목록
|
||||||
|
|
||||||
const [trestleList, setTrestleList] = useState([])
|
const [trestleList, setTrestleList] = useState([])
|
||||||
const [constMthdList, setConstMthdList] = useState([])
|
const [constMthdList, setConstMthdList] = useState([])
|
||||||
const [roofBaseList, setRoofBaseList] = useState([])
|
const [roofBaseList, setRoofBaseList] = useState([])
|
||||||
@ -54,12 +46,19 @@ export default function ModuleTabContents({
|
|||||||
|
|
||||||
const [isExistData, setIsExistData] = useState(false)
|
const [isExistData, setIsExistData] = useState(false)
|
||||||
|
|
||||||
|
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState) //선택된 모듈
|
||||||
|
const [moduleConstructionSelectionData, setModuleConstructionSelectionData] = useState()
|
||||||
|
|
||||||
|
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setModuleConstructionSelectionData(moduleSelectionData.roofConstructions[roofTab])
|
||||||
|
}, [moduleSelectionData])
|
||||||
|
|
||||||
//서까래간격 변경
|
//서까래간격 변경
|
||||||
const handleChangeRaftBase = (option) => {
|
const handleChangeRaftBase = (option) => {
|
||||||
setSelectedRaftBase(option)
|
setSelectedRaftBase(option)
|
||||||
setTrestleParams({ ...trestleParams, raftBaseCd: option.clCode })
|
setTrestleParams({ ...trestleParams, raftBaseCd: option.clCode }) //가대메이커
|
||||||
|
|
||||||
setTrestleList([]) //가대메이커
|
|
||||||
setConstMthdList([]) //공법 초기화
|
setConstMthdList([]) //공법 초기화
|
||||||
setRoofBaseList([]) //지붕밑바탕 초기화
|
setRoofBaseList([]) //지붕밑바탕 초기화
|
||||||
setConstructionList([]) //공법 초기화
|
setConstructionList([]) //공법 초기화
|
||||||
@ -78,6 +77,7 @@ export default function ModuleTabContents({
|
|||||||
const handleChangeConstMthd = (option) => {
|
const handleChangeConstMthd = (option) => {
|
||||||
setSelectedConstMthd(option) //선택된값 저장
|
setSelectedConstMthd(option) //선택된값 저장
|
||||||
setRoofBaseParams({ ...trestleParams, trestleMkrCd: selectedTrestle.trestleMkrCd, constMthdCd: option.constMthdCd, roofBaseCd: '' })
|
setRoofBaseParams({ ...trestleParams, trestleMkrCd: selectedTrestle.trestleMkrCd, constMthdCd: option.constMthdCd, roofBaseCd: '' })
|
||||||
|
setRoofBaseList([]) //지붕밑바탕 초기화
|
||||||
setConstructionList([]) //공법 초기화
|
setConstructionList([]) //공법 초기화
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,45 +93,6 @@ export default function ModuleTabContents({
|
|||||||
setSelectedRoofBase(option)
|
setSelectedRoofBase(option)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getModuleOptionsListData = async (params) => {
|
|
||||||
const optionsList = await getTrestleList(params)
|
|
||||||
|
|
||||||
if (optionsList.data.length > 0) {
|
|
||||||
if (optionsList.data[0].trestleMkrCd && optionsList.data[0].constMthdCd === null) {
|
|
||||||
setTrestleList(optionsList.data)
|
|
||||||
if (isExistData) {
|
|
||||||
setSelectedTrestle({ ...moduleConstructionSelectionData.trestle })
|
|
||||||
} else {
|
|
||||||
setConstMthdList([])
|
|
||||||
setRoofBaseList([])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optionsList.data[0].trestleMkrCd && optionsList.data[0].constMthdCd && optionsList.data[0].roofBaseCd === null) {
|
|
||||||
setConstMthdList(optionsList.data)
|
|
||||||
if (isExistData) {
|
|
||||||
setSelectedConstMthd({ ...moduleConstructionSelectionData.trestle })
|
|
||||||
} else {
|
|
||||||
setRoofBaseList([])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optionsList.data[0].trestleMkrCd && optionsList.data[0].constMthdCd && optionsList.data[0].roofBaseCd) {
|
|
||||||
setRoofBaseList(optionsList.data)
|
|
||||||
if (isExistData) {
|
|
||||||
setSelectedRoofBase({ ...moduleConstructionSelectionData.trestle })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getConstructionListData = async (params) => {
|
|
||||||
if (params.trestleMkrCd && params.constMthdCd && params.roofBaseCd) {
|
|
||||||
const optionsList = await getConstructionList(params)
|
|
||||||
setConstructionList(optionsList.data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleConstruction = (index) => {
|
const handleConstruction = (index) => {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
const isPossibleIndex = constructionRef.current
|
const isPossibleIndex = constructionRef.current
|
||||||
@ -163,9 +124,54 @@ export default function ModuleTabContents({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
const handleCvrChecked = () => {
|
||||||
console.log('tempModuleSelectionData', tempModuleSelectionData)
|
setCvrChecked(!cvrChecked)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSnowGdChecked = () => {
|
||||||
|
setSnowGdChecked(!snowGdChecked)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getModuleOptionsListData = async (params) => {
|
||||||
|
const optionsList = await getTrestleList(params)
|
||||||
|
|
||||||
|
if (optionsList.data.length > 0) {
|
||||||
|
if (optionsList.data[0].trestleMkrCd && optionsList.data[0].constMthdCd === null) {
|
||||||
|
setTrestleList(optionsList.data)
|
||||||
|
if (isExistData) {
|
||||||
|
setSelectedTrestle({ ...moduleConstructionSelectionData?.trestle })
|
||||||
|
} else {
|
||||||
|
setConstMthdList([])
|
||||||
|
setRoofBaseList([])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optionsList.data[0].trestleMkrCd && optionsList.data[0].constMthdCd && optionsList.data[0].roofBaseCd === null) {
|
||||||
|
setConstMthdList(optionsList.data)
|
||||||
|
if (isExistData) {
|
||||||
|
setSelectedConstMthd({ ...moduleConstructionSelectionData?.trestle })
|
||||||
|
} else {
|
||||||
|
setRoofBaseList([])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optionsList.data[0].trestleMkrCd && optionsList.data[0].constMthdCd && optionsList.data[0].roofBaseCd) {
|
||||||
|
setRoofBaseList(optionsList.data)
|
||||||
|
if (isExistData) {
|
||||||
|
setSelectedRoofBase({ ...moduleConstructionSelectionData?.trestle })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getConstructionListData = async (params) => {
|
||||||
|
if (params.trestleMkrCd && params.constMthdCd && params.roofBaseCd) {
|
||||||
|
const optionsList = await getConstructionList(params)
|
||||||
|
setConstructionList(optionsList.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
if (isObjectNotEmpty(selectedRoofBase) && isObjectNotEmpty(selectedConstruction)) {
|
if (isObjectNotEmpty(selectedRoofBase) && isObjectNotEmpty(selectedConstruction)) {
|
||||||
const newRoofConstructions = {
|
const newRoofConstructions = {
|
||||||
roofIndex: roofTab,
|
roofIndex: roofTab,
|
||||||
@ -189,14 +195,6 @@ export default function ModuleTabContents({
|
|||||||
}
|
}
|
||||||
}, [selectedConstruction])
|
}, [selectedConstruction])
|
||||||
|
|
||||||
const handleCvrChecked = () => {
|
|
||||||
setCvrChecked(!cvrChecked)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSnowGdChecked = () => {
|
|
||||||
setSnowGdChecked(!snowGdChecked)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectedConstruction({ ...selectedConstruction, setupCover: cvrChecked })
|
setSelectedConstruction({ ...selectedConstruction, setupCover: cvrChecked })
|
||||||
}, [cvrChecked])
|
}, [cvrChecked])
|
||||||
@ -219,7 +217,10 @@ export default function ModuleTabContents({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isExistData && constructionList.length > 0) {
|
if (isExistData && constructionList.length > 0) {
|
||||||
const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex
|
const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex
|
||||||
handleConstruction(selectedIndex)
|
const construction = constructionList[selectedIndex]
|
||||||
|
if (construction.constPossYn === 'Y') {
|
||||||
|
handleConstruction(selectedIndex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [constructionList])
|
}, [constructionList])
|
||||||
|
|
||||||
@ -246,20 +247,19 @@ export default function ModuleTabContents({
|
|||||||
if (isModuleLoaded) {
|
if (isModuleLoaded) {
|
||||||
setTrestleParams({ moduleTpCd: moduleSelectionInitParams.moduleTpCd, roofMatlCd: addRoof.roofMatlCd, raftBaseCd: addRoof.raftBaseCd })
|
setTrestleParams({ moduleTpCd: moduleSelectionInitParams.moduleTpCd, roofMatlCd: addRoof.roofMatlCd, raftBaseCd: addRoof.raftBaseCd })
|
||||||
setConstructionList([])
|
setConstructionList([])
|
||||||
setTempModuleSelectionData({ common: moduleSelectionInitParams, module: selectedModule })
|
|
||||||
|
|
||||||
if (isObjectNotEmpty(moduleConstructionSelectionData)) {
|
if (isObjectNotEmpty(moduleConstructionSelectionData)) {
|
||||||
//기존에 데이터가 있으면
|
//기존에 데이터가 있으면 파라메터를 넣는다
|
||||||
setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' })
|
setConstructionParams({ ...moduleConstructionSelectionData.trestle, constMthdCd: '', roofBaseCd: '' })
|
||||||
setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' })
|
setRoofBaseParams({ ...moduleConstructionSelectionData.trestle, roofBaseCd: '' })
|
||||||
setCvrChecked(moduleConstructionSelectionData.construction.setupCover)
|
setCvrChecked(moduleConstructionSelectionData.construction.setupCover)
|
||||||
setSnowGdChecked(moduleConstructionSelectionData.construction.setupSnowCover)
|
setSnowGdChecked(moduleConstructionSelectionData.construction.setupSnowCover)
|
||||||
setIsExistData(true)
|
setIsExistData(true)
|
||||||
|
|
||||||
setTempModuleSelectionData({ roofConstructions: [{ ...moduleConstructionSelectionData }] })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTempModuleSelectionData({ common: moduleSelectionInitParams, module: selectedModules })
|
||||||
}, [moduleSelectionInitParams])
|
}, [moduleSelectionInitParams])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -288,8 +288,7 @@ export default function ModuleTabContents({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isObjectNotEmpty(tempModuleSelectionData)) {
|
if (isObjectNotEmpty(tempModuleSelectionData)) {
|
||||||
setModuleSelectionDataPlanList({ ...moduleSelectionDataPlanList, [currentCanvasPlan.id]: tempModuleSelectionData })
|
setModuleSelectionData(tempModuleSelectionData)
|
||||||
// setModuleSelectionData(tempModuleSelectionData)
|
|
||||||
}
|
}
|
||||||
}, [tempModuleSelectionData])
|
}, [tempModuleSelectionData])
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { forwardRef, useImperativeHandle, useState } from 'react'
|
import { forwardRef, useContext, useImperativeHandle, useState } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useOrientation } from '@/hooks/module/useOrientation'
|
import { useOrientation } from '@/hooks/module/useOrientation'
|
||||||
import { getDegreeInOrientation } from '@/util/canvas-util'
|
import { getDegreeInOrientation } from '@/util/canvas-util'
|
||||||
import { numberCheck } from '@/util/common-utils'
|
import { numberCheck } from '@/util/common-utils'
|
||||||
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
|
|
||||||
export const Orientation = forwardRef(({ tabNum }, ref) => {
|
export const Orientation = forwardRef(({ tabNum }, ref) => {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -17,6 +18,7 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
|||||||
|
|
||||||
const handleNextStep = () => {
|
const handleNextStep = () => {
|
||||||
nextStep()
|
nextStep()
|
||||||
|
canvasPopupStatusTrigger(compasDeg)
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkDegree = (e) => {
|
const checkDegree = (e) => {
|
||||||
@ -27,6 +29,8 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { trigger: canvasPopupStatusTrigger } = useCanvasPopupStatusController(1)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="properties-setting-wrap">
|
<div className="properties-setting-wrap">
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { useMessage } from '@/hooks/useMessage'
|
|||||||
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
|
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
|
||||||
import { checkedModuleState, currentCanvasPlanState } from '@/store/canvasAtom'
|
import { checkedModuleState, currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
import { useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { moduleSelectionDataPlanListState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
import { useModulePlace } from '@/hooks/module/useModulePlace'
|
import { useModulePlace } from '@/hooks/module/useModulePlace'
|
||||||
|
|
||||||
const Placement = forwardRef((props, refs) => {
|
const Placement = forwardRef((props, refs) => {
|
||||||
@ -20,15 +20,14 @@ const Placement = forwardRef((props, refs) => {
|
|||||||
const { selectedModules } = useModulePlace()
|
const { selectedModules } = useModulePlace()
|
||||||
|
|
||||||
const setCheckedModules = useSetRecoilState(checkedModuleState)
|
const setCheckedModules = useSetRecoilState(checkedModuleState)
|
||||||
const moduleSelectionDataPlanList = useRecoilValue(moduleSelectionDataPlanListState)
|
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
||||||
|
|
||||||
//모듈 배치면 생성
|
//모듈 배치면 생성
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
makeModuleInstArea()
|
makeModuleInstArea()
|
||||||
|
if (moduleSelectionData) {
|
||||||
if (moduleSelectionDataPlanList) {
|
|
||||||
//1개라도 치도리 불가가 있으면 치도리 불가
|
//1개라도 치도리 불가가 있으면 치도리 불가
|
||||||
const isChidroriValue = moduleSelectionDataPlanList[currentCanvasPlan.id].roofConstructions.some((item) => item.construction.plvrYn === 'N')
|
const isChidroriValue = moduleSelectionData.roofConstructions.some((item) => item.construction.plvrYn === 'N')
|
||||||
if (isChidroriValue) {
|
if (isChidroriValue) {
|
||||||
setIsChidoriNotAble(true)
|
setIsChidoriNotAble(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +1,77 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import useSWRMutation from 'swr/mutation'
|
import useSWRMutation from 'swr/mutation'
|
||||||
import { useAxios } from '../useAxios'
|
import { useAxios } from '../useAxios'
|
||||||
import { useRecoilState } from 'recoil'
|
import { unescapeString } from '@/util/common-utils'
|
||||||
import { canvasPopupStatusStore } from '@/store/canvasPopupStatusAtom'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
|
import { compasDegAtom } from '@/store/orientationAtom'
|
||||||
|
import { currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
|
|
||||||
export function useCanvasPopupStatusController(popupType) {
|
export function useCanvasPopupStatusController(param = 1) {
|
||||||
const [canvasPopupStatusState, setCanvasPopupStatusState] = useRecoilState(canvasPopupStatusStore)
|
const popupType = param
|
||||||
|
|
||||||
|
const [compasDeg, setCompasDeg] = useRecoilState(compasDegAtom)
|
||||||
|
const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState)
|
||||||
const { getFetcher, postFetcher } = useAxios()
|
const { getFetcher, postFetcher } = useAxios()
|
||||||
|
|
||||||
|
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||||
|
console.log('🚀 ~ Orientation ~ currentCanvasPlan:', currentCanvasPlan)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: popupStatus,
|
data: popupStatus,
|
||||||
error,
|
error,
|
||||||
isLoading,
|
isLoading,
|
||||||
} = useSWR(popupType ? 'canvas-popup-status--data' : null, () => getFetcher(`http://localhost:8080/api/tutorial?popupType=${popupType}`))
|
} = useSWR(
|
||||||
|
popupType ? `/api/v1/canvas-popup-status?objectNo=${currentCanvasPlan.objectNo}&planNo=${currentCanvasPlan.planNo}&popupType=${popupType}` : null,
|
||||||
|
getFetcher,
|
||||||
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('🚀 ~ useEffect ~ popupStatus:', popupStatus)
|
||||||
if (popupStatus) {
|
if (popupStatus) {
|
||||||
setCanvasPopupStatusState({ ...canvasPopupStatusState, [popupType]: popupStatus })
|
switch (parseInt(popupStatus?.popupType)) {
|
||||||
|
case 1:
|
||||||
|
setCompasDeg(popupStatus.popupStatus)
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
setModuleSelectionDataStore(JSON.parse(unescapeString(popupStatus.popupStatus)))
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (popupType) {
|
||||||
|
case 1:
|
||||||
|
setCompasDeg(0)
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
setModuleSelectionDataStore({
|
||||||
|
common: {},
|
||||||
|
roofConstructions: [],
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [popupStatus])
|
}, [popupStatus])
|
||||||
|
|
||||||
const { trigger, isMutating } = useSWRMutation('canvas-popup-status-update', postFetcher)
|
const { trigger, isMutating } = useSWRMutation(
|
||||||
|
`/api/v1/canvas-popup-status?objectNo=${currentCanvasPlan.objectNo}&planNo=${currentCanvasPlan.planNo}&popupType=${popupType}`,
|
||||||
|
(url, { arg }) => {
|
||||||
|
const params = {
|
||||||
|
objectNo: currentCanvasPlan.objectNo,
|
||||||
|
planNo: parseInt(currentCanvasPlan.planNo),
|
||||||
|
popupType: popupType.toString(),
|
||||||
|
popupStatus: JSON.stringify(arg).replace(/"/g, '\"'),
|
||||||
|
}
|
||||||
|
postFetcher(`/api/v1/canvas-popup-status`, params)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
return { trigger }
|
return { trigger }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -853,7 +853,7 @@ export function useModuleBasicSetting() {
|
|||||||
leftMargin = j === 0 ? 0 : intvVer * j
|
leftMargin = j === 0 ? 0 : intvVer * j
|
||||||
chidoriLength = 0
|
chidoriLength = 0
|
||||||
if (isChidori) {
|
if (isChidori) {
|
||||||
chidoriLength = i % 2 === 0 ? 0 : height / 2 - intvHor
|
chidoriLength = i % 2 === 0 ? 0 : height / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
square = [
|
square = [
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
import { moduleSelectionDataPlanListState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
import { canvasState, currentCanvasPlanState } from '@/store/canvasAtom'
|
import { canvasState, currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
|
|
||||||
export function useModulePlace() {
|
export function useModulePlace() {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const moduleSelectionDataPlanList = useRecoilValue(moduleSelectionDataPlanListState) //다음으로 넘어가는 최종 데이터
|
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
||||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||||
const [trestleDetailParams, setTrestleDetailParams] = useState([])
|
const [trestleDetailParams, setTrestleDetailParams] = useState([])
|
||||||
const [trestleDetailList, setTrestleDetailList] = useState([])
|
const [trestleDetailList, setTrestleDetailList] = useState([])
|
||||||
@ -14,9 +14,9 @@ export function useModulePlace() {
|
|||||||
const { getTrestleDetailList } = useMasterController()
|
const { getTrestleDetailList } = useMasterController()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (moduleSelectionDataPlanList) {
|
if (moduleSelectionData) {
|
||||||
const common = moduleSelectionDataPlanList[currentCanvasPlan.id].common
|
const common = moduleSelectionData.common
|
||||||
const roofConstructions = moduleSelectionDataPlanList[currentCanvasPlan.id].roofConstructions
|
const roofConstructions = moduleSelectionData.roofConstructions
|
||||||
|
|
||||||
const listParams = roofConstructions.map((item) => {
|
const listParams = roofConstructions.map((item) => {
|
||||||
return {
|
return {
|
||||||
@ -31,11 +31,12 @@ export function useModulePlace() {
|
|||||||
roofPitch: selectedModules.roofPchBase ? selectedModules.roofPchBase : null,
|
roofPitch: selectedModules.roofPchBase ? selectedModules.roofPchBase : null,
|
||||||
inclCd: String(item.addRoof.pitch),
|
inclCd: String(item.addRoof.pitch),
|
||||||
roofIndex: item.addRoof.index,
|
roofIndex: item.addRoof.index,
|
||||||
|
workingWidth: item.addRoof.lenBase,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setTrestleDetailParams(listParams)
|
setTrestleDetailParams(listParams)
|
||||||
}
|
}
|
||||||
}, [moduleSelectionDataPlanList])
|
}, [moduleSelectionData])
|
||||||
|
|
||||||
const getTrestleDetailListData = async () => {
|
const getTrestleDetailListData = async () => {
|
||||||
const trestleDetailList = await getTrestleDetailList(trestleDetailParams)
|
const trestleDetailList = await getTrestleDetailList(trestleDetailParams)
|
||||||
@ -49,8 +50,6 @@ export function useModulePlace() {
|
|||||||
}, [trestleDetailParams])
|
}, [trestleDetailParams])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('🚀 ~ useModulePlace ~ trestleDetailList:', trestleDetailList)
|
|
||||||
|
|
||||||
//지붕을 가져옴
|
//지붕을 가져옴
|
||||||
canvas
|
canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
@ -71,8 +70,6 @@ export function useModulePlace() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('roof', roof)
|
|
||||||
})
|
})
|
||||||
}, [trestleDetailList])
|
}, [trestleDetailList])
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,9 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
|||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
|
|
||||||
import { selectedModuleState, moduleSelectionInitParamsState } from '@/store/selectedModuleOptions'
|
import { selectedModuleState, moduleSelectionInitParamsState } from '@/store/selectedModuleOptions'
|
||||||
import { pitchSelector } from '@/store/canvasAtom'
|
|
||||||
|
|
||||||
export function useModuleSelection(props) {
|
export function useModuleSelection(props) {
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const globalPitch = useRecoilValue(pitchSelector) //피치
|
|
||||||
|
|
||||||
const [roughnessCodes, setRoughnessCodes] = useState([]) //면조도 목록
|
const [roughnessCodes, setRoughnessCodes] = useState([]) //면조도 목록
|
||||||
const [windSpeedCodes, setWindSpeedCodes] = useState([]) //기준풍속 목록
|
const [windSpeedCodes, setWindSpeedCodes] = useState([]) //기준풍속 목록
|
||||||
@ -17,9 +15,9 @@ export function useModuleSelection(props) {
|
|||||||
|
|
||||||
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState) //선택된 모듈
|
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState) //선택된 모듈
|
||||||
const [selectedSurfaceType, setSelectedSurfaceType] = useState({}) //선택된 면조도
|
const [selectedSurfaceType, setSelectedSurfaceType] = useState({}) //선택된 면조도
|
||||||
const [installHeight, setInstallHeight] = useState('0') //설치 높이
|
const [installHeight, setInstallHeight] = useState(managementState?.installHeight) //설치 높이
|
||||||
const [standardWindSpeed, setStandardWindSpeed] = useState({}) //기준풍속
|
const [standardWindSpeed, setStandardWindSpeed] = useState({}) //기준풍속
|
||||||
const [verticalSnowCover, setVerticalSnowCover] = useState('0') //수직적설량
|
const [verticalSnowCover, setVerticalSnowCover] = useState(managementState?.verticalSnowCover) //수직적설량
|
||||||
const [moduleSelectionInitParams, setModuleSelectionInitParams] = useRecoilState(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등
|
const [moduleSelectionInitParams, setModuleSelectionInitParams] = useRecoilState(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등
|
||||||
|
|
||||||
const { getModuleTypeItemList } = useMasterController()
|
const { getModuleTypeItemList } = useMasterController()
|
||||||
@ -76,12 +74,14 @@ export function useModuleSelection(props) {
|
|||||||
|
|
||||||
const getModuleData = async (roofsIds) => {
|
const getModuleData = async (roofsIds) => {
|
||||||
const list = await getModuleTypeItemList(roofsIds)
|
const list = await getModuleTypeItemList(roofsIds)
|
||||||
//selectbox에 이름을 넣는다
|
if (list.data.length > 0) {
|
||||||
list.data.forEach((item) => {
|
//selectbox에 이름을 넣는다
|
||||||
item.name = item.itemNm
|
list.data.forEach((item) => {
|
||||||
})
|
item.name = item.itemNm
|
||||||
//셀렉트박스 데이터 초기화
|
})
|
||||||
setModuleList(list.data)
|
//셀렉트박스 데이터 초기화
|
||||||
|
setModuleList(list.data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleChangeModule = (option) => {
|
const handleChangeModule = (option) => {
|
||||||
@ -112,7 +112,6 @@ export function useModuleSelection(props) {
|
|||||||
|
|
||||||
const handleChangeInstallHeight = (option) => {
|
const handleChangeInstallHeight = (option) => {
|
||||||
setInstallHeight(option)
|
setInstallHeight(option)
|
||||||
|
|
||||||
setModuleSelectionInitParams({
|
setModuleSelectionInitParams({
|
||||||
...moduleSelectionInitParams,
|
...moduleSelectionInitParams,
|
||||||
instHt: option,
|
instHt: option,
|
||||||
|
|||||||
@ -58,17 +58,22 @@ export function useCanvasSetting() {
|
|||||||
|
|
||||||
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
||||||
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
||||||
|
const resetSettingModalFirstOptions = useResetRecoilState(settingModalFirstOptionsState)
|
||||||
|
const resetSettingModalSecondOptions = useResetRecoilState(settingModalSecondOptionsState)
|
||||||
|
|
||||||
const [selectedFont, setSelectedFont] = useState()
|
const [selectedFont, setSelectedFont] = useState()
|
||||||
const [selectedFontWeight, setSelectedFontWeight] = useState()
|
const [selectedFontWeight, setSelectedFontWeight] = useState()
|
||||||
const [selectedFontSize, setSelectedFontSize] = useState()
|
const [selectedFontSize, setSelectedFontSize] = useState()
|
||||||
const [selectedFontColor, setSelectedFontColor] = useState()
|
const [selectedFontColor, setSelectedFontColor] = useState()
|
||||||
const [globalFont, setGlobalFont] = useRecoilState(globalFontAtom)
|
const [globalFont, setGlobalFont] = useRecoilState(globalFontAtom)
|
||||||
|
const resetGlobalFont = useResetRecoilState(globalFontAtom)
|
||||||
|
|
||||||
const [adsorptionPointMode, setAdsorptionPointMode] = useRecoilState(adsorptionPointModeState)
|
const [adsorptionPointMode, setAdsorptionPointMode] = useRecoilState(adsorptionPointModeState)
|
||||||
const [adsorptionRange, setAdsorptionRange] = useRecoilState(adsorptionRangeState)
|
const [adsorptionRange, setAdsorptionRange] = useRecoilState(adsorptionRangeState)
|
||||||
const [planSizeSettingMode, setPlanSizeSettingMode] = useRecoilState(planSizeSettingState)
|
const [planSizeSettingMode, setPlanSizeSettingMode] = useRecoilState(planSizeSettingState)
|
||||||
|
const resetPlanSizeSettingMode = useResetRecoilState(planSizeSettingState)
|
||||||
const [dimensionLineSettings, setDimensionLineSettings] = useRecoilState(dimensionLineSettingsState)
|
const [dimensionLineSettings, setDimensionLineSettings] = useRecoilState(dimensionLineSettingsState)
|
||||||
|
const resetDimensionLineSettings = useResetRecoilState(dimensionLineSettingsState)
|
||||||
|
|
||||||
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
const setSettingModalGridOptions = useSetRecoilState(settingModalGridOptionsState)
|
||||||
const [dotLineGridSetting, setDotLineGridSettingState] = useRecoilState(dotLineGridSettingState)
|
const [dotLineGridSetting, setDotLineGridSettingState] = useRecoilState(dotLineGridSettingState)
|
||||||
@ -120,6 +125,8 @@ export function useCanvasSetting() {
|
|||||||
const { closeAll } = usePopup()
|
const { closeAll } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('correntObjectNo', correntObjectNo)
|
||||||
|
|
||||||
setFetchRoofMaterials(!fetchRoofMaterials)
|
setFetchRoofMaterials(!fetchRoofMaterials)
|
||||||
if (fetchRoofMaterials) {
|
if (fetchRoofMaterials) {
|
||||||
addRoofMaterials()
|
addRoofMaterials()
|
||||||
@ -165,9 +172,10 @@ export function useCanvasSetting() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//console.log('🚀 ~ useEffect ~ roofMaterials 22 :', previousRoofMaterialsYn, roofMaterials.length , JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials))
|
//console.log('🚀 ~ useEffect ~ roofMaterials 22 :', previousRoofMaterialsYn, roofMaterials.length , JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials))
|
||||||
// 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
|
// 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
|
||||||
if (!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo
|
if (
|
||||||
|| roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials)) {
|
(!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo) ||
|
||||||
|
(roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials))
|
||||||
|
) {
|
||||||
// 1회만 실행
|
// 1회만 실행
|
||||||
if (roofMaterials && previousRoofMaterialsYn === 'N') {
|
if (roofMaterials && previousRoofMaterialsYn === 'N') {
|
||||||
fetchBasicSettings()
|
fetchBasicSettings()
|
||||||
@ -290,10 +298,12 @@ export function useCanvasSetting() {
|
|||||||
const fetchBasicSettings = async () => {
|
const fetchBasicSettings = async () => {
|
||||||
try {
|
try {
|
||||||
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => {
|
await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => {
|
||||||
|
console.log('🚀 ~ fetchBasicSettings ~ res >>>>>>>>>> :', res)
|
||||||
|
|
||||||
let roofsRow = {}
|
let roofsRow = {}
|
||||||
let roofsArray = {}
|
let roofsArray = {}
|
||||||
|
|
||||||
if (res) {
|
if (res.length > 0) {
|
||||||
roofsRow = res.map((item) => {
|
roofsRow = res.map((item) => {
|
||||||
return {
|
return {
|
||||||
roofSizeSet: String(item.roofSizeSet),
|
roofSizeSet: String(item.roofSizeSet),
|
||||||
@ -444,7 +454,7 @@ export function useCanvasSetting() {
|
|||||||
const res = await get({ url: `/api/canvas-management/canvas-settings/by-object/${correntObjectNo}` })
|
const res = await get({ url: `/api/canvas-management/canvas-settings/by-object/${correntObjectNo}` })
|
||||||
console.log('res', res)
|
console.log('res', res)
|
||||||
|
|
||||||
if (res.length > 0) {
|
if (Object.keys(res).length > 0) {
|
||||||
const optionData1 = settingModalFirstOptions.option1.map((item) => ({ ...item, selected: res[item.column] }))
|
const optionData1 = settingModalFirstOptions.option1.map((item) => ({ ...item, selected: res[item.column] }))
|
||||||
const optionData2 = settingModalFirstOptions.option2.map((item) => ({ ...item, selected: res[item.column] }))
|
const optionData2 = settingModalFirstOptions.option2.map((item) => ({ ...item, selected: res[item.column] }))
|
||||||
const optionData3 = settingModalSecondOptions.option3.map((item) => ({ ...item }))
|
const optionData3 = settingModalSecondOptions.option3.map((item) => ({ ...item }))
|
||||||
@ -533,26 +543,27 @@ export function useCanvasSetting() {
|
|||||||
//그리드 색 설정
|
//그리드 색 설정
|
||||||
setGridColor(res.gridColor)
|
setGridColor(res.gridColor)
|
||||||
} else {
|
} else {
|
||||||
//조회된 글꼴 데이터가 없는 경우
|
//조회된 글꼴 데이터가 없는 경우 (데이터 초기화)
|
||||||
|
|
||||||
//흡착점 ON/OFF
|
//흡착점 ON/OFF
|
||||||
setAdsorptionPointMode({ ...adsorptionPointMode, adsorptionPoint: false })
|
setAdsorptionPointMode({ ...adsorptionPointMode, adsorptionPoint: false })
|
||||||
|
|
||||||
//치수선 설정
|
//치수선 설정
|
||||||
setDimensionLineSettings({ ...dimensionLineSettings })
|
// setDimensionLineSettings({ ...dimensionLineSettings, ...dimensionLineSettingsState.default })
|
||||||
|
resetDimensionLineSettings()
|
||||||
|
|
||||||
//도면크기 설정
|
//도면크기 설정
|
||||||
setPlanSizeSettingMode({ ...planSizeSettingMode })
|
// setPlanSizeSettingMode({ ...planSizeSettingMode, ...planSizeSettingState.default })
|
||||||
|
resetPlanSizeSettingMode()
|
||||||
|
|
||||||
// 데이터 설정
|
// 데이터 설정
|
||||||
setSettingModalFirstOptions({
|
// setSettingModalFirstOptions({ ...settingModalFirstOptions, ...settingModalFirstOptionsState.default })
|
||||||
...settingModalFirstOptions,
|
resetSettingModalFirstOptions()
|
||||||
})
|
//setSettingModalSecondOptions({ ...settingModalSecondOptions, ...settingModalSecondOptionsState.default })
|
||||||
setSettingModalSecondOptions({
|
resetSettingModalSecondOptions()
|
||||||
...settingModalSecondOptions,
|
|
||||||
})
|
|
||||||
|
|
||||||
setGlobalFont({ ...globalFont })
|
// setGlobalFont({ ...globalFont, ...globalFontAtom.default })
|
||||||
|
resetGlobalFont()
|
||||||
|
|
||||||
//점/선 그리드
|
//점/선 그리드
|
||||||
setDotLineGridSettingState({ ...defaultDotLineGridSetting })
|
setDotLineGridSettingState({ ...defaultDotLineGridSetting })
|
||||||
@ -677,7 +688,7 @@ export function useCanvasSetting() {
|
|||||||
// HTTP POST 요청 보내기
|
// HTTP POST 요청 보내기
|
||||||
await post({ url: `/api/canvas-management/canvas-settings`, data: patternData })
|
await post({ url: `/api/canvas-management/canvas-settings`, data: patternData })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
swalFire({ text: getMessage(res.returnMessage) })
|
//swalFire({ text: getMessage(res.returnMessage) })
|
||||||
|
|
||||||
// Canvas 디스플레이 설정 시 해당 옵션 적용
|
// Canvas 디스플레이 설정 시 해당 옵션 적용
|
||||||
frontSettings()
|
frontSettings()
|
||||||
@ -777,6 +788,7 @@ export function useCanvasSetting() {
|
|||||||
adsorptionRange,
|
adsorptionRange,
|
||||||
setAdsorptionRange,
|
setAdsorptionRange,
|
||||||
fetchSettings,
|
fetchSettings,
|
||||||
|
fetchBasicSettings,
|
||||||
frontSettings,
|
frontSettings,
|
||||||
globalFont,
|
globalFont,
|
||||||
setGlobalFont,
|
setGlobalFont,
|
||||||
|
|||||||
@ -649,11 +649,11 @@ export function useSurfaceShapeBatch() {
|
|||||||
|
|
||||||
const deleteAllSurfacesAndObjects = () => {
|
const deleteAllSurfacesAndObjects = () => {
|
||||||
swalFire({
|
swalFire({
|
||||||
text: '배치면 내용을 전부 삭제하시겠습니까?',
|
text: getMessage('batch.canvas.delete.all'),
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
confirmFn: () => {
|
confirmFn: () => {
|
||||||
canvas.clear()
|
canvas.clear()
|
||||||
swalFire({ text: '삭제 완료 되었습니다.' })
|
swalFire({ text: getMessage('plan.message.delete') })
|
||||||
},
|
},
|
||||||
// denyFn: () => {
|
// denyFn: () => {
|
||||||
// swalFire({ text: '취소되었습니다.', icon: 'error' })
|
// swalFire({ text: '취소되었습니다.', icon: 'error' })
|
||||||
|
|||||||
@ -14,6 +14,7 @@ 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'
|
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||||
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||||
|
|
||||||
export function usePlan(params = {}) {
|
export function usePlan(params = {}) {
|
||||||
const { floorPlanState } = useContext(FloorPlanContext)
|
const { floorPlanState } = useContext(FloorPlanContext)
|
||||||
|
|
||||||
@ -159,7 +160,7 @@ export function usePlan(params = {}) {
|
|||||||
/**
|
/**
|
||||||
* 신규 canvas 데이터를 저장
|
* 신규 canvas 데이터를 저장
|
||||||
*/
|
*/
|
||||||
const postCanvasStatus = async (userId, objectNo, canvasStatus) => {
|
const postCanvasStatus = async (userId, objectNo, canvasStatus, isInitPlan = false) => {
|
||||||
const planNo = await postObjectPlan(userId, objectNo)
|
const planNo = await postObjectPlan(userId, objectNo)
|
||||||
if (!planNo) return
|
if (!planNo) return
|
||||||
|
|
||||||
@ -173,7 +174,12 @@ export function usePlan(params = {}) {
|
|||||||
}
|
}
|
||||||
await promisePost({ url: '/api/canvas-management/canvas-statuses', data: planData })
|
await promisePost({ url: '/api/canvas-management/canvas-statuses', data: planData })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setPlans((plans) => [...plans, { id: res.data, objectNo: objectNo, planNo: planNo, userId: userId, canvasStatus: canvasStatus }])
|
if (isInitPlan) {
|
||||||
|
// 초기 플랜 생성인 경우 플랜 목록 초기화
|
||||||
|
setPlans([{ id: res.data, objectNo: objectNo, planNo: planNo, userId: userId, canvasStatus: canvasStatus }])
|
||||||
|
} else {
|
||||||
|
setPlans((plans) => [...plans, { id: res.data, objectNo: objectNo, planNo: planNo, userId: userId, canvasStatus: canvasStatus }])
|
||||||
|
}
|
||||||
updateCurrentPlan(res.data)
|
updateCurrentPlan(res.data)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -313,13 +319,13 @@ export function usePlan(params = {}) {
|
|||||||
text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'),
|
text: `Plan ${currentCanvasPlan.planNo} ` + getMessage('plan.message.confirm.copy'),
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
confirmFn: async () => {
|
confirmFn: async () => {
|
||||||
await postCanvasStatus(userId, objectNo, currentCanvasData())
|
await postCanvasStatus(userId, objectNo, currentCanvasData(), false)
|
||||||
},
|
},
|
||||||
denyFn: async () => {
|
denyFn: async () => {
|
||||||
await postCanvasStatus(userId, objectNo, '')
|
await postCanvasStatus(userId, objectNo, '', false)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: await postCanvasStatus(userId, objectNo, '')
|
: await postCanvasStatus(userId, objectNo, '', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -374,7 +380,7 @@ export function usePlan(params = {}) {
|
|||||||
setPlans(res)
|
setPlans(res)
|
||||||
updateCurrentPlan(res.find((plan) => plan.planNo === planNo).id)
|
updateCurrentPlan(res.find((plan) => plan.planNo === planNo).id)
|
||||||
} else {
|
} else {
|
||||||
postCanvasStatus(userId, objectNo, '')
|
postCanvasStatus(userId, objectNo, '', true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -986,5 +986,6 @@
|
|||||||
"module.place.out": "설치면 밖으로 모듈을 설치 할 수 없습니다.",
|
"module.place.out": "설치면 밖으로 모듈을 설치 할 수 없습니다.",
|
||||||
"module.place.no.surface": "선택된 모듈 설치면이 없습니다.",
|
"module.place.no.surface": "선택된 모듈 설치면이 없습니다.",
|
||||||
"module.place.select.module": "모듈을 선택해주세요.",
|
"module.place.select.module": "모듈을 선택해주세요.",
|
||||||
"module.place.select.one.module": "모듈은 하나만 선택해주세요."
|
"module.place.select.one.module": "모듈은 하나만 선택해주세요.",
|
||||||
|
"batch.canvas.delete.all": "배치면 내용을 전부 삭제하시겠습니까?"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,9 +85,3 @@ export const moduleSelectionDataState = atom({
|
|||||||
},
|
},
|
||||||
dangerouslyAllowMutability: true,
|
dangerouslyAllowMutability: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const moduleSelectionDataPlanListState = atom({
|
|
||||||
key: 'moduleSelectionDataPlanListState',
|
|
||||||
default: {},
|
|
||||||
dangerouslyAllowMutability: true,
|
|
||||||
})
|
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
|
|
||||||
// 파일 다운로드
|
// 파일 다운로드
|
||||||
export const handleFileDown = async (file) => {
|
export const handleFileDown = async (keyNo, zipYn) => {
|
||||||
const { promiseGet } = useAxios()
|
const { promiseGet } = useAxios()
|
||||||
|
|
||||||
const url = `/api/board/file/download`
|
const url = `/api/board/file/download`
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
encodeFileNo: file.encodeFileNo,
|
keyNo: keyNo,
|
||||||
|
zipYn: zipYn,
|
||||||
})
|
})
|
||||||
const options = { responseType: 'blob' }
|
const options = { responseType: 'blob' }
|
||||||
const apiUrl = `${url}?${params.toString()}`
|
const apiUrl = `${url}?${params.toString()}`
|
||||||
@ -18,8 +19,17 @@ export const handleFileDown = async (file) => {
|
|||||||
const fileUrl = window.URL.createObjectURL(blob)
|
const fileUrl = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
|
|
||||||
|
const contentDisposition = resultData.headers.get('content-disposition')
|
||||||
|
let filename = 'filename'
|
||||||
|
if (contentDisposition) {
|
||||||
|
const matches = contentDisposition.match(/filename="?([^"]+)"?/)
|
||||||
|
if (matches && matches[1]) {
|
||||||
|
filename = matches[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
link.download = decodeURIComponent(filename)
|
||||||
link.href = fileUrl
|
link.href = fileUrl
|
||||||
link.download = file.srcFileNm
|
|
||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click()
|
link.click()
|
||||||
link.remove()
|
link.remove()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user