File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change 70
70
71
71
<!-- 弹窗:流程模型图的预览 -->
72
72
<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" />
80
74
</Dialog >
81
75
</template >
82
76
@@ -118,7 +112,7 @@ const formDetailPreview = ref({
118
112
rule: [],
119
113
option: {}
120
114
})
121
- const handleFormDetail = async (row ) => {
115
+ const handleFormDetail = async (row : any ) => {
122
116
if (row .formType == 10 ) {
123
117
// 设置表单
124
118
setConfAndFields2 (formDetailPreview , row .formConf , row .formFields )
@@ -133,13 +127,13 @@ const handleFormDetail = async (row) => {
133
127
134
128
/** 流程图的详情按钮操作 */
135
129
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 = ' '
142
134
bpmnDetailVisible .value = true
135
+ // 加载 BPMN XML
136
+ bpmnXml .value = (await DefinitionApi .getProcessDefinition (row .id ))?.bpmnXml
143
137
}
144
138
145
139
/** 初始化 **/
Original file line number Diff line number Diff line change 95
95
<script lang="ts" setup>
96
96
import * as DefinitionApi from ' @/api/bpm/definition'
97
97
import * as ProcessInstanceApi from ' @/api/bpm/processInstance'
98
- import { setConfAndFields2 } from ' @/utils/formCreate'
98
+ import { decodeFields , setConfAndFields2 } from ' @/utils/formCreate'
99
99
import type { ApiAttrs } from ' @form-create/element-ui/types/config'
100
100
import ProcessInstanceBpmnViewer from ' ../detail/ProcessInstanceBpmnViewer.vue'
101
101
import { CategoryApi } from ' @/api/bpm/category'
@@ -185,7 +185,17 @@ const handleSelect = async (row, formVariables) => {
185
185
// 情况一:流程表单
186
186
if (row .formType == 10 ) {
187
187
// 设置表单
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
+ }
188
197
setConfAndFields2 (detailForm , row .formConf , row .formFields , formVariables )
198
+
189
199
// 加载流程图
190
200
const processDefinitionDetail = await DefinitionApi .getProcessDefinition (row .id )
191
201
if (processDefinitionDetail ) {
You can’t perform that action at this time.
0 commit comments