diff --git a/src/pages/app/contractUpdate.vue b/src/pages/app/contractUpdate.vue index 8f10af6..d3927ef 100644 --- a/src/pages/app/contractUpdate.vue +++ b/src/pages/app/contractUpdate.vue @@ -17,7 +17,6 @@ const priceSearchCheckBoxStatus = ref(false) const isLoading = ref(false) onBeforeMount(async ()=>{ - console.log(history.state.key) const result = await getContractDetail(history.state.key) getDetailList(result) }) @@ -42,8 +41,6 @@ const params = reactive({ contAtts: [], //첨부파일 데이터 }) - - const completedPriceDataParams = reactive({ prcsNo:'', cateCd:'', @@ -82,7 +79,6 @@ params.contAtts = [ { prcsNo : '', bizNo : '' ,fileOrd : 0 ,logiFnm : '' ,physFnm : '',size : 0 ,data : '' ,path : '' }, ] - const data = reactive({ contractData: [], completedPriceSearchData: [], @@ -118,6 +114,7 @@ function getDetailList(arg){ completedPriceDataParams.signDt = arg.signDt params.contStatCd = arg.contStatCd params.contNo = arg.contNo + params.contAtts = arg.contAtts } function formatMonthDate(dateStr) { @@ -200,7 +197,7 @@ function handlePriceRowClick(row) { console.log(completedPriceDataParams.estimates) } -const showFileInputs = ref(false) +const showFileInputs = ref(true) const fileInputs = ref([ { file: null, description: '시행 품의문' }, { file: null, description: '소액수의계약서' }, @@ -256,6 +253,13 @@ const saveContOne = async () => { const pbAtts = ref(params.contAtts) +watch( + () => params.contAtts, + (newContAtts) => { + pbAtts.value = newContAtts.map(() => null) + }, + { immediate: true, deep: true } +) const onFileChange = (e, idx) => { const file = e.target.files[0] if (!file) return @@ -276,6 +280,20 @@ const onFileChange = (e, idx) => { reader.readAsDataURL(file) } +function removeFile(idx) { + pbAtts.value[idx] = null // 신규 파일 제거 + params.contAtts[idx] = null // 기존 파일도 제거(화면상 표시 안 됨) +} + +// [추가] 다운로드 버튼: 기존 파일 다운로드 +function downloadFile(file) { + // file.path가 실제 다운로드 가능한 URL이면 바로 열기 + console.log(file) + file.path = `https://svcm.hmsn.ink/api/cont/${file.contNo}/${file.fileOrd}` + window.open(file.path, '_blank') + return +} + function resetForm() { completedPriceDataParams.prcsNo = '' completedPriceDataParams.bizNo = '' @@ -350,6 +368,7 @@ const onChangeSign = async() => { } } +