물건정보 설계의뢰 세팅

This commit is contained in:
basssy 2024-10-22 12:32:28 +09:00
parent b968fd074d
commit 093e355d8a
2 changed files with 39 additions and 27 deletions

View File

@ -20,7 +20,8 @@ import { useCommonCode } from '@/hooks/common/useCommonCode'
export default function StuffDetail() { export default function StuffDetail() {
// //
const { commonCode, findCommonCode } = useCommonCode() const { commonCode, findCommonCode } = useCommonCode()
const [selOptions, setSelOptions] = useState('') const [selOptions, setSelOptions] = useState('') // 1
const [otherSelOptions, setOtherSelOptions] = useState('') // 1
const sessionState = useRecoilValue(sessionStore) const sessionState = useRecoilValue(sessionStore)
@ -113,23 +114,31 @@ export default function StuffDetail() {
} }
}) })
// 1 saleStoreId=201TES01
// T01
//1 : X167 T01 //1 : X167 T01
// get({ url: `/api/object/saleStore/T01/list` }).then((res) => { //2 : 10X22, 201X112
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => { get({ url: `/api/object/saleStore/T100/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)
if (sessionState?.storeLvl === '1') {
setSelOptions(sessionState?.storeId)
form.setValue('saleStoreId', sessionState?.storeId)
form.setValue('saleStoreLevel', sessionState?.storeLvl)
} else {
setSelOptions(firstList[0].saleStoreId)
setOtherSelOptions(sessionState?.storeId)
form.setValue('saleStoreId', firstList[0].saleStoreId)
form.setValue('otherSaleStoreId', sessionState?.storeId)
form.setValue('otherSaleStoreLevel', sessionState?.storeLvl)
}
} }
}) })
} }
@ -158,7 +167,6 @@ export default function StuffDetail() {
// API // API
get({ url: '/api/object/prefecture/list' }).then((res) => { get({ url: '/api/object/prefecture/list' }).then((res) => {
if (!isEmptyArray(res)) { if (!isEmptyArray(res)) {
// console.log('API :::', res)
setPrefCodeList(res) setPrefCodeList(res)
} }
}) })
@ -234,10 +242,12 @@ export default function StuffDetail() {
//2 //2
const onSelectionChange2 = (key) => { const onSelectionChange2 = (key) => {
if (isObjectNotEmpty(key)) { if (isObjectNotEmpty(key)) {
setOtherSelOptions(key.saleStoreId)
form.setValue('otherSaleStoreId', key.saleStoreId) form.setValue('otherSaleStoreId', key.saleStoreId)
form.setValue('otherSaleStoreName', key.saleStoreName) form.setValue('otherSaleStoreName', key.saleStoreName)
form.setValue('otherSaleStoreLevel', key.saleStoreLevel) form.setValue('otherSaleStoreLevel', key.saleStoreLevel)
} else { } else {
setOtherSelOptions('')
form.setValue('otherSaleStoreId', '') form.setValue('otherSaleStoreId', '')
form.setValue('otherSaleStoreName', '') form.setValue('otherSaleStoreName', '')
form.setValue('otherSaleStoreLevel', '') form.setValue('otherSaleStoreLevel', '')
@ -268,7 +278,6 @@ export default function StuffDetail() {
form.setValue('objectName', info.planReqName) form.setValue('objectName', info.planReqName)
form.setValue('zipNo', info.zipNo) form.setValue('zipNo', info.zipNo)
form.setValue('address', info.address2) form.setValue('address', info.address2)
// console.log(' ::: ', info)
prefCodeList.map((row) => { prefCodeList.map((row) => {
if (row.prefName == info.address1) { if (row.prefName == info.address1) {
@ -277,19 +286,23 @@ export default function StuffDetail() {
form.setValue('prefName', info.address1) form.setValue('prefName', info.address1)
} }
}) })
if (info.saleStoreLevel === '1') {
setSelOptions(info.saleStoreId)
form.setValue('saleStoreId', info.saleStoreName)
} else {
console.log('설계의뢰 정보가 2차점인경우::::::::::::', info)
}
form.setValue('windSpeed', info.windSpeed) form.setValue('windSpeed', info.windSpeed)
form.setValue('verticalSnowCover', info.verticalSnowCover) form.setValue('verticalSnowCover', info.verticalSnowCover)
form.setValue('surfaceType', info.surfaceType) form.setValue('surfaceType', info.surfaceType)
// installHeight
form.setValue('installHeight', info.installHeight) form.setValue('installHeight', info.installHeight)
form.setValue('remarks', info.remarks) form.setValue('remarks', info.remarks)
if (info.saleStoreLevel === '1') {
setSelOptions(info.saleStoreId)
form.setValue('saleStoreId', info.saleStoreId)
form.setValue('saleStoreName', key.saleStoreName)
form.setValue('saleStoreLevel', key.saleStoreLevel)
} else {
setOtherSelOptions(info.saleStoreId)
form.setValue('otherSaleStoreId', info.saleStoreId)
form.setValue('otherSaleStoreName', info.saleStoreName)
form.setValue('otherSaleStoreLevel', info.saleStoreLevel)
}
} }
// //
@ -636,9 +649,8 @@ 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={true} isClearable={sessionState?.storeLvl === '1' ? true : false}
value={saleStoreList.filter(function (option) { value={saleStoreList.filter(function (option) {
// console.log('1::::::', selOptions)
return option.saleStoreId === selOptions return option.saleStoreId === selOptions
})} })}
/> />
@ -672,12 +684,11 @@ 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={form.watch('saleStoreId') !== '' ? false : true} isDisabled={sessionState?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true}
isClearable={true} isClearable={sessionState?.storeLvl === '1' ? true : false}
//value={otherSaleStoreList.filter(function (option) { value={otherSaleStoreList.filter(function (option) {
// console.log('2::::::', option) return option.saleStoreId === otherSelOptions
// return option.saleStoreId === selOptions })}
//})}
/> />
</div> </div>
<div className="input-wrap" style={{ width: '216px' }}> <div className="input-wrap" style={{ width: '216px' }}>

View File

@ -85,6 +85,7 @@ export default function PlanRequestPop(props) {
// //
const onSubmit = (page, type) => { const onSubmit = (page, type) => {
//2 201X112
const params = { const params = {
// saleStoreId: 'T100', // saleStoreId: 'T100',
// saleStoreLevel: '1', // saleStoreLevel: '1',