Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
yoosangwook 2024-10-28 14:56:45 +09:00
commit 7c264a8b35
3 changed files with 21 additions and 5 deletions

View File

@ -10,15 +10,18 @@ import { globalLocaleStore } from '@/store/localeAtom'
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty } from '@/util/common-utils'
import { useMessage } from '@/hooks/useMessage'
import { useForm } from 'react-hook-form'
import { useRecoilValue } from 'recoil'
import { useRecoilValue, useSetRecoilState } from 'recoil'
import { sessionStore } from '@/store/commonAtom'
import FindAddressPop from './popup/FindAddressPop'
import PlanRequestPop from './popup/PlanRequestPop'
import WindSelectPop from './popup/WindSelectPop'
import { useCommonCode } from '@/hooks/common/useCommonCode'
import StuffPlanQGrid from './StuffPlanQGrid'
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
export default function StuffDetail() {
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //
const inputReceiveUserEl = useRef(null) //ref
const inputObjectNameEl = useRef(null) //ref
const inputZipNoEl = useRef(null) //ref
@ -1077,6 +1080,7 @@ export default function StuffDetail() {
//
if (res.status === 201) {
alert(getMessage('stuff.detail.save'))
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
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) => {
if (res.status === 201) {
alert(getMessage('stuff.detail.save'))
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
router.refresh()
}
})
@ -1153,7 +1158,8 @@ export default function StuffDetail() {
alert(getMessage('stuff.detail.delete.message1'))
} else {
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')
})
}

View File

@ -5,14 +5,15 @@ import Link from 'next/link'
import Image from 'next/image'
import { useMessage } from '@/hooks/useMessage'
import { useRouter, useSearchParams } from 'next/navigation'
import { stuffSearchState } from '@/store/stuffAtom'
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
import { useSetRecoilState } from 'recoil'
export default function StuffSubHeader({ type }) {
const { getMessage } = useMessage()
const router = useRouter()
const setSchObjectNo = useSetRecoilState(stuffSearchState)
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState)
useEffect(() => {
window.scrollTo(0, 0)
}, [])
@ -22,7 +23,7 @@ export default function StuffSubHeader({ type }) {
// url
const moveFloorPlan = () => {
setSchObjectNo(objectNo)
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
router.push('/floor-plan')
}

View File

@ -0,0 +1,9 @@
import { atom } from 'recoil'
import { v1 } from 'uuid'
export const floorPlanObjectState = atom({
key: `floorPlanObjectState/${v1()}`,
default: {
objectNo: '', //물건번호
},
dangerouslyAllowMutability: true,
})