func : 계약관리 수정 폼 작성

This commit is contained in:
Yesol Choi
2025-05-27 14:08:17 +09:00
parent c39290f146
commit b82053a51d
3 changed files with 747 additions and 22 deletions

View File

@@ -1,26 +1,37 @@
import axios from 'axios'
/**
* 계약관리 조회(페이징)
* @property {string} params.page - 페이지
* @property {string} params.row - 아이템갯수
*
*/``
export async function getContractList(params = {}) {
try {
const result = await axios.get(`/api/cont/page`,params)
return result.data
* 계약관리 수정
* @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 updateContract(params = {}) {
try {
const result = await axios.put(`/api/cont`,params)
return result
} catch (e) {
if (e.response) {
if (e.response.status >= 500) {
throw new Error('서버 오류가 발생했습니다.')
} else if (e.response.status >= 400) {
throw new Error('잘못된 요청입니다.')
} else if (e.response._data && e.response._data.message) {
throw new Error(e.response._data.message)
}
}
throw new Error(e.message || '알 수 없는 오류')
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;
}
}
@@ -41,6 +52,100 @@ export async function saveContract(params = {}) {
} 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;
}
}
/**
* 계약관리 상세조회
* @param {object} params
* @property {string} params.contNo -계약번호
* @returns
*/
export async function getContractDetail(contNo) {
try {
const result = await axios.get(`/api/cont/${contNo}`)
return result.data
} 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 - 페이지
* @property {string} params.row - 아이템갯수
*
*/``
export async function getContractList(params = {}) {
try {
const result = await axios.get(`/api/cont/page`,params)
return result.data
} catch (e) {
if (e.response) {
if (e.response.status >= 500) {
throw new Error('서버 오류가 발생했습니다.')
} else if (e.response.status >= 400) {
throw new Error('잘못된 요청입니다.')
} else if (e.response._data && e.response._data.message) {
throw new Error(e.response._data.message)
}
}
throw new Error(e.message || '알 수 없는 오류')
}
}
/**
* 계약관리 - 가격조사 가져오기
* @param {object} params
* @returns
*/
export async function getPriceList() {
try {
const result = await axios.get(`/api/cont/prcs`)
return result.data
} 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;
}
}
/**
* 계약관리 회수 처리
* @param {object} contNo
* @returns
*/
export async function getPrice(contNo) {
try {
const result = await axios.put(`/api/cont/ret/${contNo}`)
return result.data
} catch (e) {
const serverError = e.response?.data;
const message = typeof serverError?.body === 'string'
? serverError.body
: 'Unknown error occurred';