mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 07:33:32 +09:00
func : 계약관리 첨부파일 기능 추가중
This commit is contained in:
@@ -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<iPbAtt[]>([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)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -501,11 +517,13 @@ const saveContOne = async () => {
|
||||
<input
|
||||
type="file"
|
||||
class="file-input"
|
||||
@change="e => handleFileChange(e, idx)"
|
||||
@change="(e) => onFileChange(e, idx)"
|
||||
/>
|
||||
<span class="file-cta">파일선택</span>
|
||||
</label>
|
||||
<span style="flex:1; margin-right: 10px;">{{ input.file ? input.file.name : '첨부된 파일 없음' }}</span>
|
||||
<span style="flex:1; margin-right: 10px;">
|
||||
{{ pbAtts[idx] == null ? '' : pbAtts[idx].logiFnm }}
|
||||
</span>
|
||||
<span style="flex:2; color: #666;">{{ input.description }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user