mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-19 21:15:11 +09:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import axios from 'axios'
|
||||
import {getContractDetail, saveContract} from "/@src/service/contractApi.ts";
|
||||
import {delContAttachFile, getContractDetail, saveContract, updateContract} from "/@src/service/contractApi.ts";
|
||||
import type {iPbAtt} from "/@src/utils/types.ts";
|
||||
import {useRouter} from "vue-router";
|
||||
import {signStart} from "/@src/service/signDocApi.ts";
|
||||
@@ -76,9 +76,7 @@ params.modalColumn = [
|
||||
{ key: 'regNm', label: '선택' },
|
||||
]
|
||||
|
||||
params.contAtts = [
|
||||
{ prcsNo : '', bizNo : '' ,fileOrd : 0 ,logiFnm : '' ,physFnm : '',size : 0 ,data : '' ,path : '' },
|
||||
]
|
||||
params.contAtts = []
|
||||
|
||||
const data = reactive({
|
||||
contractData: [],
|
||||
@@ -209,14 +207,49 @@ const fileInputs = ref([
|
||||
{ file: null, description: '인지세 납부확인서' },
|
||||
])
|
||||
|
||||
const saveContOne = async () => {
|
||||
const updateContOne = async () => {
|
||||
let res = null
|
||||
try{
|
||||
loading.value = true
|
||||
|
||||
const changeFileOrd = []
|
||||
const conAtts = fileInputs.value.map((input, idx) => {
|
||||
// console.log(fileInputs)
|
||||
if(pbAtts.value[idx]) {
|
||||
// console.log('pbAtts.value[idx]', pbAtts.value[idx])
|
||||
changeFileOrd.push(idx)
|
||||
return pbAtts.value[idx]
|
||||
} else if(params.contAtts[idx]) {
|
||||
// console.log('params.contAtts[idx]', params.contAtts[idx])
|
||||
return params.contAtts[idx]
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
})
|
||||
console.log('conAtts', conAtts)
|
||||
|
||||
const paramsCont ={
|
||||
contNo: params.contNo || '',
|
||||
bizNo: completedPriceDataParams.bizNo,
|
||||
prcsNo: completedPriceDataParams.prcsNo || '',
|
||||
compNm: completedPriceDataParams.compNm,
|
||||
contAmt: completedPriceDataParams.contAmt,
|
||||
cateCd: priceSearchCheckBoxStatus.value ? selectedCode.value : completedPriceDataParams.cateCd,
|
||||
title: completedPriceDataParams.title,
|
||||
signDt: formatMonthDate(completedPriceDataParams.signDt),
|
||||
contSdat: formatMonthDate(completedPriceDataParams.contSdat),
|
||||
contEdat: formatMonthDate(completedPriceDataParams.contEdat),
|
||||
reason: completedPriceDataParams.reason || '',
|
||||
excYn: priceSearchCheckBoxStatus.value, // 가격조사 예외여부 확인필요
|
||||
contAtts: conAtts,
|
||||
}
|
||||
console.log(pbAtts)
|
||||
console.log(paramsCont.contAtts)
|
||||
|
||||
const amt = Number(String(completedPriceDataParams.contAmt).replace(/[^0-9]/g, ''))
|
||||
if (amt >= 10000000) {
|
||||
const injiFile = pbAtts.value[6]
|
||||
const injiIdx = fileInputs.value.findIndex(input => input.description === '인지세 납부확인서');
|
||||
const injiFile = injiIdx !== -1 ? paramsCont.contAtts[injiIdx] : null;
|
||||
if (!injiFile || !injiFile.logiFnm) {
|
||||
notyf.error('계약금액이 1,000만원 이상일 경우 인지세 납부확인서 첨부가 필수입니다.')
|
||||
loading.value = false
|
||||
@@ -224,22 +257,30 @@ const saveContOne = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const paramsCont ={
|
||||
prcsNo: completedPriceDataParams.prcsNo,
|
||||
bizNo: completedPriceDataParams.bizNo,
|
||||
cateCd: priceSearchCheckBoxStatus.value ? selectedCode.value : completedPriceDataParams.cateCd,
|
||||
compNm: completedPriceDataParams.compNm,
|
||||
title: completedPriceDataParams.title,
|
||||
contSdat: formatMonthDate(completedPriceDataParams.contSdat),
|
||||
contEdat: formatMonthDate(completedPriceDataParams.contEdat),
|
||||
contAmt: completedPriceDataParams.contAmt,
|
||||
signDt: formatMonthDate(completedPriceDataParams.signDt),
|
||||
reason: completedPriceDataParams.reason,
|
||||
excYn: priceSearchCheckBoxStatus.value, // 가격조사 예외여부 확인필요
|
||||
contAtts: params.contAtts,
|
||||
console.log('changeFileOrd', changeFileOrd)
|
||||
|
||||
// 첨부파일 삭제
|
||||
for(const idx of changeFileOrd) {
|
||||
const file = params.contAtts[idx]
|
||||
if(file){
|
||||
const delParam = [{
|
||||
contNo: file.contNo,
|
||||
fileOrd: file.fileOrd,
|
||||
}]
|
||||
console.log('delParam',delParam)
|
||||
// await delContAttachFile(file)
|
||||
}
|
||||
console.log(pbAtts)
|
||||
res = await saveContract(paramsCont)
|
||||
}
|
||||
|
||||
// 기존 첨부파일 전체 삭제
|
||||
// for (const file of params.contAtts) {
|
||||
// if (file && file.fileOrd !== undefined) {
|
||||
// await delContAttachFile(file) // 서버 파일 삭제 API 호출
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
res = await updateContract(paramsCont)
|
||||
|
||||
if(res.request.status == '200'){
|
||||
notyf.primary('등록 되었습니다.')
|
||||
@@ -254,13 +295,6 @@ const saveContOne = async () => {
|
||||
|
||||
const pbAtts = ref<iPbAtt[]>(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
|
||||
@@ -268,15 +302,14 @@ const onFileChange = (e, idx) => {
|
||||
reader.onload = () => {
|
||||
const result = reader.result
|
||||
const pbAtt = {
|
||||
prcsNo: completedPriceDataParams.prcsNo,
|
||||
contNo: completedPriceDataParams.contNo,
|
||||
fileOrd: idx + 1,
|
||||
logiFnm: file.name,
|
||||
size: file.size,
|
||||
data: result.split(',')[1],
|
||||
}
|
||||
// 인덱스별로 파일 저장
|
||||
pbAtts.value[idx] = pbAtt
|
||||
console.log(pbAtts)
|
||||
console.log(pbAtts.value[idx].logiFnm)
|
||||
}
|
||||
reader.readAsDataURL(file)
|
||||
}
|
||||
@@ -695,7 +728,7 @@ const onChangeSign = async() => {
|
||||
</table>
|
||||
</div>
|
||||
<div class="bottom-button">
|
||||
<VButton @click="saveContOne">수 정</VButton>
|
||||
<VButton @click="updateContOne">수 정</VButton>
|
||||
<VButton v-if="params.contStatCd == '0000'" @click="onChangeSign">전자 결재(등록)</VButton>
|
||||
<!-- todo 전자결재 url 태우기-->
|
||||
<VButton @click="routerMove">취 소</VButton>
|
||||
|
||||
@@ -45,7 +45,6 @@ export async function updateContract(params = {}) {
|
||||
* @returns
|
||||
*/
|
||||
export async function saveContract(params = {}) {
|
||||
console.log(params)
|
||||
try {
|
||||
const result = await axios.post(`/api/cont`,params)
|
||||
return result
|
||||
@@ -87,6 +86,41 @@ export async function getContractDetail(contNo) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 계약관리 삭제
|
||||
* @param {object} params
|
||||
* @property {string} params.contNo -
|
||||
* @property {string} params.bizNo -
|
||||
* @property {string} params.prcsNo -
|
||||
* @property {string} params.title -
|
||||
* @property {string} params.compNm -
|
||||
* @property {string} params.signDt -
|
||||
* @property {string} params.contSdat -
|
||||
* @property {string} params.contEdat -
|
||||
* @property {string} params.amt -
|
||||
* @property {string} params.excYn -
|
||||
* @property {string} params.reason -
|
||||
* @property {string} params.contAtts{fileOrd,logiFnm,data} -
|
||||
* @returns
|
||||
*/
|
||||
export async function delContAttachFile(params = {}) {
|
||||
try {
|
||||
const result = await axios.delete(`/api/cont/${params.contNo}/${params.fileOrd}`)
|
||||
return result
|
||||
} catch (e) {
|
||||
const serverError = e.response?.data;
|
||||
|
||||
const message = typeof serverError?.body === 'string'
|
||||
? serverError.body
|
||||
: 'Unknown error occurred';
|
||||
|
||||
const error = new Error(message); // ✅ 반드시 string만 넣기! 아니면 객체가 문자열로 나옴
|
||||
error.code = serverError?.code;
|
||||
error.errTime = serverError?.errTime;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 계약관리 조회(페이징)
|
||||
* @property {string} params.page - 페이지
|
||||
|
||||
Reference in New Issue
Block a user