From b1b295def70778c56764355fa7ef21a204bae7c7 Mon Sep 17 00:00:00 2001 From: likunming Date: Wed, 23 Jul 2025 17:32:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=80=E5=B9=B6=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/components/toolbar/Toolbar.ts | 4 ++-- .../components/workflow/WWorkflowAction.vue | 24 +++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/io.sc.platform.core.frontend/src/platform/components/toolbar/Toolbar.ts b/io.sc.platform.core.frontend/src/platform/components/toolbar/Toolbar.ts index b6271fcc..a2ed8627 100644 --- a/io.sc.platform.core.frontend/src/platform/components/toolbar/Toolbar.ts +++ b/io.sc.platform.core.frontend/src/platform/components/toolbar/Toolbar.ts @@ -156,7 +156,7 @@ export class Toolbar { if (Tools.isUndefinedOrNull(icon)) { return undefined; } else if (typeof icon === 'function') { - return icon(this.cm.args); + return icon(this.cm.args.value); } else { return icon; } @@ -171,7 +171,7 @@ export class Toolbar { if (Tools.isUndefinedOrNull(label)) { return ''; } else if (typeof label === 'function') { - return label(this.cm.args); + return label(this.cm.args.value); } else { return label; } diff --git a/io.sc.platform.core.frontend/src/platform/components/workflow/WWorkflowAction.vue b/io.sc.platform.core.frontend/src/platform/components/workflow/WWorkflowAction.vue index 3d04269a..bfb5f34e 100644 --- a/io.sc.platform.core.frontend/src/platform/components/workflow/WWorkflowAction.vue +++ b/io.sc.platform.core.frontend/src/platform/components/workflow/WWorkflowAction.vue @@ -37,6 +37,15 @@ const props = defineProps({ isGobackActionDropdown: { type: Boolean, default: false }, // 是否出现默认的 submit 按钮 defaultSubmitButton: { type: Boolean, default: true }, + // 提交数据是否包含文件 + isContainsFile: { type: Boolean, default: false }, + // 用户组装好包含文件的FormData对象,真正提交时将getData函数中的内容追加到该对象中提交给后端 + formData: { + type: FormData, + default: () => { + return new FormData(); + } + }, }); /** @@ -117,7 +126,7 @@ const buttonClick = (action) => { if (value) { DialogManager.confirm(t('lcdp.bpm.completeTask.action.tip', { action: action.title }), () => { currentActionRef.value = action; - axios.post(props.actionUrl + '/' + props.taskId, getData(action)).then((response) => { + axios.post(props.actionUrl + '/' + props.taskId, getSubmitData(action)).then((response) => { if (response.data.code === 0) { // 操作成功 emit('afterSubmit'); @@ -132,7 +141,7 @@ const buttonClick = (action) => { }; const assigneeSelected = (assignee) => { - axios.post(props.actionUrl + '/' + props.taskId, getData(currentActionRef.value, assignee)).then((response) => { + axios.post(props.actionUrl + '/' + props.taskId, getSubmitData(currentActionRef.value, assignee)).then((response) => { const rawData = response.data; if (rawData.code === 0) { // 操作成功 @@ -141,6 +150,17 @@ const assigneeSelected = (assignee) => { }); }; +const getSubmitData = (action, assignee = undefined) => { + const data = getData(action, assignee); + if (props.isContainsFile) { + const formData = props.formData; + formData.append('data', JSON.stringify(data)); + return formData; + } else { + return data; + } +}; + const getData = (action, assignee) => { const data = { variables: {},