mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 14:13:33 +09:00
first
This commit is contained in:
75
src/service/integratedPayment.ts
Normal file
75
src/service/integratedPayment.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import axios from 'axios'
|
||||
|
||||
/**
|
||||
* 통합결재목록(부서) 조회
|
||||
* @param {object} params
|
||||
* @property {string} params.page - 페이지번호
|
||||
* @property {string} params.row - 행 개수
|
||||
* @property {string} params.title - 제목
|
||||
* @returns
|
||||
*/
|
||||
export async function getIntegratedApproval(params = {}) {
|
||||
try {
|
||||
const result = await axios.get(`/api/itg/appr/req`, {
|
||||
params,
|
||||
headers: { sabun: params.sabun },
|
||||
})
|
||||
console.log(result)
|
||||
if (result.status === 200) {
|
||||
return result.data
|
||||
} else if (result.status >= 500) {
|
||||
throw new Error('서버 오류가 발생했습니다.')
|
||||
} else if (result.status >= 400) {
|
||||
throw new Error('잘못된 요청입니다.')
|
||||
} else {
|
||||
throw new Error(`예상치 못한 상태코드: ${result.status}`)
|
||||
}
|
||||
} 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
|
||||
* @property {string} params.apprNo - 결재번호
|
||||
* @property {string} params.apprOrd - 결재순서
|
||||
* @property {string} params.sabun - 사번
|
||||
* @property {string} params.apprStatCd - 결재상태코드
|
||||
* @property {string} params.reason - 사유 (반려일시 상태코드 0400)
|
||||
* @returns
|
||||
*/
|
||||
export async function updateIntegratedApproval(params = {}) {
|
||||
try {
|
||||
const result = await axios.put(`/api/appr`, params, {
|
||||
headers: { sabun: params.sabun },
|
||||
})
|
||||
if (result.status === 200) {
|
||||
return result.data
|
||||
} else if (result.status >= 500) {
|
||||
throw new Error('서버 오류가 발생했습니다.')
|
||||
} else {
|
||||
throw new Error(`예상치 못한 상태코드: ${result.status}`)
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e.response) {
|
||||
if (e.response.status >= 500) {
|
||||
throw new Error('서버 오류가 발생했습니다.')
|
||||
} else if (e.response.status >= 400) {
|
||||
throw new Error('잘못된 요청입니다.')
|
||||
}
|
||||
}
|
||||
throw new Error(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user