물건현황 리스트 상세 자동완성 셋팅 수정
This commit is contained in:
parent
acc7a73e20
commit
779261308a
@ -16,6 +16,8 @@ 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'
|
||||||
export default function StuffDetail() {
|
export default function StuffDetail() {
|
||||||
|
const [selOptions, setSelOptions] = useState('')
|
||||||
|
|
||||||
const sessionState = useRecoilValue(sessionStore)
|
const sessionState = useRecoilValue(sessionStore)
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -107,14 +109,18 @@ export default function StuffDetail() {
|
|||||||
|
|
||||||
// 임시 1차점 판매점코드 saleStoreId=201TES01
|
// 임시 1차점 판매점코드 saleStoreId=201TES01
|
||||||
// T01
|
// T01
|
||||||
//1차점 : X167
|
//1차점 : X167 T01
|
||||||
get({ url: `/api/object/saleStore/T01/list` }).then((res) => {
|
// get({ url: `/api/object/saleStore/TEMP02/list` }).then((res) => {
|
||||||
// get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
||||||
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
||||||
//1차점 셀렉트박스
|
//1차점 셀렉트박스
|
||||||
setSaleStoreList(firstList)
|
setSaleStoreList(firstList)
|
||||||
|
setSelOptions(sessionState?.storeId)
|
||||||
|
form.setValue('saleStoreId', sessionState?.storeId)
|
||||||
|
form.setValue('saleStoreLevel', sessionState?.storeLvl)
|
||||||
|
|
||||||
//1차점 아닌 판매점 셀렉트박스
|
//1차점 아닌 판매점 셀렉트박스
|
||||||
setOriginOtherSaleStoreList(otherList)
|
setOriginOtherSaleStoreList(otherList)
|
||||||
setOtherSaleStoreList(otherList)
|
setOtherSaleStoreList(otherList)
|
||||||
@ -125,8 +131,6 @@ export default function StuffDetail() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isObjectNotEmpty(detailData)) {
|
if (isObjectNotEmpty(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)) {
|
||||||
@ -151,6 +155,8 @@ export default function StuffDetail() {
|
|||||||
setOtherSaleStoreList(otherList)
|
setOtherSaleStoreList(otherList)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log('상세데이타::세팅:::::', detailData)
|
||||||
}
|
}
|
||||||
}, [detailData])
|
}, [detailData])
|
||||||
|
|
||||||
@ -161,12 +167,14 @@ export default function StuffDetail() {
|
|||||||
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차점 list 추리기
|
//선택한 1차점 정보로 2차점 list 추리기
|
||||||
//長府工産株式会社 大阪支社
|
//長府工産株式会社 大阪支社
|
||||||
let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
let newOtherSaleStoreList = originOtherSaleStoreList.filter((row) => row.firstAgentId === key.saleStoreId)
|
||||||
setOtherSaleStoreList(newOtherSaleStoreList)
|
setOtherSaleStoreList(newOtherSaleStoreList)
|
||||||
} else {
|
} else {
|
||||||
//X누름
|
//X누름
|
||||||
|
setSelOptions('')
|
||||||
form.setValue('saleStoreId', '')
|
form.setValue('saleStoreId', '')
|
||||||
form.setValue('saleStoreName', '')
|
form.setValue('saleStoreName', '')
|
||||||
form.setValue('saleStoreLevel', '')
|
form.setValue('saleStoreLevel', '')
|
||||||
@ -212,6 +220,12 @@ export default function StuffDetail() {
|
|||||||
//팝업에서 넘어온 설계의뢰 정보로 바꾸기
|
//팝업에서 넘어온 설계의뢰 정보로 바꾸기
|
||||||
const setPlanReqInfo = (info) => {
|
const setPlanReqInfo = (info) => {
|
||||||
console.log('팝업에서 넘어온 설계의뢰 정보::: ', info)
|
console.log('팝업에서 넘어온 설계의뢰 정보::: ', info)
|
||||||
|
//building : 신축 기축
|
||||||
|
//planReqName : 물건명
|
||||||
|
//zipNo : 우편번호
|
||||||
|
//도도부현 :address1 주소 : address2 미세팅
|
||||||
|
//기준풍속 팝업열려면 setPrefValue(info.prefId) 필요
|
||||||
|
//기준풍속 :
|
||||||
// form.setValue('dispCompanyName', info.planReqName)
|
// form.setValue('dispCompanyName', info.planReqName)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +563,9 @@ export default function StuffDetail() {
|
|||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
isClearable={true}
|
isClearable={true}
|
||||||
|
value={saleStoreList.filter(function (option) {
|
||||||
|
return option.saleStoreId === selOptions
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="input-wrap" style={{ width: '216px' }}>
|
<div className="input-wrap" style={{ width: '216px' }}>
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import { useMessage } from '@/hooks/useMessage'
|
|||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
export default function StuffSearchCondition() {
|
export default function StuffSearchCondition() {
|
||||||
const sessionState = useRecoilValue(sessionStore)
|
const sessionState = useRecoilValue(sessionStore)
|
||||||
|
|
||||||
const [appMessageState, setAppMessageState] = useRecoilState(appMessageStore)
|
const [appMessageState, setAppMessageState] = useRecoilState(appMessageStore)
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -74,10 +73,6 @@ export default function StuffSearchCondition() {
|
|||||||
startRow: stuffSearch?.startRow ? stuffSearch.startRow : 1,
|
startRow: stuffSearch?.startRow ? stuffSearch.startRow : 1,
|
||||||
endRow: stuffSearch?.endRow ? stuffSearch.endRow : 100,
|
endRow: stuffSearch?.endRow ? stuffSearch.endRow : 100,
|
||||||
schSortType: stuffSearch?.schSortType ? stuffSearch.schSortType : 'R',
|
schSortType: stuffSearch?.schSortType ? stuffSearch.schSortType : 'R',
|
||||||
selObject: {
|
|
||||||
label: stuffSearch.selObject.label,
|
|
||||||
value: stuffSearch.selObject.value,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +95,7 @@ export default function StuffSearchCondition() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isObjectNotEmpty(sessionState)) {
|
if (isObjectNotEmpty(sessionState)) {
|
||||||
// storeId가 T01 이거나 1차점일때만 판매대리점 선택 활성화
|
// storeId가 T01 이거나 1차점일때만 판매대리점 선택 활성화
|
||||||
// get({ url: `/api/object/saleStore/201TES01/list` }).then((res) => {
|
// get({ url: `/api/object/saleStore/TEMP02/list` }).then((res) => {
|
||||||
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
res.map((row) => {
|
res.map((row) => {
|
||||||
@ -128,7 +123,6 @@ export default function StuffSearchCondition() {
|
|||||||
...stuffSearch,
|
...stuffSearch,
|
||||||
code: 'S',
|
code: 'S',
|
||||||
schSelSaleStoreId: key.saleStoreId,
|
schSelSaleStoreId: key.saleStoreId,
|
||||||
selObject: { value: key.saleStoreId, label: key.saleStoreName },
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
setSchSelSaleStoreId('')
|
setSchSelSaleStoreId('')
|
||||||
@ -268,7 +262,21 @@ export default function StuffSearchCondition() {
|
|||||||
onChange={onSelectionChange}
|
onChange={onSelectionChange}
|
||||||
getOptionLabel={(x) => x.saleStoreName}
|
getOptionLabel={(x) => x.saleStoreName}
|
||||||
getOptionValue={(x) => x.saleStoreId}
|
getOptionValue={(x) => x.saleStoreId}
|
||||||
defaultValue={stuffSearch?.selObject?.value ? stuffSearch?.selObject : null}
|
value={schSelSaleStoreList.filter(function (option) {
|
||||||
|
if (stuffSearch?.code === 'S' && schSelSaleStoreId === '') {
|
||||||
|
return false
|
||||||
|
} else if (stuffSearch?.code === 'S' && schSelSaleStoreId !== '') {
|
||||||
|
return option.saleStoreId === schSelSaleStoreId
|
||||||
|
} else if (stuffSearch?.code === 'E' && schSelSaleStoreId !== '') {
|
||||||
|
return option.saleStoreId === schSelSaleStoreId
|
||||||
|
} else {
|
||||||
|
if (stuffSearch?.schSelSaleStoreId !== '') {
|
||||||
|
return option.saleStoreId === stuffSearch.schSelSaleStoreId
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})}
|
||||||
isDisabled={sessionState?.storeLvl === '1' ? false : true}
|
isDisabled={sessionState?.storeLvl === '1' ? false : true}
|
||||||
isClearable={true}
|
isClearable={true}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -18,10 +18,6 @@ export const stuffSearchState = atom({
|
|||||||
startRow: 1,
|
startRow: 1,
|
||||||
endRow: 100,
|
endRow: 100,
|
||||||
schSortType: 'R', //정렬조건 (R:최근등록일 U:최근수정일)
|
schSortType: 'R', //정렬조건 (R:최근등록일 U:최근수정일)
|
||||||
selObject: {
|
|
||||||
value: '',
|
|
||||||
label: '',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
dangerouslyAllowMutability: true,
|
dangerouslyAllowMutability: true,
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user