Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev

This commit is contained in:
yoosangwook 2025-02-07 17:53:30 +09:00
commit 26b6da22da
3 changed files with 30 additions and 15 deletions

View File

@ -23,6 +23,7 @@ import { useSearchParams } from 'next/navigation'
import { usePlan } from '@/hooks/usePlan' 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'
export default function Estimate({}) { export default function Estimate({}) {
const [uniqueData, setUniqueData] = useState([]) const [uniqueData, setUniqueData] = useState([])
@ -81,6 +82,7 @@ export default function Estimate({}) {
const [specialNoteList, setSpecialNoteList] = useState([]) const [specialNoteList, setSpecialNoteList] = useState([])
const [popShowSpecialNoteList, setPopShowSpecialNoteList] = useState([]) const [popShowSpecialNoteList, setPopShowSpecialNoteList] = useState([])
const { setIsGlobalLoading } = useContext(QcastContext)
const globalLocaleState = useRecoilValue(globalLocaleStore) const globalLocaleState = useRecoilValue(globalLocaleStore)
const { get, post, promisePost } = useAxios(globalLocaleState) const { get, post, promisePost } = useAxios(globalLocaleState)
@ -490,6 +492,7 @@ export default function Estimate({}) {
} }
} }
setIsGlobalLoading(true)
await promisePost({ url: '/api/estimate/price/item-price-list', data: param }).then((res) => { await promisePost({ url: '/api/estimate/price/item-price-list', data: param }).then((res) => {
let updateList = [] let updateList = []
if (res) { if (res) {
@ -537,6 +540,7 @@ export default function Estimate({}) {
} }
} }
} }
setIsGlobalLoading(false)
}) })
} }

View File

@ -37,6 +37,7 @@ import { menuTypeState } from '@/store/menuAtom'
import { usePopup } from '../usePopup' import { usePopup } from '../usePopup'
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider' import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions' import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
import { useCommonCode } from '@/hooks/common/useCommonCode'
const defaultDotLineGridSetting = { const defaultDotLineGridSetting = {
INTERVAL: { INTERVAL: {
@ -119,6 +120,10 @@ export function useCanvasSetting() {
const resetModuleSelectionData = useResetRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터 const resetModuleSelectionData = useResetRecoilState(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
const resetSelectedModules = useResetRecoilState(selectedModuleState) //선택된 모듈 const resetSelectedModules = useResetRecoilState(selectedModuleState) //선택된 모듈
const [raftCodes, setRaftCodes] = useState([]) // 서까래 정보
const { findCommonCode } = useCommonCode()
const [currentRoof, setCurrentRoof] = useState(null) // 현재 선택된 지붕재 정보
const SelectOptions = [ const SelectOptions = [
{ id: 1, name: getMessage('modal.canvas.setting.grid.dot.line.setting.line.origin'), value: 1 }, { id: 1, name: getMessage('modal.canvas.setting.grid.dot.line.setting.line.origin'), value: 1 },
{ id: 2, name: '1/2', value: 1 / 2 }, { id: 2, name: '1/2', value: 1 / 2 },
@ -133,10 +138,11 @@ export function useCanvasSetting() {
const { closeAll } = usePopup() const { closeAll } = usePopup()
useEffect(() => { useEffect(() => {
console.log('correntObjectNo', correntObjectNo) const tempFetchRoofMaterials = !fetchRoofMaterials
setFetchRoofMaterials(!fetchRoofMaterials) //최초 1회만 실행하도록 처리
if (fetchRoofMaterials) { setFetchRoofMaterials(tempFetchRoofMaterials)
if (tempFetchRoofMaterials) {
addRoofMaterials() addRoofMaterials()
} }
}, []) }, [])
@ -197,6 +203,16 @@ export function useCanvasSetting() {
} }
}, [roofMaterials, correntObjectNo]) }, [roofMaterials, correntObjectNo])
//배치면 초기설정 화면이 열리지 않아도 데이터 set 하기 위해서 추가
useEffect(() => {
if (addedRoofs.length > 0) {
const raftCodeList = findCommonCode('203800')
setRaftCodes(raftCodeList)
setCurrentRoof({ ...addedRoofs[0] })
}
}, [addedRoofs])
useEffect(() => { useEffect(() => {
if (!canvas) { if (!canvas) {
return return

View File

@ -156,7 +156,7 @@ export function usePlan(params = {}) {
* case 2) 플랜 생성 : isInitPlan = false, isCopy = false * case 2) 플랜 생성 : isInitPlan = false, isCopy = false
* case 3) 복제 플랜 생성 : isInitPlan = false, isCopy = true * case 3) 복제 플랜 생성 : isInitPlan = false, isCopy = true
*/ */
const postObjectPlanTemp = async (userId, objectNo, isCopy = false, isInitPlan = false) => { const postObjectPlan = async (userId, objectNo, isCopy = false, isInitPlan = false) => {
const planData = isCopy const planData = isCopy
? { ? {
userId: userId, userId: userId,
@ -319,13 +319,8 @@ export function usePlan(params = {}) {
} }
const handleCurrentPlanUrl = () => { const handleCurrentPlanUrl = () => {
const currentPlan = plans.find((plan) => plan.isCurrent) if (currentCanvasPlan?.planNo && currentCanvasPlan?.objectNo)
// if (currentPlan) router.push(`${pathname}?pid=${currentPlan?.planNo}&objectNo=${floorPlanState?.objectNo}`) router.push(`${pathname}?pid=${currentCanvasPlan?.planNo}&objectNo=${currentCanvasPlan?.objectNo}`)
if (currentPlan !== currentCanvasPlan) {
// todo: [유상욱] 현재 플랜과 현재 캔버스 플랜이 다른 경우 플랜 이동
// 우선 주석처리
// router.push(`${pathname}?pid=${currentPlan?.planNo}&objectNo=${currentPlan.objectNo}`)
}
} }
const setBgImage = () => { const setBgImage = () => {
@ -345,13 +340,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 postObjectPlanTemp(userId, objectNo, true, false) await postObjectPlan(userId, objectNo, true, false)
}, },
denyFn: async () => { denyFn: async () => {
await postObjectPlanTemp(userId, objectNo, false, false) await postObjectPlan(userId, objectNo, false, false)
}, },
}) })
: await postObjectPlanTemp(userId, objectNo, false, false) : await postObjectPlan(userId, objectNo, false, false)
} }
/** /**
@ -407,7 +402,7 @@ export function usePlan(params = {}) {
setCurrentCanvasPlan(res.find((plan) => plan.planNo === planNo)) setCurrentCanvasPlan(res.find((plan) => plan.planNo === planNo))
setPlans(res) setPlans(res)
} else { } else {
await postObjectPlanTemp(userId, objectNo, false, true) await postObjectPlan(userId, objectNo, false, true)
} }
}) })
} }