견적서 상세
This commit is contained in:
parent
5d8837b1c4
commit
82dbd1fc1b
@ -20,6 +20,7 @@ import ProductFeaturesPop from './popup/ProductFeaturesPop'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
export default function Estimate({ params }) {
|
||||
const [specialNoteFirstFlg, setSpecialNoteFirstFlg] = useState(false)
|
||||
const fixedKey = 'itemKey'
|
||||
const [itemChangeYn, setItemChangeYn] = useState(false)
|
||||
const { session } = useContext(SessionContext)
|
||||
@ -102,33 +103,80 @@ export default function Estimate({ params }) {
|
||||
useEffect(() => {
|
||||
//견적특이사항 API호출
|
||||
//여러개 선택하면 구분자로 (、)
|
||||
let url = `/api/estimate/special-note-list`
|
||||
get({ url: url }).then((res) => {
|
||||
if (isNotEmptyArray(res)) {
|
||||
if (estimateContextState?.estimateOption) {
|
||||
res.map((row) => {
|
||||
let estimateOption = estimateContextState?.estimateOption?.split('、')
|
||||
row.check = false
|
||||
estimateOption.map((row2) => {
|
||||
if (row2 === row.code) {
|
||||
if (!specialNoteFirstFlg) {
|
||||
let url = `/api/estimate/special-note-list`
|
||||
get({ url: url }).then((res) => {
|
||||
if (isNotEmptyArray(res)) {
|
||||
if (estimateContextState?.estimateOption) {
|
||||
res.map((row) => {
|
||||
let estimateOption = estimateContextState?.estimateOption?.split('、')
|
||||
row.check = false
|
||||
estimateOption.map((row2) => {
|
||||
if (row2 === row.code) {
|
||||
row.check = true
|
||||
}
|
||||
})
|
||||
//detail과 상관없이 디폴트 체크목록
|
||||
//ATTR003,ATTR007
|
||||
if (row.code === 'ATTR003') {
|
||||
row.check = true
|
||||
}
|
||||
if (row.code === 'ATTR007') {
|
||||
row.check = true
|
||||
}
|
||||
})
|
||||
//detail과 상관없이 디폴트 체크목록
|
||||
//ATTR003,ATTR007
|
||||
if (row.code === 'ATTR003') {
|
||||
row.check = true
|
||||
}
|
||||
if (row.code === 'ATTR007') {
|
||||
row.check = true
|
||||
}
|
||||
})
|
||||
setSpecialNoteList(res)
|
||||
|
||||
setSpecialNoteList(res)
|
||||
|
||||
setSpecialNoteFirstFlg(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}, [estimateContextState?.estimateOption])
|
||||
|
||||
//변경버전
|
||||
// useEffect(() => {
|
||||
// //견적특이사항 API호출
|
||||
// //여러개 선택하면 구분자로 (、)
|
||||
// let url = `/api/estimate/special-note-title-list`
|
||||
// // let url = `/api/estimate/special-note-list`
|
||||
// get({ url: url }).then((res) => {
|
||||
// if (isNotEmptyArray(res)) {
|
||||
// if (estimateContextState?.estimateOption) {
|
||||
// res.map((row) => {
|
||||
// // console.log('API결과:::', row)
|
||||
// //ATTR001、ATTR002、ATTR009、ATTR010
|
||||
// let estimateOption = estimateContextState?.estimateOption?.split('、')
|
||||
// row.check = false
|
||||
// estimateOption.map((row2) => {
|
||||
// if (row.pkgYn === '0') {
|
||||
// if (row2 === row.code) {
|
||||
// row.check = true
|
||||
// }
|
||||
// } else {
|
||||
// if (row.code.includes(row2)) {
|
||||
// row.check = true
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// //detail과 상관없이 디폴트 체크목록
|
||||
// //ATTR003,ATTR007
|
||||
// if (row.code === 'ATTR003') {
|
||||
// row.check = true
|
||||
// }
|
||||
// if (row.code === 'ATTR007') {
|
||||
// row.check = true
|
||||
// }
|
||||
// })
|
||||
|
||||
// setSpecialNoteList(res)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }, [estimateContextState?.estimateOption])
|
||||
|
||||
//API데이터로 견적일 셋팅
|
||||
let begin = 1
|
||||
useEffect(() => {
|
||||
@ -141,7 +189,9 @@ export default function Estimate({ params }) {
|
||||
//견적일 set
|
||||
useEffect(() => {
|
||||
let estimateDate = dayjs(startDate).format('YYYY-MM-DD')
|
||||
setEstimateContextState({ estimateDate: estimateDate })
|
||||
if (begin === 1) {
|
||||
setEstimateContextState({ estimateDate: estimateDate })
|
||||
}
|
||||
}, [startDate])
|
||||
|
||||
useEffect(() => {
|
||||
@ -335,7 +385,6 @@ export default function Estimate({ params }) {
|
||||
updateList.push({ ...item, salePrice: '0', saleTotPrice: '0' })
|
||||
}
|
||||
})
|
||||
|
||||
setEstimateContextState({
|
||||
priceCd: showPriceCd,
|
||||
itemList: updateList,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user