첨부파일 삭제/복원

This commit is contained in:
basssy 2024-12-04 08:50:44 +09:00
parent e1eae2ae45
commit 921b19b7e6

View File

@ -61,7 +61,7 @@ export default function Estimate({ params }) {
const objectRecoil = useRecoilValue(floorPlanObjectState)
//
const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(params.pid)
const { estimateContextState, setEstimateContextState, addItem } = useEstimateController(params.pid)
// List
const [specialNoteList, setSpecialNoteList] = useState([])
@ -120,7 +120,6 @@ export default function Estimate({ params }) {
let url = `/api/estimate/special-note-title-list`
get({ url: url }).then((res) => {
if (isNotEmptyArray(res)) {
// ATTR001ATTR002ATTR003ATTR007ATTR009ATTR010ATTR015ATTR019
if (estimateContextState?.estimateOption) {
res.map((row) => {
let estimateOption = estimateContextState?.estimateOption?.split('、')
@ -226,8 +225,20 @@ export default function Estimate({ params }) {
}
}, [estimateContextState?.fileList])
//
const returnOriginFile = (no) => {
originFiles.map((file) => {
if (file.no === no) {
file.delFlg = '0'
}
})
setOriginFiles((prev) => {
return [...prev]
})
}
// ( ?)
const deleteOriginFile = (objectNo, no) => {
const deleteOriginFile = (no) => {
originFiles.map((file) => {
if (file.no === no) {
file.delFlg = '1'
@ -235,12 +246,15 @@ export default function Estimate({ params }) {
})
// console.log('originFiles::', originFiles)
setOriginFiles(originFiles)
const delParams = {
userId: session.userId,
objectNo: objectNo,
no: no,
}
setOriginFiles((prev) => {
return [...prev]
})
// setOriginFiles(originFiles)
// const delParams = {
// userId: session.userId,
// objectNo: objectNo,
// no: no,
// }
alert(getMessage('estimate.detail.alert.delFile'))
// await promisePost({ url: 'api/file/fileDelete', data: delParams }).then((res) => {
// if (res.status === 204) {
@ -1139,24 +1153,32 @@ export default function Estimate({ params }) {
return (
<li className="file-item" key={uuidv4()}>
<div className="file-item-wrap">
<span>
플래그::::::{originFile.delFlg} ///
<span style={{ display: originFile.delFlg === '0' ? '' : 'none' }}>
{originFile.faileName}
<button
type="button"
className="delete"
onClick={(e) => {
deleteOriginFile(originFile.objectNo, originFile.no)
deleteOriginFile(originFile.no)
e.stopPropagation()
}}
></button>
</span>
{/* <div className="return-wrap">
<div className="return-wrap" style={{ display: originFile.delFlg !== '0' ? '' : 'none' }}>
<span className="return">{originFile.faileName}</span>
<button type="button" className="return-btn">
<button
type="button"
className="return-btn"
onClick={(e) => {
returnOriginFile(originFile.no)
e.stopPropagation()
}}
>
<i className="return-ico"></i>
{getMessage('estimate.detail.fileList2.btn.return')}
</button>
</div> */}
</div>
</div>
</li>
)