Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
cbc97960da
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { correntObjectNoState } from '@/store/settingAtom'
|
import { correntObjectNoState } from '@/store/settingAtom'
|
||||||
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
import { notFound, usePathname, useSearchParams } from 'next/navigation'
|
||||||
import { createContext, useReducer, useState } from 'react'
|
import { createContext, useReducer, useState, useEffect } from 'react'
|
||||||
import { useSetRecoilState } from 'recoil'
|
import { useSetRecoilState } from 'recoil'
|
||||||
|
|
||||||
const reducer = (prevState, nextState) => {
|
const reducer = (prevState, nextState) => {
|
||||||
@ -48,12 +48,14 @@ const FloorPlanProvider = ({ children }) => {
|
|||||||
const objectNo = searchParams.get('objectNo')
|
const objectNo = searchParams.get('objectNo')
|
||||||
const pid = searchParams.get('pid')
|
const pid = searchParams.get('pid')
|
||||||
|
|
||||||
if (pathname === '/floor-plan') {
|
useEffect(() => { // 오류 발생으로 useEffect 사용
|
||||||
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
if (pathname === '/floor-plan') {
|
||||||
notFound()
|
if (pid === undefined || pid === '' || pid === null || objectNo === undefined || objectNo === '' || objectNo === null) {
|
||||||
|
notFound()
|
||||||
|
}
|
||||||
|
setCurrentObjectNo(objectNo)
|
||||||
}
|
}
|
||||||
setCurrentObjectNo(objectNo)
|
}, [pid, objectNo])
|
||||||
}
|
|
||||||
|
|
||||||
const [floorPlanState, setFloorPlanState] = useState({
|
const [floorPlanState, setFloorPlanState] = useState({
|
||||||
// 플랜 파일 업로드 모달 오픈 제어
|
// 플랜 파일 업로드 모달 오픈 제어
|
||||||
|
|||||||
@ -254,10 +254,19 @@ export default function Playground() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const [getFetcherCallFlag, setGetFetcherCallFlag] = 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 { trigger, isMutating } = useSWRMutation('http://localhost:8080/api/tutorial', postFetcher)
|
const { trigger, isMutating } = useSWRMutation('http://localhost:8080/api/tutorial', postFetcher)
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <div>Loading...</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <div>Error...</div>
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container mx-auto p-4 m-4 border">
|
<div className="container mx-auto p-4 m-4 border">
|
||||||
@ -571,7 +580,12 @@ export default function Playground() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="my-2">
|
<div className="my-2">
|
||||||
<Button onClick={() => trigger({ id: 3, name: 'seulda kim', email: 'seulda.kim@interplug.co.kr' })}>insert data</Button>
|
<Button onClick={() => setCallFlag(true)}>getFetcher call</Button>
|
||||||
|
</div>
|
||||||
|
<div className="my-2">
|
||||||
|
<Button disabled={isMutating} onClick={() => trigger({ id: 3, name: 'seulda kim', email: 'seulda.kim@interplug.co.kr' })}>
|
||||||
|
insert data
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -74,7 +74,6 @@ export default function Estimate({}) {
|
|||||||
const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(currentPid)
|
const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(currentPid)
|
||||||
|
|
||||||
const { selectedPlan } = usePlan()
|
const { selectedPlan } = usePlan()
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
//견적특이사항 List
|
//견적특이사항 List
|
||||||
const [specialNoteList, setSpecialNoteList] = useState([])
|
const [specialNoteList, setSpecialNoteList] = useState([])
|
||||||
@ -299,12 +298,16 @@ export default function Estimate({}) {
|
|||||||
} else {
|
} else {
|
||||||
if (originFiles.length > 0) {
|
if (originFiles.length > 0) {
|
||||||
if (isEmptyArray(files)) {
|
if (isEmptyArray(files)) {
|
||||||
let file
|
if (originFiles[0].planNo !== estimateContextState.planNo) {
|
||||||
file = originFiles.filter((item) => item.delFlg === '0')
|
setOriginFiles([])
|
||||||
setEstimateContextState({
|
} else {
|
||||||
originFiles: file,
|
let file
|
||||||
})
|
file = originFiles.filter((item) => item.delFlg === '0')
|
||||||
setOriginFiles(file)
|
setEstimateContextState({
|
||||||
|
originFiles: file,
|
||||||
|
})
|
||||||
|
setOriginFiles(file)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1002,6 +1005,7 @@ export default function Estimate({}) {
|
|||||||
<div className="estimate-box">
|
<div className="estimate-box">
|
||||||
<div className="estimate-tit">{getMessage('estimate.detail.objectNo')}</div>
|
<div className="estimate-tit">{getMessage('estimate.detail.objectNo')}</div>
|
||||||
<div className="estimate-name">
|
<div className="estimate-name">
|
||||||
|
{/* {objectNo} (Plan No: {estimateContextState.planNo}) */}
|
||||||
{objectNo} (Plan No: {planNo})
|
{objectNo} (Plan No: {planNo})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useContext, useEffect, useState } from 'react'
|
import { useContext, useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { usePathname, useRouter } from 'next/navigation'
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
|
||||||
|
|
||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ export default function CanvasMenu(props) {
|
|||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { handleZoomClear, handleZoom } = useCanvasEvent()
|
const { handleZoomClear, handleZoom } = useCanvasEvent()
|
||||||
const { handleMenu } = useMenu()
|
const { handleMenu } = useMenu()
|
||||||
|
// const urlParams = useSearchParams()
|
||||||
const { handleEstimateSubmit, fetchSetting } = useEstimateController()
|
const { handleEstimateSubmit, fetchSetting } = useEstimateController()
|
||||||
const estimateRecoilState = useRecoilValue(estimateState)
|
const estimateRecoilState = useRecoilValue(estimateState)
|
||||||
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
||||||
@ -85,7 +85,6 @@ export default function CanvasMenu(props) {
|
|||||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
||||||
|
|
||||||
//견적서버튼 노출용
|
//견적서버튼 노출용
|
||||||
const [buttonStyle, setButtonStyle] = useState('') //시연용 원복
|
|
||||||
const [buttonStyle1, setButtonStyle1] = useState('') //문서 다운로드 버튼
|
const [buttonStyle1, setButtonStyle1] = useState('') //문서 다운로드 버튼
|
||||||
const [buttonStyle2, setButtonStyle2] = useState('') //저장 버튼
|
const [buttonStyle2, setButtonStyle2] = useState('') //저장 버튼
|
||||||
const [buttonStyle3, setButtonStyle3] = useState('') //초기화 버튼
|
const [buttonStyle3, setButtonStyle3] = useState('') //초기화 버튼
|
||||||
@ -173,6 +172,7 @@ export default function CanvasMenu(props) {
|
|||||||
setType('module')
|
setType('module')
|
||||||
break
|
break
|
||||||
case 5:
|
case 5:
|
||||||
|
// let pid = urlParams.get('pid')
|
||||||
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) {
|
||||||
const estimateDetail = res.data
|
const estimateDetail = res.data
|
||||||
@ -309,10 +309,9 @@ export default function CanvasMenu(props) {
|
|||||||
}, [type, globalLocale])
|
}, [type, globalLocale])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('🚀 ~ useEffect ~ basicSetting:', basicSetting)
|
if (!selectedRoofMaterial) return
|
||||||
if (Object.keys(basicSetting).length === 0 || !basicSetting.roofSizeSet) return
|
//if (Object.keys(basicSetting).length === 0 || !basicSetting.roofSizeSet) return
|
||||||
|
setMenuNumber(1)
|
||||||
// setMenuNumber(1)
|
|
||||||
// if ([2, 3].some((num) => num === canvasSetting?.roofSizeSet)) {
|
// if ([2, 3].some((num) => num === canvasSetting?.roofSizeSet)) {
|
||||||
// setMenuNumber(3)
|
// setMenuNumber(3)
|
||||||
// setType('surface')
|
// setType('surface')
|
||||||
@ -322,7 +321,8 @@ export default function CanvasMenu(props) {
|
|||||||
// setType('outline')
|
// setType('outline')
|
||||||
// setCurrentMenu(MENU.ROOF_COVERING.EXTERIOR_WALL_LINE)
|
// setCurrentMenu(MENU.ROOF_COVERING.EXTERIOR_WALL_LINE)
|
||||||
// }
|
// }
|
||||||
}, [basicSetting])
|
}, [selectedRoofMaterial])
|
||||||
|
|
||||||
const checkMenuState = (menu) => {
|
const checkMenuState = (menu) => {
|
||||||
return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && menu.index === 2)
|
return (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) || (menuNumber === 4 && menu.index === 2)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,15 +43,15 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
|
|
||||||
//치수 입력방법(복시도입력/실측값입력/육지붕)
|
//치수 입력방법(복시도입력/실측값입력/육지붕)
|
||||||
const roofSizeSetArray = [
|
const roofSizeSetArray = [
|
||||||
{ id: 'ra01', name: 'roofSizeSet', value: '1', checked: 'ture', message: 'modal.placement.initial.setting.size.roof' },
|
{ id: 'ra01', name: 'roofSizeSet', value: '1', message: 'modal.placement.initial.setting.size.roof' },
|
||||||
{ id: 'ra02', name: 'roofSizeSet', value: '2', checked: 'false', message: 'modal.placement.initial.setting.size.actual' },
|
{ id: 'ra02', name: 'roofSizeSet', value: '2', message: 'modal.placement.initial.setting.size.actual' },
|
||||||
{ id: 'ra03', name: 'roofSizeSet', value: '3', checked: 'false', message: 'modal.placement.initial.setting.size.none.pitch' },
|
{ id: 'ra03', name: 'roofSizeSet', value: '3', message: 'modal.placement.initial.setting.size.none.pitch' },
|
||||||
]
|
]
|
||||||
|
|
||||||
//지붕각도 설정(경사/각도)
|
//지붕각도 설정(경사/각도)
|
||||||
const roofAngleSetArray = [
|
const roofAngleSetArray = [
|
||||||
{ id: 'ra04', name: 'roofAngleSet', value: 'slope', checked: 'true', message: 'modal.placement.initial.setting.roof.pitch'},
|
{ id: 'ra04', name: 'roofAngleSet', value: 'slope', message: 'modal.placement.initial.setting.roof.pitch'},
|
||||||
{ id: 'ra05', name: 'roofAngleSet', value: 'flat', checked: 'false', message: 'modal.placement.initial.setting.roof.angle' },
|
{ id: 'ra05', name: 'roofAngleSet', value: 'flat', message: 'modal.placement.initial.setting.roof.angle' },
|
||||||
]
|
]
|
||||||
|
|
||||||
// 데이터를 최초 한 번만 조회
|
// 데이터를 최초 한 번만 조회
|
||||||
@ -59,12 +59,17 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return
|
if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return
|
||||||
const raftCodeList = findCommonCode('203800')
|
const raftCodeList = findCommonCode('203800')
|
||||||
setRaftCodes(raftCodeList)
|
setRaftCodes(raftCodeList)
|
||||||
setCurrentRoof({ ...currentRoof, roofSizeSet: basicSetting.roofSizeSet, roofAngleSet: basicSetting.roofAngleSet })
|
|
||||||
console.log('🚀 ~ fetchBasicSettings ~ currentRoof 11:', currentRoof)
|
if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) {
|
||||||
|
setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet })
|
||||||
|
} else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) {
|
||||||
|
setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet })
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('🚀 ~ fetchBasicSettings ~ currentRoof 22:', currentRoof)
|
console.log('🚀 ~ fetchBasicSettings ~ currentRoof :', currentRoof)
|
||||||
|
if(!currentRoof) return
|
||||||
setBasicSettings({
|
setBasicSettings({
|
||||||
...basicSetting,
|
...basicSetting,
|
||||||
roofSizeSet: String(currentRoof.roofSizeSet),
|
roofSizeSet: String(currentRoof.roofSizeSet),
|
||||||
@ -194,14 +199,12 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
<div className="pop-form-radio">
|
<div className="pop-form-radio">
|
||||||
{currentRoof &&
|
{currentRoof &&
|
||||||
roofSizeSetArray.map((item) => (
|
roofSizeSetArray.map((item) => (
|
||||||
<div className="d-check-radio pop">
|
<div className="d-check-radio pop" key={item.id}>
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
key={item.id}
|
|
||||||
id={item.id}
|
id={item.id}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
value={item.value}
|
value={item.value}
|
||||||
checked={currentRoof?.roofSizeSet === item.value}
|
checked={currentRoof?.roofSizeSet === item.value}
|
||||||
defaultChecked={'1'}
|
|
||||||
onChange={(e) => setCurrentRoof({ ...currentRoof, roofSizeSet: e.target.value })}
|
onChange={(e) => setCurrentRoof({ ...currentRoof, roofSizeSet: e.target.value })}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={item.id}>{getMessage(item.message)}</label>
|
<label htmlFor={item.id}>{getMessage(item.message)}</label>
|
||||||
@ -217,14 +220,12 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
<div className="pop-form-radio">
|
<div className="pop-form-radio">
|
||||||
{currentRoof &&
|
{currentRoof &&
|
||||||
roofAngleSetArray.map((item) => (
|
roofAngleSetArray.map((item) => (
|
||||||
<div className="d-check-radio pop">
|
<div className="d-check-radio pop" key={item.id}>
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
key={item.id}
|
|
||||||
id={item.id}
|
id={item.id}
|
||||||
name={item.name}
|
name={item.name}
|
||||||
value={item.value}
|
value={item.value}
|
||||||
checked={currentRoof?.roofAngleSet === item.value}
|
checked={currentRoof?.roofAngleSet === item.value}
|
||||||
defaultChecked={'slope'}
|
|
||||||
onChange={(e) => setCurrentRoof({ ...currentRoof, roofAngleSet: e.target.value })}
|
onChange={(e) => setCurrentRoof({ ...currentRoof, roofAngleSet: e.target.value })}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={item.id}>{getMessage(item.message)}</label>
|
<label htmlFor={item.id}>{getMessage(item.message)}</label>
|
||||||
|
|||||||
@ -19,6 +19,8 @@ import { globalLocaleStore } from '@/store/localeAtom'
|
|||||||
import { stuffSearchState } from '@/store/stuffAtom'
|
import { stuffSearchState } from '@/store/stuffAtom'
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
|
||||||
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
|
||||||
export const ToggleonMouse = (e, act, target) => {
|
export const ToggleonMouse = (e, act, target) => {
|
||||||
const listWrap = e.target.closest(target)
|
const listWrap = e.target.closest(target)
|
||||||
const ListItem = Array.from(listWrap.childNodes)
|
const ListItem = Array.from(listWrap.childNodes)
|
||||||
@ -39,6 +41,8 @@ export default function Header(props) {
|
|||||||
|
|
||||||
const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState)
|
const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState)
|
||||||
|
|
||||||
|
const { closeAll } = usePopup()
|
||||||
|
|
||||||
const { userSession } = props
|
const { userSession } = props
|
||||||
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
const [sessionState, setSessionState] = useRecoilState(sessionStore)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -176,6 +180,9 @@ export default function Header(props) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
// moveHome()
|
// moveHome()
|
||||||
removeStuffRecoil(menu)
|
removeStuffRecoil(menu)
|
||||||
|
if (pathName === '/') {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getMessage(menu.name)}
|
{getMessage(menu.name)}
|
||||||
@ -226,6 +233,9 @@ export default function Header(props) {
|
|||||||
...stuffSearch,
|
...stuffSearch,
|
||||||
code: 'DELETE',
|
code: 'DELETE',
|
||||||
})
|
})
|
||||||
|
if (pathName === '/') {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
></Link>
|
></Link>
|
||||||
</h1>
|
</h1>
|
||||||
@ -239,6 +249,7 @@ export default function Header(props) {
|
|||||||
href="#"
|
href="#"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setUserInfoModal(true)
|
setUserInfoModal(true)
|
||||||
|
closeAll()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<button className="profile">{userSession.userNm}</button>
|
<button className="profile">{userSession.userNm}</button>
|
||||||
|
|||||||
@ -88,6 +88,8 @@ export const useEstimateController = (planNo) => {
|
|||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('견적서 상세조회 Error: ', error)
|
console.error('견적서 상세조회 Error: ', error)
|
||||||
|
|
||||||
|
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,7 +156,13 @@ export function useRoofAllocationSetting(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCurrentRoofList(selectRoofs)
|
setCurrentRoofList(selectRoofs)
|
||||||
setBasicSetting({ ...basicSetting, roofsData: roofsArray })
|
//setBasicSetting({ ...basicSetting, roofsData: roofsArray })
|
||||||
|
setBasicSetting({
|
||||||
|
...basicSetting,
|
||||||
|
roofSizeSet: res[0].roofSizeSet,
|
||||||
|
roofAngleSet: res[0].roofAngleSet,
|
||||||
|
roofsData: roofsArray,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Data fetching error:', error)
|
console.error('Data fetching error:', error)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ 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'
|
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||||
|
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||||
export function usePlan(params = {}) {
|
export function usePlan(params = {}) {
|
||||||
const { floorPlanState } = useContext(FloorPlanContext)
|
const { floorPlanState } = useContext(FloorPlanContext)
|
||||||
|
|
||||||
@ -31,8 +31,9 @@ export function usePlan(params = {}) {
|
|||||||
|
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { get, promisePost, promisePut, promiseDel } = useAxios()
|
const { get, promisePost, promisePut, promiseDel, promiseGet } = useAxios()
|
||||||
|
|
||||||
|
const { setEstimateContextState } = useEstimateController()
|
||||||
/**
|
/**
|
||||||
* 마우스 포인터의 가이드라인을 제거합니다.
|
* 마우스 포인터의 가이드라인을 제거합니다.
|
||||||
*/
|
*/
|
||||||
@ -203,12 +204,44 @@ export function usePlan(params = {}) {
|
|||||||
* 현재 plan의 작업상태를 저장 후 이동
|
* 현재 plan의 작업상태를 저장 후 이동
|
||||||
*/
|
*/
|
||||||
const handleCurrentPlan = async (newCurrentId) => {
|
const handleCurrentPlan = async (newCurrentId) => {
|
||||||
if (pathname === '/floor-plan') {
|
const orderingNo = plans?.find((obj) => obj.id === newCurrentId).ordering
|
||||||
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
|
const objectNo = floorPlanState.objectNo
|
||||||
await saveCanvas()
|
await promiseGet({ url: `/api/estimate/${objectNo}/${orderingNo}/detail` })
|
||||||
}
|
.then((res) => {
|
||||||
}
|
if (res.status === 200) {
|
||||||
updateCurrentPlan(newCurrentId)
|
const estimateDetail = res.data
|
||||||
|
if (estimateDetail.docNo) {
|
||||||
|
res.data.resetFlag = 'N'
|
||||||
|
|
||||||
|
if (res.data.itemList.length > 0) {
|
||||||
|
res.data.itemList.map((item) => {
|
||||||
|
item.delFlg = '0'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (res.data.pkgAsp === null || res.data.pkgAsp == undefined) {
|
||||||
|
res.data.pkgAsp = '0.00'
|
||||||
|
} else {
|
||||||
|
const number = parseFloat(res.data.pkgAsp)
|
||||||
|
const roundedNumber = isNaN(number) ? '0.00' : number.toFixed(2)
|
||||||
|
|
||||||
|
res.data.pkgAsp = roundedNumber.toString()
|
||||||
|
}
|
||||||
|
setEstimateContextState(res.data)
|
||||||
|
|
||||||
|
if (pathname === '/floor-plan') {
|
||||||
|
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
|
||||||
|
saveCanvas()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateCurrentPlan(newCurrentId)
|
||||||
|
} else {
|
||||||
|
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCurrentPlan = (newCurrentId) => {
|
const updateCurrentPlan = (newCurrentId) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user