Merge branch 'feature/bpm' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feature/bpm

pull/582/head
jason 2024-10-29 21:24:46 +08:00
commit 7044bcee60
2 changed files with 19 additions and 15 deletions

View File

@ -70,13 +70,7 @@
<!-- 弹窗流程模型图的预览 --> <!-- 弹窗流程模型图的预览 -->
<Dialog title="流程图" v-model="bpmnDetailVisible" width="800"> <Dialog title="流程图" v-model="bpmnDetailVisible" width="800">
<MyProcessViewer <MyProcessViewer style="height: 700px" key="designer" :xml="bpmnXml" />
key="designer"
v-model="bpmnXml"
:value="bpmnXml as any"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</Dialog> </Dialog>
</template> </template>
@ -118,7 +112,7 @@ const formDetailPreview = ref({
rule: [], rule: [],
option: {} option: {}
}) })
const handleFormDetail = async (row) => { const handleFormDetail = async (row: any) => {
if (row.formType == 10) { if (row.formType == 10) {
// //
setConfAndFields2(formDetailPreview, row.formConf, row.formFields) setConfAndFields2(formDetailPreview, row.formConf, row.formFields)
@ -133,13 +127,13 @@ const handleFormDetail = async (row) => {
/** 流程图的详情按钮操作 */ /** 流程图的详情按钮操作 */
const bpmnDetailVisible = ref(false) const bpmnDetailVisible = ref(false)
const bpmnXml = ref(null) const bpmnXml = ref('')
const bpmnControlForm = ref({ const handleBpmnDetail = async (row: any) => {
prefix: 'flowable' //
}) bpmnXml.value = ''
const handleBpmnDetail = async (row) => {
bpmnXml.value = (await DefinitionApi.getProcessDefinition(row.id))?.bpmnXml
bpmnDetailVisible.value = true bpmnDetailVisible.value = true
// BPMN XML
bpmnXml.value = (await DefinitionApi.getProcessDefinition(row.id))?.bpmnXml
} }
/** 初始化 **/ /** 初始化 **/

View File

@ -95,7 +95,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import * as DefinitionApi from '@/api/bpm/definition' import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance' import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { setConfAndFields2 } from '@/utils/formCreate' import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
import type { ApiAttrs } from '@form-create/element-ui/types/config' import type { ApiAttrs } from '@form-create/element-ui/types/config'
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue' import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
import { CategoryApi } from '@/api/bpm/category' import { CategoryApi } from '@/api/bpm/category'
@ -185,7 +185,17 @@ const handleSelect = async (row, formVariables) => {
// //
if (row.formType == 10) { if (row.formType == 10) {
// //
// formVariables row.formFields
// formVariables
//
const allowedFields = decodeFields(row.formFields).map((fieldObj: any) => fieldObj.field)
for (const key in formVariables) {
if (!allowedFields.includes(key)) {
delete formVariables[key]
}
}
setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables) setConfAndFields2(detailForm, row.formConf, row.formFields, formVariables)
// //
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id) const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id)
if (processDefinitionDetail) { if (processDefinitionDetail) {