견적서 상세

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' 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)
// //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 //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,