물건 상세 수정
This commit is contained in:
parent
05ef45bd38
commit
fcdd57cba2
@ -10,7 +10,7 @@ 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, useSetRecoilState } from 'recoil'
|
import { useRecoilValue, useSetRecoilState, useResetRecoilState, useRecoilState } from 'recoil'
|
||||||
import { SessionContext } from '@/app/SessionProvider'
|
import { SessionContext } from '@/app/SessionProvider'
|
||||||
import FindAddressPop from './popup/FindAddressPop'
|
import FindAddressPop from './popup/FindAddressPop'
|
||||||
import PlanRequestPop from './popup/PlanRequestPop'
|
import PlanRequestPop from './popup/PlanRequestPop'
|
||||||
@ -20,8 +20,12 @@ import StuffPlanQGrid from './StuffPlanQGrid'
|
|||||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||||
import { ManagementContext } from '@/app/management/ManagementProvider'
|
import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||||
import DocDownOptionPop from '../estimate/popup/DocDownOptionPop'
|
import DocDownOptionPop from '../estimate/popup/DocDownOptionPop'
|
||||||
|
import { stuffSearchState } from '@/store/stuffAtom'
|
||||||
|
|
||||||
export default function StuffDetail() {
|
export default function StuffDetail() {
|
||||||
|
const resetStuffRecoil = useResetRecoilState(stuffSearchState)
|
||||||
|
const stuffSearchParams = useRecoilValue(stuffSearchState)
|
||||||
|
|
||||||
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //견적서 화면용 물건번호리코일
|
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //견적서 화면용 물건번호리코일
|
||||||
|
|
||||||
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
||||||
@ -433,6 +437,7 @@ export default function StuffDetail() {
|
|||||||
}, [commonCode])
|
}, [commonCode])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (objectNo) {
|
||||||
if (isObjectNotEmpty(managementState)) {
|
if (isObjectNotEmpty(managementState)) {
|
||||||
// 도도부현API
|
// 도도부현API
|
||||||
get({ url: '/api/object/prefecture/list' }).then((res) => {
|
get({ url: '/api/object/prefecture/list' }).then((res) => {
|
||||||
@ -586,6 +591,7 @@ export default function StuffDetail() {
|
|||||||
form.setValue('remarks', managementState.remarks)
|
form.setValue('remarks', managementState.remarks)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, [managementState])
|
}, [managementState])
|
||||||
|
|
||||||
//경칭선택 변경 이벤트
|
//경칭선택 변경 이벤트
|
||||||
@ -1267,7 +1273,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 })
|
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`)
|
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -1276,8 +1282,7 @@ export default function StuffDetail() {
|
|||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
|
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
|
||||||
alert(getMessage('stuff.detail.save'))
|
alert(getMessage('stuff.detail.save'))
|
||||||
// router.refresh()
|
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1312,6 +1317,7 @@ export default function StuffDetail() {
|
|||||||
tempFlg: '1',
|
tempFlg: '1',
|
||||||
workNo: null,
|
workNo: null,
|
||||||
workName: null,
|
workName: null,
|
||||||
|
objectNo: objectNo ? objectNo : '',
|
||||||
}
|
}
|
||||||
|
|
||||||
//1차점 or 2차점 안고르고 임시저장하면
|
//1차점 or 2차점 안고르고 임시저장하면
|
||||||
@ -1320,16 +1326,28 @@ export default function StuffDetail() {
|
|||||||
params.saleStoreLevel = session.storeLvl
|
params.saleStoreLevel = session.storeLvl
|
||||||
}
|
}
|
||||||
|
|
||||||
await promisePost({ url: '/api/object/save-object', data: params }).then((res) => {
|
const apiUrl = '/api/object/save-object'
|
||||||
|
if (objectNo) {
|
||||||
|
await promisePut({ url: apiUrl, data: params }).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
alert(getMessage('stuff.detail.tempSave.message1'))
|
alert(getMessage('stuff.detail.save'))
|
||||||
router.push(`${pathname}?objectNo=${res.data.objectNo.toString()}`)
|
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
Kle.log('썡판 신규', objectNo)
|
||||||
|
await promisePost({ url: apiUrl, data: params }).then((res) => {
|
||||||
|
if (res.status === 201) {
|
||||||
|
alert(getMessage('stuff.detail.save'))
|
||||||
|
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 물건삭제
|
// 물건삭제
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
|
// console.log('검색조건리코일값:::::', stuffSearchParams)
|
||||||
const specificationConfirmDate = managementState.specificationConfirmDate
|
const specificationConfirmDate = managementState.specificationConfirmDate
|
||||||
if (specificationConfirmDate != null) {
|
if (specificationConfirmDate != null) {
|
||||||
alert(getMessage('stuff.detail.delete.message1'))
|
alert(getMessage('stuff.detail.delete.message1'))
|
||||||
@ -1337,6 +1355,12 @@ export default function StuffDetail() {
|
|||||||
if (confirm(getMessage('common.message.data.delete'))) {
|
if (confirm(getMessage('common.message.data.delete'))) {
|
||||||
del({ url: `/api/object/${objectNo}` }).then(() => {
|
del({ url: `/api/object/${objectNo}` }).then(() => {
|
||||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||||
|
// console.log('초기화::::::::::')
|
||||||
|
// resetStuffRecoil()
|
||||||
|
// stuffSearchParams.code = 'DELETE'
|
||||||
|
// stuffSearchParams.schSelSaleStoreId = ''
|
||||||
|
// stuffSearchParams.schOtherSelSaleStoreId = ''
|
||||||
|
// console.log('판매점 초기화도')
|
||||||
router.push('/management/stuff')
|
router.push('/management/stuff')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user