Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
aafc50c6b8
@ -22,7 +22,7 @@ import { usePlan } from '@/hooks/usePlan'
|
|||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||||
export default function Estimate({}) {
|
export default function Estimate({}) {
|
||||||
const [uniqueData, setUniqueData] = useState([])
|
const [uniqueData, setUniqueData] = useState([])
|
||||||
const [handlePricingFlag, setHandlePricingFlag] = useState(false)
|
const [handlePricingFlag, setHandlePricingFlag] = useState(false)
|
||||||
@ -87,7 +87,7 @@ export default function Estimate({}) {
|
|||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
|
|
||||||
const { closeAll } = usePopup()
|
const { closeAll } = usePopup()
|
||||||
|
const { setMenuNumber } = useCanvasMenu()
|
||||||
//새로 추가한 첨부파일 props
|
//새로 추가한 첨부파일 props
|
||||||
const fileUploadProps = {
|
const fileUploadProps = {
|
||||||
uploadFiles: files,
|
uploadFiles: files,
|
||||||
@ -119,8 +119,6 @@ export default function Estimate({}) {
|
|||||||
if (estimateContextState?.itemList.length > 0) {
|
if (estimateContextState?.itemList.length > 0) {
|
||||||
tempList = estimateContextState.itemList.filter((item) => !res.some((resItem) => resItem.itemId === item.itemId))
|
tempList = estimateContextState.itemList.filter((item) => !res.some((resItem) => resItem.itemId === item.itemId))
|
||||||
updatedRes = [...res, ...tempList]
|
updatedRes = [...res, ...tempList]
|
||||||
// console.log('tempList::::::::', tempList)
|
|
||||||
// console.log('updatedRes::::::::', updatedRes)
|
|
||||||
} else {
|
} else {
|
||||||
updatedRes = [...res]
|
updatedRes = [...res]
|
||||||
}
|
}
|
||||||
@ -144,6 +142,7 @@ export default function Estimate({}) {
|
|||||||
}, [selectedPlan])
|
}, [selectedPlan])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
setMenuNumber(5)
|
||||||
initEstimate()
|
initEstimate()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@ -171,8 +171,6 @@ export default function CanvasMenu(props) {
|
|||||||
await reloadCanvasStatus(objectNo, pid)
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
break
|
break
|
||||||
case 3:
|
case 3:
|
||||||
console.log('🚀 ~ onClickNav ~ menu:', menu)
|
|
||||||
console.log('🚀 ~ onClickNav ~ menuNumber:', menuNumber)
|
|
||||||
if (menuNumber > menu.index) {
|
if (menuNumber > menu.index) {
|
||||||
const modules = canvas.getObjects().filter((module) => module.name === POLYGON_TYPE.MODULE)
|
const modules = canvas.getObjects().filter((module) => module.name === POLYGON_TYPE.MODULE)
|
||||||
if (modules.length > 0) {
|
if (modules.length > 0) {
|
||||||
@ -199,6 +197,7 @@ export default function CanvasMenu(props) {
|
|||||||
return
|
return
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
setType('surface')
|
setType('surface')
|
||||||
}
|
}
|
||||||
@ -221,16 +220,14 @@ export default function CanvasMenu(props) {
|
|||||||
await reloadCanvasStatus(objectNo, pid)
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
break
|
break
|
||||||
case 5:
|
case 5:
|
||||||
setIsGlobalLoading(true)
|
|
||||||
//로딩바해제는 견적서 상세조회쪽(useEstimateController.js)에서 setIsGlobalLoading(false)
|
|
||||||
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
|
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
const estimateDetail = res.data
|
const estimateDetail = res.data
|
||||||
// if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) {
|
|
||||||
if (estimateDetail.estimateDate !== null) {
|
if (estimateDetail.estimateDate !== null) {
|
||||||
setMenuNumber(menu.index)
|
setMenuNumber(menu.index)
|
||||||
setCurrentMenu(menu.title)
|
setCurrentMenu(menu.title)
|
||||||
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||||
|
setIsGlobalLoading(false)
|
||||||
router.push(`/floor-plan/estimate/${menu.index}?pid=${selectedPlan.planNo}&objectNo=${objectNo}`)
|
router.push(`/floor-plan/estimate/${menu.index}?pid=${selectedPlan.planNo}&objectNo=${objectNo}`)
|
||||||
} else {
|
} else {
|
||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { useRouter, useSearchParams } from 'next/navigation'
|
|||||||
|
|
||||||
import { useSetRecoilState } from 'recoil'
|
import { useSetRecoilState } from 'recoil'
|
||||||
|
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||||
import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
||||||
@ -24,8 +23,6 @@ export default function StuffSubHeader({ type }) {
|
|||||||
|
|
||||||
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState)
|
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState)
|
||||||
|
|
||||||
const { isGlobalLoading } = useContext(QcastContext)
|
|
||||||
|
|
||||||
const { managementState } = useContext(GlobalDataContext)
|
const { managementState } = useContext(GlobalDataContext)
|
||||||
|
|
||||||
const [buttonStyle, setButtonStyle] = useState('')
|
const [buttonStyle, setButtonStyle] = useState('')
|
||||||
@ -70,7 +67,7 @@ export default function StuffSubHeader({ type }) {
|
|||||||
<div className="sub-header-inner">
|
<div className="sub-header-inner">
|
||||||
{type === 'list' && (
|
{type === 'list' && (
|
||||||
<>
|
<>
|
||||||
<Link href={'#'}>
|
<Link href={'#'} scroll={false}>
|
||||||
<h1 className="sub-header-title">{getMessage('header.menus.management')}</h1>
|
<h1 className="sub-header-title">{getMessage('header.menus.management')}</h1>
|
||||||
</Link>
|
</Link>
|
||||||
<ul className="sub-header-location">
|
<ul className="sub-header-location">
|
||||||
@ -92,7 +89,7 @@ export default function StuffSubHeader({ type }) {
|
|||||||
<>
|
<>
|
||||||
<ul className="sub-header-title-wrap">
|
<ul className="sub-header-title-wrap">
|
||||||
<li className="title-item">
|
<li className="title-item">
|
||||||
<Link className="sub-header-title" href={'#'}>
|
<Link className="sub-header-title" href={'#'} scroll={false}>
|
||||||
{getMessage('stuff.temp.subTitle')}
|
{getMessage('stuff.temp.subTitle')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
@ -116,7 +113,7 @@ export default function StuffSubHeader({ type }) {
|
|||||||
<>
|
<>
|
||||||
<ul className="sub-header-title-wrap">
|
<ul className="sub-header-title-wrap">
|
||||||
<li className="title-item">
|
<li className="title-item">
|
||||||
<Link className="sub-header-title" href={'#'}>
|
<Link className="sub-header-title" href={'#'} scroll={false}>
|
||||||
{getMessage('stuff.temp.subTitle')}
|
{getMessage('stuff.temp.subTitle')}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
||||||
import { useContext, useEffect, useState } from 'react'
|
import { useContext, useEffect, useState } from 'react'
|
||||||
import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||||
import { useMasterController } from '@/hooks/common/useMasterController'
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
@ -7,6 +7,7 @@ import { selectedModuleState, moduleSelectionInitParamsState, moduleSelectionDat
|
|||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
import { canvasState } from '@/store/canvasAtom'
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
import { POLYGON_TYPE } from '@/common/common'
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
|
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
||||||
|
|
||||||
export function useModuleSelection(props) {
|
export function useModuleSelection(props) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -25,6 +26,7 @@ export function useModuleSelection(props) {
|
|||||||
const [moduleSelectionInitParams, setModuleSelectionInitParams] = useRecoilState(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등
|
const [moduleSelectionInitParams, setModuleSelectionInitParams] = useRecoilState(moduleSelectionInitParamsState) //모듈 기본 데이터 ex) 면조도, 높이등등
|
||||||
const { getModuleTypeItemList } = useMasterController()
|
const { getModuleTypeItemList } = useMasterController()
|
||||||
const { findCommonCode } = useCommonCode()
|
const { findCommonCode } = useCommonCode()
|
||||||
|
const resetStatisticsData = useResetRecoilState(moduleStatisticsState)
|
||||||
|
|
||||||
const bindInitData = () => {
|
const bindInitData = () => {
|
||||||
setInstallHeight(managementState?.installHeight)
|
setInstallHeight(managementState?.installHeight)
|
||||||
@ -98,6 +100,7 @@ export function useModuleSelection(props) {
|
|||||||
canvas.remove(moduleSurface)
|
canvas.remove(moduleSurface)
|
||||||
})
|
})
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
resetStatisticsData()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@ -140,8 +140,7 @@ export function useCanvasSetting() {
|
|||||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) // 선택된 지붕재 정보
|
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) // 선택된 지붕재 정보
|
||||||
const { floorPlanState } = useContext(FloorPlanContext) // 플랜 상태
|
const { floorPlanState } = useContext(FloorPlanContext) // 플랜 상태
|
||||||
const { closeAll } = usePopup() // 팝업 닫기
|
const { closeAll } = usePopup() // 팝업 닫기
|
||||||
// const previousObjectNoRef = useRef(null) // 최초 데이터 설정 확인
|
const [isRoofMaterialsLoaded, setIsRoofMaterialsLoaded] = useState(false) // roofMaterials 로드 상태 확인
|
||||||
// const previousRoofMaterialsRef = useRef(null) // 최초 데이터 설정 확인
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const tempFetchRoofMaterials = !fetchRoofMaterials
|
const tempFetchRoofMaterials = !fetchRoofMaterials
|
||||||
@ -153,6 +152,15 @@ export function useCanvasSetting() {
|
|||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* roofMaterials가 변경될 때마다 로드 상태 업데이트
|
||||||
|
*/
|
||||||
|
useEffect(() => {
|
||||||
|
if (roofMaterials.length > 0) {
|
||||||
|
setIsRoofMaterialsLoaded(true)
|
||||||
|
}
|
||||||
|
}, [roofMaterials])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 지붕재 초기세팅
|
* 지붕재 초기세팅
|
||||||
*/
|
*/
|
||||||
@ -188,26 +196,6 @@ export function useCanvasSetting() {
|
|||||||
setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial })
|
setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial })
|
||||||
}
|
}
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// // 지붕재 select 정보가 존재해야 배치면초기설정 DB 정보 비교 후 지붕재 정보를 가져올 수 있음
|
|
||||||
// if (
|
|
||||||
// (!previousObjectNoRef.current && !correntObjectNo && previousObjectNoRef.current !== correntObjectNo) ||
|
|
||||||
// (roofMaterials.length !== 0 && JSON.stringify(previousRoofMaterialsRef.current) !== JSON.stringify(roofMaterials))
|
|
||||||
// ) {
|
|
||||||
// // 1회만 실행
|
|
||||||
// if (roofMaterials && previousRoofMaterialsYn === 'N') {
|
|
||||||
// if (correntObjectNo) {
|
|
||||||
// //fetchBasicSettings()
|
|
||||||
// previousRoofMaterialsYn = 'Y'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 이전 값을 업데이트
|
|
||||||
// previousObjectNoRef.current = correntObjectNo
|
|
||||||
// previousRoofMaterialsRef.current = roofMaterials
|
|
||||||
// }
|
|
||||||
// }, [roofMaterials, correntObjectNo])
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 배치면 초기설정 화면이 열리지 않아도 데이터 set 하기 위해서 추가
|
* 배치면 초기설정 화면이 열리지 않아도 데이터 set 하기 위해서 추가
|
||||||
*/
|
*/
|
||||||
@ -330,13 +318,24 @@ export function useCanvasSetting() {
|
|||||||
* 기본설정(PlacementShapeSetting) 조회 및 초기화
|
* 기본설정(PlacementShapeSetting) 조회 및 초기화
|
||||||
*/
|
*/
|
||||||
const fetchBasicSettings = async (planNo, openPoint) => {
|
const fetchBasicSettings = async (planNo, openPoint) => {
|
||||||
/* roofMaterials가 로드될 때까지 대기 */
|
try {
|
||||||
if (!roofMaterials || roofMaterials.length === 0) {
|
/* roofMaterials가 로드될 때까지 대기 후 실행 */
|
||||||
console.log('Waiting for roofMaterials to load...')
|
if (!isRoofMaterialsLoaded) {
|
||||||
return
|
/* roofMaterials가 아직 로드되지 않았다면 */
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
/* 새로운 Promise 생성 */
|
||||||
|
const checkInterval = setInterval(() => {
|
||||||
|
/* 100ms마다 체크하는 인터벌 설정 */
|
||||||
|
console.log('roofMaterials loading... ', roofMaterials.length)
|
||||||
|
if (roofMaterials.length > 0) {
|
||||||
|
/* roofMaterials가 로드되었다면 */
|
||||||
|
clearInterval(checkInterval) // 인터벌 중지
|
||||||
|
resolve() // Promise 완료
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
await get({
|
await get({
|
||||||
url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}/${planNo}`,
|
url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}/${planNo}`,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@ -433,6 +432,7 @@ export function useCanvasSetting() {
|
|||||||
|
|
||||||
if (addRoofs.length > 0) {
|
if (addRoofs.length > 0) {
|
||||||
setAddedRoofs(addRoofs)
|
setAddedRoofs(addRoofs)
|
||||||
|
|
||||||
setBasicSettings({
|
setBasicSettings({
|
||||||
...basicSetting,
|
...basicSetting,
|
||||||
roofMaterials: addRoofs[0],
|
roofMaterials: addRoofs[0],
|
||||||
@ -442,13 +442,23 @@ export function useCanvasSetting() {
|
|||||||
roofsData: roofsArray,
|
roofsData: roofsArray,
|
||||||
selectedRoofMaterial: addRoofs.find((roof) => roof.selected),
|
selectedRoofMaterial: addRoofs.find((roof) => roof.selected),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
setCanvasSetting({
|
||||||
|
...basicSetting,
|
||||||
|
roofMaterials: addRoofs[0],
|
||||||
|
planNo: roofsRow[0].planNo,
|
||||||
|
roofSizeSet: roofsRow[0].roofSizeSet,
|
||||||
|
roofAngleSet: roofsRow[0].roofAngleSet,
|
||||||
|
roofsData: roofsArray,
|
||||||
|
selectedRoofMaterial: addRoofs.find((roof) => roof.selected),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Data fetching error:', error)
|
console.error('Data fetching error:', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
setCanvasSetting({ ...basicSetting })
|
// setCanvasSetting({ ...basicSetting })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -482,12 +492,15 @@ export function useCanvasSetting() {
|
|||||||
|
|
||||||
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData }).then((res) => {
|
await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData }).then((res) => {
|
||||||
swalFire({ text: getMessage(res.returnMessage) })
|
swalFire({ text: getMessage(res.returnMessage) })
|
||||||
/* 배치면초기설정 조회 */
|
/* BasicSettings Recoil 설정 */
|
||||||
setBasicSettings({ ...params })
|
setBasicSettings({ ...params })
|
||||||
})
|
})
|
||||||
|
|
||||||
/* CanvasSetting Recoil 설정 */
|
/* CanvasSetting Recoil 설정 - roofSizeSet을 문자열로 변환 */
|
||||||
setCanvasSetting({ ...basicSetting })
|
setCanvasSetting({
|
||||||
|
...basicSetting,
|
||||||
|
roofSizeSet: String(params.roofSizeSet),
|
||||||
|
})
|
||||||
|
|
||||||
/* 배치면초기설정 조회 */
|
/* 배치면초기설정 조회 */
|
||||||
fetchBasicSettings(params.planNo, null)
|
fetchBasicSettings(params.planNo, null)
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
var exec = require('child_process').exec
|
var exec = require('child_process').exec
|
||||||
exec('yarn start', { windowsHide: true })
|
exec('yarn serve', { windowsHide: true })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user