feat: [antd][bpm] 发起流程问题修复, todo 修改

pull/247/head
jason 2025-11-02 09:29:46 +08:00
parent 40f615d3c5
commit 1f767c5090
2 changed files with 27 additions and 19 deletions

View File

@ -51,7 +51,6 @@ const props = defineProps({
const emit = defineEmits(['cancel']); const emit = defineEmits(['cancel']);
const { closeCurrentTab } = useTabs(); const { closeCurrentTab } = useTabs();
const isFormReady = ref(false); // form-create
const getTitle = computed(() => { const getTitle = computed(() => {
return `流程表单 - ${props.selectProcessDefinition.name}`; return `流程表单 - ${props.selectProcessDefinition.name}`;
}); });
@ -122,21 +121,32 @@ async function initProcessInfo(row: any, formVariables?: any) {
// formVariables row.formFields // formVariables row.formFields
// formVariables // formVariables
// //
const formApi = formCreate.create(decodeFields(row.formFields));
const allowedFields = formApi.fields(); //
for (const key in formVariables) { const decodedFields = decodeFields(row.formFields);
if (!allowedFields.includes(key)) { const allowedFields = new Set(
delete formVariables[key]; decodedFields.map((field: any) => field.field).filter(Boolean),
);
//
if (formVariables) {
for (const key in formVariables) {
if (!allowedFields.has(key)) {
delete formVariables[key];
}
} }
} }
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables); setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables);
// // form-create
// TODO @jason detailForm.value.option = {
isFormReady.value = true; ...detailForm.value.option,
submitBtn: false,
resetBtn: false,
};
await nextTick(); await nextTick();
fApi.value?.btn.show(false); //
// , // ,
await getApprovalDetail({ await getApprovalDetail({
@ -153,30 +163,32 @@ async function initProcessInfo(row: any, formVariables?: any) {
} }
// //
} else if (row.formCustomCreatePath) { } else if (row.formCustomCreatePath) {
// Tab
await router.push({ await router.push({
path: row.formCustomCreatePath, path: row.formCustomCreatePath,
}); });
// Tab //
emit('cancel');
} }
} }
/** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */ /** 预测流程节点会因为输入的参数值而产生新的预测结果值,所以需重新预测一次 */
watch( watch(
detailForm.value, () => detailForm.value.value,
(newValue) => { (newValue) => {
if (newValue && Object.keys(newValue.value).length > 0) { if (newValue && Object.keys(newValue).length > 0) {
// //
tempStartUserSelectAssignees.value = startUserSelectAssignees.value; tempStartUserSelectAssignees.value = startUserSelectAssignees.value;
startUserSelectAssignees.value = {}; startUserSelectAssignees.value = {};
// //
getApprovalDetail({ getApprovalDetail({
id: props.selectProcessDefinition.id, id: props.selectProcessDefinition.id,
processVariablesStr: JSON.stringify(newValue.value), // GET String JSON processVariablesStr: JSON.stringify(newValue), // GET String JSON
}); });
} }
}, },
{ {
immediate: true, deep: true,
}, },
); );
@ -283,7 +295,6 @@ defineExpose({ initProcessInfo });
class="flex-1 overflow-auto" class="flex-1 overflow-auto"
> >
<form-create <form-create
v-if="isFormReady"
:rule="detailForm.rule" :rule="detailForm.rule"
v-model:api="fApi" v-model:api="fApi"
v-model="detailForm.value" v-model="detailForm.value"

View File

@ -268,9 +268,6 @@ async function openPopover(type: string) {
Object.keys(popOverVisible.value).forEach((item) => { Object.keys(popOverVisible.value).forEach((item) => {
if (popOverVisible.value[item]) popOverVisible.value[item] = item === type; if (popOverVisible.value[item]) popOverVisible.value[item] = item === type;
}); });
// TODO @jason 2
// await nextTick()
// formRef.value.resetFields()
} }
/** 关闭气泡卡 */ /** 关闭气泡卡 */