mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 03:12:27 +09:00
func : 기존 첨부파일 받기코드 완성
- API 필요로 추후 테스트 issue : 수정폼의 수정기능 500에러 확인 - 금일 가격조사 첨부파일 관련 에러났던것처럼 백엔드쪽 의심
This commit is contained in:
@@ -17,7 +17,6 @@ const priceSearchCheckBoxStatus = ref(false)
|
|||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
|
|
||||||
onBeforeMount(async ()=>{
|
onBeforeMount(async ()=>{
|
||||||
console.log(history.state.key)
|
|
||||||
const result = await getContractDetail(history.state.key)
|
const result = await getContractDetail(history.state.key)
|
||||||
getDetailList(result)
|
getDetailList(result)
|
||||||
})
|
})
|
||||||
@@ -42,8 +41,6 @@ const params = reactive({
|
|||||||
contAtts: [], //첨부파일 데이터
|
contAtts: [], //첨부파일 데이터
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const completedPriceDataParams = reactive({
|
const completedPriceDataParams = reactive({
|
||||||
prcsNo:'',
|
prcsNo:'',
|
||||||
cateCd:'',
|
cateCd:'',
|
||||||
@@ -82,7 +79,6 @@ params.contAtts = [
|
|||||||
{ prcsNo : '', bizNo : '' ,fileOrd : 0 ,logiFnm : '' ,physFnm : '',size : 0 ,data : '' ,path : '' },
|
{ prcsNo : '', bizNo : '' ,fileOrd : 0 ,logiFnm : '' ,physFnm : '',size : 0 ,data : '' ,path : '' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
contractData: [],
|
contractData: [],
|
||||||
completedPriceSearchData: [],
|
completedPriceSearchData: [],
|
||||||
@@ -118,6 +114,7 @@ function getDetailList(arg){
|
|||||||
completedPriceDataParams.signDt = arg.signDt
|
completedPriceDataParams.signDt = arg.signDt
|
||||||
params.contStatCd = arg.contStatCd
|
params.contStatCd = arg.contStatCd
|
||||||
params.contNo = arg.contNo
|
params.contNo = arg.contNo
|
||||||
|
params.contAtts = arg.contAtts
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatMonthDate(dateStr) {
|
function formatMonthDate(dateStr) {
|
||||||
@@ -200,7 +197,7 @@ function handlePriceRowClick(row) {
|
|||||||
console.log(completedPriceDataParams.estimates)
|
console.log(completedPriceDataParams.estimates)
|
||||||
}
|
}
|
||||||
|
|
||||||
const showFileInputs = ref(false)
|
const showFileInputs = ref(true)
|
||||||
const fileInputs = ref([
|
const fileInputs = ref([
|
||||||
{ file: null, description: '시행 품의문' },
|
{ file: null, description: '시행 품의문' },
|
||||||
{ file: null, description: '소액수의계약서' },
|
{ file: null, description: '소액수의계약서' },
|
||||||
@@ -256,6 +253,13 @@ const saveContOne = async () => {
|
|||||||
|
|
||||||
const pbAtts = ref<iPbAtt[]>(params.contAtts)
|
const pbAtts = ref<iPbAtt[]>(params.contAtts)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => params.contAtts,
|
||||||
|
(newContAtts) => {
|
||||||
|
pbAtts.value = newContAtts.map(() => null)
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true }
|
||||||
|
)
|
||||||
const onFileChange = (e, idx) => {
|
const onFileChange = (e, idx) => {
|
||||||
const file = e.target.files[0]
|
const file = e.target.files[0]
|
||||||
if (!file) return
|
if (!file) return
|
||||||
@@ -276,6 +280,20 @@ const onFileChange = (e, idx) => {
|
|||||||
reader.readAsDataURL(file)
|
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() {
|
function resetForm() {
|
||||||
completedPriceDataParams.prcsNo = ''
|
completedPriceDataParams.prcsNo = ''
|
||||||
completedPriceDataParams.bizNo = ''
|
completedPriceDataParams.bizNo = ''
|
||||||
@@ -350,6 +368,7 @@ const onChangeSign = async() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -624,13 +643,12 @@ const onChangeSign = async() => {
|
|||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td colspan="7">
|
<td colspan="7">
|
||||||
<div v-if="showFileInputs" class="file-upload-list" style="margin-top:10px;">
|
<div class="file-upload-list" style="margin-top:10px;">
|
||||||
<div
|
<div
|
||||||
v-for="(input, idx) in fileInputs"
|
v-for="(input, idx) in fileInputs"
|
||||||
:key="idx"
|
:key="idx"
|
||||||
style="display: flex; align-items: center; margin-bottom: 8px;"
|
style="display: flex; align-items: center; margin-bottom: 8px;"
|
||||||
>
|
>
|
||||||
<!-- 파일선택 -->
|
|
||||||
<label class="file-label" style="margin-right: 10px;">
|
<label class="file-label" style="margin-right: 10px;">
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
@@ -640,15 +658,66 @@ const onChangeSign = async() => {
|
|||||||
<span class="file-cta">파일선택</span>
|
<span class="file-cta">파일선택</span>
|
||||||
</label>
|
</label>
|
||||||
<span style="flex:1; margin-right: 10px;">
|
<span style="flex:1; margin-right: 10px;">
|
||||||
{{ pbAtts[idx] == null ? '' : pbAtts[idx].logiFnm }}
|
{{ pbAtts[idx]?.logiFnm || params.contAtts?.[idx]?.logiFnm || '' }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="input.description != '인지세 납부확인서'" style="flex:2; color: #666;">{{ input.description }}</span>
|
<!-- 설명/인지세 안내는 등록폼과 동일하게 -->
|
||||||
<span v-if="input.description == '인지세 납부확인서'" style="flex:2; color: #666;">{{ input.description }}
|
<span v-if="input.description != '인지세 납부확인서'" style="flex:2; color: #666;">
|
||||||
<span style="color:red" >{{"(계약금액이 1,000만원 이상일 경우 인지세 납부확인서 첨부가 필수입니다.)"}}</span>
|
{{ input.description }}
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="input.description == '인지세 납부확인서'" style="flex:2; color: #666;">
|
||||||
|
{{ input.description }}
|
||||||
|
<span style="color:red">(계약금액이 1,000만원 이상일 경우 인지세 납부확인서 첨부가 필수입니다.)</span>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<template v-if="pbAtts[idx] || params.contAtts?.[idx]">
|
||||||
|
<VButton
|
||||||
|
v-if="params.contAtts?.[idx]"
|
||||||
|
color="primary"
|
||||||
|
size="big"
|
||||||
|
style="margin-right:8px; width: 10%"
|
||||||
|
@click="downloadFile(params.contAtts[idx])"
|
||||||
|
>
|
||||||
|
다운로드
|
||||||
|
</VButton>
|
||||||
|
<VButton
|
||||||
|
color="danger"
|
||||||
|
size="big"
|
||||||
|
style="width: 10%"
|
||||||
|
@click="removeFile(idx)"
|
||||||
|
>
|
||||||
|
삭제
|
||||||
|
</VButton>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- <td colspan="7">-->
|
||||||
|
<!-- <div v-if="showFileInputs" class="file-upload-list" style="margin-top:10px;">-->
|
||||||
|
<!-- <div-->
|
||||||
|
<!-- v-for="(input, idx) in fileInputs"-->
|
||||||
|
<!-- :key="idx"-->
|
||||||
|
<!-- style="display: flex; align-items: center; margin-bottom: 8px;"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- <!– 파일선택 –>-->
|
||||||
|
<!-- <label class="file-label" style="margin-right: 10px;">-->
|
||||||
|
<!-- <input-->
|
||||||
|
<!-- type="file"-->
|
||||||
|
<!-- class="file-input"-->
|
||||||
|
<!-- @change="(e) => onFileChange(e, idx)"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- <span class="file-cta">파일선택</span>-->
|
||||||
|
<!-- </label>-->
|
||||||
|
<!-- <span style="flex:1; margin-right: 10px;">-->
|
||||||
|
<!-- {{ pbAtts[idx] == null ? '' : pbAtts[idx].logiFnm }}-->
|
||||||
|
<!-- </span>-->
|
||||||
|
<!-- <span v-if="input.description != '인지세 납부확인서'" style="flex:2; color: #666;">{{ input.description }}</span>-->
|
||||||
|
<!-- <span v-if="input.description == '인지세 납부확인서'" style="flex:2; color: #666;">{{ input.description }}-->
|
||||||
|
<!-- <span style="color:red" >{{"(계약금액이 1,000만원 이상일 경우 인지세 납부확인서 첨부가 필수입니다.)"}}</span>-->
|
||||||
|
<!-- </span>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </td>-->
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user