refactor: reduce approval context overhead
CI / Client installer (macos-latest) (push) Canceled after 0s
CI / Client installer (ubuntu-latest) (push) Canceled after 0s
CI / Client installer (windows-latest) (push) Canceled after 0s
CI / test (22) (push) Canceled after 0s
CI / test (24) (push) Canceled after 0s
CI / release-smoke (push) Canceled after 0s
CI / Client installer (macos-latest) (push) Canceled after 0s
CI / Client installer (ubuntu-latest) (push) Canceled after 0s
CI / Client installer (windows-latest) (push) Canceled after 0s
CI / test (22) (push) Canceled after 0s
CI / test (24) (push) Canceled after 0s
CI / release-smoke (push) Canceled after 0s
This commit is contained in:
@@ -1149,21 +1149,18 @@ export class UnifiedApprovalService {
|
||||
return {
|
||||
approvalId: this.signPortableApprovalReference(ref),
|
||||
source: "dingtalk",
|
||||
sourceType: item.source,
|
||||
businessNo: item.processInstanceId,
|
||||
title: item.title ?? item.processName ?? "钉钉审批",
|
||||
applicant: {
|
||||
...(item.applicantName ? { name: item.applicantName } : {}),
|
||||
...(item.applicantDepartment ? { department: item.applicantDepartment } : {}),
|
||||
},
|
||||
...(item.submittedAt ? { submittedAt: item.submittedAt } : {}),
|
||||
...(item.submittedAt ? localTimeFields(item.submittedAt) : {}),
|
||||
...(item.submittedAt ? { submittedAt: localTime(item.submittedAt) } : {}),
|
||||
...(item.amount !== undefined ? { amount: { value: item.amount, currency: item.currency ?? "CNY" } } : {}),
|
||||
...(item.summary ? { summary: item.summary } : {}),
|
||||
availableActions: [
|
||||
...(clientOnly ? [] : ["approve", "reject"]),
|
||||
],
|
||||
actionsHint: "approve/reject 可直接批量提交,网关会在写入前逐张实时复核;只有退回需要调用 approval_get_actions 获取 targetId。",
|
||||
...(clientOnly ? {
|
||||
manualAction: {
|
||||
required: true,
|
||||
@@ -1188,15 +1185,13 @@ export class UnifiedApprovalService {
|
||||
return {
|
||||
approvalId: this.signPortableApprovalReference(ref),
|
||||
source: "xft",
|
||||
sourceType: "smart_expense",
|
||||
businessNo: item.billId,
|
||||
title: item.title ?? "薪福通审批",
|
||||
applicant: {
|
||||
...(item.applicantName ? { name: item.applicantName } : {}),
|
||||
...(item.applicantDepartment ? { department: item.applicantDepartment } : {}),
|
||||
},
|
||||
...(item.applyTime ? { submittedAt: item.applyTime } : {}),
|
||||
...(item.applyTime ? localTimeFields(item.applyTime) : {}),
|
||||
...(item.applyTime ? { submittedAt: localTime(item.applyTime) } : {}),
|
||||
...(item.amount !== undefined ? { amount: { value: item.amount, currency: item.currency ?? "CNY" } } : {}),
|
||||
...(item.reason ? { summary: item.reason } : {}),
|
||||
availableActions: [
|
||||
@@ -1848,6 +1843,10 @@ function localTimeFields(value: string): Record<string, string> {
|
||||
return { submittedAtLocal: local, submittedTimeZone: "Asia/Shanghai" };
|
||||
}
|
||||
|
||||
function localTime(value: string): string {
|
||||
return localTimeFields(value).submittedAtLocal ?? value;
|
||||
}
|
||||
|
||||
function dingTalkSubmissionTemplateAllowed(template: { dirName?: string; name?: string }): boolean {
|
||||
if (!template.dirName || !template.name) return false;
|
||||
const names = DINGTALK_SUBMISSION_TEMPLATES[template.dirName as keyof typeof DINGTALK_SUBMISSION_TEMPLATES];
|
||||
|
||||
Reference in New Issue
Block a user