|
@@ -1,4 +1,4 @@
|
|
|
-import { getApiBaseUrl, getServerConfig, request } from '@/utils/auth'
|
|
|
|
|
|
|
+import { getServerConfig, request } from '@/utils/auth'
|
|
|
import { resignings, resignStages } from '@/data/mock'
|
|
import { resignings, resignStages } from '@/data/mock'
|
|
|
import {
|
|
import {
|
|
|
addCreatedResignation,
|
|
addCreatedResignation,
|
|
@@ -23,12 +23,6 @@ function isServerMode() {
|
|
|
return getServerConfig().mode === 'server'
|
|
return getServerConfig().mode === 'server'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function serverPath() {
|
|
|
|
|
- const base = getApiBaseUrl()
|
|
|
|
|
- if (!base) throw new Error('缺少服务器地址,请先在登录页右上角配置')
|
|
|
|
|
- return base
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// ============ 枚举 ============
|
|
// ============ 枚举 ============
|
|
|
|
|
|
|
|
// 员工端申请表单(form.vue actionSheet)→ 后端 resignationType 枚举
|
|
// 员工端申请表单(form.vue actionSheet)→ 后端 resignationType 枚举
|
|
@@ -512,7 +506,7 @@ async function fetchEmployeeBrief(userId) {
|
|
|
const key = String(userId)
|
|
const key = String(userId)
|
|
|
if (employeeCache.has(key)) return employeeCache.get(key)
|
|
if (employeeCache.has(key)) return employeeCache.get(key)
|
|
|
try {
|
|
try {
|
|
|
- const res = await request({ url: `${serverPath()}/main/user/getById/${key}`, method: 'GET' })
|
|
|
|
|
|
|
+ const res = await request({ url: `/main/user/getById/${key}`, method: 'GET' })
|
|
|
const vo = res.data || {}
|
|
const vo = res.data || {}
|
|
|
const brief = {
|
|
const brief = {
|
|
|
name: vo.name || vo.userName || '',
|
|
name: vo.name || vo.userName || '',
|
|
@@ -544,20 +538,20 @@ function extrasOf(brief) {
|
|
|
|
|
|
|
|
/** 查询离职单详情 GET /main/resignations/{id} */
|
|
/** 查询离职单详情 GET /main/resignations/{id} */
|
|
|
export async function getResignationById(id) {
|
|
export async function getResignationById(id) {
|
|
|
- const res = await request({ url: `${serverPath()}/main/resignations/${id}`, method: 'GET' })
|
|
|
|
|
|
|
+ const res = await request({ url: `/main/resignations/${id}`, method: 'GET' })
|
|
|
return res.data
|
|
return res.data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 提交离职审批 POST /main/resignations/{id}/submit */
|
|
/** 提交离职审批 POST /main/resignations/{id}/submit */
|
|
|
export async function submitResignation(id) {
|
|
export async function submitResignation(id) {
|
|
|
- const res = await request({ url: `${serverPath()}/main/resignations/${id}/submit`, method: 'POST' })
|
|
|
|
|
|
|
+ const res = await request({ url: `/main/resignations/${id}/submit`, method: 'POST' })
|
|
|
return res.data
|
|
return res.data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 撤回离职审批 POST /main/resignations/{id}/withdraw */
|
|
/** 撤回离职审批 POST /main/resignations/{id}/withdraw */
|
|
|
export async function withdrawResignation(id, reason = '') {
|
|
export async function withdrawResignation(id, reason = '') {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/resignations/${id}/withdraw`,
|
|
|
|
|
|
|
+ url: `/main/resignations/${id}/withdraw`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: compact({ reason }),
|
|
data: compact({ reason }),
|
|
|
})
|
|
})
|
|
@@ -567,7 +561,7 @@ export async function withdrawResignation(id, reason = '') {
|
|
|
/** 取消离职单 POST /main/resignations/cancel/{id}(注意:cancel 在路径中间) */
|
|
/** 取消离职单 POST /main/resignations/cancel/{id}(注意:cancel 在路径中间) */
|
|
|
export async function cancelResignation(id, reason = '') {
|
|
export async function cancelResignation(id, reason = '') {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/resignations/cancel/${id}`,
|
|
|
|
|
|
|
+ url: `/main/resignations/cancel/${id}`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: compact({ reason }),
|
|
data: compact({ reason }),
|
|
|
})
|
|
})
|
|
@@ -576,14 +570,14 @@ export async function cancelResignation(id, reason = '') {
|
|
|
|
|
|
|
|
/** 归档离职单 POST /main/resignations/{id}/archive */
|
|
/** 归档离职单 POST /main/resignations/{id}/archive */
|
|
|
export async function archiveResignation(id) {
|
|
export async function archiveResignation(id) {
|
|
|
- const res = await request({ url: `${serverPath()}/main/resignations/${id}/archive`, method: 'POST' })
|
|
|
|
|
|
|
+ const res = await request({ url: `/main/resignations/${id}/archive`, method: 'POST' })
|
|
|
return res.data
|
|
return res.data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 强制办结离职单 POST /main/resignations/{id}/force-complete(原因必填) */
|
|
/** 强制办结离职单 POST /main/resignations/{id}/force-complete(原因必填) */
|
|
|
export async function forceCompleteResignation(id, reason) {
|
|
export async function forceCompleteResignation(id, reason) {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/resignations/${id}/force-complete`,
|
|
|
|
|
|
|
+ url: `/main/resignations/${id}/force-complete`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: { reason },
|
|
data: { reason },
|
|
|
})
|
|
})
|
|
@@ -593,7 +587,7 @@ export async function forceCompleteResignation(id, reason) {
|
|
|
/** 生成离职交接单 POST /main/resignations/{id}/generate-handover */
|
|
/** 生成离职交接单 POST /main/resignations/{id}/generate-handover */
|
|
|
export async function generateResignationHandover(id) {
|
|
export async function generateResignationHandover(id) {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/resignations/${id}/generate-handover`,
|
|
|
|
|
|
|
+ url: `/main/resignations/${id}/generate-handover`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
})
|
|
})
|
|
|
return res.data
|
|
return res.data
|
|
@@ -602,7 +596,7 @@ export async function generateResignationHandover(id) {
|
|
|
/** 完成离职交接事项 PUT /main/resignations/{id}/handover/items/{itemId}/complete */
|
|
/** 完成离职交接事项 PUT /main/resignations/{id}/handover/items/{itemId}/complete */
|
|
|
export async function completeResignationHandoverItem(resignationId, itemId, remark = '') {
|
|
export async function completeResignationHandoverItem(resignationId, itemId, remark = '') {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/resignations/${resignationId}/handover/items/${itemId}/complete`,
|
|
|
|
|
|
|
+ url: `/main/resignations/${resignationId}/handover/items/${itemId}/complete`,
|
|
|
method: 'PUT',
|
|
method: 'PUT',
|
|
|
data: compact({ reason: remark }),
|
|
data: compact({ reason: remark }),
|
|
|
})
|
|
})
|
|
@@ -612,7 +606,7 @@ export async function completeResignationHandoverItem(resignationId, itemId, rem
|
|
|
/** 分页查询离职交接单 POST /main/handovers/page */
|
|
/** 分页查询离职交接单 POST /main/handovers/page */
|
|
|
export async function getHandoverPage(params = {}) {
|
|
export async function getHandoverPage(params = {}) {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/handovers/page`,
|
|
|
|
|
|
|
+ url: `/main/handovers/page`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: compact({
|
|
data: compact({
|
|
|
pageNum: params.pageNum,
|
|
pageNum: params.pageNum,
|
|
@@ -627,20 +621,20 @@ export async function getHandoverPage(params = {}) {
|
|
|
|
|
|
|
|
/** 查询离职交接单 GET /main/handovers/{id} */
|
|
/** 查询离职交接单 GET /main/handovers/{id} */
|
|
|
export async function getHandoverDetail(id) {
|
|
export async function getHandoverDetail(id) {
|
|
|
- const res = await request({ url: `${serverPath()}/main/handovers/${id}`, method: 'GET' })
|
|
|
|
|
|
|
+ const res = await request({ url: `/main/handovers/${id}`, method: 'GET' })
|
|
|
return res.data
|
|
return res.data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 删除离职交接单 DELETE /main/handovers/{id} */
|
|
/** 删除离职交接单 DELETE /main/handovers/{id} */
|
|
|
export async function deleteHandover(id) {
|
|
export async function deleteHandover(id) {
|
|
|
- const res = await request({ url: `${serverPath()}/main/handovers/${id}`, method: 'DELETE' })
|
|
|
|
|
|
|
+ const res = await request({ url: `/main/handovers/${id}`, method: 'DELETE' })
|
|
|
return res.data
|
|
return res.data
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 回退离职交接事项 PUT /main/handovers/{id}/items/{itemId}/rollback */
|
|
/** 回退离职交接事项 PUT /main/handovers/{id}/items/{itemId}/rollback */
|
|
|
export async function rollbackHandoverItem(handoverId, itemId, reason = '') {
|
|
export async function rollbackHandoverItem(handoverId, itemId, reason = '') {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/handovers/${handoverId}/items/${itemId}/rollback`,
|
|
|
|
|
|
|
+ url: `/main/handovers/${handoverId}/items/${itemId}/rollback`,
|
|
|
method: 'PUT',
|
|
method: 'PUT',
|
|
|
data: compact({ rollbackReason: reason }),
|
|
data: compact({ rollbackReason: reason }),
|
|
|
})
|
|
})
|
|
@@ -650,7 +644,7 @@ export async function rollbackHandoverItem(handoverId, itemId, reason = '') {
|
|
|
/** 套用离职交接模板 POST /main/handovers/{id}/templates/{templateId}/apply */
|
|
/** 套用离职交接模板 POST /main/handovers/{id}/templates/{templateId}/apply */
|
|
|
export async function applyHandoverTemplate(handoverId, templateId) {
|
|
export async function applyHandoverTemplate(handoverId, templateId) {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/handovers/${handoverId}/templates/${templateId}/apply`,
|
|
|
|
|
|
|
+ url: `/main/handovers/${handoverId}/templates/${templateId}/apply`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
})
|
|
})
|
|
|
return res.data
|
|
return res.data
|
|
@@ -744,7 +738,7 @@ export async function loadResignationList(params = {}) {
|
|
|
let rows = []
|
|
let rows = []
|
|
|
try {
|
|
try {
|
|
|
const res = await request({
|
|
const res = await request({
|
|
|
- url: `${serverPath()}/main/resignations/page`,
|
|
|
|
|
|
|
+ url: `/main/resignations/page`,
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
data: compact({ pageNum, size, resignationNo: keyword || undefined }),
|
|
data: compact({ pageNum, size, resignationNo: keyword || undefined }),
|
|
|
})
|
|
})
|
|
@@ -971,7 +965,7 @@ export async function submitResignationApplication(payload) {
|
|
|
return Date.now()
|
|
return Date.now()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const path = `${serverPath()}/hr/ess/mobile/applications/resignation`
|
|
|
|
|
|
|
+ const path = `/hr/ess/mobile/applications/resignation`
|
|
|
const res = await request({ url: path, method: 'POST', data: payload })
|
|
const res = await request({ url: path, method: 'POST', data: payload })
|
|
|
const id = Number(res.data)
|
|
const id = Number(res.data)
|
|
|
return Number.isFinite(id) ? id : 0
|
|
return Number.isFinite(id) ? id : 0
|