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