견적서 상세

This commit is contained in:
basssy 2024-11-26 11:59:24 +09:00
parent 5d8837b1c4
commit 82dbd1fc1b

View File

@ -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)
// //ATTR001ATTR002ATTR009ATTR010
// 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,