|
|
@ -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: {}, |
|
|
|