물건현황
This commit is contained in:
parent
f3460c5423
commit
cdf7d41033
@ -10,8 +10,7 @@ import { useRecoilValue, useRecoilState } from 'recoil'
|
|||||||
import { stuffSearchState } from '@/store/stuffAtom'
|
import { stuffSearchState } from '@/store/stuffAtom'
|
||||||
import { queryStringFormatter, isEmptyArray } from '@/util/common-utils'
|
import { queryStringFormatter, isEmptyArray } from '@/util/common-utils'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import isLeapYear from 'dayjs/plugin/isLeapYear' // 윤년 판단 플러그인
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
dayjs.extend(isLeapYear)
|
|
||||||
import { convertNumberToPriceDecimal } from '@/util/common-utils'
|
import { convertNumberToPriceDecimal } from '@/util/common-utils'
|
||||||
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
|
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
|
||||||
import KO from '@/locales/ko.json'
|
import KO from '@/locales/ko.json'
|
||||||
@ -242,10 +241,10 @@ export default function Stuff() {
|
|||||||
|
|
||||||
// 진입시 그리드 데이터 조회
|
// 진입시 그리드 데이터 조회
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isObjectNotEmpty(sessionState)) {
|
||||||
if (stuffSearchParams?.code === 'S') {
|
if (stuffSearchParams?.code === 'S') {
|
||||||
const params = {
|
const params = {
|
||||||
schObjectNo: '',
|
schObjectNo: '',
|
||||||
schSaleStoreId: '',
|
|
||||||
schAddress: '',
|
schAddress: '',
|
||||||
schObjectName: '',
|
schObjectName: '',
|
||||||
schSaleStoreName: '',
|
schSaleStoreName: '',
|
||||||
@ -261,7 +260,6 @@ export default function Stuff() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
// console.log('화면진입:::::::::::::', params)
|
|
||||||
//api에 넘길값 startRow, endRow
|
//api에 넘길값 startRow, endRow
|
||||||
// let startRow
|
// let startRow
|
||||||
// let endRow
|
// let endRow
|
||||||
@ -276,9 +274,10 @@ export default function Stuff() {
|
|||||||
// let size
|
// let size
|
||||||
// let pageCount
|
// let pageCount
|
||||||
|
|
||||||
// console.log('세션정보::::::::::', sessionState)
|
// console.log('화면진입 세션정보::::::::::', sessionState)
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(params)}`
|
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(params)}`
|
||||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(params)}`
|
// const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(params)}`
|
||||||
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(params)}`
|
||||||
await get({
|
await get({
|
||||||
url: apiUrl,
|
url: apiUrl,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
@ -290,18 +289,20 @@ export default function Stuff() {
|
|||||||
}
|
}
|
||||||
fetchData()
|
fetchData()
|
||||||
}
|
}
|
||||||
}, [])
|
}
|
||||||
|
}, [sessionState])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (stuffSearchParams?.code === 'E') {
|
if (stuffSearchParams?.code === 'E') {
|
||||||
stuffSearchParams.startRow = (curPage - 1) * defaultSize + 1
|
stuffSearchParams.startRow = (curPage - 1) * defaultSize + 1
|
||||||
stuffSearchParams.endRow = curPage * defaultSize
|
stuffSearchParams.endRow = curPage * defaultSize
|
||||||
stuffSearchParams.schSortType = defaultSortType
|
stuffSearchParams.schSortType = defaultSortType
|
||||||
console.log('조회누름::::::::', stuffSearchParams)
|
// console.log('조회누름::::::::', stuffSearchParams)
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
// console.log('세션정보:::::::::::::', sessionState)
|
// console.log('조회누름 세션정보:::::::::::::', sessionState)
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
// const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
||||||
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
||||||
await get({ url: apiUrl }).then((res) => {
|
await get({ url: apiUrl }).then((res) => {
|
||||||
// console.log('검색조건 변경 조회 API결과:::::::', res)
|
// console.log('검색조건 변경 조회 API결과:::::::', res)
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
@ -329,10 +330,11 @@ export default function Stuff() {
|
|||||||
startRow: startRow,
|
startRow: startRow,
|
||||||
endRow: curPage * e.target.value,
|
endRow: curPage * e.target.value,
|
||||||
})
|
})
|
||||||
console.log('페이지 갯수 변경 때 셋팅된 검색조건:::', stuffSearchParams)
|
// console.log('페이지 갯수 변경 때 셋팅된 검색조건:::', stuffSearchParams)
|
||||||
// console.log('세션정보:::', sessionState)
|
// console.log('페이지 갯수 변경 때 sessionState:::', sessionState)
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
// const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
||||||
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
||||||
get({ url: apiUrl }).then((res) => {
|
get({ url: apiUrl }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt })
|
setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt })
|
||||||
@ -354,9 +356,10 @@ export default function Stuff() {
|
|||||||
code: 'S',
|
code: 'S',
|
||||||
schSortType: e.target.value,
|
schSortType: e.target.value,
|
||||||
})
|
})
|
||||||
// console.log('세션정보::::::::::::', sessionState)
|
// console.log('정렬 변경시 세션정보::::::::::::', sessionState)
|
||||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
// const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
||||||
|
const apiUrl = `/api/object/list?saleStoreId=${sessionState?.storeId}&${queryStringFormatter(stuffSearchParams)}`
|
||||||
get({ url: apiUrl }).then((res) => {
|
get({ url: apiUrl }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt })
|
setGridProps({ ...gridProps, gridData: res, count: res[0].totCnt })
|
||||||
|
|||||||
@ -34,7 +34,8 @@ export default function StuffDetail() {
|
|||||||
prefId: '', //도도부현
|
prefId: '', //도도부현
|
||||||
prefName: '',
|
prefName: '',
|
||||||
address: '', //주소
|
address: '', //주소
|
||||||
areaId: '', //발전량시뮬레이션지역new
|
areaId: '', //발전량시뮬레이션지역id
|
||||||
|
// areaName: '', //발전량시뮬레이션지역명
|
||||||
windSpeed: '', //기준풍속
|
windSpeed: '', //기준풍속
|
||||||
verticalSnowCover: '', //수직적설량NEW
|
verticalSnowCover: '', //수직적설량NEW
|
||||||
coldRegionFlg: false, //한랭지대책시행(true : 1 / false : 0)
|
coldRegionFlg: false, //한랭지대책시행(true : 1 / false : 0)
|
||||||
@ -56,8 +57,9 @@ export default function StuffDetail() {
|
|||||||
const [saleStoreList, setSaleStoreList] = useState([]) // 판매점 리스트
|
const [saleStoreList, setSaleStoreList] = useState([]) // 판매점 리스트
|
||||||
const [otherSaleStoreList, setOtherSaleStoreList] = useState([])
|
const [otherSaleStoreList, setOtherSaleStoreList] = useState([])
|
||||||
|
|
||||||
const [areaIdList, setAreaIdList] = useState([]) //발전시뮬레이션 리스트 NEW
|
const [areaIdList, setAreaIdList] = useState([]) //발전시뮬레이션 리스트
|
||||||
|
|
||||||
|
const [windSpeedList, setWindSpeedList] = useState([]) //기준풍속 리스트
|
||||||
const [isFormValid, setIsFormValid] = useState(false) //임시저장, 진짜저장 버튼 컨트롤
|
const [isFormValid, setIsFormValid] = useState(false) //임시저장, 진짜저장 버튼 컨트롤
|
||||||
const [buttonValid, setButtonValid] = useState(false) //주소검색 활성화 컨트롤
|
const [buttonValid, setButtonValid] = useState(false) //주소검색 활성화 컨트롤
|
||||||
const objectNo = searchParams.get('objectNo') //url에서 물건번호 꺼내서 바로 set
|
const objectNo = searchParams.get('objectNo') //url에서 물건번호 꺼내서 바로 set
|
||||||
@ -83,7 +85,7 @@ 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)
|
// console.log('도도부현API 결과:::', res)
|
||||||
setPrefCodeList(res)
|
setPrefCodeList(res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -274,9 +276,11 @@ export default function StuffDetail() {
|
|||||||
const params = {
|
const params = {
|
||||||
zipcode: _zipNo,
|
zipcode: _zipNo,
|
||||||
}
|
}
|
||||||
|
|
||||||
get({ url: `https://zipcloud.ibsnet.co.jp/api/search?${queryStringFormatter(params)}` }).then((res) => {
|
get({ url: `https://zipcloud.ibsnet.co.jp/api/search?${queryStringFormatter(params)}` }).then((res) => {
|
||||||
//7830060
|
//7830060
|
||||||
//9302226
|
//9302226
|
||||||
|
//0790177 3개짜리
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
if (res.results != null) {
|
if (res.results != null) {
|
||||||
console.log('주소검색::', res.results)
|
console.log('주소검색::', res.results)
|
||||||
@ -295,6 +299,9 @@ export default function StuffDetail() {
|
|||||||
setPrefValue('')
|
setPrefValue('')
|
||||||
setAreaIdList([])
|
setAreaIdList([])
|
||||||
form.setValue('areaId', '')
|
form.setValue('areaId', '')
|
||||||
|
// form.setValue('areaName', '')
|
||||||
|
setWindSpeedList([])
|
||||||
|
form.setValue('windSpeed', '')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(res.message)
|
alert(res.message)
|
||||||
@ -304,18 +311,39 @@ export default function StuffDetail() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (prefValue !== '') {
|
if (prefValue !== '') {
|
||||||
// console.log('우편번호 검색해서 도도부현골랐을때::::', prefValue)
|
|
||||||
// 발전량시뮬레이션 지역 목록
|
// 발전량시뮬레이션 지역 목록
|
||||||
// /api/object/prefecture/도도부현코드/list
|
// /api/object/prefecture/도도부현코드/list
|
||||||
get({ url: `/api/object/prefecture/${prefValue}/list` }).then((res) => {
|
get({ url: `/api/object/prefecture/${prefValue}/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
console.log('발전량 시뮬레이션::::::::', res)
|
// console.log('발전량 시뮬레이션::::::::', res)
|
||||||
|
form.setValue('areaId', res[0].prefId)
|
||||||
|
form.setValue('areaName', res[0].prefName)
|
||||||
setAreaIdList(res)
|
setAreaIdList(res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, [prefValue])
|
}, [prefValue])
|
||||||
|
|
||||||
|
// 발전량 시뮬레이션 변경
|
||||||
|
const handleAreaIdOnChange = (e) => {
|
||||||
|
form.setValue('areaId', e.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isEmptyArray(areaIdList)) {
|
||||||
|
//도도부현넘기는지 발전량시뮬레이션지역 넘기는지 ->도도부현넘기기
|
||||||
|
console.log('prefName::', form.watch('prefName'))
|
||||||
|
let _prefName = form.watch('prefName')
|
||||||
|
//http://localhost:8080/api/object/windSpeed/兵庫県/list
|
||||||
|
get({ url: `/api/object/windSpeed/${_prefName}/list` }).then((res) => {
|
||||||
|
if (!isEmptyArray(res)) {
|
||||||
|
// console.log('기준풍속결과:::::::::', res)
|
||||||
|
setWindSpeedList(res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [areaIdList])
|
||||||
|
|
||||||
//필수값 다 입력했을때
|
//필수값 다 입력했을때
|
||||||
const onValid = (data) => {
|
const onValid = (data) => {
|
||||||
// 수정모드일때는 PUT
|
// 수정모드일때는 PUT
|
||||||
@ -382,14 +410,6 @@ export default function StuffDetail() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 발전량 시뮬레이션 변경
|
|
||||||
const handleAreaIdOnChange = (e) => {
|
|
||||||
// console.log('가지고있는 도도부현코드:::::::::', prefValue)
|
|
||||||
console.log('발전량시뮬레이션변경:::::::::', e.target.value)
|
|
||||||
form.setValue('areaId', e.target.value)
|
|
||||||
//값 set해주고 그거 useEffect로 기준풍속, 수직적설량 api호출
|
|
||||||
}
|
|
||||||
|
|
||||||
// 물건삭제
|
// 물건삭제
|
||||||
const onDelete = () => {
|
const onDelete = () => {
|
||||||
//http://localhost:8080/api/object/R201TES01240910023
|
//http://localhost:8080/api/object/R201TES01240910023
|
||||||
@ -588,8 +608,14 @@ export default function StuffDetail() {
|
|||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div className="select-wrap" style={{ width: '200px' }}>
|
<div className="select-wrap" style={{ width: '200px' }}>
|
||||||
{areaIdList?.length > 0 && (
|
<select
|
||||||
<select className="select-light" name="areaId" onChange={handleAreaIdOnChange}>
|
className="select-light"
|
||||||
|
name="areaId"
|
||||||
|
onChange={(e) => {
|
||||||
|
form.setValue('areaId', e.target.value)
|
||||||
|
}}
|
||||||
|
disabled={areaIdList?.length > 0 ? false : true}
|
||||||
|
>
|
||||||
{areaIdList.map((row) => {
|
{areaIdList.map((row) => {
|
||||||
return (
|
return (
|
||||||
<option key={row.prefName} value={row.prefId}>
|
<option key={row.prefName} value={row.prefId}>
|
||||||
@ -598,7 +624,6 @@ export default function StuffDetail() {
|
|||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</select>
|
</select>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -610,10 +635,13 @@ export default function StuffDetail() {
|
|||||||
<div className="flx-box">
|
<div className="flx-box">
|
||||||
<div className="select-wrap mr10" style={{ width: '200px' }}>
|
<div className="select-wrap mr10" style={{ width: '200px' }}>
|
||||||
<select className="select-light" name="windSpeed" {...register('windSpeed')}>
|
<select className="select-light" name="windSpeed" {...register('windSpeed')}>
|
||||||
<option value="">기준풍속공통코드?</option>
|
{windSpeedList.map((row) => {
|
||||||
<option value="30">30</option>
|
return (
|
||||||
<option value="50">50</option>
|
<option key={row.windSpeed} value={row.windSpeed}>
|
||||||
<option value="60">60</option>
|
{row.windSpeed}
|
||||||
|
</option>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<span>m/s이하</span>
|
<span>m/s이하</span>
|
||||||
@ -756,233 +784,6 @@ export default function StuffDetail() {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{/* {(editMode === 'NEW' && (
|
|
||||||
<form onSubmit={handleSubmit(onValid)}>
|
|
||||||
<div>
|
|
||||||
<div>(*필수 입력항목)</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>담당자*</label>
|
|
||||||
<input type="text" className="input-origin" {...form.register('dispCompanyName')} />
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>물건구분/물건명*</label>
|
|
||||||
<input type="radio" name="objectStatusId" value="0" id="objectStatus0" {...form.register('objectStatusId')} />
|
|
||||||
<label htmlFor="objectStatus0">신축</label>
|
|
||||||
<input type="radio" name="objectStatusId" value="1" id="objectStatus1" {...form.register('objectStatusId')} />
|
|
||||||
<label htmlFor="objectStatus0">기축</label>
|
|
||||||
<input type="text" className="input-origin" {...form.register('objectName')} />
|
|
||||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
|
||||||
<select name="objectNameOmit" {...register('objectNameOmit')}>
|
|
||||||
<option value="">경칭선택</option>
|
|
||||||
<option value="11">111</option>
|
|
||||||
<option value="22">222</option>
|
|
||||||
<option value="33">333</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>물건명 후리가나</label>
|
|
||||||
<input type="text" className="input-origin" {...form.register('objectNameKana')} />
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>1차 판매점명 / ID</label>
|
|
||||||
<div className="flex w-full max-w-xs flex-col gap2">
|
|
||||||
{saleStoreList?.length > 0 && (
|
|
||||||
<Autocomplete
|
|
||||||
className="max-w-xs"
|
|
||||||
defaultItems={saleStoreList}
|
|
||||||
label="판매점ID자동완성"
|
|
||||||
selectedKey={form.watch('saleStoreId')}
|
|
||||||
{...form.register('saleStoreId')}
|
|
||||||
onSelectionChange={onSelectionChange}
|
|
||||||
>
|
|
||||||
{(option) => <AutocompleteItem key={option.saleStoreId}>{option.saleStoreName}</AutocompleteItem>}
|
|
||||||
</Autocomplete>
|
|
||||||
)}
|
|
||||||
<input type="text" className="input-origin" value={form.watch('saleStoreName')} {...form.register('saleStoreName')} disabled />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>2차 판매점명 / ID</label>
|
|
||||||
<div className="flex w-full max-w-xs flex-col gap2">
|
|
||||||
{otherSaleStoreList?.length > 0 && (
|
|
||||||
<Autocomplete
|
|
||||||
className="max-w-xs"
|
|
||||||
defaultItems={otherSaleStoreList}
|
|
||||||
label="2차판매점ID자동완성"
|
|
||||||
{...form.register('otherSaleStoreId')}
|
|
||||||
onSelectionChange={onSelectionChange2}
|
|
||||||
>
|
|
||||||
{(option) => <AutocompleteItem key={option.saleStoreId}>{option.saleStoreName}</AutocompleteItem>}
|
|
||||||
</Autocomplete>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>우편번호</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-origin"
|
|
||||||
maxLength={7}
|
|
||||||
{...form.register('zipNo', {
|
|
||||||
minLength: { value: 7, message: '7자리만가능' },
|
|
||||||
pattern: { value: /^[0-9]*$/g, message: '숫자만 입력' },
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
<Button isDisabled={!buttonValid} onClick={onSearchPostNumber}>
|
|
||||||
주소검색
|
|
||||||
</Button>
|
|
||||||
*우편번호 7자리를 입력한 후, 주소검색 버튼을 클릭해 주십시오
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>도도부현 / 주소</label>
|
|
||||||
<div className="flex w-full flex-wrap items-end md:flex-nowrap mb-6 md:mb-0 gap-4">
|
|
||||||
{prefCodeList?.length > 0 && (
|
|
||||||
<Select className="max-w-xs" selectedKeys={prefValue} isDisabled {...form.register('prefId')}>
|
|
||||||
{prefCodeList.map((row) => {
|
|
||||||
return <SelectItem key={row.prefId}>{row.prefName}</SelectItem>
|
|
||||||
})}
|
|
||||||
</Select>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="text" className="input-origin" value={form.watch('address')} {...form.register('address')} />
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>발전량시뮬레이션지역</label>
|
|
||||||
{powerSimAreaList?.length > 0 && (
|
|
||||||
<Select
|
|
||||||
className="max-w-xs"
|
|
||||||
selectedKeys={form.watch('powerSimArea')}
|
|
||||||
{...form.register('powerSimArea')}
|
|
||||||
onChange={handlePowerSimAreaOnChange}
|
|
||||||
>
|
|
||||||
{powerSimAreaList.map((row) => {
|
|
||||||
// console.log('row::', row)
|
|
||||||
return (
|
|
||||||
<SelectItem key={row.prefName} value={row.prefId}>
|
|
||||||
{row.prefName}
|
|
||||||
</SelectItem>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</Select>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>기준풍속</label>
|
|
||||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
|
||||||
<select name="windSpeed" {...register('windSpeed')}>
|
|
||||||
<option value="">기준풍속</option>
|
|
||||||
<option value="30">30</option>
|
|
||||||
<option value="50">50</option>
|
|
||||||
<option value="60">60</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>수직적설량</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-origin"
|
|
||||||
maxLength={3}
|
|
||||||
{...form.register('snowCover', {
|
|
||||||
pattern: { value: /^[0-9]*$/g, message: '정수만 입력' },
|
|
||||||
})}
|
|
||||||
/>{' '}
|
|
||||||
cm
|
|
||||||
<Checkbox
|
|
||||||
onValueChange={(e) => {
|
|
||||||
form.setValue('coldAreaChk', e)
|
|
||||||
}}
|
|
||||||
{...form.register('coldAreaChk')}
|
|
||||||
>
|
|
||||||
한랭지대책시행
|
|
||||||
</Checkbox>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>면조도구분</label>
|
|
||||||
<input type="radio" name="surfaceType" value="Ⅲ・Ⅳ" id="surfaceType0" {...form.register('surfaceType')} />
|
|
||||||
<label htmlFor="surfaceType0">Ⅲ・Ⅳ</label>
|
|
||||||
<input type="radio" name="surfaceType" value="Ⅱ" id="surfaceType1" {...form.register('surfaceType')} />
|
|
||||||
<label htmlFor="surfaceType1">Ⅱ</label>
|
|
||||||
<Checkbox
|
|
||||||
{...form.register('saltAreaChk')}
|
|
||||||
onValueChange={(e) => {
|
|
||||||
form.setValue('saltAreaChk', e)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
염해지역용아이템사용
|
|
||||||
</Checkbox>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>설치높이</label>
|
|
||||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
|
||||||
<select name="installHeight" {...register('installHeight')}>
|
|
||||||
<option value="">설치높이</option>
|
|
||||||
<option value="11">111</option>
|
|
||||||
<option value="22">222</option>
|
|
||||||
<option value="33">333</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>계약조건</label>
|
|
||||||
<input type="radio" name="powerConTerms" value="0" id="powerConTerms0" {...form.register('powerConTerms')} />
|
|
||||||
<label htmlFor="powerConTerms0">잉여</label>
|
|
||||||
<input type="radio" name="powerConTerms" value="1" id="powerConTerms1" {...form.register('powerConTerms')} />
|
|
||||||
<label htmlFor="powerConTerms1">전량</label>
|
|
||||||
</div>
|
|
||||||
<div className="form-input">
|
|
||||||
<label>메모</label>
|
|
||||||
<Textarea
|
|
||||||
disableAutosize
|
|
||||||
classNames={{
|
|
||||||
base: 'max-w-xs',
|
|
||||||
input: 'resize-y min-h-[40px]',
|
|
||||||
}}
|
|
||||||
{...form.register('remarks')}
|
|
||||||
onValueChange={(e) => {
|
|
||||||
// console.log('e::::', e)
|
|
||||||
form.setValue('remarks', e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{!isFormValid ? (
|
|
||||||
<>
|
|
||||||
<Button type="submit" onClick={onTempSave}>
|
|
||||||
NEW화면임시저장
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<button type="submit">NEW화면 저장</button>
|
|
||||||
)}
|
|
||||||
<Link href="/management/stuff">
|
|
||||||
<button type="button">NEW화면 물건목록이동</button>
|
|
||||||
</Link>
|
|
||||||
</form>
|
|
||||||
)) || (
|
|
||||||
<>
|
|
||||||
{objectNo.substring(0, 1) === 'R' ? (
|
|
||||||
<>
|
|
||||||
<Link href="/management/stuff">
|
|
||||||
<button type="button">R상세:물건목록</button>
|
|
||||||
</Link>
|
|
||||||
<button type="submit">R상세:저장</button>
|
|
||||||
<button type="submit" onClick={onDelete}>
|
|
||||||
R상세:물건삭제
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Link href="/management/stuff">
|
|
||||||
<button type="button">T상세:물건목록</button>
|
|
||||||
</Link>
|
|
||||||
<button type="submit">T상세:저장</button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)} */}
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import Link from 'next/link'
|
|||||||
import SingleDatePicker from '../common/datepicker/SingleDatePicker'
|
import SingleDatePicker from '../common/datepicker/SingleDatePicker'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
export default function StuffSearchCondition() {
|
export default function StuffSearchCondition() {
|
||||||
const sessionState = useRecoilValue(sessionStore)
|
const sessionState = useRecoilValue(sessionStore)
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ export default function StuffSearchCondition() {
|
|||||||
const resetStuffRecoil = useResetRecoilState(stuffSearchState)
|
const resetStuffRecoil = useResetRecoilState(stuffSearchState)
|
||||||
const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState)
|
const [stuffSearch, setStuffSearch] = useRecoilState(stuffSearchState)
|
||||||
const [objectNo, setObjectNo] = useState('') //물건번호
|
const [objectNo, setObjectNo] = useState('') //물건번호
|
||||||
const [saleStoreId, setSaleStoreId] = useState('') //판매대리점ID
|
// const [saleStoreId, setSaleStoreId] = useState('') //판매대리점ID 세션에서 가져와서세팅
|
||||||
const [address, setAddress] = useState('') //물건주소
|
const [address, setAddress] = useState('') //물건주소
|
||||||
const [objectName, setobjectName] = useState('') //물건명
|
const [objectName, setobjectName] = useState('') //물건명
|
||||||
const [saleStoreName, setSaleStoreName] = useState('') //판매대리점명
|
const [saleStoreName, setSaleStoreName] = useState('') //판매대리점명
|
||||||
@ -60,7 +61,6 @@ export default function StuffSearchCondition() {
|
|||||||
|
|
||||||
setStuffSearch({
|
setStuffSearch({
|
||||||
schObjectNo: stuffSearch?.schObjectNo ? stuffSearch.schObjectNo : objectNo,
|
schObjectNo: stuffSearch?.schObjectNo ? stuffSearch.schObjectNo : objectNo,
|
||||||
schSaleStoreId: stuffSearch?.schSaleStoreId ? stuffSearch.schSaleStoreId : saleStoreId,
|
|
||||||
schAddress: stuffSearch?.schAddress ? stuffSearch.schAddress : address,
|
schAddress: stuffSearch?.schAddress ? stuffSearch.schAddress : address,
|
||||||
schObjectName: stuffSearch?.schObjectName ? stuffSearch.schObjectName : objectName,
|
schObjectName: stuffSearch?.schObjectName ? stuffSearch.schObjectName : objectName,
|
||||||
schSaleStoreName: stuffSearch?.schSaleStoreName ? stuffSearch.schSaleStoreName : saleStoreName,
|
schSaleStoreName: stuffSearch?.schSaleStoreName ? stuffSearch.schSaleStoreName : saleStoreName,
|
||||||
@ -80,7 +80,7 @@ export default function StuffSearchCondition() {
|
|||||||
//초기화
|
//초기화
|
||||||
const resetRecoil = () => {
|
const resetRecoil = () => {
|
||||||
setObjectNo('')
|
setObjectNo('')
|
||||||
setSaleStoreId('')
|
//setSaleStoreId('') //세션정보
|
||||||
setAddress('')
|
setAddress('')
|
||||||
setobjectName('')
|
setobjectName('')
|
||||||
setSaleStoreName('')
|
setSaleStoreName('')
|
||||||
@ -95,14 +95,18 @@ export default function StuffSearchCondition() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('세션정보::::::::', sessionState)
|
if (isObjectNotEmpty(sessionState)) {
|
||||||
get({ url: `/api/object/saleStore/201TES01/list` }).then((res) => {
|
// console.log('판매대리점 리스트 가져오기 위한 세션정보::::::::', sessionState)
|
||||||
|
// storeId가 T01 이거나 1차점일때만 판매대리점 선택 활성화
|
||||||
|
// get({ url: `/api/object/saleStore/201TES01/list` }).then((res) => {
|
||||||
|
get({ url: `/api/object/saleStore/${sessionState?.storeId}/list` }).then((res) => {
|
||||||
if (!isEmptyArray(res)) {
|
if (!isEmptyArray(res)) {
|
||||||
// console.log('판매점 결과:::::', res)
|
// console.log('판매점 결과:::::', res)
|
||||||
setSchSelSaleStoreList(res)
|
setSchSelSaleStoreList(res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, [])
|
}
|
||||||
|
}, [sessionState])
|
||||||
|
|
||||||
//초기화 눌렀을 때 자동완성도..
|
//초기화 눌렀을 때 자동완성도..
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
@ -117,7 +121,7 @@ export default function StuffSearchCondition() {
|
|||||||
const onSelectionChange = (key) => {
|
const onSelectionChange = (key) => {
|
||||||
if (!isEmptyArray(key)) {
|
if (!isEmptyArray(key)) {
|
||||||
setSchSelSaleStoreId(key[0].saleStoreId)
|
setSchSelSaleStoreId(key[0].saleStoreId)
|
||||||
setStuffSearch({ ...stuffSearch, schSelSaleStoreId: key[0].saleStoreId })
|
setStuffSearch({ ...stuffSearch, code: 'S', schSelSaleStoreId: key[0].saleStoreId })
|
||||||
} else {
|
} else {
|
||||||
setSchSelSaleStoreId('')
|
setSchSelSaleStoreId('')
|
||||||
setStuffSearch({ ...stuffSearch, schSelSaleStoreId: '' })
|
setStuffSearch({ ...stuffSearch, schSelSaleStoreId: '' })
|
||||||
@ -192,11 +196,12 @@ export default function StuffSearchCondition() {
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="input-light"
|
className="input-light"
|
||||||
placeholder="판매대리점ID 입력"
|
placeholder="판매대리점명 입력"
|
||||||
value={stuffSearch?.schSaleStoreId ? stuffSearch.schSaleStoreId : saleStoreId}
|
value={stuffSearch?.schSaleStoreName ? stuffSearch.schSaleStoreName : saleStoreName}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSaleStoreId(e.target.value)
|
//setSaleStoreId(e.target.value)
|
||||||
setStuffSearch({ ...stuffSearch, code: 'S', schSaleStoreId: e.target.value })
|
setSaleStoreName(e.target.value)
|
||||||
|
setStuffSearch({ ...stuffSearch, code: 'S', schSaleStoreName: e.target.value })
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -263,6 +268,7 @@ export default function StuffSearchCondition() {
|
|||||||
clearable={true}
|
clearable={true}
|
||||||
onClearAll={handleClear}
|
onClearAll={handleClear}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
disabled={sessionState?.storeLvl === '1' ? false : true}
|
||||||
></Select>
|
></Select>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
import { atom } from 'recoil'
|
import { atom } from 'recoil'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import isLeapYear from 'dayjs/plugin/isLeapYear' // 윤년 판단 플러그인
|
import { v1 } from 'uuid'
|
||||||
dayjs.extend(isLeapYear)
|
|
||||||
export const stuffSearchState = atom({
|
export const stuffSearchState = atom({
|
||||||
key: 'stuffSearchState',
|
key: `stuffSearchState/${v1()}`,
|
||||||
default: {
|
default: {
|
||||||
schObjectNo: '', //물건번호
|
schObjectNo: '', //물건번호
|
||||||
schSaleStoreId: '', //판매대리점ID
|
|
||||||
schAddress: '', //물건주소
|
schAddress: '', //물건주소
|
||||||
schObjectName: '', //물건명
|
schObjectName: '', //물건명
|
||||||
schSaleStoreName: '', //판매대리점명
|
schSaleStoreName: '', //판매대리점명
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user