客户自定义表单流程

This commit is contained in:
‘huanghaiixia’
2025-11-27 17:23:14 +08:00
parent 57472a55c0
commit 105da87b88
12 changed files with 382 additions and 133 deletions

View File

@ -10,6 +10,8 @@
<template #left>
<FlowPanel :xml="data.xml" :taskRecords="data.taskRecords" :predecessorTasks="selectedPredecessorTasks" :processId="props.processId" :schemaId="props.schemaId" position="top">
<FormInformation
:curPageCode="curPageCode"
:id="id"
:opinionsComponents="data.opinionsComponents"
:opinions="data.opinions"
:disabled="false"
@ -143,12 +145,14 @@
schemaId: string;
processId: string;
taskId: string;
id: string;
visible?: boolean;
}>(),
{
schemaId: '',
processId: '',
taskId: '',
id: '',
visible: false
}
);
@ -210,7 +214,8 @@
return ele.taskId;
});
});
const curPageCode = ref()
const id = ref()
// 审批
async function approval() {
showLoading.value = true;
@ -218,6 +223,8 @@
if (props.taskId) {
try {
let res = await getApprovalProcess(props.taskId, props.processId);
curPageCode.value = res?.schemaInfo?.code
id.value = res?.formInfos[0]?.formData?.id
initProcessData(res);
if (res.buttonConfigs) {
approvalData.buttonConfigs = res.buttonConfigs;

View File

@ -35,8 +35,13 @@
<div id="approveExtendButton"></div>
<div id="approveRightButton"></div>
</div>
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" />
<SimpleForm v-else-if="item.formType == FormType.CUSTOM" class="form-box testClass" :ref="setItemRef" :formProps="item.formProps" :formModel="item.formModel" :isWorkFlow="true" />
<div style="height: 500px;" v-if="customFormConfig.codeList.includes(props.curPageCode)">
<component :id="props.id" :is="componentName" :disabled="props.disabled" />
</div>
<div v-else>
<SystemForm class="form-box" v-if="item.formType == FormType.SYSTEM" :systemComponent="item.systemComponent" :isViewProcess="props.disabled" :formModel="item.formModel" :workflowConfig="item" :ref="setItemRef" />
<SimpleForm v-else-if="item.formType == FormType.CUSTOM" class="form-box testClass" :ref="setItemRef" :formProps="item.formProps" :formModel="item.formModel" :isWorkFlow="true" />
</div>
</div>
</div>
</div>
@ -50,7 +55,7 @@
import { FewerLeft, FewerRight } from '/@/components/ModalPanel';
import { NodeHead } from '/@/components/ModalPanel/index';
import IconFontSymbol from '/@/components/IconFontSymbol/Index.vue';
import { onBeforeUpdate, nextTick, onMounted, reactive, computed, ref } from 'vue';
import { onBeforeUpdate, nextTick, onMounted, reactive, computed, ref, defineAsyncComponent } from 'vue';
import { TaskApproveOpinion, ValidateForms } from '/@/model/workflow/bpmnConfig';
import { cloneDeep } from 'lodash-es';
import { useI18n } from '/@/hooks/web/useI18n';
@ -62,6 +67,7 @@
import { createFormEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent';
import { message } from 'ant-design-vue';
import { updateWorkflow } from '/@/api/workflow/adminOperation';
import {customFormConfig} from '/@/views/secondDev/customFormConfig'
const { t } = useI18n();
const props = withDefaults(
defineProps<{
@ -71,13 +77,17 @@
opinionsComponents?: Array<string> | undefined;
formAssignmentData?: null | Recordable;
processId: string;
curPageCode: string;
id: string;
}>(),
{
disabled: false,
formInfos: () => {
return [];
},
processId: ''
processId: '',
curPageCode: '',
id: ''
}
);
@ -143,6 +153,16 @@
formEventConfigs: [],
modes: []
});
const componentName = computed(() => {
if (!props.formInfos.length) {
return defineAsyncComponent({
loader: () => import('/@/views/secondDev/Empty.vue')
});
}
return defineAsyncComponent({
loader: () => import(`/@/views/${props.formInfos[0]?.functionalModule}/${props.formInfos[0]?.functionName}/components/createForm.vue`)
});
});
onMounted(async () => {
for await (let element of props.formInfos) {
let formModels = {};

View File

@ -14,7 +14,7 @@
:formDataId="data.formInfos[0].formData.id"
:formInfos="data.formInfos"
>
<FormInformation :opinionsComponents="data.opinionsComponents" :opinions="data.opinions" :formInfos="data.formInfos" :disabled="true" :processId="props.processId" />
<FormInformation :curPageCode="curPageCode" :id="id" :opinionsComponents="data.opinionsComponents" :opinions="data.opinions" :formInfos="data.formInfos" :disabled="true" :processId="props.processId" />
</FlowPanel>
</template>
@ -27,11 +27,15 @@
let props = defineProps(['position', 'processId', 'taskId', 'schemaId']);
let visible = ref(false);
const { data, initProcessData } = userTaskItem();
const curPageCode = ref()
const id = ref()
onMounted(async () => {
try {
let res = await getApprovalProcess(props.taskId, props.processId);
initProcessData(res);
visible.value = true;
curPageCode.value = res?.schemaInfo?.code
id.value = res?.formInfos[0]?.formData?.id
console.error('555555', data);
} catch (error) {}
});