diff --git a/src/pages/app/ContractInsert.vue b/src/pages/app/ContractInsert.vue index bdd5938..8c71b5e 100644 --- a/src/pages/app/ContractInsert.vue +++ b/src/pages/app/ContractInsert.vue @@ -2,6 +2,7 @@ import axios from 'axios' import {saveContract} from "/@src/service/contract.ts"; +import type {iPbAtt} from "/@src/utils/types.ts"; const registerFormOpen = ref(false) const loading = ref(false) @@ -23,6 +24,7 @@ const params = reactive({ row: 10, flexColumn: [], modalColumn: [], + contAtts: [], //첨부파일 데이터 }) const completedPriceDataParams = reactive({ @@ -44,6 +46,7 @@ const completedPriceDataParams = reactive({ svyDt:'', reason:'', estimates: [], + exeYn: false, page: 1, row: 5, }) @@ -171,15 +174,6 @@ const fileInputs = ref([ { file: null, description: '기타' } ]) -function handleFileChange(e, idx) { - const files = e.target.files - if (files && files.length > 0) { - fileInputs.value[idx].file = files[0] - } else { - fileInputs.value[idx].file = null - } -} - const saveContOne = async () => { let res = null try{ @@ -198,6 +192,7 @@ const saveContOne = async () => { signDt: formatMonthDate(completedPriceDataParams.svyDt), reason: completedPriceDataParams.reason, exeYn: true, // 가격조사 예외여부 확인필요 + // contAtts: pbAtts.value., // cateCd: completedPriceDataParams.cateCd, // cateNm: completedPriceDataParams.cateNm, // content: completedPriceDataParams.content, @@ -208,7 +203,7 @@ const saveContOne = async () => { // stNm: completedPriceDataParams.stNm, } - + console.log(pbAtts) res = await saveContract(paramsCont) if(res.request.status == '200'){ @@ -222,6 +217,27 @@ const saveContOne = async () => { } } +const pbAtts = ref([params.contAtts]) + +const onFileChange = (e, idx) => { + const file = e.target.files[0] + if (!file) return + const reader = new FileReader() + reader.onload = () => { + const result = reader.result + const pbAtt = { + prcsNo: completedPriceDataParams.prcsNo, + logiFnm: file.name, + size: file.size, + data: result.split(',')[1], + } + // 인덱스별로 파일 저장 + pbAtts.value[idx] = pbAtt + console.log(pbAtts) + console.log(pbAtts.value[0].logiFnm) + } + reader.readAsDataURL(file) +} @@ -501,11 +517,13 @@ const saveContOne = async () => { 파일선택 - {{ input.file ? input.file.name : '첨부된 파일 없음' }} + + {{ pbAtts[idx] == null ? '' : pbAtts[idx].logiFnm }} + {{ input.description }}