diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx
index 6b257645..65a24def 100644
--- a/src/components/estimate/Estimate.jsx
+++ b/src/components/estimate/Estimate.jsx
@@ -9,7 +9,7 @@ import SingleDatePicker from '../common/datepicker/SingleDatePicker'
import EstimateFileUploader from './EstimateFileUploader'
import { useAxios } from '@/hooks/useAxios'
import { globalLocaleStore } from '@/store/localeAtom'
-import { isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
+import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils'
import dayjs from 'dayjs'
import { useCommonCode } from '@/hooks/common/useCommonCode'
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
@@ -61,7 +61,7 @@ export default function Estimate({ params }) {
const objectRecoil = useRecoilValue(floorPlanObjectState)
//견적서 상세데이터
- const { estimateContextState, setEstimateContextState, addItem } = useEstimateController(params.pid)
+ const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(params.pid)
//견적특이사항 List
const [specialNoteList, setSpecialNoteList] = useState([])
@@ -209,11 +209,12 @@ export default function Estimate({ params }) {
}, [files])
useEffect(() => {
- if (originFiles.length > 0) {
- setEstimateContextState({
- originFiles: originFiles,
- })
- }
+ // console.log('USEEFFECT originFiles::::::::::', originFiles)
+ // if (originFiles.length > 0) {
+ // setEstimateContextState({
+ // originFiles: originFiles,
+ // })
+ // }
}, [originFiles])
//상세에서 내려온 첨부파일 set 만들기
@@ -232,10 +233,12 @@ export default function Estimate({ params }) {
file.delFlg = '0'
}
})
-
setOriginFiles((prev) => {
return [...prev]
})
+ setEstimateContextState({
+ originFiles: originFiles,
+ })
}
// 기존첨부파일 삭제 (플래그값 추가?) 저장할때 플래그값에 따라 진짜 삭제
const deleteOriginFile = (no) => {
@@ -245,29 +248,13 @@ export default function Estimate({ params }) {
}
})
- // console.log('originFiles::', originFiles)
setOriginFiles((prev) => {
return [...prev]
})
- // setOriginFiles(originFiles)
- // const delParams = {
- // userId: session.userId,
- // objectNo: objectNo,
- // no: no,
- // }
+ setEstimateContextState({
+ originFiles: originFiles,
+ })
alert(getMessage('estimate.detail.alert.delFile'))
- // await promisePost({ url: 'api/file/fileDelete', data: delParams }).then((res) => {
- // if (res.status === 204) {
- // setOriginFiles(originFiles.filter((file) => file.objectNo === objectNo && file.no !== no))
- // setEstimateContextState({
- // fileList: originFiles.filter((file) => file.objectNo === objectNo && file.no !== no),
- // originFiles: originFiles.filter((file) => file.objectNo === objectNo && file.no !== no),
- // newFileList: originFiles.filter((file) => file.objectNo === objectNo && file.no !== no),
- // })
-
- // alert(getMessage('plan.message.delete'))
- // }
- // })
}
//가격표시 option 목록 최초세팅 && 주문분류 변경시
@@ -446,20 +433,6 @@ export default function Estimate({ params }) {
}
}
}
- // data.data2.map((item2) => {
- // if (item2) {
- // // console.log('프라이싱아이템::::', item2)
- // if (item2.itemId === item.itemId) {
- // updateList.push({
- // ...item,
- // openFlg: item2.unitPrice === '0.0' ? '1' : '0',
- // salePrice: item2.unitPrice === null ? '0' : item2.unitPrice,
- // saleTotPrice: (item.amount * item2.unitPrice).toString(),
- // })
- // checkYn = true
- // }
- // }
- // })
if (!checkYn) {
updateList.push({ ...item, salePrice: '0', saleTotPrice: '0' })
@@ -624,14 +597,12 @@ export default function Estimate({ params }) {
updates.pkgMaterialFlg = res.pkgMaterialFlg
updates.pnowW = res.pnowW
updates.salePrice = res.salePrice
- // updates.salePrice = ''
updates.specification = res.specification
updates.unit = res.unit
updates.specialNoteCd = res.spnAttrCds
updates.itemGroup = res.itemGroup
updates.delFlg = '0' // 삭제플래그 0
updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString()
- // updates.saleTotPrice = ''
updates.amount = ''
updates.openFlg = res.openFlg
@@ -1153,7 +1124,10 @@ export default function Estimate({ params }) {
return (
-
+ handleEstimateFileDownload(originFile)}
+ >
{originFile.faileName}