feat: 增强员工管理与报销单全流程功能
- 新增员工Excel导入服务(employee_spreadsheet)及导入/导出API端点 - 员工服务增加批量创建、邮箱唯一校验、组织架构关联等能力 - 报销单提交补充身份回填、部门信息透传及预审结果展示优化 - 认证流程增加部门信息(departmentName)并在schema中同步扩展 - 用户Agent服务增加部门关联与报销单回填逻辑 - 前端员工管理页面全面重构,新增导入导出、搜索过滤、分页等功能 - 前端审批中心、审计、差旅报销等视图交互与样式优化 - 新增TableLoadingState共享组件及员工导入测试用例
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { apiRequest } from './api.js'
|
||||
|
||||
export function fetchEmployees(params = {}) {
|
||||
function buildEmployeesQuery(params = {}) {
|
||||
const search = new URLSearchParams()
|
||||
|
||||
if (params.status && params.status !== '全部员工') {
|
||||
@@ -11,10 +11,54 @@ export function fetchEmployees(params = {}) {
|
||||
search.set('keyword', params.keyword)
|
||||
}
|
||||
|
||||
const query = search.toString()
|
||||
return search
|
||||
}
|
||||
|
||||
export function fetchEmployees(params = {}) {
|
||||
const query = buildEmployeesQuery(params).toString()
|
||||
return apiRequest(`/employees${query ? `?${query}` : ''}`)
|
||||
}
|
||||
|
||||
function triggerBlobDownload(blob, filename) {
|
||||
const objectUrl = URL.createObjectURL(blob)
|
||||
const anchor = document.createElement('a')
|
||||
anchor.href = objectUrl
|
||||
anchor.download = filename
|
||||
anchor.rel = 'noopener'
|
||||
document.body.appendChild(anchor)
|
||||
anchor.click()
|
||||
anchor.remove()
|
||||
URL.revokeObjectURL(objectUrl)
|
||||
}
|
||||
|
||||
export async function downloadEmployeeImportTemplate() {
|
||||
const blob = await apiRequest('/employees/import-template', {
|
||||
responseType: 'blob',
|
||||
contentType: null
|
||||
})
|
||||
triggerBlobDownload(blob, '员工导入模板.xlsx')
|
||||
}
|
||||
|
||||
export async function exportEmployees(params = {}) {
|
||||
const query = buildEmployeesQuery(params).toString()
|
||||
const blob = await apiRequest(`/employees/export${query ? `?${query}` : ''}`, {
|
||||
responseType: 'blob',
|
||||
contentType: null
|
||||
})
|
||||
triggerBlobDownload(blob, '员工目录导出.xlsx')
|
||||
}
|
||||
|
||||
export function importEmployees(file) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
return apiRequest('/employees/import', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
contentType: null
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchEmployeeMeta() {
|
||||
return apiRequest('/employees/meta')
|
||||
}
|
||||
|
||||
@@ -87,6 +87,13 @@ export function submitExpenseClaim(claimId) {
|
||||
})
|
||||
}
|
||||
|
||||
export function returnExpenseClaim(claimId, payload = {}) {
|
||||
return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}/return`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteExpenseClaim(claimId) {
|
||||
return apiRequest(`/reimbursements/claims/${encodeURIComponent(String(claimId || '').trim())}`, {
|
||||
method: 'DELETE'
|
||||
|
||||
Reference in New Issue
Block a user