BpmButton.vue将提交审批信息移动到提交对话框中

This commit is contained in:
thinkgem
2023-12-07 15:57:37 +08:00
parent d00f4b6d25
commit a07cb38dab
2 changed files with 25 additions and 2 deletions

View File

@@ -301,6 +301,11 @@ public class ${ClassName}Controller extends BaseController {
@RequestMapping(value = "delete")
@ResponseBody
public String delete(${ClassName} ${className}) {
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
if (!${ClassName}.STATUS_DRAFT.equals(${className}.getStatus())){
return renderResult(Global.FALSE, text("只能删除草稿状态的数据!"));
}
<% } %>
${className}Service.delete(${className});
return renderResult(Global.TRUE, text("删除${functionNameSimple}成功!"));
}

View File

@@ -50,8 +50,10 @@
bpmEntityKey="id"
formKey="${table.optionMap['bpmFormKey']}"
completeText="提交"
:completeModal="true"
:loading="loadingRef"
:auth="'${permissionPrefix}:edit'"
@validate="handleValidate"
@complete="handleSubmit"
@success="handleSuccess"
@close="closeDrawer"
@@ -340,7 +342,7 @@ for (c in table.columnList){
},
<%
}
if(toBoolean(table.optionMap['isBpmForm'])){
if(false && toBoolean(table.optionMap['isBpmForm'])){
%>
{
label: t('审批意见'),
@@ -618,14 +620,30 @@ for (c in table.columnList){
<% } %>
setDrawerProps({ loading: false });
});
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
async function handleSubmit() {
async function handleValidate(_event: any, formData: any) {
try {
const data = await validate();
formData(true, data); // 将表单数据传递给 BpmButton
} catch (error: any) {
if (error && error.errorFields) {
showMessage(t('common.validateError'));
}
console.log('error', error);
}
}
<% } %>
async function handleSubmit(<% if(toBoolean(table.optionMap['isBpmForm'])){ %>event: any<% } %>) {
try {
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
const data = event.formData; // 接受 BpmButton 传递过来的表单数据
data.bpm = Object.assign(data.bpm || {}, record.value.bpm); // 流程信息
data.status = record.value.status; // 提交状态
loadingRef.value = true;
<% } else { %>
const data = await validate();
<% } %>
setDrawerProps({ confirmLoading: true });
const params: any = {