물건상세화면
This commit is contained in:
parent
6da947f6da
commit
ba23e3b55c
@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import React, { useState, useEffect, useRef } from 'react'
|
import { useState, useEffect, useRef, useContext } from 'react'
|
||||||
import { useRouter, useSearchParams, usePathname } from 'next/navigation'
|
import { useRouter, useSearchParams, usePathname } from 'next/navigation'
|
||||||
import { Button } from '@nextui-org/react'
|
import { Button } from '@nextui-org/react'
|
||||||
import Select, { components } from 'react-select'
|
import Select, { components } from 'react-select'
|
||||||
@ -12,6 +12,7 @@ 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 } from 'recoil'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
|
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'
|
||||||
import WindSelectPop from './popup/WindSelectPop'
|
import WindSelectPop from './popup/WindSelectPop'
|
||||||
@ -22,19 +23,13 @@ import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
|||||||
export default function StuffDetail() {
|
export default function StuffDetail() {
|
||||||
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //견적서 화면용 물건번호리코일
|
const setFloorPlanObjectNo = useSetRecoilState(floorPlanObjectState) //견적서 화면용 물건번호리코일
|
||||||
|
|
||||||
// const inputReceiveUserEl = useRef(null) //담당자ref
|
|
||||||
// const inputObjectNameEl = useRef(null) //물건명ref
|
|
||||||
// const inputZipNoEl = useRef(null) //우편번호ref
|
|
||||||
// const inputAddressEl = useRef(null) //주소ref
|
|
||||||
// const inputVerticalSnowCoverEl = useRef(null) //수직적설량ref
|
|
||||||
// const inputInstallHeightEl = useRef(null) //설치높이ref
|
|
||||||
|
|
||||||
//공통코드
|
//공통코드
|
||||||
const { commonCode, findCommonCode } = useCommonCode()
|
const { commonCode, findCommonCode } = useCommonCode()
|
||||||
const [selOptions, setSelOptions] = useState('') //선택한 1차점
|
const [selOptions, setSelOptions] = useState('') //선택한 1차점
|
||||||
const [otherSelOptions, setOtherSelOptions] = useState('') //선택한 1차점외
|
const [otherSelOptions, setOtherSelOptions] = useState('') //선택한 1차점외
|
||||||
|
|
||||||
const sessionState = useRecoilValue(sessionStore)
|
const sessionState = useRecoilValue(sessionStore)
|
||||||
|
const { session } = useContext(SessionContext)
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
@ -252,6 +247,7 @@ export default function StuffDetail() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('buttonStyle:::', buttonStyle, params.value)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="grid-cell-btn">
|
<div className="grid-cell-btn">
|
||||||
@ -322,55 +318,132 @@ export default function StuffDetail() {
|
|||||||
//1차점 : X167 T01
|
//1차점 : X167 T01
|
||||||
//2차점 : 10X22, 201X112
|
//2차점 : 10X22, 201X112
|
||||||
let url
|
let url
|
||||||
if (sessionState?.storeId === 'T01') {
|
let firstList
|
||||||
// url = `/api/object/saleStore/${sessionState?.storeId}/list?userId=an1`
|
let otherList
|
||||||
url = `/api/object/saleStore/${sessionState?.storeId}/list?userId=${sessionState?.userId}`
|
let favList
|
||||||
|
// if (sessionState?.storeId === 'T01') {
|
||||||
|
if (session?.storeId === 'T01') {
|
||||||
|
console.log('신규T01::::::::::::::::::::::::::::::::::::')
|
||||||
|
// url = `/api/object/saleStore/${sessionState?.storeId}/list?userId=${sessionState?.userId}`
|
||||||
|
url = `/api/object/saleStore/${session?.storeId}/firstList?userId=${session?.userId}`
|
||||||
} else {
|
} else {
|
||||||
url = `/api/object/saleStore/${sessionState?.storeId}/list`
|
// url = `/api/object/saleStore/${sessionState?.storeId}/list`
|
||||||
|
if (session.storeLvl === '1') {
|
||||||
|
console.log('로그인이1차:::::::')
|
||||||
|
//url = `/api/object/saleStore/${session?.storeId}/list`
|
||||||
|
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${sessionState?.userId}`
|
||||||
|
} else {
|
||||||
|
console.log('로그인이2차:::')
|
||||||
|
url = ``
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get({ url: url }).then((res) => {
|
get({ url: url }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
res.map((row) => {
|
||||||
let favList
|
row.value = row.saleStoreId
|
||||||
if (sessionState?.storeId === 'T01') {
|
row.label = row.saleStoreName
|
||||||
|
})
|
||||||
|
if (session?.storeId === 'T01') {
|
||||||
|
firstList = res
|
||||||
firstList.sort((a, b) => (a.saleStoreId !== 'T01') - (b.saleStoreId !== 'T01') || a.saleStoreId - b.saleStoreId)
|
firstList.sort((a, b) => (a.saleStoreId !== 'T01') - (b.saleStoreId !== 'T01') || a.saleStoreId - b.saleStoreId)
|
||||||
favList = firstList.filter((row) => row.saleStoreId === 'T01' || row.priority !== 'B')
|
favList = firstList.filter((row) => row.saleStoreId === 'T01' || row.priority !== 'B')
|
||||||
|
|
||||||
setSaleStoreList(firstList)
|
setSaleStoreList(firstList)
|
||||||
setFavoriteStoreList(favList)
|
setFavoriteStoreList(favList)
|
||||||
setShowSaleStoreList(favList)
|
setShowSaleStoreList(favList)
|
||||||
} else {
|
setSelOptions(session?.storeId)
|
||||||
//1차점 셀렉트박스
|
form.setValue('saleStoreId', session?.storeId)
|
||||||
setSaleStoreList(firstList)
|
form.setValue('saleStoreLevel', session?.storeLvl)
|
||||||
}
|
//T01일떄는 1차점을 고른다음 2차점 목록 조회하기
|
||||||
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
//디폴트 값(T01)으로 2차점목록 조회하기
|
||||||
let filterOtherList
|
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=0&userId=${session?.userId}`
|
||||||
if (sessionState?.storeId === 'T01') {
|
get({ url: url }).then((res) => {
|
||||||
filterOtherList = otherList.filter((row) => row.firstAgentId === 'T01')
|
if (!isEmptyArray(res)) {
|
||||||
|
res.map((row) => {
|
||||||
|
row.value = row.saleStoreId
|
||||||
|
row.label = row.saleStoreName
|
||||||
|
})
|
||||||
|
|
||||||
setOriginOtherSaleStoreList(filterOtherList)
|
otherList = res
|
||||||
setOtherSaleStoreList(filterOtherList)
|
setOtherSaleStoreList(otherList)
|
||||||
|
} else {
|
||||||
|
setOtherSaleStoreList([])
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
//T01 아니고 2차점 판매점 셀렉트박스
|
if (session?.storeLvl === '1') {
|
||||||
setOriginOtherSaleStoreList(otherList)
|
firstList = res
|
||||||
setOtherSaleStoreList(otherList)
|
favList = res.filter((row) => row.priority !== 'B')
|
||||||
}
|
otherList = res.filter((row) => row.firstAgentYn === 'N')
|
||||||
|
|
||||||
if (sessionState?.storeLvl === '1') {
|
setSaleStoreList(firstList)
|
||||||
setSelOptions(sessionState?.storeId)
|
setFavoriteStoreList(firstList)
|
||||||
form.setValue('saleStoreId', sessionState?.storeId)
|
setShowSaleStoreList(firstList)
|
||||||
form.setValue('saleStoreLevel', sessionState?.storeLvl)
|
setSelOptions(firstList[0].saleStoreId)
|
||||||
} else {
|
form.setValue('saleStoreId', session?.storeId)
|
||||||
setSelOptions(firstList[0].saleStoreId)
|
form.setValue('saleStoreLevel', session?.storeLvl)
|
||||||
setOtherSelOptions(sessionState?.storeId)
|
|
||||||
form.setValue('saleStoreId', firstList[0].saleStoreId)
|
setOtherSaleStoreList(otherList)
|
||||||
form.setValue('otherSaleStoreId', sessionState?.storeId)
|
} else {
|
||||||
form.setValue('otherSaleStoreLevel', sessionState?.storeLvl)
|
console.log('1차점아님:::::::::', res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// get({ url: url }).then((res) => {
|
||||||
|
// if (!isEmptyArray(res)) {
|
||||||
|
// const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
||||||
|
// let favList
|
||||||
|
// // if (sessionState?.storeId === 'T01') {
|
||||||
|
// if (session?.storeId === 'T01') {
|
||||||
|
// firstList.sort((a, b) => (a.saleStoreId !== 'T01') - (b.saleStoreId !== 'T01') || a.saleStoreId - b.saleStoreId)
|
||||||
|
// favList = firstList.filter((row) => row.saleStoreId === 'T01' || row.priority !== 'B')
|
||||||
|
// setSaleStoreList(firstList)
|
||||||
|
// setFavoriteStoreList(favList)
|
||||||
|
// setShowSaleStoreList(favList)
|
||||||
|
// } else {
|
||||||
|
// //1차점 셀렉트박스
|
||||||
|
// setSaleStoreList(firstList)
|
||||||
|
// }
|
||||||
|
// const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
||||||
|
// let filterOtherList
|
||||||
|
// // if (sessionState?.storeId === 'T01') {
|
||||||
|
// if (session?.storeId === 'T01') {
|
||||||
|
// filterOtherList = otherList.filter((row) => row.firstAgentId === 'T01')
|
||||||
|
|
||||||
|
// setOriginOtherSaleStoreList(filterOtherList)
|
||||||
|
// setOtherSaleStoreList(filterOtherList)
|
||||||
|
// } else {
|
||||||
|
// //T01 아니고 2차점 판매점 셀렉트박스
|
||||||
|
// setOriginOtherSaleStoreList(otherList)
|
||||||
|
// setOtherSaleStoreList(otherList)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // if (sessionState?.storeLvl === '1') {
|
||||||
|
// if (session?.storeLvl === '1') {
|
||||||
|
// // setSelOptions(sessionState?.storeId)
|
||||||
|
// setSelOptions(session?.storeId)
|
||||||
|
// // form.setValue('saleStoreId', sessionState?.storeId)
|
||||||
|
// form.setValue('saleStoreId', session?.storeId)
|
||||||
|
// // form.setValue('saleStoreLevel', sessionState?.storeLvl)
|
||||||
|
// form.setValue('saleStoreLevel', session?.storeLvl)
|
||||||
|
// } else {
|
||||||
|
// setSelOptions(firstList[0].saleStoreId)
|
||||||
|
// // setOtherSelOptions(sessionState?.storeId)
|
||||||
|
// setOtherSelOptions(session?.storeId)
|
||||||
|
// form.setValue('saleStoreId', firstList[0].saleStoreId)
|
||||||
|
// // form.setValue('otherSaleStoreId', sessionState?.storeId)
|
||||||
|
// form.setValue('otherSaleStoreId', session?.storeId)
|
||||||
|
// // form.setValue('otherSaleStoreLevel', sessionState?.storeLvl)
|
||||||
|
// form.setValue('otherSaleStoreLevel', session?.storeLvl)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}, [objectNo, sessionState])
|
// }, [objectNo, sessionState])
|
||||||
|
}, [objectNo, session])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const code1 = findCommonCode(200800) //경칭
|
const code1 = findCommonCode(200800) //경칭
|
||||||
@ -389,7 +462,7 @@ export default function StuffDetail() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isObjectNotEmpty(detailData)) {
|
if (isObjectNotEmpty(detailData)) {
|
||||||
// console.log('상세데이타세팅:::::', detailData)
|
console.log('상세데이타세팅:::::', detailData)
|
||||||
// 도도부현API
|
// 도도부현API
|
||||||
get({ url: '/api/object/prefecture/list' }).then((res) => {
|
get({ url: '/api/object/prefecture/list' }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
@ -400,38 +473,73 @@ export default function StuffDetail() {
|
|||||||
//1차점 : X167 T01
|
//1차점 : X167 T01
|
||||||
//2차점 : 10X22, 201X112
|
//2차점 : 10X22, 201X112
|
||||||
let url
|
let url
|
||||||
if (sessionState?.storeId === 'T01') {
|
let firstList
|
||||||
// url = `/api/object/saleStore/${sessionState?.storeId}/list?userId=an1`
|
let otherList
|
||||||
url = `/api/object/saleStore/${sessionState?.storeId}/list?userId=${sessionState?.userId}`
|
let favList
|
||||||
|
// if (sessionState?.storeId === 'T01') {
|
||||||
|
if (session?.storeId === 'T01') {
|
||||||
|
// url = `/api/object/saleStore/${sessionState?.storeId}/firstList?userId=${sessionState?.userId}`
|
||||||
|
url = `/api/object/saleStore/${session?.storeId}/firstList?userId=${session?.userId}`
|
||||||
} else {
|
} else {
|
||||||
url = `/api/object/saleStore/${sessionState?.storeId}/list`
|
// if (sessionState.storeLvl === '1') {
|
||||||
|
if (session.storeLvl === '1') {
|
||||||
|
// url = `/api/object/saleStore/${sessionState?.storeId}/list?firstFlg=1&userId=${sessionState?.userId}`
|
||||||
|
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}`
|
||||||
|
} else {
|
||||||
|
// url = `/api/object/saleStore/${sessionState?.storeId}/list?firstFlg=1&userId=${sessionState?.userId}`
|
||||||
|
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
get({ url: url }).then((res) => {
|
get({ url: url }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
// if (sessionState?.storeId === 'T01') {
|
||||||
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
if (session?.storeId === 'T01') {
|
||||||
let favList
|
firstList = res.filter((row) => row.saleStoreLevel === '1')
|
||||||
|
|
||||||
if (sessionState?.storeId === 'T01') {
|
|
||||||
firstList.sort((a, b) => (a.saleStoreId !== 'T01') - (b.saleStoreId !== 'T01') || a.saleStoreId - b.saleStoreId)
|
firstList.sort((a, b) => (a.saleStoreId !== 'T01') - (b.saleStoreId !== 'T01') || a.saleStoreId - b.saleStoreId)
|
||||||
favList = firstList.filter((row) => row.saleStoreId === 'T01' || row.priority !== 'B')
|
favList = firstList.filter((row) => row.saleStoreId === 'T01' || row.priority !== 'B')
|
||||||
setSaleStoreList(firstList)
|
setSaleStoreList(firstList)
|
||||||
setFavoriteStoreList(favList)
|
setFavoriteStoreList(favList)
|
||||||
setShowSaleStoreList(favList)
|
setShowSaleStoreList(favList)
|
||||||
|
|
||||||
|
//상세데이터의 1차점 아이디로 2차점 목록 조회하기
|
||||||
|
// url = `/api/object/saleStore/${detailData?.saleStoreId}/list?firstFlg=0&userId=${sessionState?.userId}`
|
||||||
|
url = `/api/object/saleStore/${detailData?.saleStoreId}/list?firstFlg=0&userId=${session?.userId}`
|
||||||
|
|
||||||
|
get({ url: url }).then((res) => {
|
||||||
|
if (!isEmptyArray(res)) {
|
||||||
|
res.map((row) => {
|
||||||
|
row.value = row.saleStoreId
|
||||||
|
row.label = row.saleStoreName
|
||||||
|
})
|
||||||
|
|
||||||
|
otherList = res
|
||||||
|
setOriginOtherSaleStoreList(otherList)
|
||||||
|
setOtherSaleStoreList(otherList)
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
//1차점 셀렉트박스
|
//1차점 셀렉트박스
|
||||||
setSaleStoreList(firstList)
|
// if (sessionState?.storeLvl === '1') {
|
||||||
}
|
if (session?.storeLvl === '1') {
|
||||||
|
firstList = res
|
||||||
|
favList = res.filter((row) => row.priority !== 'B')
|
||||||
|
otherList = res.filter((row) => row.firstAgentYn === 'N')
|
||||||
|
|
||||||
let filterOtherList
|
setSaleStoreList(firstList)
|
||||||
if (sessionState?.storeId === 'T01') {
|
setFavoriteStoreList(firstList)
|
||||||
filterOtherList = otherList.filter((row) => row.firstAgentId === 'T01')
|
setShowSaleStoreList(firstList)
|
||||||
setOriginOtherSaleStoreList(filterOtherList)
|
|
||||||
setOtherSaleStoreList(filterOtherList)
|
setOtherSaleStoreList(otherList)
|
||||||
} else {
|
} else {
|
||||||
//1차점 아닌 판매점 셀렉트박스
|
setSelOptions(res[0].saleStoreId)
|
||||||
setOriginOtherSaleStoreList(otherList)
|
form.setValue('saleStoreId', res[0].saleStoreId)
|
||||||
setOtherSaleStoreList(otherList)
|
form.setValue('saleStoreLevel', res[0].storeLvl)
|
||||||
|
setSaleStoreList(res)
|
||||||
|
setFavoriteStoreList(res)
|
||||||
|
setShowSaleStoreList(res)
|
||||||
|
otherList = res.filter((row) => row.firstAgentYn === 'N')
|
||||||
|
setOtherSaleStoreList(otherList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,9 +550,6 @@ export default function StuffDetail() {
|
|||||||
form.setValue('saleStoreId', detailData.saleStoreId)
|
form.setValue('saleStoreId', detailData.saleStoreId)
|
||||||
form.setValue('saleStoreLevel', detailData.saleStoreLevel)
|
form.setValue('saleStoreLevel', detailData.saleStoreLevel)
|
||||||
} else {
|
} else {
|
||||||
setSelOptions(sessionState?.storeId)
|
|
||||||
form.setValue('saleStoreId', sessionState?.storeId)
|
|
||||||
form.setValue('saleStoreLevel', sessionState?.storeLvl)
|
|
||||||
setOtherSelOptions(detailData.saleStoreId)
|
setOtherSelOptions(detailData.saleStoreId)
|
||||||
form.setValue('otherSaleStoreId', detailData.saleStoreId)
|
form.setValue('otherSaleStoreId', detailData.saleStoreId)
|
||||||
form.setValue('otherSaleStoreLevel', detailData.saleStoreLevel)
|
form.setValue('otherSaleStoreLevel', detailData.saleStoreLevel)
|
||||||
@ -504,7 +609,8 @@ export default function StuffDetail() {
|
|||||||
form.setValue('remarks', detailData.remarks)
|
form.setValue('remarks', detailData.remarks)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, [detailData, sessionState])
|
// }, [detailData, sessionState])
|
||||||
|
}, [detailData, session])
|
||||||
|
|
||||||
//경칭선택 변경 이벤트
|
//경칭선택 변경 이벤트
|
||||||
const onChangeHonorificCode = (key) => {
|
const onChangeHonorificCode = (key) => {
|
||||||
@ -586,8 +692,9 @@ export default function StuffDetail() {
|
|||||||
setSelOptions(key.saleStoreId)
|
setSelOptions(key.saleStoreId)
|
||||||
//선택한 1차점 정보로 2차점 list 추리기
|
//선택한 1차점 정보로 2차점 list 추리기
|
||||||
//長府工産株式会社 大阪支社
|
//長府工産株式会社 大阪支社
|
||||||
let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
console.log('여기도?????????????????????')
|
||||||
setOtherSaleStoreList(newOtherSaleStoreList)
|
// let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
||||||
|
// setOtherSaleStoreList(newOtherSaleStoreList)
|
||||||
} else {
|
} else {
|
||||||
//X누름
|
//X누름
|
||||||
setSelOptions('')
|
setSelOptions('')
|
||||||
@ -604,15 +711,38 @@ export default function StuffDetail() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isObjectNotEmpty(key)) {
|
if (isObjectNotEmpty(key)) {
|
||||||
setOtherSaleStoreList(otherSaleStoreList)
|
setSelOptions(key.saleStoreId)
|
||||||
form.setValue('saleStoreId', key.saleStoreId)
|
form.setValue('saleStoreId', key.saleStoreId)
|
||||||
form.setValue('saleStoreName', key.saleStoreName)
|
form.setValue('saleStoreName', key.saleStoreName)
|
||||||
form.setValue('saleStoreLevel', key.saleStoreLevel)
|
form.setValue('saleStoreLevel', key.saleStoreLevel)
|
||||||
setSelOptions(key.saleStoreId)
|
//선택한 1차점 정보로 2차점 조회하기
|
||||||
//선택한 1차점 정보로 2차점 list 추리기
|
|
||||||
//長府工産株式会社 大阪支社
|
//長府工産株式会社 大阪支社
|
||||||
let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
console.log('바꿔조ㅜㅝ............', key.saleStoreId)
|
||||||
setOtherSaleStoreList(newOtherSaleStoreList)
|
let url = `/api/object/saleStore/${key.saleStoreId}/list?firstFlg=0&userId=${session?.userId}`
|
||||||
|
let otherList
|
||||||
|
get({ url: url }).then((res) => {
|
||||||
|
console.log('고른1차점으로 2차점목록조회결과;:::', res)
|
||||||
|
if (!isEmptyArray(res)) {
|
||||||
|
res.map((row) => {
|
||||||
|
row.value = row.saleStoreId
|
||||||
|
row.label = row.saleStoreName
|
||||||
|
})
|
||||||
|
|
||||||
|
otherList = res
|
||||||
|
console.log('otherList::::::::', otherList)
|
||||||
|
setOtherSaleStoreList(otherList)
|
||||||
|
setOtherSelOptions('')
|
||||||
|
form.setValue('otherSaleStoreId', '')
|
||||||
|
form.setValue('otherSaleStoreName', '')
|
||||||
|
form.setValue('otherSaleStoreLevel', '')
|
||||||
|
} else {
|
||||||
|
setOtherSelOptions('')
|
||||||
|
form.setValue('otherSaleStoreId', '')
|
||||||
|
form.setValue('otherSaleStoreName', '')
|
||||||
|
form.setValue('otherSaleStoreLevel', '')
|
||||||
|
setOtherSaleStoreList([])
|
||||||
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
//X누름
|
//X누름
|
||||||
setSelOptions('')
|
setSelOptions('')
|
||||||
@ -636,8 +766,9 @@ export default function StuffDetail() {
|
|||||||
setSelOptions(key.saleStoreId)
|
setSelOptions(key.saleStoreId)
|
||||||
//선택한 1차점 정보로 2차점 list 추리기
|
//선택한 1차점 정보로 2차점 list 추리기
|
||||||
//長府工産株式会社 大阪支社
|
//長府工産株式会社 大阪支社
|
||||||
let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
console.log('여기도용')
|
||||||
setOtherSaleStoreList(newOtherSaleStoreList)
|
// let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
||||||
|
// setOtherSaleStoreList(newOtherSaleStoreList)
|
||||||
} else {
|
} else {
|
||||||
//X누름
|
//X누름
|
||||||
setSelOptions('')
|
setSelOptions('')
|
||||||
@ -1170,8 +1301,10 @@ export default function StuffDetail() {
|
|||||||
|
|
||||||
//1차점 or 2차점 안고르고 임시저장하면
|
//1차점 or 2차점 안고르고 임시저장하면
|
||||||
if (params.saleStoreId == '') {
|
if (params.saleStoreId == '') {
|
||||||
params.saleStoreId = sessionState.storeId
|
// params.saleStoreId = sessionState.storeId
|
||||||
params.saleStoreLevel = sessionState.storeLvl
|
params.saleStoreId = session.storeId
|
||||||
|
// params.saleStoreLevel = sessionState.storeLvl
|
||||||
|
params.saleStoreLevel = session.storeLvl
|
||||||
}
|
}
|
||||||
//수직적설량, 설치높이 0인지 체크
|
//수직적설량, 설치높이 0인지 체크
|
||||||
// let snow = params.verticalSnowCover
|
// let snow = params.verticalSnowCover
|
||||||
@ -1343,7 +1476,113 @@ export default function StuffDetail() {
|
|||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div className="flx-box">
|
<div className="flx-box">
|
||||||
{(sessionState?.storeId === 'T01' && (
|
{/* {sessionState?.storeId === 'T01' && ( */}
|
||||||
|
{session?.storeId === 'T01' && (
|
||||||
|
<>
|
||||||
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
|
<Select
|
||||||
|
id="long-value-select1"
|
||||||
|
instanceId="long-value-select1"
|
||||||
|
className="react-select-custom"
|
||||||
|
classNamePrefix="custom"
|
||||||
|
placeholder="Select"
|
||||||
|
options={showSaleStoreList}
|
||||||
|
onInputChange={onInputChange}
|
||||||
|
onChange={onSelectionChange}
|
||||||
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
|
// isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
|
isClearable={session?.storeLvl === '1' ? true : false}
|
||||||
|
// isDisabled={sessionState?.storeLvl !== '1' ? true : false}
|
||||||
|
isDisabled={session?.storeLvl !== '1' ? true : false}
|
||||||
|
value={saleStoreList.filter(function (option) {
|
||||||
|
// console.log('showSaleStoreList:::::', option.saleStoreId)
|
||||||
|
return option.saleStoreId === selOptions
|
||||||
|
})}
|
||||||
|
></Select>
|
||||||
|
</div>
|
||||||
|
<div className="input-wrap" style={{ width: '216px' }}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-light"
|
||||||
|
value={form.watch('saleStoreId') || ''}
|
||||||
|
{...form.register('saleStoreId')}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* {sessionState?.storeId !== 'T01' && sessionState?.storeLvl === '1' && ( */}
|
||||||
|
{session?.storeId !== 'T01' && session?.storeLvl === '1' && (
|
||||||
|
<>
|
||||||
|
신규 T01아닌 1차점
|
||||||
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
|
<Select
|
||||||
|
id="long-value-select1"
|
||||||
|
instanceId="long-value-select1"
|
||||||
|
className="react-select-custom"
|
||||||
|
classNamePrefix="custom"
|
||||||
|
placeholder="Select"
|
||||||
|
options={showSaleStoreList[0]}
|
||||||
|
onChange={onSelectionChange}
|
||||||
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
|
isClearable={session?.storeLvl === '1' ? true : false}
|
||||||
|
isDisabled={session?.storeLvl !== '1' ? true : session?.storeId !== 'T01' ? true : false}
|
||||||
|
value={showSaleStoreList.filter(function (option) {
|
||||||
|
return option.saleStoreId === selOptions
|
||||||
|
})}
|
||||||
|
></Select>
|
||||||
|
</div>
|
||||||
|
<div className="input-wrap" style={{ width: '216px' }}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-light"
|
||||||
|
value={form.watch('saleStoreId') || ''}
|
||||||
|
{...form.register('saleStoreId')}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{/* {sessionState?.storeId !== 'T01' && sessionState?.storeLvl !== '1' && ( */}
|
||||||
|
{session?.storeId !== 'T01' && session?.storeLvl !== '1' && (
|
||||||
|
<>
|
||||||
|
신규 로그인이2차점
|
||||||
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
|
<Select
|
||||||
|
id="long-value-select1"
|
||||||
|
instanceId="long-value-select1"
|
||||||
|
className="react-select-custom"
|
||||||
|
classNamePrefix="custom"
|
||||||
|
placeholder="Select"
|
||||||
|
options={saleStoreList}
|
||||||
|
onChange={onSelectionChange}
|
||||||
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
|
// isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
|
isClearable={session?.storeLvl === '1' ? true : false}
|
||||||
|
// isDisabled={sessionState?.storeLvl !== '1' ? true : false}
|
||||||
|
isDisabled={session?.storeLvl !== '1' ? true : false}
|
||||||
|
value={saleStoreList.filter(function (option) {
|
||||||
|
return option.saleStoreId === selOptions
|
||||||
|
})}
|
||||||
|
></Select>
|
||||||
|
</div>
|
||||||
|
<div className="input-wrap" style={{ width: '216px' }}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-light"
|
||||||
|
value={form.watch('saleStoreId') || ''}
|
||||||
|
{...form.register('saleStoreId')}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* {(sessionState?.storeId === 'T01' && (
|
||||||
<>
|
<>
|
||||||
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
<Select
|
<Select
|
||||||
@ -1377,6 +1616,7 @@ export default function StuffDetail() {
|
|||||||
)) || (
|
)) || (
|
||||||
<>
|
<>
|
||||||
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
|
T01아님
|
||||||
<Select
|
<Select
|
||||||
id="long-value-select1"
|
id="long-value-select1"
|
||||||
instanceId="long-value-select1"
|
instanceId="long-value-select1"
|
||||||
@ -1404,7 +1644,7 @@ export default function StuffDetail() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)} */}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -1432,8 +1672,10 @@ export default function StuffDetail() {
|
|||||||
onChange={onSelectionChange2}
|
onChange={onSelectionChange2}
|
||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isDisabled={sessionState?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true}
|
// isDisabled={session?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true}
|
||||||
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
isDisabled={session?.storeLvl === '1' && form.watch('saleStoreId') != '' && otherSaleStoreList.length > 1 ? false : true}
|
||||||
|
// isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
|
isClearable={session?.storeLvl === '1' ? true : false}
|
||||||
value={otherSaleStoreList.filter(function (option) {
|
value={otherSaleStoreList.filter(function (option) {
|
||||||
return option.saleStoreId === otherSelOptions
|
return option.saleStoreId === otherSelOptions
|
||||||
})}
|
})}
|
||||||
@ -1688,7 +1930,7 @@ export default function StuffDetail() {
|
|||||||
<div className="product-input-wrap mr5">
|
<div className="product-input-wrap mr5">
|
||||||
<input type="text" className="product-input" readOnly value={form.watch('planReqNo') || ''} />
|
<input type="text" className="product-input" readOnly value={form.watch('planReqNo') || ''} />
|
||||||
{/* {detailData?.tempFlg === '1' && form.watch('planReqNo') ? ( */}
|
{/* {detailData?.tempFlg === '1' && form.watch('planReqNo') ? ( */}
|
||||||
{objectNo.substring(0, 1) === 'T' && form.watch('planReqNo') ? (
|
{detailData?.tempFlg === '1' && form.watch('planReqNo') ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="product-delete"
|
className="product-delete"
|
||||||
@ -1699,7 +1941,7 @@ export default function StuffDetail() {
|
|||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
{/* {detailData?.tempFlg === '1' ? ( */}
|
{/* {detailData?.tempFlg === '1' ? ( */}
|
||||||
{objectNo.substring(0, 1) === 'T' ? (
|
{detailData?.tempFlg === '1' ? (
|
||||||
<>
|
<>
|
||||||
<Button className="btn-origin grey" onPress={onSearchDesignRequestPopOpen}>
|
<Button className="btn-origin grey" onPress={onSearchDesignRequestPopOpen}>
|
||||||
{getMessage('stuff.planReqPopup.title')}
|
{getMessage('stuff.planReqPopup.title')}
|
||||||
@ -1790,10 +2032,12 @@ export default function StuffDetail() {
|
|||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div className="flx-box">
|
<div className="flx-box">
|
||||||
{(sessionState?.storeId === 'T01' && (
|
{/* {sessionState?.storeId === 'T01' && ( */}
|
||||||
|
{session?.storeId === 'T01' && (
|
||||||
<>
|
<>
|
||||||
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
<Select
|
<Select
|
||||||
|
menuPlacement={'auto'}
|
||||||
id="long-value-select1"
|
id="long-value-select1"
|
||||||
instanceId="long-value-select1"
|
instanceId="long-value-select1"
|
||||||
className="react-select-custom"
|
className="react-select-custom"
|
||||||
@ -1804,8 +2048,10 @@ export default function StuffDetail() {
|
|||||||
onChange={onSelectionChange}
|
onChange={onSelectionChange}
|
||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
// isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
isDisabled={sessionState?.storeLvl !== '1' ? true : false}
|
isClearable={session?.storeLvl === '1' ? true : false}
|
||||||
|
// isDisabled={sessionState?.storeLvl !== '1' ? true : false}
|
||||||
|
isDisabled={session?.storeLvl !== '1' ? true : false}
|
||||||
value={saleStoreList.filter(function (option) {
|
value={saleStoreList.filter(function (option) {
|
||||||
return option.saleStoreId === selOptions
|
return option.saleStoreId === selOptions
|
||||||
})}
|
})}
|
||||||
@ -1821,22 +2067,26 @@ export default function StuffDetail() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)) || (
|
)}
|
||||||
|
{/* {sessionState?.storeId !== 'T01' && sessionState?.storeLvl === '1' && ( */}
|
||||||
|
{session?.storeId !== 'T01' && session?.storeLvl === '1' && (
|
||||||
<>
|
<>
|
||||||
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
<Select
|
<Select
|
||||||
|
menuPlacement={'auto'}
|
||||||
id="long-value-select1"
|
id="long-value-select1"
|
||||||
instanceId="long-value-select1"
|
instanceId="long-value-select1"
|
||||||
className="react-select-custom"
|
className="react-select-custom"
|
||||||
classNamePrefix="custom"
|
classNamePrefix="custom"
|
||||||
placeholder="Select"
|
placeholder="Select"
|
||||||
options={saleStoreList}
|
options={showSaleStoreList[0]}
|
||||||
onChange={onSelectionChange}
|
onChange={onSelectionChange}
|
||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
isClearable={false}
|
||||||
isDisabled={sessionState?.storeLvl !== '1' ? true : false}
|
// isDisabled={sessionState?.storeLvl !== '1' ? true : sessionState?.storeId !== 'T01' ? true : false}
|
||||||
value={saleStoreList.filter(function (option) {
|
isDisabled={session?.storeLvl !== '1' ? true : session?.storeId !== 'T01' ? true : false}
|
||||||
|
value={showSaleStoreList.filter(function (option) {
|
||||||
return option.saleStoreId === selOptions
|
return option.saleStoreId === selOptions
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
@ -1852,6 +2102,41 @@ export default function StuffDetail() {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{/* {sessionState?.storeId !== 'T01' && sessionState?.storeLvl !== '1' && ( */}
|
||||||
|
{session?.storeId !== 'T01' && session?.storeLvl !== '1' && (
|
||||||
|
<>
|
||||||
|
<div className="select-wrap mr5" style={{ width: '567px' }}>
|
||||||
|
<Select
|
||||||
|
menuPlacement={'auto'}
|
||||||
|
id="long-value-select1"
|
||||||
|
instanceId="long-value-select1"
|
||||||
|
className="react-select-custom"
|
||||||
|
classNamePrefix="custom"
|
||||||
|
placeholder="Select"
|
||||||
|
options={showSaleStoreList[0]}
|
||||||
|
onChange={onSelectionChange}
|
||||||
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
|
isClearable={false}
|
||||||
|
isDisabled={true}
|
||||||
|
value={showSaleStoreList.filter(function (option) {
|
||||||
|
if (option.firstAgentYn === 'Y') {
|
||||||
|
return option.saleStoreId
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="input-wrap" style={{ width: '216px' }}>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="input-light"
|
||||||
|
value={form.watch('saleStoreId') || ''}
|
||||||
|
{...form.register('saleStoreId')}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -1878,8 +2163,10 @@ export default function StuffDetail() {
|
|||||||
onChange={onSelectionChange2}
|
onChange={onSelectionChange2}
|
||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isDisabled={sessionState?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true}
|
// isDisabled={sessionState?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true}
|
||||||
isClearable={sessionState?.storeLvl === '1' ? true : false}
|
isDisabled={session?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true}
|
||||||
|
// isClearable={sessionState?.storeLvl === '1' ? true : false}
|
||||||
|
isClearable={session?.storeLvl === '1' ? true : false}
|
||||||
value={otherSaleStoreList.filter(function (option) {
|
value={otherSaleStoreList.filter(function (option) {
|
||||||
return option.saleStoreId === otherSelOptions
|
return option.saleStoreId === otherSelOptions
|
||||||
})}
|
})}
|
||||||
@ -2112,7 +2399,7 @@ export default function StuffDetail() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* {detailData?.tempFlg === '0' ? ( */}
|
{/* {detailData?.tempFlg === '0' ? ( */}
|
||||||
{objectNo.substring(0, 1) !== 'T' ? (
|
{detailData?.tempFlg === '0' ? (
|
||||||
<>
|
<>
|
||||||
{/* 진짜R 플랜시작 */}
|
{/* 진짜R 플랜시작 */}
|
||||||
<div className="table-box-title-wrap">
|
<div className="table-box-title-wrap">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user