chore(P14-8): 完成运营化与验收收口
这个提交包含在:
+46
-44
@@ -140,10 +140,10 @@ function isoOrNull(value) {
|
||||
function mapTaskSummary(task) {
|
||||
const workflowInstance = task.workflow_instance
|
||||
? {
|
||||
entity_type: task.workflow_instance.entity_type,
|
||||
entity_id: task.workflow_instance.entity_id,
|
||||
current_status: task.workflow_instance.current_status,
|
||||
}
|
||||
entity_type: task.workflow_instance.entity_type,
|
||||
entity_id: task.workflow_instance.entity_id,
|
||||
current_status: task.workflow_instance.current_status,
|
||||
}
|
||||
: null;
|
||||
|
||||
return {
|
||||
@@ -168,10 +168,10 @@ function mapTaskSummary(task) {
|
||||
completedAt: isoOrNull(task.completed_at),
|
||||
workflowInstance: workflowInstance
|
||||
? {
|
||||
entityType: workflowInstance.entity_type,
|
||||
entityId: workflowInstance.entity_id,
|
||||
currentStatus: workflowInstance.current_status,
|
||||
}
|
||||
entityType: workflowInstance.entity_type,
|
||||
entityId: workflowInstance.entity_id,
|
||||
currentStatus: workflowInstance.current_status,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
}
|
||||
@@ -425,6 +425,7 @@ async function workflowRoutes(fastify) {
|
||||
fastify.get(
|
||||
"/workflow/tasks",
|
||||
{
|
||||
schema: { tags: ["Workflow"], summary: "List Workflow Tasks" },
|
||||
preHandler: fastify.authenticate,
|
||||
},
|
||||
async (request, reply) => {
|
||||
@@ -479,6 +480,7 @@ async function workflowRoutes(fastify) {
|
||||
fastify.get(
|
||||
"/workflow/tasks/:taskId",
|
||||
{
|
||||
schema: { tags: ["Workflow"], summary: "Get Workflow Task Detail" },
|
||||
preHandler: fastify.authenticate,
|
||||
},
|
||||
async (request, reply) => {
|
||||
@@ -612,39 +614,39 @@ async function workflowRoutes(fastify) {
|
||||
},
|
||||
workflowInstance: task.workflow_instance
|
||||
? {
|
||||
id: task.workflow_instance.id,
|
||||
currentStatus: task.workflow_instance.current_status,
|
||||
currentStepId: task.workflow_instance.current_step_id,
|
||||
startedAt: isoOrNull(task.workflow_instance.started_at),
|
||||
completedAt: isoOrNull(task.workflow_instance.completed_at),
|
||||
}
|
||||
id: task.workflow_instance.id,
|
||||
currentStatus: task.workflow_instance.current_status,
|
||||
currentStepId: task.workflow_instance.current_step_id,
|
||||
startedAt: isoOrNull(task.workflow_instance.started_at),
|
||||
completedAt: isoOrNull(task.workflow_instance.completed_at),
|
||||
}
|
||||
: null,
|
||||
reimbursement: task.workflow_instance?.reimbursement_form
|
||||
? {
|
||||
id: task.workflow_instance.reimbursement_form.id,
|
||||
formNumber: task.workflow_instance.reimbursement_form.form_number,
|
||||
status: task.workflow_instance.reimbursement_form.status,
|
||||
reimbursementDate:
|
||||
task.workflow_instance.reimbursement_form.reimbursement_date
|
||||
?.toISOString?.()
|
||||
?.slice(0, 10) ?? null,
|
||||
totalAmount: toMoneyString(task.workflow_instance.reimbursement_form.total_amount),
|
||||
description: task.workflow_instance.reimbursement_form.description,
|
||||
owner: task.workflow_instance.reimbursement_form.owner
|
||||
? {
|
||||
id: task.workflow_instance.reimbursement_form.owner.id,
|
||||
employeeNo: task.workflow_instance.reimbursement_form.owner.employee_no,
|
||||
name: task.workflow_instance.reimbursement_form.owner.name,
|
||||
}
|
||||
: null,
|
||||
submitter: task.workflow_instance.reimbursement_form.submitter
|
||||
? {
|
||||
id: task.workflow_instance.reimbursement_form.submitter.id,
|
||||
employeeNo: task.workflow_instance.reimbursement_form.submitter.employee_no,
|
||||
name: task.workflow_instance.reimbursement_form.submitter.name,
|
||||
}
|
||||
: null,
|
||||
}
|
||||
id: task.workflow_instance.reimbursement_form.id,
|
||||
formNumber: task.workflow_instance.reimbursement_form.form_number,
|
||||
status: task.workflow_instance.reimbursement_form.status,
|
||||
reimbursementDate:
|
||||
task.workflow_instance.reimbursement_form.reimbursement_date
|
||||
?.toISOString?.()
|
||||
?.slice(0, 10) ?? null,
|
||||
totalAmount: toMoneyString(task.workflow_instance.reimbursement_form.total_amount),
|
||||
description: task.workflow_instance.reimbursement_form.description,
|
||||
owner: task.workflow_instance.reimbursement_form.owner
|
||||
? {
|
||||
id: task.workflow_instance.reimbursement_form.owner.id,
|
||||
employeeNo: task.workflow_instance.reimbursement_form.owner.employee_no,
|
||||
name: task.workflow_instance.reimbursement_form.owner.name,
|
||||
}
|
||||
: null,
|
||||
submitter: task.workflow_instance.reimbursement_form.submitter
|
||||
? {
|
||||
id: task.workflow_instance.reimbursement_form.submitter.id,
|
||||
employeeNo: task.workflow_instance.reimbursement_form.submitter.employee_no,
|
||||
name: task.workflow_instance.reimbursement_form.submitter.name,
|
||||
}
|
||||
: null,
|
||||
}
|
||||
: null,
|
||||
allowedActions: listAllowedActionsForTask(request, task, actionable),
|
||||
history: historyItems.map((item) => ({
|
||||
@@ -681,12 +683,12 @@ async function workflowRoutes(fastify) {
|
||||
},
|
||||
...(query.keyword
|
||||
? {
|
||||
OR: [
|
||||
{ name: { contains: query.keyword, mode: "insensitive" } },
|
||||
{ email: { contains: query.keyword, mode: "insensitive" } },
|
||||
{ employee_no: { contains: query.keyword, mode: "insensitive" } },
|
||||
],
|
||||
}
|
||||
OR: [
|
||||
{ name: { contains: query.keyword, mode: "insensitive" } },
|
||||
{ email: { contains: query.keyword, mode: "insensitive" } },
|
||||
{ employee_no: { contains: query.keyword, mode: "insensitive" } },
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户