물건수정
This commit is contained in:
parent
1ceaebfa60
commit
e5c84aa13a
@ -563,7 +563,8 @@ export default function Estimate({}) {
|
||||
//주택PKG input 변경
|
||||
const onChangePkgAsp = (value) => {
|
||||
if (estimateContextState.estimateType === 'YJSS') {
|
||||
let newValue = value.replace(/[^0-9.]/g, '')
|
||||
// let newValue = value.replace(/[^0-9.]/g, '')
|
||||
let newValue = (value || '0').replace(/[^0-9.]/g, '')
|
||||
if (newValue.length > 1) {
|
||||
newValue = newValue.replace(/(^0+)/, '')
|
||||
if (newValue.length === 0) {
|
||||
|
||||
@ -195,7 +195,7 @@ export default function CanvasMenu(props) {
|
||||
setCurrentMenu(menu.title)
|
||||
}
|
||||
|
||||
if (pathname !== '/floor-plan' && pathname !== '/floor-plan/estimate/5') {
|
||||
if (pathname !== '/floor-plan' && pathname !== '/floor-plan/estimate/5' && pathname !== '/floor-plan/simulator/6') {
|
||||
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import { globalLocaleStore } from '@/store/localeAtom'
|
||||
import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { useRecoilValue, useSetRecoilState, useResetRecoilState } from 'recoil'
|
||||
import { useRecoilValue, useSetRecoilState, useResetRecoilState, useRecoilState } from 'recoil'
|
||||
import { SessionContext } from '@/app/SessionProvider'
|
||||
import FindAddressPop from './popup/FindAddressPop'
|
||||
import PlanRequestPop from './popup/PlanRequestPop'
|
||||
@ -23,7 +23,12 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
import DocDownOptionPop from '../estimate/popup/DocDownOptionPop'
|
||||
import { stuffSearchState } from '@/store/stuffAtom'
|
||||
import { QcastContext } from '@/app/QcastProvider'
|
||||
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
|
||||
export default function StuffDetail() {
|
||||
const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState)
|
||||
const { swalFire } = useSwal()
|
||||
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||
const resetStuffRecoil = useResetRecoilState(stuffSearchState)
|
||||
const stuffSearchParams = useRecoilValue(stuffSearchState)
|
||||
@ -118,13 +123,13 @@ export default function StuffDetail() {
|
||||
field: 'planNo',
|
||||
headerName: getMessage('stuff.detail.planGridHeader.planNo'),
|
||||
width: 100,
|
||||
cellStyle: { justifyContent: 'center' },
|
||||
cellStyle: { justifyContent: 'center', cursor: 'pointer' },
|
||||
},
|
||||
{
|
||||
field: 'orderFlg',
|
||||
headerName: getMessage('stuff.detail.planGridHeader.orderFlg'),
|
||||
width: 80,
|
||||
cellStyle: { justifyContent: 'center' },
|
||||
cellStyle: { justifyContent: 'center', cursor: 'pointer' },
|
||||
cellRenderer: (params) => {
|
||||
//1일때만 동그라미
|
||||
let orderFlg
|
||||
@ -137,13 +142,31 @@ export default function StuffDetail() {
|
||||
headerName: getMessage('stuff.detail.planGridHeader.moduleModel'),
|
||||
flex: 1,
|
||||
wrapText: true,
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
|
||||
// cellRenderer: (params) => {
|
||||
// let origin = params.value
|
||||
// console.log('모듈:::', origin)
|
||||
// if (origin !== null) {
|
||||
// return (
|
||||
// <>
|
||||
// {origin?.split('、').map((it, idx) => (
|
||||
// <span key={idx} className="block">
|
||||
// {it}
|
||||
// <br />
|
||||
// </span>
|
||||
// ))}
|
||||
// </>
|
||||
// )
|
||||
// } else {
|
||||
// return null
|
||||
// }
|
||||
// },
|
||||
},
|
||||
{
|
||||
field: 'capacity',
|
||||
headerName: getMessage('stuff.detail.planGridHeader.capacity'),
|
||||
width: 120,
|
||||
cellStyle: { justifyContent: 'flex-end' /* 우측정렬*/ },
|
||||
cellStyle: { justifyContent: 'flex-end' /* 우측정렬*/, cursor: 'pointer' },
|
||||
cellRenderer: (params) => {
|
||||
let origin = params.value
|
||||
let capacity
|
||||
@ -162,9 +185,8 @@ export default function StuffDetail() {
|
||||
width: 140,
|
||||
wrapText: true,
|
||||
autoHeight: true,
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
|
||||
cellRenderer: (params) => {
|
||||
//콤마가 아니라 、.. 일본콤마?
|
||||
let origin = params.value
|
||||
if (origin !== null) {
|
||||
return (
|
||||
@ -187,7 +209,7 @@ export default function StuffDetail() {
|
||||
headerName: getMessage('stuff.detail.planGridHeader.constructSpecificationMulti'),
|
||||
wrapText: true,
|
||||
autoHeight: true,
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
|
||||
cellRenderer: (params) => {
|
||||
let origin = params.value
|
||||
if (origin !== null) {
|
||||
@ -211,7 +233,7 @@ export default function StuffDetail() {
|
||||
headerName: getMessage('stuff.detail.planGridHeader.supportMethodIdMulti'),
|
||||
wrapText: true,
|
||||
autoHeight: true,
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
|
||||
cellRenderer: (params) => {
|
||||
let origin = params.value
|
||||
if (origin !== null) {
|
||||
@ -236,7 +258,7 @@ export default function StuffDetail() {
|
||||
flex: 1,
|
||||
wrapText: true,
|
||||
autoHeight: true,
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ },
|
||||
cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/, cursor: 'pointer' },
|
||||
cellRenderer: (params) => {
|
||||
let origin = params.value
|
||||
if (origin !== null) {
|
||||
@ -325,13 +347,10 @@ export default function StuffDetail() {
|
||||
}
|
||||
promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => {
|
||||
if (res.status === 200) {
|
||||
// console.log(res.data.createUser)
|
||||
// console.log(session)
|
||||
if (res?.data?.createUser === 'T01' && session?.userId !== 'T01') {
|
||||
//createUser가 T01인데 로그인사용자가 T01이 아니면 버튼숨기기
|
||||
setShowButton('none')
|
||||
}
|
||||
// console.log('상세::', res.data)
|
||||
if (isObjectNotEmpty(res.data)) {
|
||||
let surfaceTypeValue
|
||||
if (res.data.surfaceType === 'Ⅲ・Ⅳ') {
|
||||
@ -342,8 +361,13 @@ export default function StuffDetail() {
|
||||
setManagementState({ ...res.data, surfaceTypeValue: surfaceTypeValue })
|
||||
} else {
|
||||
setManagementState({})
|
||||
alert(getMessage('stuff.detail.header.notExistObjectNo'))
|
||||
router.push('/management/stuff', { scroll: false })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.header.notExistObjectNo'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
router.push('/management/stuff', { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
if (isNotEmptyArray(res.data.planList)) {
|
||||
setPlanGridProps({ ...planGridProps, planGridData: res.data.planList })
|
||||
@ -354,8 +378,13 @@ export default function StuffDetail() {
|
||||
setManagementState({})
|
||||
setPlanGridProps({ ...planGridProps, planGridData: [] })
|
||||
|
||||
alert(getMessage('stuff.detail.header.notExistObjectNo'))
|
||||
router.push('/management/stuff', { scroll: false })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.header.notExistObjectNo'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
router.push('/management/stuff', { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -923,9 +952,6 @@ export default function StuffDetail() {
|
||||
|
||||
//팝업에서 넘어온 설계의뢰 정보로 바꾸기
|
||||
const setPlanReqInfo = (info) => {
|
||||
// console.log('session 정보:::::::', session)
|
||||
// console.log('설계의뢰에서 넘어온 정보:::::::', info)
|
||||
|
||||
form.setValue('planReqNo', info.planReqNo)
|
||||
|
||||
form.setValue('objectStatusId', info.building)
|
||||
@ -1118,7 +1144,7 @@ export default function StuffDetail() {
|
||||
const onSearchDesignRequestPopOpen = () => {
|
||||
const saleStoreId = form.watch('saleStoreId')
|
||||
if (saleStoreId === '') {
|
||||
alert(getMessage('stuff.planReqPopup.error.message2'))
|
||||
swalFire({ text: getMessage('stuff.planReqPopup.error.message2'), type: 'alert' })
|
||||
} else {
|
||||
setShowDesignRequestButtonValid(true)
|
||||
}
|
||||
@ -1128,7 +1154,7 @@ export default function StuffDetail() {
|
||||
const onSearchWindSpeedPopOpen = () => {
|
||||
const prefName = form.watch('prefName')
|
||||
if (prefName === '') {
|
||||
alert(getMessage('stuff.windSelectPopup.error.message1'))
|
||||
swalFire({ text: getMessage('stuff.windSelectPopup.error.message1'), type: 'alert' })
|
||||
} else {
|
||||
setShowWindSpeedButtonValid(true)
|
||||
}
|
||||
@ -1219,7 +1245,7 @@ export default function StuffDetail() {
|
||||
}
|
||||
|
||||
if (Object.keys(errors).length > 0) {
|
||||
return alert(getMessage('stuff.detail.save.valierror3', [errors]))
|
||||
return swalFire({ text: getMessage('stuff.detail.save.valierror3', [errors]), type: 'alert' })
|
||||
}
|
||||
|
||||
const apiUrl = '/api/object/save-object'
|
||||
@ -1259,10 +1285,10 @@ export default function StuffDetail() {
|
||||
let height = params.installHeight
|
||||
|
||||
if (snow === '0') {
|
||||
return alert(getMessage('stuff.detail.save.valierror1'))
|
||||
return swalFire({ text: getMessage('stuff.detail.save.valierror1'), type: 'alert' })
|
||||
}
|
||||
if (height === '0') {
|
||||
return alert(getMessage('stuff.detail.save.valierror2'))
|
||||
return swalFire({ text: getMessage('stuff.detail.save.valierror2'), type: 'alert' })
|
||||
}
|
||||
|
||||
if (managementState) {
|
||||
@ -1316,50 +1342,65 @@ export default function StuffDetail() {
|
||||
delete params_sort.workName
|
||||
|
||||
if (Object.entries(detail_sort).toString() === Object.entries(params_sort).toString()) {
|
||||
return alert(getMessage('stuff.detail.noChgData'))
|
||||
return swalFire({ text: getMessage('stuff.detail.noChgData'), type: 'alert' })
|
||||
}
|
||||
}
|
||||
|
||||
if (params?.receiveUser !== '') {
|
||||
if (params?.receiveUser.trim().length > 10) {
|
||||
return alert(getMessage('stuff.detail.tempSave.message2'))
|
||||
return swalFire({ text: getMessage('stuff.detail.tempSave.message2'), type: 'alert' })
|
||||
}
|
||||
}
|
||||
//로그인이 2차점인데 otherSaleStoreId가 없으면 알럿
|
||||
if (session.storeLvl !== '1') {
|
||||
if (params.saleStoreLevel === '1') {
|
||||
return alert(getMessage('stuff.detail.tempSave.message4'))
|
||||
return swalFire({ text: getMessage('stuff.detail.tempSave.message4'), type: 'alert' })
|
||||
}
|
||||
}
|
||||
|
||||
if (editMode === 'NEW') {
|
||||
await promisePost({ url: apiUrl, data: params })
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
//상세화면으로 전환
|
||||
if (res.status === 201) {
|
||||
alert(getMessage('stuff.detail.save'))
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
|
||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.save'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
|
||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error::::::', error)
|
||||
alert(error?.response.data.message)
|
||||
setIsGlobalLoading(false)
|
||||
})
|
||||
} else {
|
||||
// 수정모드일때는 PUT
|
||||
// await promisePut({ url: apiUrl, data: params }).then((res) => {
|
||||
await promisePut({ url: apiUrl, data: params })
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
|
||||
if (res.status === 201) {
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: res.data.objectNo })
|
||||
alert(getMessage('stuff.detail.save'))
|
||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.save'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error::::::', error)
|
||||
alert(error?.response.data.message)
|
||||
setIsGlobalLoading(false)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1406,7 +1447,7 @@ export default function StuffDetail() {
|
||||
// 담당자 자리수 체크
|
||||
if (params?.receiveUser !== '') {
|
||||
if (params?.receiveUser.trim().length > 10) {
|
||||
return alert(getMessage('stuff.detail.tempSave.message2'))
|
||||
return swalFire({ text: getMessage('stuff.detail.tempSave.message2'), type: 'alert' })
|
||||
}
|
||||
}
|
||||
|
||||
@ -1414,26 +1455,40 @@ export default function StuffDetail() {
|
||||
if (objectNo) {
|
||||
await promisePut({ url: apiUrl, data: params })
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
if (res.status === 201) {
|
||||
alert(getMessage('stuff.detail.tempSave.message1'))
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.tempSave.message1'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
setIsGlobalLoading(false)
|
||||
console.log('error::::::', error)
|
||||
alert(error?.response.data.message)
|
||||
})
|
||||
} else {
|
||||
await promisePost({ url: apiUrl, data: params })
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
if (res.status === 201) {
|
||||
alert(getMessage('stuff.detail.tempSave.message1'))
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
swalFire({
|
||||
text: getMessage('stuff.detail.tempSave.message1'),
|
||||
type: 'alert',
|
||||
confirmFn: () => {
|
||||
setIsGlobalLoading(false)
|
||||
router.push(`/management/stuff/tempdetail?objectNo=${res.data.objectNo.toString()}`, { scroll: false })
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error::::::', error)
|
||||
alert(error?.response.data.message)
|
||||
setIsGlobalLoading(false)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1445,25 +1500,63 @@ export default function StuffDetail() {
|
||||
userId: session.userId,
|
||||
}
|
||||
if (specificationConfirmDate != null) {
|
||||
alert(getMessage('stuff.detail.delete.message1'))
|
||||
swalFire({ text: getMessage('stuff.detail.delete.message1'), type: 'alert' })
|
||||
} else {
|
||||
if (confirm(getMessage('common.message.data.delete'))) {
|
||||
// setIsGlobalLoading(true)
|
||||
del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` })
|
||||
.then(() => {
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||
if (session.storeId === 'T01') {
|
||||
stuffSearchParams.code = 'DELETE'
|
||||
} else {
|
||||
resetStuffRecoil()
|
||||
}
|
||||
// setIsGlobalLoading(false)
|
||||
router.push('/management/stuff', { scroll: false })
|
||||
})
|
||||
.catch(() => {
|
||||
// setIsGlobalLoading(false)
|
||||
})
|
||||
}
|
||||
swalFire({
|
||||
text: getMessage('common.message.data.delete'),
|
||||
type: 'confirm',
|
||||
confirmFn: () => {
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||
del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` })
|
||||
.then((res) => {
|
||||
setIsGlobalLoading(true)
|
||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||
if (session.storeId === 'T01') {
|
||||
stuffSearchParams.code = 'DELETE'
|
||||
} else {
|
||||
if (session.storeLvl === '1') {
|
||||
stuffSearch.schObjectNo = ''
|
||||
stuffSearch.schAddress = ''
|
||||
stuffSearch.schObjectName = ''
|
||||
stuffSearch.schSaleStoreName = ''
|
||||
stuffSearch.schReceiveUser = ''
|
||||
stuffSearch.schDispCompanyName = ''
|
||||
stuffSearch.schDateType = 'U'
|
||||
stuffSearch.schTempFlg = ''
|
||||
stuffSearch.schMyDataCheck = false
|
||||
stuffSearch.startRow = 1
|
||||
stuffSearch.endRow = 100
|
||||
stuffSearch.schSortType = 'U'
|
||||
stuffSearch.pageNo = 1
|
||||
stuffSearch.pageSize = 100
|
||||
stuffSearch.code = 'S'
|
||||
} else {
|
||||
stuffSearch.schObjectNo = ''
|
||||
stuffSearch.schAddress = ''
|
||||
stuffSearch.schObjectName = ''
|
||||
stuffSearch.schSaleStoreName = ''
|
||||
stuffSearch.schReceiveUser = ''
|
||||
stuffSearch.schDispCompanyName = ''
|
||||
stuffSearch.schDateType = 'U'
|
||||
stuffSearch.schTempFlg = ''
|
||||
stuffSearch.schMyDataCheck = false
|
||||
stuffSearch.startRow = 1
|
||||
stuffSearch.endRow = 100
|
||||
stuffSearch.schSortType = 'U'
|
||||
stuffSearch.pageNo = 1
|
||||
stuffSearch.pageSize = 100
|
||||
stuffSearch.code = 'S'
|
||||
}
|
||||
}
|
||||
setIsGlobalLoading(false)
|
||||
router.push('/management/stuff', { scroll: false })
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error::::::', error)
|
||||
setIsGlobalLoading(false)
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -1491,12 +1584,14 @@ export default function StuffDetail() {
|
||||
|
||||
// 그리드 더블 클릭
|
||||
const getCellDoubleClicked = (params) => {
|
||||
if (params?.column?.colId !== 'estimateDate') {
|
||||
setIsGlobalLoading(true)
|
||||
if (params?.data?.planNo && params?.data?.objectNo) {
|
||||
let objectNo = params?.data?.objectNo
|
||||
let planNo = params?.data?.planNo
|
||||
router.push(`/floor-plan/estimate/5?pid=${planNo}&objectNo=${objectNo}`)
|
||||
if (params.data.estimateDate != null) {
|
||||
if (params?.column?.colId !== 'estimateDate') {
|
||||
if (params?.data?.planNo && params?.data?.objectNo) {
|
||||
setIsGlobalLoading(true)
|
||||
let objectNo = params?.data?.objectNo
|
||||
let planNo = params?.data?.planNo
|
||||
router.push(`/floor-plan/estimate/5?pid=${planNo}&objectNo=${objectNo}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,7 +343,6 @@ export default function StuffSearchCondition() {
|
||||
} else {
|
||||
if (session?.storeLvl === '2') {
|
||||
if (otherSaleStoreList.length > 1) {
|
||||
// handleClear2()
|
||||
setOtherSaleStoreId(session.storeId)
|
||||
stuffSearch.schOtherSelSaleStoreId = session.storeId
|
||||
stuffSearch.schObjectNo = ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user