diff --git a/src/pages/app/contractUpdate.vue b/src/pages/app/contractUpdate.vue index 07cf87b..1ac241f 100644 --- a/src/pages/app/contractUpdate.vue +++ b/src/pages/app/contractUpdate.vue @@ -5,6 +5,7 @@ import {delContAttachFile, getContractDetail, saveContract, updateContract} from import type {iPbAtt} from "/@src/utils/types.ts"; import {useRouter} from "vue-router"; import {signStart} from "/@src/service/signDocApi.ts"; +import {deletePrcsFile} from "/@src/service/priceApi.ts"; const registerFormOpen = ref(false) @@ -114,6 +115,10 @@ function getDetailList(arg){ params.contStatCd = arg.contStatCd params.contNo = arg.contNo params.contAtts = arg.contAtts + // params.contAtts = arg.contAtts.map((item: any, index: any) => ({ + // ...item, + // description: fileInputs.value[index]?.description || '', + // }) } function formatMonthDate(dateStr) { @@ -314,13 +319,35 @@ const onFileChange = (e, idx) => { reader.readAsDataURL(file) } -function removeFile(idx) { - pbAtts.value[idx] = null - params.contAtts[idx] = null +// function removeFile(idx, input) { +// console.log("input",input) +// pbAtts.value[idx] = null +// params.contAtts[idx] = null +// } + +const removeFile = async (contNo: string, index: number, fileOrd: number) => { + notyf.dismissAll() + const confirmed = confirm('삭제하시겠습니까?') + if (!contNo) { + if (confirmed){ + pbAtts.value.splice(index, 1) + console.log("index",index) + console.log("fileOrd",fileOrd) + } + } else { + if (confirmed) { + await delContAttachFile(contNo, fileOrd).then((res: string) => { + notyf.success(res) + pbAtts.value.splice(index, 1) + }).catch((err) => { + notyf.error('삭제 중 오류가 발생했습니다.') + console.error(err) + }) + } + } } function downloadFile(file) { - console.log(file) file.path = `https://svcm.hmsn.ink/api/cont/${file.contNo}/${file.fileOrd}` window.open(file.path, '_blank') return @@ -676,29 +703,29 @@ const onChangeSign = async() => {
- {{ pbAtts[idx]?.logiFnm || params.contAtts?.[idx]?.logiFnm || '' }} + {{ pbAtts[f.fileOrd]?.logiFnm || params.contAtts?.[f.fileOrd]?.logiFnm || '' }}
-