Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
64c4a6ddca
3
src/app/floor-plan/[mid]/[pid]/page.jsx
Normal file
3
src/app/floor-plan/[mid]/[pid]/page.jsx
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export default function EstimatePage() {
|
||||||
|
return <div>이자리....</div>
|
||||||
|
}
|
||||||
@ -1,11 +1,17 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||||
import { FloorPlanProvider } from './FloorPlanProvider'
|
import { FloorPlanProvider } from './FloorPlanProvider'
|
||||||
|
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||||
|
|
||||||
export default function FloorPlanLayout({ children }) {
|
export default function FloorPlanLayout({ children }) {
|
||||||
console.log('FloorPlanLayout')
|
console.log('FloorPlanLayout')
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FloorPlanProvider>{children}</FloorPlanProvider>
|
<FloorPlanProvider>
|
||||||
|
<FloorPlan>
|
||||||
|
<CanvasLayout>{children}</CanvasLayout>
|
||||||
|
</FloorPlan>
|
||||||
|
</FloorPlanProvider>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
|
import CanvasFrame from '@/components/floor-plan/CanvasFrame'
|
||||||
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
import FloorPlan from '@/components/floor-plan/FloorPlan'
|
||||||
|
|
||||||
export default function FloorPlanPage() {
|
export default function FloorPlanPage() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FloorPlan />
|
<CanvasFrame />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { useCanvasConfigInitialize } from '@/hooks/common/useCanvasConfigInitial
|
|||||||
import { MENU } from '@/common/common'
|
import { MENU } from '@/common/common'
|
||||||
import PanelBatchStatistics from '@/components/floor-plan/modal/panelBatch/PanelBatchStatistics'
|
import PanelBatchStatistics from '@/components/floor-plan/modal/panelBatch/PanelBatchStatistics'
|
||||||
|
|
||||||
export default function CanvasFrame({ plan }) {
|
export default function CanvasFrame() {
|
||||||
const canvasRef = useRef(null)
|
const canvasRef = useRef(null)
|
||||||
const [modifiedPlanFlag, setModifiedPlanFlag] = useRecoilState(modifiedPlanFlagState)
|
const [modifiedPlanFlag, setModifiedPlanFlag] = useRecoilState(modifiedPlanFlagState)
|
||||||
const { canvas } = useCanvas('canvas')
|
const { canvas } = useCanvas('canvas')
|
||||||
@ -24,14 +24,14 @@ export default function CanvasFrame({ plan }) {
|
|||||||
const currentObject = useRecoilValue(currentObjectState)
|
const currentObject = useRecoilValue(currentObjectState)
|
||||||
const currentMenu = useRecoilValue(currentMenuState)
|
const currentMenu = useRecoilValue(currentMenuState)
|
||||||
const { contextMenu, handleClick, handleKeyup } = useContextMenu()
|
const { contextMenu, handleClick, handleKeyup } = useContextMenu()
|
||||||
const { checkCanvasObjectEvent, checkUnsavedCanvasPlan, resetModifiedPlans } = usePlan()
|
const { selectedPlan, checkCanvasObjectEvent, checkUnsavedCanvasPlan, resetModifiedPlans } = usePlan()
|
||||||
useEvent()
|
useEvent()
|
||||||
|
|
||||||
const loadCanvas = () => {
|
const loadCanvas = () => {
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
canvas?.clear() // 캔버스를 초기화합니다.
|
canvas?.clear() // 캔버스를 초기화합니다.
|
||||||
if (plan?.canvasStatus) {
|
if (selectedPlan?.canvasStatus) {
|
||||||
canvas?.loadFromJSON(JSON.parse(plan.canvasStatus), function () {
|
canvas?.loadFromJSON(JSON.parse(selectedPlan.canvasStatus), function () {
|
||||||
canvasLoadInit() //config된 상태로 캔버스 객체를 그린다
|
canvasLoadInit() //config된 상태로 캔버스 객체를 그린다
|
||||||
canvas?.renderAll() // 캔버스를 다시 그립니다.
|
canvas?.renderAll() // 캔버스를 다시 그립니다.
|
||||||
})
|
})
|
||||||
@ -41,15 +41,15 @@ export default function CanvasFrame({ plan }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (modifiedPlanFlag && plan?.id) {
|
if (modifiedPlanFlag && selectedPlan?.id) {
|
||||||
checkCanvasObjectEvent(plan.id)
|
checkCanvasObjectEvent(selectedPlan.id)
|
||||||
}
|
}
|
||||||
}, [modifiedPlanFlag])
|
}, [modifiedPlanFlag])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadCanvas()
|
loadCanvas()
|
||||||
resetModifiedPlans()
|
resetModifiedPlans()
|
||||||
}, [plan, canvas])
|
}, [selectedPlan, canvas])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="canvas-frame">
|
<div className="canvas-frame">
|
||||||
|
|||||||
@ -9,9 +9,11 @@ import { usePlan } from '@/hooks/usePlan'
|
|||||||
import { modifiedPlansState } from '@/store/canvasAtom'
|
import { modifiedPlansState } from '@/store/canvasAtom'
|
||||||
import { globalLocaleStore } from '@/store/localeAtom'
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
import { SessionContext } from '@/app/SessionProvider'
|
import { SessionContext } from '@/app/SessionProvider'
|
||||||
|
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||||
|
|
||||||
export default function CanvasLayout(props) {
|
export default function CanvasLayout({ children }) {
|
||||||
const { menuNumber } = props
|
// const { menuNumber } = props
|
||||||
|
const { menuNumber } = useCanvasMenu()
|
||||||
const { session } = useContext(SessionContext)
|
const { session } = useContext(SessionContext)
|
||||||
const [objectNo, setObjectNo] = useState('test123240822001') // 이후 삭제 필요
|
const [objectNo, setObjectNo] = useState('test123240822001') // 이후 삭제 필요
|
||||||
const [modifiedPlans, setModifiedPlans] = useRecoilState(modifiedPlansState) // 변경된 canvas plan
|
const [modifiedPlans, setModifiedPlans] = useRecoilState(modifiedPlansState) // 변경된 canvas plan
|
||||||
@ -60,7 +62,7 @@ export default function CanvasLayout(props) {
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<CanvasFrame plan={plans.find((plan) => plan.isCurrent === true)} />
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,16 +7,18 @@ import { globalLocaleStore } from '@/store/localeAtom'
|
|||||||
import { settingModalFirstOptionsState, settingModalSecondOptionsState } from '@/store/settingAtom'
|
import { settingModalFirstOptionsState, settingModalSecondOptionsState } from '@/store/settingAtom'
|
||||||
import CanvasMenu from '@/components/floor-plan/CanvasMenu'
|
import CanvasMenu from '@/components/floor-plan/CanvasMenu'
|
||||||
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
||||||
|
import { useCanvasMenu } from '@/hooks/common/useCanvasMenu'
|
||||||
import '@/styles/contents.scss'
|
import '@/styles/contents.scss'
|
||||||
|
|
||||||
export default function FloorPlan() {
|
export default function FloorPlan({ children }) {
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
const { get } = useAxios(globalLocaleState)
|
const { get } = useAxios(globalLocaleState)
|
||||||
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
const [settingModalFirstOptions, setSettingModalFirstOptions] = useRecoilState(settingModalFirstOptionsState)
|
||||||
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
const [settingModalSecondOptions, setSettingModalSecondOptions] = useRecoilState(settingModalSecondOptionsState)
|
||||||
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
const [objectNo, setObjectNo] = useState('test123240912001') // 이후 삭제 필요
|
||||||
|
|
||||||
const [menuNumber, setMenuNumber] = useState(null)
|
// const [menuNumber, setMenuNumber] = useState(null)
|
||||||
|
const { menuNumber, setMenuNumber } = useCanvasMenu()
|
||||||
|
|
||||||
const modalProps = {
|
const modalProps = {
|
||||||
menuNumber,
|
menuNumber,
|
||||||
@ -57,9 +59,7 @@ export default function FloorPlan() {
|
|||||||
<>
|
<>
|
||||||
<div className="canvas-wrap">
|
<div className="canvas-wrap">
|
||||||
<CanvasMenu {...modalProps} />
|
<CanvasMenu {...modalProps} />
|
||||||
<div className={`canvas-content ${menuNumber === 2 || menuNumber === 3 || menuNumber === 4 ? 'active' : ''}`}>
|
<div className={`canvas-content ${menuNumber === 2 || menuNumber === 3 || menuNumber === 4 ? 'active' : ''}`}>{children}</div>
|
||||||
<CanvasLayout menuNumber={menuNumber} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -10,15 +10,18 @@ import { globalLocaleStore } from '@/store/localeAtom'
|
|||||||
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty } from '@/util/common-utils'
|
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty } from '@/util/common-utils'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import FindAddressPop from './popup/FindAddressPop'
|
import FindAddressPop from './popup/FindAddressPop'
|
||||||
import PlanRequestPop from './popup/PlanRequestPop'
|
import PlanRequestPop from './popup/PlanRequestPop'
|
||||||
import WindSelectPop from './popup/WindSelectPop'
|
import WindSelectPop from './popup/WindSelectPop'
|
||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
import StuffPlanQGrid from './StuffPlanQGrid'
|
import StuffPlanQGrid from './StuffPlanQGrid'
|
||||||
|
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||||
|
|
||||||
export default function StuffDetail() {
|
export default function StuffDetail() {
|
||||||
|
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //견적서 화면용 물건번호리코일
|
||||||
|
|
||||||
const inputReceiveUserEl = useRef(null) //담당자ref
|
const inputReceiveUserEl = useRef(null) //담당자ref
|
||||||
const inputObjectNameEl = useRef(null) //물건명ref
|
const inputObjectNameEl = useRef(null) //물건명ref
|
||||||
const inputZipNoEl = useRef(null) //우편번호ref
|
const inputZipNoEl = useRef(null) //우편번호ref
|
||||||
@ -1077,6 +1080,7 @@ export default function StuffDetail() {
|
|||||||
//상세화면으로 전환
|
//상세화면으로 전환
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
alert(getMessage('stuff.detail.save'))
|
alert(getMessage('stuff.detail.save'))
|
||||||
|
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`)
|
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1085,6 +1089,7 @@ export default function StuffDetail() {
|
|||||||
await promisePut({ url: apiUrl, data: params }).then((res) => {
|
await promisePut({ url: apiUrl, data: params }).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
alert(getMessage('stuff.detail.save'))
|
alert(getMessage('stuff.detail.save'))
|
||||||
|
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||||
router.refresh()
|
router.refresh()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1153,7 +1158,8 @@ export default function StuffDetail() {
|
|||||||
alert(getMessage('stuff.detail.delete.message1'))
|
alert(getMessage('stuff.detail.delete.message1'))
|
||||||
} else {
|
} else {
|
||||||
if (confirm(getMessage('common.message.data.delete'))) {
|
if (confirm(getMessage('common.message.data.delete'))) {
|
||||||
del({ url: `/api/object/${objectNo}` }).then((res) => {
|
del({ url: `/api/object/${objectNo}` }).then(() => {
|
||||||
|
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||||
router.push('/management/stuff')
|
router.push('/management/stuff')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,14 +5,15 @@ import Link from 'next/link'
|
|||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useRouter, useSearchParams } from 'next/navigation'
|
import { useRouter, useSearchParams } from 'next/navigation'
|
||||||
import { stuffSearchState } from '@/store/stuffAtom'
|
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||||
import { useSetRecoilState } from 'recoil'
|
import { useSetRecoilState } from 'recoil'
|
||||||
|
|
||||||
export default function StuffSubHeader({ type }) {
|
export default function StuffSubHeader({ type }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const setSchObjectNo = useSetRecoilState(stuffSearchState)
|
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0)
|
||||||
}, [])
|
}, [])
|
||||||
@ -22,7 +23,7 @@ export default function StuffSubHeader({ type }) {
|
|||||||
|
|
||||||
// url에 물건번호로 도면작성화면으로 이동
|
// url에 물건번호로 도면작성화면으로 이동
|
||||||
const moveFloorPlan = () => {
|
const moveFloorPlan = () => {
|
||||||
setSchObjectNo(objectNo)
|
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||||
|
|
||||||
router.push('/floor-plan')
|
router.push('/floor-plan')
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/hooks/common/useCanvasMenu.js
Normal file
10
src/hooks/common/useCanvasMenu.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
|
export const useCanvasMenu = () => {
|
||||||
|
const [menuNumber, setMenuNumber] = useState(null)
|
||||||
|
|
||||||
|
return {
|
||||||
|
menuNumber,
|
||||||
|
setMenuNumber,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ import { useSwal } from '@/hooks/useSwal'
|
|||||||
|
|
||||||
export function usePlan() {
|
export function usePlan() {
|
||||||
const [planNum, setPlanNum] = useState(0)
|
const [planNum, setPlanNum] = useState(0)
|
||||||
|
const [selectedPlan, setSelectedPlan] = useState(null)
|
||||||
|
|
||||||
const [canvas, setCanvas] = useRecoilState(canvasState)
|
const [canvas, setCanvas] = useRecoilState(canvasState)
|
||||||
const [currentCanvasPlan, setCurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
const [currentCanvasPlan, setCurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
||||||
@ -279,6 +280,7 @@ export function usePlan() {
|
|||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentCanvasPlan(plans.find((plan) => plan.isCurrent) || null)
|
setCurrentCanvasPlan(plans.find((plan) => plan.isCurrent) || null)
|
||||||
|
setSelectedPlan(plans.find((plan) => plan.isCurrent))
|
||||||
}, [plans])
|
}, [plans])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -366,6 +368,7 @@ export function usePlan() {
|
|||||||
return {
|
return {
|
||||||
canvas,
|
canvas,
|
||||||
plans,
|
plans,
|
||||||
|
selectedPlan,
|
||||||
modifiedPlans,
|
modifiedPlans,
|
||||||
checkCanvasObjectEvent,
|
checkCanvasObjectEvent,
|
||||||
resetModifiedPlans,
|
resetModifiedPlans,
|
||||||
|
|||||||
9
src/store/floorPlanObjectAtom.js
Normal file
9
src/store/floorPlanObjectAtom.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { atom } from 'recoil'
|
||||||
|
import { v1 } from 'uuid'
|
||||||
|
export const floorPlanObjectState = atom({
|
||||||
|
key: `floorPlanObjectState/${v1()}`,
|
||||||
|
default: {
|
||||||
|
objectNo: '', //물건번호
|
||||||
|
},
|
||||||
|
dangerouslyAllowMutability: true,
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user