- 审批意见:{{ task.reason }}
+
审批意见:{{ task.reason }}
+
+
+
+
+
+ {{ getAttachmentName(attachment) }}
+
+
+
{
}
}
+/** 是否展示审批意见和附件 */
+const shouldShowReasonAndAttachment = (
+ task: ProcessInstanceApi.ApprovalTaskInfo,
+ nodeType: NodeType
+) => {
+ return (
+ Boolean(task.reason || task.attachments?.length) &&
+ [NodeType.START_USER_NODE, NodeType.USER_TASK_NODE, NodeType.END_EVENT_NODE].includes(nodeType)
+ )
+}
+
+/** 获取附件名 */
+const getAttachmentName = (url: string) => {
+ const cleanUrl = url.split(/[?#]/)[0]
+ const fileName = cleanUrl.slice(cleanUrl.lastIndexOf('/') + 1)
+ try {
+ return decodeURIComponent(fileName)
+ } catch {
+ return fileName
+ }
+}
+
+/** 是否图片附件 */
+const isImageAttachment = (url: string) => {
+ const ext = url.split(/[?#]/)[0]?.split('.').pop()?.toLowerCase()
+ return ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'webp'].includes(ext || '')
+}
+
// 选择自定义审批人
const userSelectFormRef = ref()
const handleSelectUser = (activityId, selectedList) => {