Skip to content

Commit 7044bce

Browse files
committed
Merge branch 'feature/bpm' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feature/bpm
2 parents 0284893 + 67430a8 commit 7044bce

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

src/views/bpm/definition/index.vue

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,7 @@
7070

7171
<!-- 弹窗:流程模型图的预览 -->
7272
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
73-
<MyProcessViewer
74-
key="designer"
75-
v-model="bpmnXml"
76-
:value="bpmnXml as any"
77-
v-bind="bpmnControlForm"
78-
:prefix="bpmnControlForm.prefix"
79-
/>
73+
<MyProcessViewer style="height: 700px" key="designer" :xml="bpmnXml" />
8074
</Dialog>
8175
</template>
8276

@@ -118,7 +112,7 @@ const formDetailPreview = ref({
118112
rule: [],
119113
option: {}
120114
})
121-
const handleFormDetail = async (row) => {
115+
const handleFormDetail = async (row: any) => {
122116
if (row.formType == 10) {
123117
// 设置表单
124118
setConfAndFields2(formDetailPreview, row.formConf, row.formFields)
@@ -133,13 +127,13 @@ const handleFormDetail = async (row) => {
133127
134128
/** 流程图的详情按钮操作 */
135129
const bpmnDetailVisible = ref(false)
136-
const bpmnXml = ref(null)
137-
const bpmnControlForm = ref({
138-
prefix: 'flowable'
139-
})
140-
const handleBpmnDetail = async (row) => {
141-
bpmnXml.value = (await DefinitionApi.getProcessDefinition(row.id))?.bpmnXml
130+
const bpmnXml = ref('')
131+
const handleBpmnDetail = async (row: any) => {
132+
// 设置可见
133+
bpmnXml.value = ''
142134
bpmnDetailVisible.value = true
135+
// 加载 BPMN XML
136+
bpmnXml.value = (await DefinitionApi.getProcessDefinition(row.id))?.bpmnXml
143137
}
144138
145139
/** 初始化 **/

src/views/bpm/processInstance/create/index.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<script lang="ts" setup>
9696
import * as DefinitionApi from '@/api/bpm/definition'
9797
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
98-
import { setConfAndFields2 } from '@/utils/formCreate'
98+
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
9999
import type { ApiAttrs } from '@form-create/element-ui/types/config'
100100
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
101101
import { CategoryApi } from '@/api/bpm/category'
@@ -185,7 +185,17 @@ const handleSelect = async (row, formVariables) => {
185185
// 情况一:流程表单
186186
if (row.formType == 10) {
187187
// 设置表单
188+
// 注意:需要从 formVariables 中,移除不在 row.formFields 的值。
189+
// 原因是:后端返回的 formVariables 里面,会有一些非表单的信息。例如说,某个流程节点的审批人。
190+
// 这样,就可能导致一个流程被审批不通过后,重新发起时,会直接后端报错!!!
191+
const allowedFields = decodeFields(row.formFields).map((fieldObj: any) => fieldObj.field)
192+
for (const key in formVariables) {
193+
if (!allowedFields.includes(key)) {
194+
delete formVariables[key]
195+
}
196+
}
188197
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables)
198+
189199
// 加载流程图
190200
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id)
191201
if (processDefinitionDetail) {

0 commit comments

Comments
 (0)