feat(HRM): 新增HRM办公审批模块及相关功能组件
新增HRM办公审批模块,包括审批中心、抄送我的、我的申请等功能页面和组件。主要变更包括: 1. 添加审批相关API接口文件 2. 新增审批详情展示组件 3. 实现审批流程操作功能 4. 添加Vuex状态管理 5. 新增相关静态资源图片 6. 配置页面路由 7. 实现审批列表展示和筛选功能 8. 添加审批操作弹窗和状态管理
This commit is contained in:
127
api/hrm/attendance.js
Normal file
127
api/hrm/attendance.js
Normal file
@@ -0,0 +1,127 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 班次
|
||||
export function listShift(query) {
|
||||
return request({
|
||||
url: '/hrm/shift/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function addShift(data) {
|
||||
return request({
|
||||
url: '/hrm/shift',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateShift(data) {
|
||||
return request({
|
||||
url: '/hrm/shift',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function delShift(shiftIds) {
|
||||
return request({
|
||||
url: `/hrm/shift/${shiftIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 排班
|
||||
export function listSchedule(query) {
|
||||
return request({
|
||||
url: '/hrm/schedule/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function addSchedule(data) {
|
||||
return request({
|
||||
url: '/hrm/schedule',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateSchedule(data) {
|
||||
return request({
|
||||
url: '/hrm/schedule',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function delSchedule(scheduleIds) {
|
||||
return request({
|
||||
url: `/hrm/schedule/${scheduleIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 打卡
|
||||
export function listPunch(query) {
|
||||
return request({
|
||||
url: '/hrm/punch/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function addPunch(data) {
|
||||
return request({
|
||||
url: '/hrm/punch',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updatePunch(data) {
|
||||
return request({
|
||||
url: '/hrm/punch',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function delPunch(punchIds) {
|
||||
return request({
|
||||
url: `/hrm/punch/${punchIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 考勤结果
|
||||
export function listAttendCalc(query) {
|
||||
return request({
|
||||
url: '/hrm/attend/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 假期余额
|
||||
export function listLeaveBalance(query) {
|
||||
return request({
|
||||
url: '/hrm/leave/balance/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function addLeaveBalance(data) {
|
||||
return request({
|
||||
url: '/hrm/leave/balance',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateLeaveBalance(data) {
|
||||
return request({
|
||||
url: '/hrm/leave/balance',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function delLeaveBalance(balIds) {
|
||||
return request({
|
||||
url: `/hrm/leave/balance/${balIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
35
api/hrm/cc.js
Normal file
35
api/hrm/cc.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 查询抄送记录列表
|
||||
export function listCc(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/cc/my',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 标记抄送为已读
|
||||
export function readCc(ccId) {
|
||||
return request({
|
||||
url: `/hrm/flow/cc/${ccId}/read`,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
// 手动抄送
|
||||
export function addCc(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/cc',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询抄送记录详细
|
||||
export function getCc(ccId) {
|
||||
return request({
|
||||
url: `/hrm/flow/cc/${ccId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
66
api/hrm/certContract.js
Normal file
66
api/hrm/certContract.js
Normal file
@@ -0,0 +1,66 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 证书
|
||||
export function listCertificate(query) {
|
||||
return request({
|
||||
url: '/hrm/certificate/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addCertificate(data) {
|
||||
return request({
|
||||
url: '/hrm/certificate',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateCertificate(data) {
|
||||
return request({
|
||||
url: '/hrm/certificate',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delCertificate(certIds) {
|
||||
return request({
|
||||
url: `/hrm/certificate/${certIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 合同
|
||||
export function listContract(query) {
|
||||
return request({
|
||||
url: '/hrm/contract/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addContract(data) {
|
||||
return request({
|
||||
url: '/hrm/contract',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateContract(data) {
|
||||
return request({
|
||||
url: '/hrm/contract',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delContract(contractIds) {
|
||||
return request({
|
||||
url: `/hrm/contract/${contractIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
33
api/hrm/empOrgPosition.js
Normal file
33
api/hrm/empOrgPosition.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from "@/util/oaRequest"
|
||||
// 员工组织岗位关系
|
||||
export function listEmpOrgPosition(query) {
|
||||
return request({
|
||||
url: '/hrm/empOrg/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addEmpOrgPosition(data) {
|
||||
return request({
|
||||
url: '/hrm/empOrg',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEmpOrgPosition(data) {
|
||||
return request({
|
||||
url: '/hrm/empOrg',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delEmpOrgPosition(relIds) {
|
||||
return request({
|
||||
url: `/hrm/empOrg/${relIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
56
api/hrm/employee.js
Normal file
56
api/hrm/employee.js
Normal file
@@ -0,0 +1,56 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 员工
|
||||
export function listEmployee(query) {
|
||||
return request({
|
||||
url: '/hrm/employee/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function allEmployee(query) {
|
||||
return request({
|
||||
url: '/hrm/employee/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addEmployee(data) {
|
||||
return request({
|
||||
url: '/hrm/employee',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEmployee(data) {
|
||||
return request({
|
||||
url: '/hrm/employee',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delEmployee(empIds) {
|
||||
return request({
|
||||
url: `/hrm/employee/${empIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function getEmployee(empId) {
|
||||
return request({
|
||||
url: `/hrm/employee/${empId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据用户ID获取员工信息
|
||||
export function getEmployeeByUserId(userId) {
|
||||
return request({
|
||||
url: `/hrm/employee/byUserId/${userId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
220
api/hrm/flow.js
Normal file
220
api/hrm/flow.js
Normal file
@@ -0,0 +1,220 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 流程任务
|
||||
export function listFlowTask(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/task/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function updateFlowInstance(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/instance',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function listTodoFlowTask(assigneeUserId) {
|
||||
return request({
|
||||
url: '/hrm/flow/task/todo',
|
||||
method: 'get',
|
||||
params: { assigneeUserId }
|
||||
})
|
||||
}
|
||||
|
||||
// 业务维度:按 bizType + bizId 查询当前待办任务(后端需提供)
|
||||
export function getTodoTaskByBiz(bizType, bizId, assigneeUserId) {
|
||||
return request({
|
||||
url: '/hrm/flow/task/todoByBiz',
|
||||
method: 'get',
|
||||
params: { bizType, bizId, assigneeUserId }
|
||||
})
|
||||
}
|
||||
|
||||
export function approveFlowTask(taskId, data) {
|
||||
return request({
|
||||
url: `/hrm/flow/task/${taskId}/approve`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function rejectFlowTask(taskId, data) {
|
||||
return request({
|
||||
url: `/hrm/flow/task/${taskId}/reject`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function withdrawFlowTask(taskId, data) {
|
||||
return request({
|
||||
url: `/hrm/flow/task/${taskId}/withdraw`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function transferFlowTask(taskId, data) {
|
||||
return request({
|
||||
url: `/hrm/flow/task/${taskId}/transfer`,
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
export function ccFlowTask(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/cc',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 流程动作/表单
|
||||
export function listFlowAction(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/action/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function listFlowFormData(query) {
|
||||
return request({
|
||||
// 后端 Controller: HrmFlowFormDataController
|
||||
// @RequestMapping("/hrm/flow/form") + @GetMapping("/list")
|
||||
url: '/hrm/flow/form/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 流程实例
|
||||
export function listFlowInstance(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/instance/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 我的申请(我发起的流程实例)
|
||||
export function listMyFlowInstance(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/instance/myList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getFlowInstance(instId) {
|
||||
return request({
|
||||
url: `/hrm/flow/instance/${instId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function queryInstanceByBiz(bizType, bizId) {
|
||||
return request({
|
||||
url: '/hrm/flow/instance/all',
|
||||
method: 'get',
|
||||
params: { bizType, bizId }
|
||||
})
|
||||
}
|
||||
|
||||
export function listFlowForm(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/form/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getFlowForm(formId) {
|
||||
return request({
|
||||
url: `/hrm/flow/form/${formId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 流程模板
|
||||
export function listFlowTemplate(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/template/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getFlowTemplate(tplId) {
|
||||
return request({
|
||||
url: `/hrm/flow/template/${tplId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addFlowTemplate(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/template',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateFlowTemplate(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/template',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delFlowTemplate(tplIds) {
|
||||
return request({
|
||||
url: `/hrm/flow/template/${tplIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 流程节点
|
||||
export function listFlowNode(query) {
|
||||
return request({
|
||||
url: '/hrm/flow/node/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getFlowNode(nodeId) {
|
||||
return request({
|
||||
url: `/hrm/flow/node/${nodeId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addFlowNode(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/node',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateFlowNode(data) {
|
||||
return request({
|
||||
url: '/hrm/flow/node',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delFlowNode(nodeIds) {
|
||||
return request({
|
||||
url: `/hrm/flow/node/${nodeIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
66
api/hrm/gradePosition.js
Normal file
66
api/hrm/gradePosition.js
Normal file
@@ -0,0 +1,66 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 职级
|
||||
export function listGrade(query) {
|
||||
return request({
|
||||
url: '/hrm/grade/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addGrade(data) {
|
||||
return request({
|
||||
url: '/hrm/grade',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateGrade(data) {
|
||||
return request({
|
||||
url: '/hrm/grade',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delGrade(gradeIds) {
|
||||
return request({
|
||||
url: `/hrm/grade/${gradeIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 岗位
|
||||
export function listPosition(query) {
|
||||
return request({
|
||||
url: '/hrm/position/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addPosition(data) {
|
||||
return request({
|
||||
url: '/hrm/position',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePosition(data) {
|
||||
return request({
|
||||
url: '/hrm/position',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delPosition(positionIds) {
|
||||
return request({
|
||||
url: `/hrm/position/${positionIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
12
api/hrm/index.js
Normal file
12
api/hrm/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// 导出所有 HRM 模块 API
|
||||
export * from './employee'
|
||||
export * from './org'
|
||||
export * from './certContract'
|
||||
export * from './empOrgPosition'
|
||||
export * from './gradePosition'
|
||||
export * from './attendance'
|
||||
export * from './leave'
|
||||
export * from './travel'
|
||||
export * from './seal'
|
||||
export * from './reimburse'
|
||||
export * from './flow'
|
||||
48
api/hrm/leave.js
Normal file
48
api/hrm/leave.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 请假单
|
||||
export function listLeaveReq(query) {
|
||||
return request({
|
||||
url: '/hrm/leave/req/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getLeaveReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/leave/req/${bizId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addLeaveReq(data) {
|
||||
return request({
|
||||
url: '/hrm/leave/req',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function editLeaveReq(data) {
|
||||
return request({
|
||||
url: '/hrm/leave/req',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delLeaveReq(bizIds) {
|
||||
return request({
|
||||
url: `/hrm/leave/req/${bizIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function allLeaveReq(query) {
|
||||
return request({
|
||||
url: '/hrm/leave/req/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
49
api/hrm/org.js
Normal file
49
api/hrm/org.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 组织
|
||||
export function listOrg(query) {
|
||||
return request({
|
||||
url: '/hrm/org/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function allOrg(query) {
|
||||
return request({
|
||||
url: '/hrm/org/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addOrg(data) {
|
||||
return request({
|
||||
url: '/hrm/org',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateOrg(data) {
|
||||
return request({
|
||||
url: '/hrm/org',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delOrg(orgIds) {
|
||||
return request({
|
||||
url: `/hrm/org/${orgIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function getOrg(orgId) {
|
||||
return request({
|
||||
url: `/hrm/org/${orgId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
49
api/hrm/reimburse.js
Normal file
49
api/hrm/reimburse.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 日常报销单
|
||||
export function listReimburseReq(query) {
|
||||
return request({
|
||||
url: '/hrm/reimburse/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getReimburseReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/reimburse/${bizId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addReimburseReq(data) {
|
||||
return request({
|
||||
url: '/hrm/reimburse',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function editReimburseReq(data) {
|
||||
return request({
|
||||
url: '/hrm/reimburse',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delReimburseReq(bizIds) {
|
||||
return request({
|
||||
url: `/hrm/reimburse/${bizIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function allReimburseReq(query) {
|
||||
return request({
|
||||
url: '/hrm/reimburse/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
99
api/hrm/seal.js
Normal file
99
api/hrm/seal.js
Normal file
@@ -0,0 +1,99 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 用印申请
|
||||
export function listSealReq(query) {
|
||||
return request({
|
||||
url: '/hrm/seal/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getSealReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/seal/${bizId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addSealReq(data) {
|
||||
return request({
|
||||
url: '/hrm/seal',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function editSealReq(data) {
|
||||
return request({
|
||||
url: '/hrm/seal',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delSealReq(bizIds) {
|
||||
return request({
|
||||
url: `/hrm/seal/${bizIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function approveSealReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/seal/${bizId}/approve`,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function rejectSealReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/seal/${bizId}/reject`,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function cancelSealReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/seal/${bizId}/cancel`,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function stampSealJava(bizId, data) {
|
||||
// 确保数据正确序列化,特别是 0 值
|
||||
const payload = {
|
||||
targetFileUrl: String(data.targetFileUrl || ''),
|
||||
stampImageUrl: String(data.stampImageUrl || ''),
|
||||
pageNo: Number(data.pageNo) || 1,
|
||||
xPx: Number(data.xPx) || 0,
|
||||
yPx: Number(data.yPx) || 0,
|
||||
viewportWidth: data.viewportWidth !== undefined && data.viewportWidth !== null ? Number(data.viewportWidth) : undefined,
|
||||
viewportHeight: data.viewportHeight !== undefined && data.viewportHeight !== null ? Number(data.viewportHeight) : undefined
|
||||
}
|
||||
// 可选字段
|
||||
if (data.widthPx !== undefined && data.widthPx !== null) {
|
||||
payload.widthPx = Number(data.widthPx)
|
||||
}
|
||||
if (data.heightPx !== undefined && data.heightPx !== null) {
|
||||
payload.heightPx = Number(data.heightPx)
|
||||
}
|
||||
// viewportWidth/Height:如果是 undefined 则不传(兼容后端校验)
|
||||
if (payload.viewportWidth === undefined) delete payload.viewportWidth
|
||||
if (payload.viewportHeight === undefined) delete payload.viewportHeight
|
||||
console.log('stampSealJava API call, payload:', JSON.stringify(payload, null, 2))
|
||||
console.log('yPx in API:', typeof payload.yPx, payload.yPx)
|
||||
return request({
|
||||
url: `/hrm/seal/${bizId}/stamp/java`,
|
||||
method: 'post',
|
||||
data: payload
|
||||
})
|
||||
}
|
||||
|
||||
export function stampSealPython(bizId, data) {
|
||||
return request({
|
||||
url: `/hrm/seal/${bizId}/stamp/python`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
48
api/hrm/travel.js
Normal file
48
api/hrm/travel.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import request from "@/util/oaRequest"
|
||||
|
||||
// 出差单
|
||||
export function listTravelReq(query) {
|
||||
return request({
|
||||
url: '/hrm/travel/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function getTravelReq(bizId) {
|
||||
return request({
|
||||
url: `/hrm/travel/${bizId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function addTravelReq(data) {
|
||||
return request({
|
||||
url: '/hrm/travel',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function editTravelReq(data) {
|
||||
return request({
|
||||
url: '/hrm/travel',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function delTravelReq(bizIds) {
|
||||
return request({
|
||||
url: `/hrm/travel/${bizIds}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function allTravelReq(query) {
|
||||
return request({
|
||||
url: '/hrm/travel/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
132
components/hrm/detailPanels/leave.vue
Normal file
132
components/hrm/detailPanels/leave.vue
Normal file
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<view class="leave-detail-container">
|
||||
<!-- 请假类型 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">请假类型:</view>
|
||||
<view class="item-value">{{ detail.leaveType || '无' }}</view>
|
||||
</view>
|
||||
<!-- 开始时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">开始时间:</view>
|
||||
<view class="item-value">{{ formatTime(detail.startTime) || '无' }}</view>
|
||||
</view>
|
||||
<!-- 结束时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">结束时间:</view>
|
||||
<view class="item-value">{{ formatTime(detail.endTime) || '无' }}</view>
|
||||
</view>
|
||||
<!-- 请假时长 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">请假时长:</view>
|
||||
<view class="item-value">{{ detail.hours || '0' }} 小时</view>
|
||||
</view>
|
||||
<!-- 请假原因 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">请假原因:</view>
|
||||
<view class="item-value">{{ detail.reason || '无' }}</view>
|
||||
</view>
|
||||
<!-- 申请人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">申请人:</view>
|
||||
<view class="item-value">{{ detail.createBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 申请时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">申请时间:</view>
|
||||
<view class="item-value">{{ formatTime(detail.createTime) || '无' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLeaveReq } from '@/api/hrm/leave'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
bizId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
bizId: {
|
||||
handler(newVal) {
|
||||
// 空值判断,避免无效请求
|
||||
if (!newVal) return;
|
||||
// 接口请求增加错误捕获
|
||||
getLeaveReq(newVal)
|
||||
.then(res => {
|
||||
this.detail = res.data || {};
|
||||
console.log(this.detail);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('获取请假详情失败:', err);
|
||||
uni.showToast({
|
||||
title: '获取详情失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 时间格式化方法
|
||||
* 将 "2026-01-08 00:00:00" 格式化为 "2026-01-08"
|
||||
* @param {String} timeStr - 原始时间字符串
|
||||
* @returns {String} 格式化后的日期
|
||||
*/
|
||||
formatTime(timeStr) {
|
||||
if (!timeStr) return '';
|
||||
// 分割时间和日期,只保留日期部分
|
||||
const [datePart] = timeStr.split(' ');
|
||||
return datePart;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 容器样式 */
|
||||
.leave-detail-container {
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
margin: 10rpx;
|
||||
}
|
||||
|
||||
/* 每一项的样式 */
|
||||
.detail-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 18rpx 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
/* 最后一项去掉下边框 */
|
||||
.detail-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* 标签样式 */
|
||||
.item-label {
|
||||
width: 140rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 值的样式 */
|
||||
.item-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
</style>
|
||||
161
components/hrm/detailPanels/reimburse.vue
Normal file
161
components/hrm/detailPanels/reimburse.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<view class="reimburse-detail-container">
|
||||
<view class="detail-item">
|
||||
<view class="item-label">报销申请:</view>
|
||||
<view class="item-value">{{ detail.createBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 出行类型 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">报销类型:</view>
|
||||
<view class="item-value">{{ detail.reimburseType || '无' }}</view>
|
||||
</view>
|
||||
<view class="detail-item">
|
||||
<view class="item-label">总金额:</view>
|
||||
<view class="item-value">{{ detail.totalAmount || '无' }}</view>
|
||||
</view>
|
||||
<!-- 开始时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">报销原因:</view>
|
||||
<view class="item-value">{{ detail.reason || '无' }}</view>
|
||||
</view>
|
||||
<!-- 备注 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">备注:</view>
|
||||
<view class="item-value">{{ detail.remark || '无' }}</view>
|
||||
</view>
|
||||
<!-- 申请人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">申请人:</view>
|
||||
<view class="item-value">{{ detail.createBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 申请时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">申请时间:</view>
|
||||
<view class="item-value">{{ formatTime(detail.createTime) || '无' }}</view>
|
||||
</view>
|
||||
<!-- 更新人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">更新人:</view>
|
||||
<view class="item-value">{{ detail.updateBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 更新时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">更新时间:</view>
|
||||
<view class="item-value">{{ formatTime(detail.updateTime) || '无' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getReimburseReq } from '@/api/hrm/reimburse.js'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
bizId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
bizId: {
|
||||
handler(newVal) {
|
||||
// 空值判断,避免无效请求
|
||||
if (!newVal) return;
|
||||
// 接口请求增加错误捕获和loading提示
|
||||
uni.showLoading({ title: '加载中...' });
|
||||
getReimburseReq(newVal)
|
||||
.then(res => {
|
||||
this.detail = res.data || {};
|
||||
console.log('报销详情:', this.detail);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('获取报销详情失败:', err);
|
||||
uni.showToast({
|
||||
title: '获取详情失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 时间格式化方法
|
||||
* 将 "2026-01-08 00:00:00" 格式化为 "2026-01-08"
|
||||
* @param {String} timeStr - 原始时间字符串
|
||||
* @returns {String} 格式化后的日期
|
||||
*/
|
||||
formatTime(timeStr) {
|
||||
if (!timeStr) return '';
|
||||
const [datePart] = timeStr.split(' ');
|
||||
return datePart;
|
||||
},
|
||||
/**
|
||||
* 状态文本转换
|
||||
* 将接口返回的英文状态转为中文展示
|
||||
* @param {String} status - 原始状态值
|
||||
* @returns {String} 中文状态文本
|
||||
*/
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
'pending': '待处理',
|
||||
'approved': '已批准',
|
||||
'rejected': '已驳回',
|
||||
'completed': '已完成'
|
||||
};
|
||||
return statusMap[status] || '未知状态';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 容器样式 */
|
||||
.reimburse-detail-container {
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
margin: 10rpx;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
/* 每一项的样式 */
|
||||
.detail-item {
|
||||
display: flex;
|
||||
align-items: flex-start; /* 多行文本对齐 */
|
||||
padding: 18rpx 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
/* 最后一项去掉下边框 */
|
||||
.detail-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* 标签样式 */
|
||||
.item-label {
|
||||
width: 140rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
font-weight: 500;
|
||||
padding-top: 2rpx; /* 对齐多行文本 */
|
||||
}
|
||||
|
||||
/* 值的样式 */
|
||||
.item-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 40rpx; /* 多行文本行高 */
|
||||
}
|
||||
</style>
|
||||
113
components/hrm/detailPanels/seal.vue
Normal file
113
components/hrm/detailPanels/seal.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<view class="reimburse-detail-container">
|
||||
<view class="detail-item">
|
||||
<view class="item-label">报销申请</view>
|
||||
<view class="item-value">{{ detail.createBy }}</view>
|
||||
</view>
|
||||
<!-- 出差开始时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">用印类型</view>
|
||||
<view class="item-value">{{ detail.sealType || '无' }}</view>
|
||||
</view>
|
||||
<!-- 出差结束时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">原因</view>
|
||||
<view class="item-value">{{ detail.purpose || '无' }}</view>
|
||||
</view>
|
||||
<!-- 备注 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">备注</view>
|
||||
<view class="item-value">{{ detail.remark || '无' }}</view>
|
||||
</view>
|
||||
<!-- 创建人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">创建人</view>
|
||||
<view class="item-value">{{ detail.createBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 创建时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">创建时间</view>
|
||||
<view class="item-value">{{ detail.createTime || '无' }}</view>
|
||||
</view>
|
||||
<!-- 更新人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">更新人</view>
|
||||
<view class="item-value">{{ detail.updateBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 更新时间(最后一项,样式会自动去掉下边框) -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">更新时间</view>
|
||||
<view class="item-value">{{ detail.updateTime || '无' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getSealReq } from '@/api/hrm/seal.js'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
bizId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
bizId: {
|
||||
handler(newVal) {
|
||||
getSealReq(newVal).then(res => {
|
||||
this.detail = res.data
|
||||
console.log(this.detail)
|
||||
})
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 容器样式 */
|
||||
.reimburse-detail-container {
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
margin: 10rpx;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
/* 每一项的样式 */
|
||||
.detail-item {
|
||||
display: flex;
|
||||
align-items: flex-start; /* 多行文本对齐 */
|
||||
padding: 18rpx 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
/* 最后一项去掉下边框 */
|
||||
.detail-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* 标签样式 */
|
||||
.item-label {
|
||||
width: 140rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
font-weight: 500;
|
||||
padding-top: 2rpx; /* 对齐多行文本 */
|
||||
}
|
||||
|
||||
/* 值的样式 */
|
||||
.item-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 40rpx; /* 多行文本行高 */
|
||||
}
|
||||
</style>
|
||||
148
components/hrm/detailPanels/travel.vue
Normal file
148
components/hrm/detailPanels/travel.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<!-- 出差申请详情容器,使用已定义的样式类 -->
|
||||
<view class="reimburse-detail-container">
|
||||
<!-- 出差开始时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">开始时间</view>
|
||||
<view class="item-value">{{ detail.startTime || '无' }}</view>
|
||||
</view>
|
||||
<!-- 出差结束时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">结束时间</view>
|
||||
<view class="item-value">{{ detail.endTime || '无' }}</view>
|
||||
</view>
|
||||
<!-- 出差类型 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">出差类型</view>
|
||||
<view class="item-value">{{ detail.travelType || '无' }}</view>
|
||||
</view>
|
||||
<!-- 出差目的地 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">出差目的地</view>
|
||||
<view class="item-value">{{ detail.destination || '无' }}</view>
|
||||
</view>
|
||||
<!-- 出差原因 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">出差原因</view>
|
||||
<view class="item-value">{{ detail.reason || '无' }}</view>
|
||||
</view>
|
||||
<!-- 收款人姓名 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">收款人姓名</view>
|
||||
<view class="item-value">{{ detail.payeeName || '无' }}</view>
|
||||
</view>
|
||||
<!-- 预估费用(拼接元单位) -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">预估费用</view>
|
||||
<view class="item-value">{{ detail.estimatedCost || 0 }} 元</view>
|
||||
</view>
|
||||
<!-- 开户银行 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">开户银行</view>
|
||||
<view class="item-value">{{ detail.bankName || '无' }}</view>
|
||||
</view>
|
||||
<!-- 银行账号 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">银行账号</view>
|
||||
<view class="item-value">{{ detail.bankAccount || '无' }}</view>
|
||||
</view>
|
||||
<!-- 备注 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">备注</view>
|
||||
<view class="item-value">{{ detail.remark || '无' }}</view>
|
||||
</view>
|
||||
<!-- 创建人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">创建人</view>
|
||||
<view class="item-value">{{ detail.createBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 创建时间 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">创建时间</view>
|
||||
<view class="item-value">{{ detail.createTime || '无' }}</view>
|
||||
</view>
|
||||
<!-- 更新人 -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">更新人</view>
|
||||
<view class="item-value">{{ detail.updateBy || '无' }}</view>
|
||||
</view>
|
||||
<!-- 更新时间(最后一项,样式会自动去掉下边框) -->
|
||||
<view class="detail-item">
|
||||
<view class="item-label">更新时间</view>
|
||||
<view class="item-value">{{ detail.updateTime || '无' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getTravelReq } from '@/api/hrm/travel.js'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
bizId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
bizId: {
|
||||
handler(newVal) {
|
||||
// 增加空值判断,避免无效请求
|
||||
if (newVal) {
|
||||
getTravelReq(newVal).then(res => {
|
||||
this.detail = res.data || {}
|
||||
console.log(this.detail)
|
||||
})
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 容器样式 */
|
||||
.reimburse-detail-container {
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
margin: 10rpx;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
/* 每一项的样式 */
|
||||
.detail-item {
|
||||
display: flex;
|
||||
align-items: flex-start; /* 多行文本对齐 */
|
||||
padding: 18rpx 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
/* 最后一项去掉下边框 */
|
||||
.detail-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* 标签样式 */
|
||||
.item-label {
|
||||
width: 140rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
font-weight: 500;
|
||||
padding-top: 2rpx; /* 对齐多行文本 */
|
||||
}
|
||||
|
||||
/* 值的样式 */
|
||||
.item-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 40rpx; /* 多行文本行高 */
|
||||
}
|
||||
</style>
|
||||
28
pages.json
28
pages.json
@@ -557,6 +557,34 @@
|
||||
"navigationBarTitleText" : "采购需求",
|
||||
"navigationStyle": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workbench/hrm/approve/approve",
|
||||
"style": {
|
||||
"navigationBarTitleText": "办公审批",
|
||||
"navigationStyle": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workbench/hrm/cc/cc",
|
||||
"style": {
|
||||
"navigationBarTitleText": "抄送我的",
|
||||
"navigationStyle": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workbench/hrm/detail/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "申请详情",
|
||||
"navigationStyle": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workbench/hrm/apply/apply",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的申请",
|
||||
"navigationStyle": "default"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
||||
627
pages/workbench/hrm/apply/apply.vue
Normal file
627
pages/workbench/hrm/apply/apply.vue
Normal file
@@ -0,0 +1,627 @@
|
||||
<template>
|
||||
<view class="hrm-page">
|
||||
<!-- 筛选栏 -->
|
||||
<view class="filter-bar">
|
||||
<view style="display: flex; align-items: center; gap: 16rpx; flex: 1">
|
||||
<span class="filter-label">申请类型:</span>
|
||||
<picker @change="handleBizTypeChange" :value="bizTypeIndex" :range="bizTypeList" range-key="label">
|
||||
<view class="picker-text">{{ bizTypeList[bizTypeIndex].label }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<button class="refresh-btn" size="mini" @click="loadTodoList">
|
||||
刷新
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 待审批列表 -->
|
||||
<scroll-view class="approval-list" scroll-y>
|
||||
<!-- 加载中 -->
|
||||
<view v-if="loading" class="loading-container">
|
||||
<uni-load-more type="loading" color="#409EFF"></uni-load-more>
|
||||
</view>
|
||||
|
||||
<!-- 空数据 -->
|
||||
<view v-else-if="todoList.length === 0" class="empty-container">
|
||||
<uni-icons type="empty" size="60" color="#909399"></uni-icons>
|
||||
<view class="empty-text">暂无待审批任务</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表项 -->
|
||||
<view v-else class="list-item" v-for="(item, index) in todoList" :key="index" @click="goDetail(item)">
|
||||
<!-- 申请类型标签 -->
|
||||
<view class="item-tag" :class="getBizTypeTagType(item.bizType)">
|
||||
{{ getBizTypeText(item.bizType) }}
|
||||
</view>
|
||||
|
||||
<!-- 核心信息 -->
|
||||
<view class="item-main">
|
||||
<view class="applicant">
|
||||
<uni-icons type="user" size="14" color="#8a8f99"></uni-icons>
|
||||
{{ item.bizTitle || '暂未标识' }}
|
||||
</view>
|
||||
<!-- <view class="request-info">{{ formatRequestInfo(item) }}</view> -->
|
||||
<!-- <view class="node-info">当前节点:{{ formatNodeName(item) }}</view> -->
|
||||
<view class="time-info">{{ formatDate(item.createTime) }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 状态标签 -->
|
||||
<view class="status-tag" :class="statusType(item.status)">
|
||||
{{ statusText(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMyFlowInstance } from '@/api/hrm/flow';
|
||||
|
||||
export default {
|
||||
name: 'HrmApproval',
|
||||
data() {
|
||||
return {
|
||||
// 员工列表
|
||||
employees: [],
|
||||
// 待审批列表
|
||||
todoList: [],
|
||||
loading: false,
|
||||
todoCount: 0,
|
||||
todayCount: 0,
|
||||
// 筛选条件
|
||||
query: {
|
||||
bizType: ''
|
||||
},
|
||||
// 申请类型筛选器配置
|
||||
bizTypeList: [{
|
||||
label: '全部',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: '请假',
|
||||
value: 'leave'
|
||||
},
|
||||
{
|
||||
label: '出差',
|
||||
value: 'travel'
|
||||
},
|
||||
{
|
||||
label: '用印',
|
||||
value: 'seal'
|
||||
},
|
||||
{
|
||||
label: '报销',
|
||||
value: 'reimburse'
|
||||
}
|
||||
],
|
||||
bizTypeIndex: 0,
|
||||
// 审批操作弹窗
|
||||
actionDialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
type: '', // approve/reject
|
||||
task: null
|
||||
},
|
||||
actionForm: {
|
||||
remark: ''
|
||||
},
|
||||
actionSubmitting: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.loadEmployees();
|
||||
},
|
||||
onShow() {
|
||||
this.loadHistory();
|
||||
},
|
||||
methods: {
|
||||
// async loadCurrentEmployee () {
|
||||
// try {
|
||||
// const userId = this.$store?.state?.user?.id
|
||||
// if (!userId) {
|
||||
// this.$message.warning('无法获取当前用户信息,请重新登录')
|
||||
// this.loadHistory() // Still try to load history if user is not found
|
||||
// return
|
||||
// }
|
||||
|
||||
// const res = await getEmployeeByUserId(userId)
|
||||
// if (res.code === 200 && res.data) {
|
||||
// this.currentEmp = res.data
|
||||
// } else {
|
||||
// this.$message.warning('未找到当前用户对应的员工信息')
|
||||
// }
|
||||
// } catch (err) {
|
||||
// console.error('加载员工信息失败', err)
|
||||
// this.$message.error('加载员工信息失败')
|
||||
// } finally {
|
||||
// this.loadHistory()
|
||||
// }
|
||||
// },
|
||||
async loadHistory() {
|
||||
try {
|
||||
const params = {
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
// bizType: this.historyQuery.type || undefined, // 业务类型:leave/travel/seal/reimburse
|
||||
}
|
||||
const res = await listMyFlowInstance(params)
|
||||
if (res.code === 200) {
|
||||
this.todoList = res.rows || []
|
||||
this.todoCount = res.total || 0
|
||||
} else {
|
||||
this.historyList = []
|
||||
this.historyTotal = 0
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('加载申请历史失败:', err)
|
||||
this.historyList = []
|
||||
this.historyTotal = 0
|
||||
}
|
||||
},
|
||||
// 格式化员工信息展示
|
||||
formatEmpLabel(emp) {
|
||||
if (!emp) return '';
|
||||
const name = emp.empName || emp.nickName || emp.userName || '';
|
||||
const no = emp.empNo ? ` · ${emp.empNo}` : '';
|
||||
const dept = emp.deptName ? ` · ${emp.deptName}` : '';
|
||||
return `${name || '员工'}${no}${dept}`.trim();
|
||||
},
|
||||
// 格式化申请人信息
|
||||
formatApplicant(task) {
|
||||
if (!task.bizData) return '加载中...';
|
||||
const empId = task.bizData.empId;
|
||||
const emp = this.employees.find(e => String(e.empId) === String(empId));
|
||||
if (emp) {
|
||||
return this.formatEmpLabel(emp);
|
||||
}
|
||||
return empId ? `员工ID:${empId}` : '未指定';
|
||||
},
|
||||
// 格式化申请信息
|
||||
formatRequestInfo(task) {
|
||||
if (!task.bizData) return '加载中...';
|
||||
const biz = task.bizData;
|
||||
if (task.bizType === 'leave') {
|
||||
return `${biz.leaveType || '请假'} · ${this.formatDuration(biz)}`;
|
||||
} else if (task.bizType === 'travel') {
|
||||
return `${biz.travelType || '出差'} · ${biz.destination || ''}`;
|
||||
} else if (task.bizType === 'seal') {
|
||||
return `${biz.sealType || '用印'} · ${biz.applyFileIds ? '已上传文件' : '未上传'}`;
|
||||
} else if (task.bizType === 'reimburse') {
|
||||
const amt = biz.totalAmount != null ? biz.totalAmount : 0;
|
||||
return `${biz.reimburseType || '报销'} · 金额: ${amt}元`;
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
// 格式化节点名称
|
||||
formatNodeName(task) {
|
||||
return `节点 #${task.nodeId}`;
|
||||
},
|
||||
// 获取申请类型文本
|
||||
getBizTypeText(type) {
|
||||
const map = {
|
||||
leave: '请假',
|
||||
travel: '出差',
|
||||
seal: '用印',
|
||||
reimburse: '报销'
|
||||
};
|
||||
return map[type] || type || '-';
|
||||
},
|
||||
// 获取申请类型标签样式
|
||||
getBizTypeTagType(type) {
|
||||
const map = {
|
||||
leave: 'primary',
|
||||
travel: 'success',
|
||||
seal: 'warning',
|
||||
reimburse: 'danger'
|
||||
};
|
||||
return map[type] || 'info';
|
||||
},
|
||||
// 获取状态文本
|
||||
statusText(status) {
|
||||
const map = {
|
||||
pending: '待审批',
|
||||
running: '待审批',
|
||||
draft: '草稿',
|
||||
approved: '已通过',
|
||||
rejected: '已驳回'
|
||||
};
|
||||
return map[status] || status || '-';
|
||||
},
|
||||
// 获取状态标签样式
|
||||
statusType(status) {
|
||||
if (!status) return 'info';
|
||||
const map = {
|
||||
pending: 'warning',
|
||||
running: 'warning',
|
||||
draft: 'info',
|
||||
approved: 'success',
|
||||
rejected: 'danger'
|
||||
};
|
||||
return map[status] || 'info';
|
||||
},
|
||||
// 格式化日期
|
||||
formatDate(val) {
|
||||
if (!val) return '';
|
||||
const d = new Date(val);
|
||||
const p = n => (n < 10 ? `0${n}` : n);
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||||
},
|
||||
// 格式化时长
|
||||
formatDuration(biz) {
|
||||
if (biz.hours) return `${biz.hours}h`;
|
||||
if (biz.startTime && biz.endTime) {
|
||||
const ms = new Date(biz.endTime).getTime() - new Date(biz.startTime).getTime();
|
||||
if (ms > 0) return `${(ms / 3600000).toFixed(1)}h`;
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
// 加载员工列表
|
||||
loadEmployees() {
|
||||
listEmployee({
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
}).then(res => {
|
||||
this.employees = res.rows || res.data || [];
|
||||
}).catch(() => {
|
||||
this.employees = [];
|
||||
});
|
||||
},
|
||||
// 加载待办列表
|
||||
async loadTodoList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const userId = this.$store?.getters.storeOaId;
|
||||
console.log(this.$store?.getters.storeOaId)
|
||||
if (!userId) {
|
||||
uni.showToast({
|
||||
title: '无法获取当前用户信息,请重新登录',
|
||||
icon: 'error'
|
||||
});
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
const res = await listTodoFlowTask(userId);
|
||||
let list = res.data || [];
|
||||
// 前端过滤 bizType
|
||||
if (this.query.bizType) {
|
||||
list = list.filter(item => item.bizType === this.query.bizType);
|
||||
}
|
||||
|
||||
this.todoList = list;
|
||||
this.todoCount = list.length;
|
||||
this.todayCount = 0; // 可根据实际需求实现今日处理数量统计
|
||||
} catch (err) {
|
||||
console.error('加载待办任务失败:', err);
|
||||
uni.showToast({
|
||||
title: '加载待办任务失败',
|
||||
icon: 'error'
|
||||
});
|
||||
this.todoList = [];
|
||||
this.todoCount = 0;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 跳转详情页
|
||||
goDetail(task) {
|
||||
if (!task || !task.bizId) {
|
||||
uni.showToast({
|
||||
title: '缺少bizId,无法打开详情',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!task || !task.bizType) {
|
||||
uni.showToast({
|
||||
title: '未知的申请类型',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/workbench/hrm/detail/detail?bizId=${task.bizId}&bizType=${task.bizType}`
|
||||
});
|
||||
},
|
||||
// 申请类型筛选变更
|
||||
handleBizTypeChange(e) {
|
||||
this.bizTypeIndex = e.detail.value;
|
||||
this.query.bizType = this.bizTypeList[this.bizTypeIndex].value;
|
||||
this.loadTodoList();
|
||||
},
|
||||
// 长按弹出操作菜单
|
||||
showActionMenu(task) {
|
||||
uni.showActionSheet({
|
||||
itemList: ['查看详情', '审批通过', '审批驳回'],
|
||||
success: (res) => {
|
||||
switch (res.tapIndex) {
|
||||
case 0: // 查看详情
|
||||
this.goDetail(task);
|
||||
break;
|
||||
case 1: // 审批通过
|
||||
approveFlowTask(task.taskId).then(() => {
|
||||
uni.showToast({
|
||||
title: '已通过审批',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loadTodoList()
|
||||
})
|
||||
break;
|
||||
case 2: // 审批驳回
|
||||
rejectFlowTask(task.taskId).then(() => {
|
||||
uni.showToast({
|
||||
title: '已驳回',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loadTodoList()
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('取消操作:', res);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 提交审批操作
|
||||
submitAction() {
|
||||
if (!this.actionDialog.task) return;
|
||||
this.actionSubmitting = true;
|
||||
const {
|
||||
task,
|
||||
type
|
||||
} = this.actionDialog;
|
||||
const action = type === 'approve' ? approveFlowTask : rejectFlowTask;
|
||||
|
||||
action(task.taskId, {
|
||||
remark: this.actionForm.remark
|
||||
})
|
||||
.then(() => {
|
||||
uni.showToast({
|
||||
title: type === 'approve' ? '审批通过' : '已驳回',
|
||||
icon: 'success'
|
||||
});
|
||||
this.actionDialog.visible = false;
|
||||
this.loadTodoList();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('审批操作失败:', err);
|
||||
uni.showToast({
|
||||
title: '操作失败',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.actionSubmitting = false;
|
||||
this.actionForm.remark = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.hrm-page {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f9fb;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
// 顶部统计栏
|
||||
.summary-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: #ffffff;
|
||||
|
||||
.summary-left {
|
||||
.page-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.page-desc {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-right {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
|
||||
.metric {
|
||||
min-width: 100rpx;
|
||||
padding: 12rpx 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: #fcfdff;
|
||||
text-align: center;
|
||||
|
||||
.metric-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
margin-top: 4rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 筛选栏
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16rpx;
|
||||
background: #fff;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.filter-label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.picker-text {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
padding: 8rpx 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 审批列表
|
||||
.approval-list {
|
||||
height: calc(100vh - 160rpx);
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 100rpx 0;
|
||||
|
||||
.empty-text {
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 12rpx;
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.item-tag {
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.primary {
|
||||
background-color: #409eff;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
|
||||
.applicant {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.request-info {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.node-info {
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.time-info {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 审批意见输入框
|
||||
.remark-textarea {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
padding: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
604
pages/workbench/hrm/approve/approve.vue
Normal file
604
pages/workbench/hrm/approve/approve.vue
Normal file
@@ -0,0 +1,604 @@
|
||||
<template>
|
||||
<view class="hrm-page">
|
||||
<!-- 顶部统计栏 -->
|
||||
<view class="summary-bar">
|
||||
<view class="summary-left">
|
||||
<view class="page-title">审批中心</view>
|
||||
<view class="page-desc">集中查看与处理待办审批</view>
|
||||
</view>
|
||||
<view class="summary-right">
|
||||
<view class="metric">
|
||||
<view class="metric-value">{{ todoCount }}</view>
|
||||
<view class="metric-label">待审批</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 筛选栏 -->
|
||||
<view class="filter-bar">
|
||||
<view style="display: flex; align-items: center; gap: 16rpx; flex: 1">
|
||||
<span class="filter-label">申请类型:</span>
|
||||
<picker @change="handleBizTypeChange" :value="bizTypeIndex" :range="bizTypeList" range-key="label">
|
||||
<view class="picker-text">{{ bizTypeList[bizTypeIndex].label }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<button class="refresh-btn" size="mini" @click="loadTodoList">
|
||||
刷新
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 待审批列表 -->
|
||||
<scroll-view class="approval-list" scroll-y>
|
||||
<!-- 加载中 -->
|
||||
<view v-if="loading" class="loading-container">
|
||||
<uni-load-more type="loading" color="#409EFF"></uni-load-more>
|
||||
</view>
|
||||
|
||||
<!-- 空数据 -->
|
||||
<view v-else-if="todoList.length === 0" class="empty-container">
|
||||
<uni-icons type="empty" size="60" color="#909399"></uni-icons>
|
||||
<view class="empty-text">暂无待审批任务</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表项 -->
|
||||
<view v-else class="list-item" v-for="(item, index) in todoList" :key="index" @click="goDetail(item)"
|
||||
@longpress="showActionMenu(item)">
|
||||
<!-- 申请类型标签 -->
|
||||
<view class="item-tag" :class="getBizTypeTagType(item.bizType)">
|
||||
{{ getBizTypeText(item.bizType) }}
|
||||
</view>
|
||||
|
||||
<!-- 核心信息 -->
|
||||
<view class="item-main">
|
||||
<view class="applicant">
|
||||
<uni-icons type="user" size="14" color="#8a8f99"></uni-icons>
|
||||
{{ formatApplicant(item) }}
|
||||
</view>
|
||||
<view class="request-info">{{ formatRequestInfo(item) }}</view>
|
||||
<!-- <view class="node-info">当前节点:{{ formatNodeName(item) }}</view> -->
|
||||
<view class="time-info">{{ formatDate(item.createTime) }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 状态标签 -->
|
||||
<view class="status-tag" :class="statusType(item.status)">
|
||||
{{ statusText(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listEmployee
|
||||
} from '@/api/hrm';
|
||||
import {
|
||||
approveFlowTask,
|
||||
listTodoFlowTask,
|
||||
rejectFlowTask
|
||||
} from '@/api/hrm/flow';
|
||||
|
||||
export default {
|
||||
name: 'HrmApproval',
|
||||
data() {
|
||||
return {
|
||||
// 员工列表
|
||||
employees: [],
|
||||
// 待审批列表
|
||||
todoList: [],
|
||||
loading: false,
|
||||
todoCount: 0,
|
||||
todayCount: 0,
|
||||
// 筛选条件
|
||||
query: {
|
||||
bizType: ''
|
||||
},
|
||||
// 申请类型筛选器配置
|
||||
bizTypeList: [{
|
||||
label: '全部',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: '请假',
|
||||
value: 'leave'
|
||||
},
|
||||
{
|
||||
label: '出差',
|
||||
value: 'travel'
|
||||
},
|
||||
{
|
||||
label: '用印',
|
||||
value: 'seal'
|
||||
},
|
||||
{
|
||||
label: '报销',
|
||||
value: 'reimburse'
|
||||
}
|
||||
],
|
||||
bizTypeIndex: 0,
|
||||
// 审批操作弹窗
|
||||
actionDialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
type: '', // approve/reject
|
||||
task: null
|
||||
},
|
||||
actionForm: {
|
||||
remark: ''
|
||||
},
|
||||
actionSubmitting: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.loadEmployees();
|
||||
},
|
||||
onShow() {
|
||||
this.loadTodoList();
|
||||
},
|
||||
methods: {
|
||||
// 格式化员工信息展示
|
||||
formatEmpLabel(emp) {
|
||||
if (!emp) return '';
|
||||
const name = emp.empName || emp.nickName || emp.userName || '';
|
||||
const no = emp.empNo ? ` · ${emp.empNo}` : '';
|
||||
const dept = emp.deptName ? ` · ${emp.deptName}` : '';
|
||||
return `${name || '员工'}${no}${dept}`.trim();
|
||||
},
|
||||
// 格式化申请人信息
|
||||
formatApplicant(task) {
|
||||
if (!task.bizData) return '加载中...';
|
||||
const empId = task.bizData.empId;
|
||||
const emp = this.employees.find(e => String(e.empId) === String(empId));
|
||||
if (emp) {
|
||||
return this.formatEmpLabel(emp);
|
||||
}
|
||||
return empId ? `员工ID:${empId}` : '未指定';
|
||||
},
|
||||
// 格式化申请信息
|
||||
formatRequestInfo(task) {
|
||||
if (!task.bizData) return '加载中...';
|
||||
const biz = task.bizData;
|
||||
if (task.bizType === 'leave') {
|
||||
return `${biz.leaveType || '请假'} · ${this.formatDuration(biz)}`;
|
||||
} else if (task.bizType === 'travel') {
|
||||
return `${biz.travelType || '出差'} · ${biz.destination || ''}`;
|
||||
} else if (task.bizType === 'seal') {
|
||||
return `${biz.sealType || '用印'} · ${biz.applyFileIds ? '已上传文件' : '未上传'}`;
|
||||
} else if (task.bizType === 'reimburse') {
|
||||
const amt = biz.totalAmount != null ? biz.totalAmount : 0;
|
||||
return `${biz.reimburseType || '报销'} · 金额: ${amt}元`;
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
// 格式化节点名称
|
||||
formatNodeName(task) {
|
||||
return `节点 #${task.nodeId}`;
|
||||
},
|
||||
// 获取申请类型文本
|
||||
getBizTypeText(type) {
|
||||
const map = {
|
||||
leave: '请假',
|
||||
travel: '出差',
|
||||
seal: '用印',
|
||||
reimburse: '报销'
|
||||
};
|
||||
return map[type] || type || '-';
|
||||
},
|
||||
// 获取申请类型标签样式
|
||||
getBizTypeTagType(type) {
|
||||
const map = {
|
||||
leave: 'primary',
|
||||
travel: 'success',
|
||||
seal: 'warning',
|
||||
reimburse: 'danger'
|
||||
};
|
||||
return map[type] || 'info';
|
||||
},
|
||||
// 获取状态文本
|
||||
statusText(status) {
|
||||
const map = {
|
||||
pending: '待审批',
|
||||
draft: '草稿',
|
||||
approved: '已通过',
|
||||
rejected: '已驳回'
|
||||
};
|
||||
return map[status] || status || '-';
|
||||
},
|
||||
// 获取状态标签样式
|
||||
statusType(status) {
|
||||
if (!status) return 'info';
|
||||
const map = {
|
||||
pending: 'warning',
|
||||
draft: 'info',
|
||||
approved: 'success',
|
||||
rejected: 'danger'
|
||||
};
|
||||
return map[status] || 'info';
|
||||
},
|
||||
// 格式化日期
|
||||
formatDate(val) {
|
||||
if (!val) return '';
|
||||
const d = new Date(val);
|
||||
const p = n => (n < 10 ? `0${n}` : n);
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||||
},
|
||||
// 格式化时长
|
||||
formatDuration(biz) {
|
||||
if (biz.hours) return `${biz.hours}h`;
|
||||
if (biz.startTime && biz.endTime) {
|
||||
const ms = new Date(biz.endTime).getTime() - new Date(biz.startTime).getTime();
|
||||
if (ms > 0) return `${(ms / 3600000).toFixed(1)}h`;
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
// 加载员工列表
|
||||
loadEmployees() {
|
||||
listEmployee({
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
}).then(res => {
|
||||
this.employees = res.rows || res.data || [];
|
||||
}).catch(() => {
|
||||
this.employees = [];
|
||||
});
|
||||
},
|
||||
// 加载待办列表
|
||||
async loadTodoList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const userId = this.$store?.getters.storeOaId;
|
||||
console.log(this.$store?.getters.storeOaId)
|
||||
if (!userId) {
|
||||
uni.showToast({
|
||||
title: '无法获取当前用户信息,请重新登录',
|
||||
icon: 'error'
|
||||
});
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
const res = await listTodoFlowTask(userId);
|
||||
let list = res.data || [];
|
||||
// 前端过滤 bizType
|
||||
if (this.query.bizType) {
|
||||
list = list.filter(item => item.bizType === this.query.bizType);
|
||||
}
|
||||
|
||||
this.todoList = list;
|
||||
this.todoCount = list.length;
|
||||
this.todayCount = 0; // 可根据实际需求实现今日处理数量统计
|
||||
} catch (err) {
|
||||
console.error('加载待办任务失败:', err);
|
||||
uni.showToast({
|
||||
title: '加载待办任务失败',
|
||||
icon: 'error'
|
||||
});
|
||||
this.todoList = [];
|
||||
this.todoCount = 0;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 跳转详情页
|
||||
goDetail(task) {
|
||||
if (!task || !task.bizId) {
|
||||
uni.showToast({
|
||||
title: '缺少bizId,无法打开详情',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!task || !task.bizType) {
|
||||
uni.showToast({
|
||||
title: '未知的申请类型',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/workbench/hrm/detail/detail?bizId=${task.bizId}&bizType=${task.bizType}`
|
||||
});
|
||||
},
|
||||
// 申请类型筛选变更
|
||||
handleBizTypeChange(e) {
|
||||
this.bizTypeIndex = e.detail.value;
|
||||
this.query.bizType = this.bizTypeList[this.bizTypeIndex].value;
|
||||
this.loadTodoList();
|
||||
},
|
||||
// 长按弹出操作菜单
|
||||
showActionMenu(task) {
|
||||
uni.showActionSheet({
|
||||
itemList: ['查看详情', '审批通过', '审批驳回'],
|
||||
success: (res) => {
|
||||
switch (res.tapIndex) {
|
||||
case 0: // 查看详情
|
||||
this.goDetail(task);
|
||||
break;
|
||||
case 1: // 审批通过
|
||||
approveFlowTask(task.taskId).then(() => {
|
||||
uni.showToast({
|
||||
title: '已通过审批',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loadTodoList()
|
||||
})
|
||||
break;
|
||||
case 2: // 审批驳回
|
||||
rejectFlowTask(task.taskId).then(() => {
|
||||
uni.showToast({
|
||||
title: '已驳回',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loadTodoList()
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('取消操作:', res);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 提交审批操作
|
||||
submitAction() {
|
||||
if (!this.actionDialog.task) return;
|
||||
this.actionSubmitting = true;
|
||||
const {
|
||||
task,
|
||||
type
|
||||
} = this.actionDialog;
|
||||
const action = type === 'approve' ? approveFlowTask : rejectFlowTask;
|
||||
|
||||
action(task.taskId, {
|
||||
remark: this.actionForm.remark
|
||||
})
|
||||
.then(() => {
|
||||
uni.showToast({
|
||||
title: type === 'approve' ? '审批通过' : '已驳回',
|
||||
icon: 'success'
|
||||
});
|
||||
this.actionDialog.visible = false;
|
||||
this.loadTodoList();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('审批操作失败:', err);
|
||||
uni.showToast({
|
||||
title: '操作失败',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.actionSubmitting = false;
|
||||
this.actionForm.remark = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.hrm-page {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f9fb;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
// 顶部统计栏
|
||||
.summary-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: #ffffff;
|
||||
|
||||
.summary-left {
|
||||
.page-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.page-desc {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-right {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
|
||||
.metric {
|
||||
min-width: 100rpx;
|
||||
padding: 12rpx 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: #fcfdff;
|
||||
text-align: center;
|
||||
|
||||
.metric-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
margin-top: 4rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 筛选栏
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16rpx;
|
||||
background: #fff;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.filter-label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.picker-text {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
padding: 8rpx 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 审批列表
|
||||
.approval-list {
|
||||
height: calc(100vh - 280rpx);
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 100rpx 0;
|
||||
|
||||
.empty-text {
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 12rpx;
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.item-tag {
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.primary {
|
||||
background-color: #409eff;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
|
||||
.applicant {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.request-info {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.node-info {
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.time-info {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 审批意见输入框
|
||||
.remark-textarea {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
padding: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
587
pages/workbench/hrm/cc/cc.vue
Normal file
587
pages/workbench/hrm/cc/cc.vue
Normal file
@@ -0,0 +1,587 @@
|
||||
<template>
|
||||
<view class="hrm-page">
|
||||
<!-- 筛选栏 -->
|
||||
<view class="filter-bar">
|
||||
<view style="display: flex; align-items: center; gap: 16rpx; flex: 1">
|
||||
<span class="filter-label">申请类型:</span>
|
||||
<picker @change="handleBizTypeChange" :value="bizTypeIndex" :range="bizTypeList" range-key="label">
|
||||
<view class="picker-text">{{ bizTypeList[bizTypeIndex].label }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<button class="refresh-btn" size="mini" @click="loadTodoList">
|
||||
刷新
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 待审批列表 -->
|
||||
<scroll-view class="approval-list" scroll-y>
|
||||
<!-- 加载中 -->
|
||||
<view v-if="loading" class="loading-container">
|
||||
<uni-load-more type="loading" color="#409EFF"></uni-load-more>
|
||||
</view>
|
||||
|
||||
<!-- 空数据 -->
|
||||
<view v-else-if="todoList.length === 0" class="empty-container">
|
||||
<uni-icons type="empty" size="60" color="#909399"></uni-icons>
|
||||
<view class="empty-text">暂无待审批任务</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表项 -->
|
||||
<view v-else class="list-item" v-for="(item, index) in todoList" :key="index" @click="goDetail(item)">
|
||||
<!-- 申请类型标签 -->
|
||||
<view class="item-tag" :class="getBizTypeTagType(item.bizType)">
|
||||
{{ getBizTypeText(item.bizType) }}
|
||||
</view>
|
||||
|
||||
<!-- 核心信息 -->
|
||||
<view class="item-main">
|
||||
<view class="applicant">
|
||||
<uni-icons type="user" size="14" color="#8a8f99"></uni-icons>
|
||||
{{ item.bizTitle }}
|
||||
</view>
|
||||
<view class="request-info">{{ item.createBy }}</view>
|
||||
<!-- <view class="node-info">当前节点:{{ formatNodeName(item) }}</view> -->
|
||||
<view class="time-info">{{ formatDate(item.createTime) }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 状态标签 -->
|
||||
<!-- <view class="status-tag" :class="statusType(item.status)">
|
||||
{{ statusText(item.status) }}
|
||||
</view> -->
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCc, readCc } from '@/api/hrm/cc';
|
||||
|
||||
export default {
|
||||
name: 'HrmApproval',
|
||||
data() {
|
||||
return {
|
||||
// 员工列表
|
||||
employees: [],
|
||||
// 待审批列表
|
||||
todoList: [],
|
||||
loading: false,
|
||||
todoCount: 0,
|
||||
todayCount: 0,
|
||||
// 筛选条件
|
||||
query: {
|
||||
bizType: ''
|
||||
},
|
||||
// 申请类型筛选器配置
|
||||
bizTypeList: [{
|
||||
label: '全部',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: '请假',
|
||||
value: 'leave'
|
||||
},
|
||||
{
|
||||
label: '出差',
|
||||
value: 'travel'
|
||||
},
|
||||
{
|
||||
label: '用印',
|
||||
value: 'seal'
|
||||
},
|
||||
{
|
||||
label: '报销',
|
||||
value: 'reimburse'
|
||||
}
|
||||
],
|
||||
bizTypeIndex: 0,
|
||||
// 审批操作弹窗
|
||||
actionDialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
type: '', // approve/reject
|
||||
task: null
|
||||
},
|
||||
actionForm: {
|
||||
remark: ''
|
||||
},
|
||||
actionSubmitting: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.loadEmployees();
|
||||
},
|
||||
onShow() {
|
||||
this.loadTodoList();
|
||||
},
|
||||
computed: {
|
||||
currentUserId() {
|
||||
return this.$store.getters.storeOaId
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 格式化员工信息展示
|
||||
formatEmpLabel(emp) {
|
||||
if (!emp) return '';
|
||||
const name = emp.empName || emp.nickName || emp.userName || '';
|
||||
const no = emp.empNo ? ` · ${emp.empNo}` : '';
|
||||
const dept = emp.deptName ? ` · ${emp.deptName}` : '';
|
||||
return `${name || '员工'}${no}${dept}`.trim();
|
||||
},
|
||||
// 格式化申请人信息
|
||||
formatApplicant(task) {
|
||||
if (!task.bizData) return '加载中...';
|
||||
const empId = task.bizData.empId;
|
||||
const emp = this.employees.find(e => String(e.empId) === String(empId));
|
||||
if (emp) {
|
||||
return this.formatEmpLabel(emp);
|
||||
}
|
||||
return empId ? `员工ID:${empId}` : '未指定';
|
||||
},
|
||||
// 格式化申请信息
|
||||
formatRequestInfo(task) {
|
||||
if (!task.bizData) return '加载中...';
|
||||
const biz = task.bizData;
|
||||
if (task.bizType === 'leave') {
|
||||
return `${biz.leaveType || '请假'} · ${this.formatDuration(biz)}`;
|
||||
} else if (task.bizType === 'travel') {
|
||||
return `${biz.travelType || '出差'} · ${biz.destination || ''}`;
|
||||
} else if (task.bizType === 'seal') {
|
||||
return `${biz.sealType || '用印'} · ${biz.applyFileIds ? '已上传文件' : '未上传'}`;
|
||||
} else if (task.bizType === 'reimburse') {
|
||||
const amt = biz.totalAmount != null ? biz.totalAmount : 0;
|
||||
return `${biz.reimburseType || '报销'} · 金额: ${amt}元`;
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
// 格式化节点名称
|
||||
formatNodeName(task) {
|
||||
return `节点 #${task.nodeId}`;
|
||||
},
|
||||
// 获取申请类型文本
|
||||
getBizTypeText(type) {
|
||||
const map = {
|
||||
leave: '请假',
|
||||
travel: '出差',
|
||||
seal: '用印',
|
||||
reimburse: '报销'
|
||||
};
|
||||
return map[type] || type || '-';
|
||||
},
|
||||
// 获取申请类型标签样式
|
||||
getBizTypeTagType(type) {
|
||||
const map = {
|
||||
leave: 'primary',
|
||||
travel: 'success',
|
||||
seal: 'warning',
|
||||
reimburse: 'danger'
|
||||
};
|
||||
return map[type] || 'info';
|
||||
},
|
||||
// 获取状态文本
|
||||
statusText(status) {
|
||||
const map = {
|
||||
pending: '待审批',
|
||||
draft: '草稿',
|
||||
approved: '已通过',
|
||||
rejected: '已驳回'
|
||||
};
|
||||
return map[status] || status || '-';
|
||||
},
|
||||
// 获取状态标签样式
|
||||
statusType(status) {
|
||||
if (!status) return 'info';
|
||||
const map = {
|
||||
pending: 'warning',
|
||||
draft: 'info',
|
||||
approved: 'success',
|
||||
rejected: 'danger'
|
||||
};
|
||||
return map[status] || 'info';
|
||||
},
|
||||
// 格式化日期
|
||||
formatDate(val) {
|
||||
if (!val) return '';
|
||||
const d = new Date(val);
|
||||
const p = n => (n < 10 ? `0${n}` : n);
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
||||
},
|
||||
// 格式化时长
|
||||
formatDuration(biz) {
|
||||
if (biz.hours) return `${biz.hours}h`;
|
||||
if (biz.startTime && biz.endTime) {
|
||||
const ms = new Date(biz.endTime).getTime() - new Date(biz.startTime).getTime();
|
||||
if (ms > 0) return `${(ms / 3600000).toFixed(1)}h`;
|
||||
}
|
||||
return '-';
|
||||
},
|
||||
// 加载员工列表
|
||||
loadEmployees() {
|
||||
listEmployee({
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
}).then(res => {
|
||||
this.employees = res.rows || res.data || [];
|
||||
}).catch(() => {
|
||||
this.employees = [];
|
||||
});
|
||||
},
|
||||
// 加载待办列表
|
||||
async loadTodoList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const userId = this.$store?.getters.storeOaId;
|
||||
console.log(this.$store?.getters.storeOaId)
|
||||
if (!userId) {
|
||||
uni.showToast({
|
||||
title: '无法获取当前用户信息,请重新登录',
|
||||
icon: 'error'
|
||||
});
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
const res = await listCc({ ccUserId: this.currentUserId });
|
||||
let list = res.rows || [];
|
||||
// 前端过滤 bizType
|
||||
if (this.query.bizType) {
|
||||
list = list.filter(item => item.bizType === this.query.bizType);
|
||||
}
|
||||
|
||||
this.todoList = list;
|
||||
this.todoCount = list.length;
|
||||
this.todayCount = 0; // 可根据实际需求实现今日处理数量统计
|
||||
} catch (err) {
|
||||
console.error('加载待办任务失败:', err);
|
||||
uni.showToast({
|
||||
title: '加载待办任务失败',
|
||||
icon: 'error'
|
||||
});
|
||||
this.todoList = [];
|
||||
this.todoCount = 0;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 跳转详情页
|
||||
goDetail(task) {
|
||||
if (!task || !task.bizId) {
|
||||
uni.showToast({
|
||||
title: '缺少bizId,无法打开详情',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!task || !task.bizType) {
|
||||
uni.showToast({
|
||||
title: '未知的申请类型',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/workbench/hrm/detail/detail?bizId=${task.bizId}&bizType=${task.bizType}`
|
||||
});
|
||||
},
|
||||
// 申请类型筛选变更
|
||||
handleBizTypeChange(e) {
|
||||
this.bizTypeIndex = e.detail.value;
|
||||
this.query.bizType = this.bizTypeList[this.bizTypeIndex].value;
|
||||
this.loadTodoList();
|
||||
},
|
||||
// 长按弹出操作菜单
|
||||
showActionMenu(task) {
|
||||
uni.showActionSheet({
|
||||
itemList: ['查看详情', '审批通过', '审批驳回'],
|
||||
success: (res) => {
|
||||
switch (res.tapIndex) {
|
||||
case 0: // 查看详情
|
||||
this.goDetail(task);
|
||||
break;
|
||||
case 1: // 审批通过
|
||||
approveFlowTask(task.taskId).then(() => {
|
||||
uni.showToast({
|
||||
title: '已通过审批',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loadTodoList()
|
||||
})
|
||||
break;
|
||||
case 2: // 审批驳回
|
||||
rejectFlowTask(task.taskId).then(() => {
|
||||
uni.showToast({
|
||||
title: '已驳回',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loadTodoList()
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('取消操作:', res);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 提交审批操作
|
||||
submitAction() {
|
||||
if (!this.actionDialog.task) return;
|
||||
this.actionSubmitting = true;
|
||||
const {
|
||||
task,
|
||||
type
|
||||
} = this.actionDialog;
|
||||
const action = type === 'approve' ? approveFlowTask : rejectFlowTask;
|
||||
|
||||
action(task.taskId, {
|
||||
remark: this.actionForm.remark
|
||||
})
|
||||
.then(() => {
|
||||
uni.showToast({
|
||||
title: type === 'approve' ? '审批通过' : '已驳回',
|
||||
icon: 'success'
|
||||
});
|
||||
this.actionDialog.visible = false;
|
||||
this.loadTodoList();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('审批操作失败:', err);
|
||||
uni.showToast({
|
||||
title: '操作失败',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.actionSubmitting = false;
|
||||
this.actionForm.remark = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.hrm-page {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f9fb;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
// 顶部统计栏
|
||||
.summary-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: #ffffff;
|
||||
|
||||
.summary-left {
|
||||
.page-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.page-desc {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-right {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
|
||||
.metric {
|
||||
min-width: 100rpx;
|
||||
padding: 12rpx 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: #fcfdff;
|
||||
text-align: center;
|
||||
|
||||
.metric-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
margin-top: 4rpx;
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 筛选栏
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16rpx;
|
||||
background: #fff;
|
||||
border-radius: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.filter-label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.picker-text {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
padding: 8rpx 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 6rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 审批列表
|
||||
.approval-list {
|
||||
height: calc(100vh - 280rpx);
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 100rpx 0;
|
||||
|
||||
.empty-text {
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 12rpx;
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.item-tag {
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.primary {
|
||||
background-color: #409eff;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
|
||||
.applicant {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.request-info {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.node-info {
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.time-info {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 审批意见输入框
|
||||
.remark-textarea {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
padding: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
206
pages/workbench/hrm/detail/detail.vue
Normal file
206
pages/workbench/hrm/detail/detail.vue
Normal file
@@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<view class="approval-detail-page">
|
||||
<!-- 动态渲染不同类型的审批详情组件 -->
|
||||
<component
|
||||
:is="currentDetailComponent"
|
||||
:bizId="bizId"
|
||||
v-if="bizId && bizType"
|
||||
></component>
|
||||
|
||||
<!-- 底部固定的审批操作按钮栏 -->
|
||||
<view class="approval-btn-bar" v-if="canApprove">
|
||||
<button class="btn reject-btn" @click="handleReject">驳回</button>
|
||||
<button class="btn approve-btn" @click="handleApprove">通过</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HRMLeaveDetail from '@/components/hrm/detailPanels/leave.vue'
|
||||
import HRMReimburseDetail from '@/components/hrm/detailPanels/reimburse.vue'
|
||||
import HRMSealDetail from '@/components/hrm/detailPanels/seal.vue'
|
||||
import HRMTravelDetail from '@/components/hrm/detailPanels/travel.vue'
|
||||
|
||||
import {
|
||||
approveFlowTask,
|
||||
listTodoFlowTask,
|
||||
rejectFlowTask,
|
||||
getTodoTaskByBiz,
|
||||
} from '@/api/hrm/flow';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
// 注册所有详情组件,供动态组件使用
|
||||
HRMLeaveDetail,
|
||||
HRMReimburseDetail,
|
||||
HRMSealDetail,
|
||||
HRMTravelDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
bizId: undefined,
|
||||
bizType: undefined,
|
||||
currentTask: undefined,
|
||||
// 映射bizType到对应的组件名(需和你的bizType实际值匹配,可自行调整)
|
||||
bizTypeComponentMap: {
|
||||
leave: 'HRMLeaveDetail', // 请假
|
||||
reimburse: 'HRMReimburseDetail', // 报销
|
||||
seal: 'HRMSealDetail', // 用章
|
||||
travel: 'HRMTravelDetail' // 差旅
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算属性:根据bizType获取当前要渲染的组件名
|
||||
currentDetailComponent() {
|
||||
return this.bizTypeComponentMap[this.bizType] || '';
|
||||
},
|
||||
canApprove() {
|
||||
return this.currentTask && this.currentTask.status === 'pending' && (this.currentTask?.assigneeUserName === this.$store.getters.storeOaName || this.currentTask?.assigneeUserId === this.$store.getters.storeOaId)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
bizId: {
|
||||
immediate: true, // 页面加载时立即执行(原代码缺失,导致首次赋值不触发)
|
||||
handler(newVal) {
|
||||
if (!newVal || !this.bizType) return;
|
||||
// 获取当前审批任务信息
|
||||
getTodoTaskByBiz(this.bizType, newVal)
|
||||
.then(res => {
|
||||
this.currentTask = res.data;
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: '获取审批信息失败',
|
||||
icon: 'none'
|
||||
});
|
||||
console.error('获取审批任务失败:', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 审批通过
|
||||
*/
|
||||
handleApprove() {
|
||||
if (!this.currentTask?.taskId) {
|
||||
uni.showToast({ title: '暂无审批任务', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 二次确认
|
||||
uni.showModal({
|
||||
title: '确认通过',
|
||||
content: '是否确定通过该审批?',
|
||||
// 箭头函数保留this指向
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
approveFlowTask(this.currentTask.taskId)
|
||||
.then(() => {
|
||||
uni.showToast({ title: '审批通过成功' });
|
||||
// 成功后返回上一页(可根据需求调整)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({ title: '审批通过失败', icon: 'none' });
|
||||
console.error('审批通过失败:', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 审批驳回
|
||||
*/
|
||||
handleReject() {
|
||||
if (!this.currentTask?.taskId) {
|
||||
uni.showToast({ title: '暂无审批任务', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 二次确认(可扩展:添加驳回理由输入框)
|
||||
uni.showModal({
|
||||
title: '确认驳回',
|
||||
content: '是否确定驳回该审批?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
rejectFlowTask(this.currentTask.taskId)
|
||||
.then(() => {
|
||||
uni.showToast({ title: '审批驳回成功' });
|
||||
// 成功后返回上一页(可根据需求调整)
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({ title: '审批驳回失败', icon: 'none' });
|
||||
console.error('审批驳回失败:', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
console.log('页面入参:', options);
|
||||
// 校验入参,避免undefined
|
||||
this.bizId = options.bizId || '';
|
||||
this.bizType = options.bizType || '';
|
||||
|
||||
// 入参缺失提示
|
||||
if (!this.bizId || !this.bizType) {
|
||||
uni.showToast({ title: '参数缺失,无法加载详情', icon: 'none' });
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器 */
|
||||
.approval-detail-page {
|
||||
min-height: 100vh;
|
||||
padding-bottom: 120rpx; /* 给底部按钮栏留空间 */
|
||||
}
|
||||
|
||||
/* 底部审批按钮栏 */
|
||||
.approval-btn-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #eee;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
/* 按钮通用样式 */
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
border: none;
|
||||
margin: 0 10rpx;
|
||||
}
|
||||
|
||||
/* 驳回按钮样式 */
|
||||
.reject-btn {
|
||||
background-color: #fff;
|
||||
color: #ff4757;
|
||||
border: 1px solid #ff4757;
|
||||
}
|
||||
|
||||
/* 通过按钮样式 */
|
||||
.approve-btn {
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
946
pages/workbench/hrm/leave/leave.vue
Normal file
946
pages/workbench/hrm/leave/leave.vue
Normal file
@@ -0,0 +1,946 @@
|
||||
<template>
|
||||
<view class="request-detail">
|
||||
<!-- 页面标题栏 -->
|
||||
<view class="page-header" v-if="!embedded">
|
||||
<uni-nav-bar
|
||||
left-icon="back"
|
||||
title="请假详情"
|
||||
@clickLeft="navigateBack"
|
||||
right-text="刷新"
|
||||
@clickRight="loadDetail"
|
||||
></uni-nav-bar>
|
||||
</view>
|
||||
|
||||
<!-- 主内容区 -->
|
||||
<scroll-view class="content-scroll" scroll-y>
|
||||
<!-- 加载中状态 -->
|
||||
<view v-if="loading" class="loading-container">
|
||||
<uni-load-more type="loading" color="#409EFF"></uni-load-more>
|
||||
</view>
|
||||
|
||||
<view v-else class="content-wrapper">
|
||||
<!-- 顶部摘要 -->
|
||||
<view class="form-summary">
|
||||
<view class="summary-left">
|
||||
<view class="summary-title">{{ detail.leaveType || '请假申请' }}</view>
|
||||
<view class="summary-sub">
|
||||
申请编号:{{ detail.bizId || '-' }} ·
|
||||
状态:<view class="status-tag" :class="statusType">{{ statusText }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="summary-right">
|
||||
<view class="summary-item">
|
||||
<view class="k">申请人</view>
|
||||
<view class="v">{{ detail.createBy || '-' }}<text v-if="detail.empNo" class="text-muted">({{ detail.empNo }})</text></view>
|
||||
</view>
|
||||
<view class="summary-item">
|
||||
<view class="k">请假时长</view>
|
||||
<view class="v">{{ detail.hours || '0' }} 小时</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 请假日期信息 -->
|
||||
<view class="block-title">请假日期</view>
|
||||
<view class="inner-card">
|
||||
<view class="descriptions-list">
|
||||
<view class="descriptions-item">
|
||||
<view class="label">开始时间</view>
|
||||
<view class="value date-time">{{ formatDate(detail.startTime) }}</view>
|
||||
</view>
|
||||
<view class="descriptions-item">
|
||||
<view class="label">结束时间</view>
|
||||
<view class="value date-time">{{ formatDate(detail.endTime) }}</view>
|
||||
</view>
|
||||
<view class="descriptions-item">
|
||||
<view class="label">请假类型</view>
|
||||
<view class="value">{{ detail.leaveType || '-' }}</view>
|
||||
</view>
|
||||
<view class="descriptions-item">
|
||||
<view class="label">时长(小时)</view>
|
||||
<view class="value">{{ detail.hours || '0' }} 小时</view>
|
||||
</view>
|
||||
<view class="descriptions-item">
|
||||
<view class="label">创建时间</view>
|
||||
<view class="value">{{ formatDate(detail.createTime) }}</view>
|
||||
</view>
|
||||
<view class="descriptions-item">
|
||||
<view class="label">更新时间</view>
|
||||
<view class="value">{{ formatDate(detail.updateTime) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 请假理由说明 -->
|
||||
<view class="block-title">请假理由说明</view>
|
||||
<view class="inner-card">
|
||||
<view class="reason-section">
|
||||
<view class="reason-label">事由</view>
|
||||
<view class="reason-content">{{ detail.reason || '未填写' }}</view>
|
||||
</view>
|
||||
<view v-if="detail.handover" class="reason-section">
|
||||
<view class="reason-label">工作交接</view>
|
||||
<view class="reason-content">{{ detail.handover }}</view>
|
||||
</view>
|
||||
<view v-if="detail.remark" class="reason-section">
|
||||
<view class="reason-label">备注</view>
|
||||
<view class="reason-content">{{ detail.remark }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 申请附件 -->
|
||||
<view class="block-title">申请附件</view>
|
||||
<view class="inner-card" v-if="attachmentLoading">
|
||||
<view class="loading-small">
|
||||
<uni-load-more type="loading" color="#409EFF" size="small"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inner-card" v-else>
|
||||
<view v-if="attachmentList.length > 0" class="attachment-list">
|
||||
<view v-for="file in attachmentList" :key="file.ossId" class="attachment-item">
|
||||
<view class="file-info">
|
||||
<uni-icons type="paper" size="24" color="#9aa3b2"></uni-icons>
|
||||
<view class="file-details">
|
||||
<view class="file-name">{{ file.originalName || file.fileName || `文件${file.ossId}` }}</view>
|
||||
<view class="file-meta">
|
||||
<text v-if="file.fileSize">{{ formatFileSize(file.fileSize) }}</text>
|
||||
<text v-if="file.createTime" class="file-time">{{ formatDate(file.createTime) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="file-actions">
|
||||
<button class="file-btn" size="mini" @click="previewFile(file)">预览</button>
|
||||
<button class="file-btn" size="mini" @click="downloadFile(file.ossId)">下载</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="empty">暂无附件</view>
|
||||
</view>
|
||||
|
||||
<!-- 审批意见 -->
|
||||
<view v-if="currentTask" class="approve-section">
|
||||
<view class="section-title">审批意见</view>
|
||||
<textarea
|
||||
v-model="approveForm.comment"
|
||||
placeholder="请输入审批意见(可选)"
|
||||
class="approve-textarea"
|
||||
></textarea>
|
||||
</view>
|
||||
|
||||
<!-- 审批操作按钮 -->
|
||||
<view v-if="!embedded && (canApprove || canWithdraw)" class="action-buttons">
|
||||
<button
|
||||
v-if="canApprove"
|
||||
class="btn approve-btn"
|
||||
:loading="actionLoading"
|
||||
@click="handleApprove"
|
||||
>
|
||||
通过
|
||||
</button>
|
||||
<button
|
||||
v-if="canApprove"
|
||||
class="btn reject-btn"
|
||||
:loading="actionLoading"
|
||||
@click="handleReject"
|
||||
>
|
||||
驳回
|
||||
</button>
|
||||
<button
|
||||
v-if="canWithdraw"
|
||||
class="btn withdraw-btn"
|
||||
:loading="actionLoading"
|
||||
@click="handleWithdraw"
|
||||
>
|
||||
撤回
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 流转历史 -->
|
||||
<view class="flow-history">
|
||||
<view class="section-title">流转历史</view>
|
||||
<view v-if="flowHistory.length > 0" class="timeline">
|
||||
<view
|
||||
v-for="(item, index) in flowHistory"
|
||||
:key="index"
|
||||
class="timeline-item"
|
||||
>
|
||||
<!-- 时间轴点 -->
|
||||
<view class="timeline-dot" :class="getTimelineType(item.action)"></view>
|
||||
<!-- 时间轴内容 -->
|
||||
<view class="timeline-content">
|
||||
<view class="timeline-time">{{ formatDate(item.createTime) }}</view>
|
||||
<view class="timeline-card">
|
||||
<view class="action-text">{{ getActionText(item.action) }}</view>
|
||||
<view class="operator">处理人: {{ item.createBy || '系统' }}</view>
|
||||
<view v-if="item.comment" class="comment">意见: {{ item.comment }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="no-data">暂无流转记录</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 导入API(需适配Uniapp的request请求,此处保留原API结构,实际需替换为uni.request)
|
||||
import { getLeaveReq } from '@/api/hrm/leave'
|
||||
import { getTodoTaskByBiz, approveFlowTask, rejectFlowTask, withdrawFlowTask, listFlowAction, queryInstanceByBiz, getFlowInstance, listFlowNode } from '@/api/hrm/flow'
|
||||
import { listByIds } from '@/api/oa/oss'
|
||||
|
||||
export default {
|
||||
name: 'LeaveDetail',
|
||||
props: {
|
||||
embedded: { type: Boolean, default: false }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
actionLoading: false,
|
||||
detail: {},
|
||||
currentTask: null,
|
||||
flowHistory: [],
|
||||
approveForm: {
|
||||
comment: ''
|
||||
},
|
||||
attachmentList: [],
|
||||
attachmentLoading: false,
|
||||
flowInstance: null, // 流程实例信息
|
||||
flowNodes: [], // 流程节点列表
|
||||
currentNode: null, // 当前节点信息
|
||||
bizId: null // 从onLoad获取的业务ID
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
statusText() {
|
||||
const statusMap = {
|
||||
'draft': '草稿',
|
||||
'pending': '审批中',
|
||||
'approved': '已通过',
|
||||
'rejected': '已驳回',
|
||||
'withdrawn': '已撤回'
|
||||
}
|
||||
return statusMap[this.detail.status] || this.detail.status || '未知'
|
||||
},
|
||||
statusType() {
|
||||
const typeMap = {
|
||||
'draft': 'info',
|
||||
'pending': 'warning',
|
||||
'approved': 'success',
|
||||
'rejected': 'danger',
|
||||
'withdrawn': 'info'
|
||||
}
|
||||
return typeMap[this.detail.status] || 'info'
|
||||
},
|
||||
canWithdraw() {
|
||||
// 只有待审批状态且是当前用户提交的才能撤回
|
||||
return this.detail.status === 'pending' && this.detail.createBy === this.$store.getters.name
|
||||
},
|
||||
canApprove() {
|
||||
// 只有待审批状态且是当前用户待审批的才能审批
|
||||
return this.detail.status === 'pending' && (this.currentTask?.assigneeUserName === this.$store.getters.name || this.currentTask?.assigneeUserId === this.$store.getters.id)
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// Uniapp通过onLoad获取页面参数
|
||||
this.bizId = options.bizId || options.id
|
||||
this.loadDetail()
|
||||
},
|
||||
methods: {
|
||||
// 返回上一页(适配Uniapp路由)
|
||||
navigateBack() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
async loadDetail() {
|
||||
const bizId = this.bizId
|
||||
if (!bizId) return
|
||||
|
||||
this.loading = true
|
||||
try {
|
||||
// 加载请假单详情
|
||||
const detailRes = await getLeaveReq(bizId)
|
||||
this.detail = detailRes.data || {}
|
||||
|
||||
// 加载流程实例信息
|
||||
await this.loadFlowInstance()
|
||||
|
||||
// 加载当前待办任务
|
||||
await this.loadCurrentTask()
|
||||
|
||||
// 加载流转历史和附件
|
||||
await Promise.all([
|
||||
this.loadFlowHistory(),
|
||||
this.loadAttachments()
|
||||
])
|
||||
} catch (error) {
|
||||
console.error('加载详情失败:', error)
|
||||
uni.showToast({
|
||||
title: '加载详情失败',
|
||||
icon: 'error'
|
||||
})
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async loadCurrentTask() {
|
||||
const bizId = this.bizId
|
||||
if (!bizId) {
|
||||
this.currentTask = null
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await getTodoTaskByBiz('leave', bizId)
|
||||
this.currentTask = res?.data || null
|
||||
} catch (error) {
|
||||
console.error('加载待办任务失败:', error)
|
||||
this.currentTask = null
|
||||
}
|
||||
},
|
||||
async loadFlowInstance() {
|
||||
if (!this.detail.instId) {
|
||||
// 如果没有instId,尝试通过bizType和bizId查询
|
||||
try {
|
||||
const res = await queryInstanceByBiz('leave', this.bizId)
|
||||
const instances = res.data || []
|
||||
if (instances.length > 0) {
|
||||
this.flowInstance = instances[0]
|
||||
this.detail.instId = instances[0].instId
|
||||
// 加载流程节点信息
|
||||
await this.loadFlowNodes()
|
||||
// 根据当前节点ID查找节点信息
|
||||
if (this.flowInstance.currentNodeId) {
|
||||
this.currentNode = this.flowNodes.find(n => n.nodeId === this.flowInstance.currentNodeId) || null
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载流程实例失败:', e)
|
||||
}
|
||||
} else {
|
||||
// 如果有instId,直接加载
|
||||
try {
|
||||
const res = await getFlowInstance(this.detail.instId)
|
||||
this.flowInstance = res.data || null
|
||||
// 加载流程节点信息
|
||||
await this.loadFlowNodes()
|
||||
// 根据当前节点ID查找节点信息
|
||||
if (this.flowInstance && this.flowInstance.currentNodeId) {
|
||||
this.currentNode = this.flowNodes.find(n => n.nodeId === this.flowInstance.currentNodeId) || null
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载流程实例失败:', e)
|
||||
}
|
||||
}
|
||||
},
|
||||
async loadFlowNodes() {
|
||||
if (!this.flowInstance || !this.flowInstance.tplId) {
|
||||
this.flowNodes = []
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await listFlowNode({ tplId: this.flowInstance.tplId, pageNum: 1, pageSize: 500 })
|
||||
this.flowNodes = res.rows || res.data || []
|
||||
} catch (e) {
|
||||
console.error('加载流程节点失败:', e)
|
||||
this.flowNodes = []
|
||||
}
|
||||
},
|
||||
|
||||
async loadFlowHistory() {
|
||||
// 基于 instId 拉取流转历史(优先用 instId;无则不查)
|
||||
const instId = this.detail?.instId
|
||||
if (!instId) {
|
||||
this.flowHistory = []
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await listFlowAction({ instId, pageNum: 1, pageSize: 200 })
|
||||
this.flowHistory = res.rows || res.data || []
|
||||
} catch (error) {
|
||||
this.flowHistory = []
|
||||
}
|
||||
},
|
||||
|
||||
async handleApprove() {
|
||||
await this.handleAction('approve', '通过成功', '通过')
|
||||
},
|
||||
|
||||
async handleReject() {
|
||||
await this.handleAction('reject', '已驳回', '驳回')
|
||||
},
|
||||
|
||||
async handleWithdraw() {
|
||||
await this.handleAction('withdraw', '已撤回', '撤回')
|
||||
},
|
||||
|
||||
async handleAction(action, successMsg, actionName) {
|
||||
if (!this.currentTask?.taskId) {
|
||||
uni.showToast({
|
||||
title: '未找到待办任务',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Uniapp确认弹窗
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `确定${actionName}该申请吗?`,
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
this.actionLoading = true
|
||||
try {
|
||||
const payload = { remark: this.approveForm.comment }
|
||||
|
||||
if (action === 'approve') {
|
||||
await approveFlowTask(this.currentTask.taskId, payload)
|
||||
} else if (action === 'reject') {
|
||||
await rejectFlowTask(this.currentTask.taskId, payload)
|
||||
} else if (action === 'withdraw') {
|
||||
await withdrawFlowTask(this.currentTask.taskId, payload)
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: successMsg,
|
||||
icon: 'success'
|
||||
})
|
||||
await this.loadDetail()
|
||||
// 清空审批意见
|
||||
this.approveForm.comment = ''
|
||||
} catch (error) {
|
||||
console.error(`${actionName}失败:`, error)
|
||||
uni.showToast({
|
||||
title: error.message || `${actionName}失败`,
|
||||
icon: 'error'
|
||||
})
|
||||
} finally {
|
||||
this.actionLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
formatDate(val) {
|
||||
if (!val) return '-'
|
||||
const d = new Date(val)
|
||||
const p = n => (n < 10 ? `0${n}` : n)
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
|
||||
},
|
||||
|
||||
getActionText(action) {
|
||||
const map = {
|
||||
'submit': '提交申请',
|
||||
'approve': '通过',
|
||||
'reject': '驳回',
|
||||
'withdraw': '撤回',
|
||||
'cancel': '取消'
|
||||
}
|
||||
return map[action] || action
|
||||
},
|
||||
|
||||
getTimelineType(action) {
|
||||
const map = {
|
||||
'submit': 'primary',
|
||||
'approve': 'success',
|
||||
'reject': 'danger',
|
||||
'withdraw': 'info',
|
||||
'cancel': 'info'
|
||||
}
|
||||
return map[action] || 'info'
|
||||
},
|
||||
async loadAttachments() {
|
||||
const fileIds = this.detail.accessoryApplyIds || this.detail.applyFileIds
|
||||
if (!fileIds) {
|
||||
this.attachmentList = []
|
||||
return
|
||||
}
|
||||
const ids = String(fileIds).split(',').map(id => id.trim()).filter(Boolean)
|
||||
if (ids.length === 0) {
|
||||
this.attachmentList = []
|
||||
return
|
||||
}
|
||||
this.attachmentLoading = true
|
||||
try {
|
||||
const res = await listByIds(ids)
|
||||
this.attachmentList = res.data || []
|
||||
} catch (e) {
|
||||
uni.showToast({
|
||||
title: '加载附件失败:' + (e.message || '未知错误'),
|
||||
icon: 'error'
|
||||
})
|
||||
this.attachmentList = []
|
||||
} finally {
|
||||
this.attachmentLoading = false
|
||||
}
|
||||
},
|
||||
formatFileSize(bytes) {
|
||||
if (!bytes) return '-'
|
||||
const units = ['B', 'KB', 'MB', 'GB']
|
||||
let size = Number(bytes)
|
||||
let unitIndex = 0
|
||||
while (size >= 1024 && unitIndex < units.length - 1) {
|
||||
size /= 1024
|
||||
unitIndex++
|
||||
}
|
||||
return `${size.toFixed(2)} ${units[unitIndex]}`
|
||||
},
|
||||
// 移动端附件预览
|
||||
previewFile(file) {
|
||||
if (file.url) {
|
||||
// 图片类文件直接预览,其他文件提示下载
|
||||
const fileExt = (file.originalName || '').split('.').pop().toLowerCase()
|
||||
const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
|
||||
|
||||
if (imageExts.includes(fileExt)) {
|
||||
uni.previewImage({
|
||||
urls: [file.url],
|
||||
current: file.url
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该文件不支持预览,是否下载?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.downloadFile(file.ossId)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '文件URL不存在',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 移动端附件下载
|
||||
downloadFile(ossId) {
|
||||
uni.showLoading({
|
||||
title: '下载中...'
|
||||
})
|
||||
// Uniapp下载文件API
|
||||
uni.downloadFile({
|
||||
url: `/system/oss/download/${ossId}`,
|
||||
success: (res) => {
|
||||
uni.hideLoading()
|
||||
if (res.statusCode === 200) {
|
||||
// 打开下载的文件
|
||||
uni.openDocument({
|
||||
filePath: res.tempFilePath,
|
||||
showMenu: true,
|
||||
fail: (err) => {
|
||||
uni.showToast({
|
||||
title: '打开文件失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '下载失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '下载失败:' + err.message,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.request-detail {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
.page-header {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.content-scroll {
|
||||
height: calc(100vh - 44px);
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 400rpx;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
gap: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.form-summary {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
padding: 16rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 10rpx;
|
||||
background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
|
||||
}
|
||||
|
||||
.summary-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 800;
|
||||
color: #2b2f36;
|
||||
}
|
||||
|
||||
.summary-sub {
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
padding: 4rpx 8rpx;
|
||||
border-radius: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
&.warning {
|
||||
background-color: #e6a23c;
|
||||
}
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-right {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.summary-item .k {
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
}
|
||||
|
||||
.summary-item .v {
|
||||
margin-top: 4rpx;
|
||||
font-weight: 700;
|
||||
color: #2b2f36;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #909399;
|
||||
margin-left: 8rpx;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.block-title {
|
||||
margin: 16rpx 0 8rpx;
|
||||
padding-left: 10rpx;
|
||||
font-weight: 700;
|
||||
color: #2f3440;
|
||||
border-left: 6rpx solid #9aa3b2;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.inner-card {
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
padding: 16rpx;
|
||||
}
|
||||
|
||||
.descriptions-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.descriptions-item {
|
||||
width: 50%;
|
||||
margin-bottom: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.descriptions-item .label {
|
||||
font-size: 24rpx;
|
||||
color: #8a8f99;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.descriptions-item .value {
|
||||
font-size: 26rpx;
|
||||
color: #2b2f36;
|
||||
}
|
||||
|
||||
.date-time {
|
||||
font-weight: 600;
|
||||
color: #2b2f36;
|
||||
}
|
||||
|
||||
.reason-section {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.reason-section:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.reason-label {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #606266;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.reason-content {
|
||||
padding: 16rpx;
|
||||
background: #f8f9fa;
|
||||
border-radius: 6rpx;
|
||||
color: #2b2f36;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.loading-small {
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.attachment-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.attachment-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10rpx 12rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 8rpx;
|
||||
background: #fafbfc;
|
||||
}
|
||||
|
||||
.file-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.file-details {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.file-name {
|
||||
font-weight: 600;
|
||||
color: #2b2f36;
|
||||
margin-bottom: 4rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.file-meta {
|
||||
font-size: 22rpx;
|
||||
color: #8a8f99;
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.file-time {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.file-actions {
|
||||
display: flex;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.file-btn {
|
||||
font-size: 22rpx;
|
||||
padding: 4rpx 8rpx;
|
||||
background-color: #f5f7fa;
|
||||
color: #409eff;
|
||||
border: none;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: #a0a3ad;
|
||||
font-size: 24rpx;
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.approve-section {
|
||||
margin-top: 20rpx;
|
||||
background: #f8f9fa;
|
||||
padding: 15rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10rpx;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.approve-textarea {
|
||||
width: 100%;
|
||||
padding: 12rpx;
|
||||
border: 1px solid #e6e8ed;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
min-height: 120rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
border: none;
|
||||
|
||||
&.approve-btn {
|
||||
background-color: #67c23a;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.reject-btn {
|
||||
background-color: #f56c6c;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.withdraw-btn {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.flow-history {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.no-data {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
padding: 40rpx 0;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding-left: 30rpx;
|
||||
margin-left: 10rpx;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 10rpx;
|
||||
top: 10rpx;
|
||||
bottom: 10rpx;
|
||||
width: 2rpx;
|
||||
background-color: #e6e8ed;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
position: relative;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -36rpx;
|
||||
top: 0;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border-radius: 50%;
|
||||
|
||||
&.primary {
|
||||
background-color: #409eff;
|
||||
}
|
||||
&.success {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
&.danger {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
&.info {
|
||||
background-color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
padding: 16rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.timeline-time {
|
||||
font-size: 22rpx;
|
||||
color: #909399;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.action-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.operator {
|
||||
font-size: 24rpx;
|
||||
color: #606266;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.comment {
|
||||
font-size: 24rpx;
|
||||
color: #606266;
|
||||
padding-top: 8rpx;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
22
pages/workbench/hrm/reimburse/reimburse.vue
Normal file
22
pages/workbench/hrm/reimburse/reimburse.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
22
pages/workbench/hrm/seal/seal.vue
Normal file
22
pages/workbench/hrm/seal/seal.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
22
pages/workbench/hrm/travel/travel.vue
Normal file
22
pages/workbench/hrm/travel/travel.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -121,6 +121,24 @@ export default {
|
||||
url: '/pages/workbench/notice/notice',
|
||||
category: '信息中心'
|
||||
},
|
||||
{
|
||||
text: '我的代办',
|
||||
icon: '/static/images/todo.png',
|
||||
url: '/pages/workbench/hrm/approve/approve',
|
||||
category: '办公管理'
|
||||
},
|
||||
{
|
||||
text: '抄送我的',
|
||||
icon: '/static/images/cc.png',
|
||||
url: '/pages/workbench/hrm/cc/cc',
|
||||
category: '办公管理'
|
||||
},
|
||||
{
|
||||
text: '我的申请',
|
||||
icon: '/static/images/hrm_apply.png',
|
||||
url: '/pages/workbench/hrm/apply/apply',
|
||||
category: '办公管理'
|
||||
},
|
||||
{
|
||||
text: '库存盘点',
|
||||
icon: '/static/images/stock.png',
|
||||
@@ -171,12 +189,7 @@ export default {
|
||||
url: '/pages/workbench/wms/out',
|
||||
category: '库房管理',
|
||||
},
|
||||
// {
|
||||
// text: '我的申请',
|
||||
// icon: '/static/images/apply.png',
|
||||
// url: '/pages/workbench/workflow/apply/apply',
|
||||
// category: '办公流程'
|
||||
// },
|
||||
|
||||
// {
|
||||
// text: '代办任务',
|
||||
// icon: '/static/images/todo.png',
|
||||
@@ -234,9 +247,11 @@ export default {
|
||||
uni.showLoading()
|
||||
console.log('开始调用getUserProfile API');
|
||||
const response = await getUserProfile();
|
||||
//
|
||||
console.log('用户个人信息:', response);
|
||||
// 从接口返回数据中提取用户权限(roleKey)
|
||||
const roles = response.data.user?.roles?.map(item => item.roleKey) || [];
|
||||
this.$store.commit('oa/SET_STATE', response.data.user)
|
||||
console.log('用户权限字段', roles);
|
||||
this.roleGroup = roles;
|
||||
uni.hideLoading()
|
||||
|
||||
BIN
static/images/cc.png
Normal file
BIN
static/images/cc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
BIN
static/images/hrm_apply.png
Normal file
BIN
static/images/hrm_apply.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@@ -19,4 +19,6 @@ export default {
|
||||
storeReinstall: (state) => state.user.reinstall,
|
||||
storeProgress: (state) => state.user.progress,
|
||||
storeAuthData: (state) => state.user.authData,
|
||||
storeOaId: (state) => state.oa.id,
|
||||
storeOaName: (state) => state.oa.userName,
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ import conversation from "./modules/conversation";
|
||||
import message from "./modules/message";
|
||||
import cache from './modules/cache.js'
|
||||
import getters from "./getters";
|
||||
import oa from './modules/oa.js'
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
@@ -15,7 +16,8 @@ const store = new Vuex.Store({
|
||||
contact,
|
||||
conversation,
|
||||
message,
|
||||
cache
|
||||
cache,
|
||||
oa
|
||||
},
|
||||
getters,
|
||||
});
|
||||
|
||||
24
store/modules/oa.js
Normal file
24
store/modules/oa.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const state = {
|
||||
id: undefined,
|
||||
nickName: undefined,
|
||||
userName: undefined,
|
||||
roles: [],
|
||||
dept: undefined,
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_STATE(state, value) {
|
||||
state.id = value.userId;
|
||||
state.nickName = value.nickName;
|
||||
state.userName = value.userName;
|
||||
state.dept = value.dept.deptName;
|
||||
},
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user