【功能修改】发起流程时,如果是 Simple 模型展示 Simple 流程图
parent
65f0b2f8ab
commit
55da358336
|
@ -71,8 +71,17 @@
|
||||||
<!-- 流程图 -->
|
<!-- 流程图 -->
|
||||||
<el-tab-pane label="流程图" name="diagram">
|
<el-tab-pane label="流程图" name="diagram">
|
||||||
<div class="form-scroll-area">
|
<div class="form-scroll-area">
|
||||||
<!-- 流程图预览 -->
|
<!-- BPMN 流程图预览 -->
|
||||||
<ProcessInstanceBpmnViewer :bpmn-xml="bpmnXML" />
|
<ProcessInstanceBpmnViewer
|
||||||
|
:bpmn-xml="bpmnXML"
|
||||||
|
v-if="BpmModelType.BPMN === selectProcessDefinition.modelType"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Simple 流程图预览 -->
|
||||||
|
<ProcessInstanceSimpleViewer
|
||||||
|
:simple-json="simpleJson"
|
||||||
|
v-if="BpmModelType.SIMPLE === selectProcessDefinition.modelType"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
@ -98,7 +107,9 @@
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
|
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
|
||||||
|
import { BpmModelType } from '@/utils/constants'
|
||||||
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
|
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
|
||||||
|
import ProcessInstanceSimpleViewer from '../detail/ProcessInstanceSimpleViewer.vue'
|
||||||
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
|
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
|
||||||
import type { ApiAttrs } from '@form-create/element-ui/types/config'
|
import type { ApiAttrs } from '@form-create/element-ui/types/config'
|
||||||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||||
|
@ -127,6 +138,7 @@ const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
|
||||||
const startUserSelectAssigneesFormRules = ref({}) // 发起人选择审批人的表单 Rules
|
const startUserSelectAssigneesFormRules = ref({}) // 发起人选择审批人的表单 Rules
|
||||||
const userList = ref<any[]>([]) // 用户列表
|
const userList = ref<any[]>([]) // 用户列表
|
||||||
const bpmnXML: any = ref(null) // BPMN 数据
|
const bpmnXML: any = ref(null) // BPMN 数据
|
||||||
|
const simpleJson = ref<string|undefined>() // Simple 设计器数据 json 格式
|
||||||
/** 当前的Tab */
|
/** 当前的Tab */
|
||||||
const activeTab = ref('form')
|
const activeTab = ref('form')
|
||||||
const emit = defineEmits(['cancel'])
|
const emit = defineEmits(['cancel'])
|
||||||
|
@ -162,6 +174,7 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
|
||||||
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id)
|
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(row.id)
|
||||||
if (processDefinitionDetail) {
|
if (processDefinitionDetail) {
|
||||||
bpmnXML.value = processDefinitionDetail.bpmnXml
|
bpmnXML.value = processDefinitionDetail.bpmnXml
|
||||||
|
simpleJson.value = processDefinitionDetail.simpleModel
|
||||||
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
|
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
|
||||||
|
|
||||||
// 设置指定审批人
|
// 设置指定审批人
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-loading="loading" class="mb-20px">
|
<div v-loading="loading" class="mb-20px">
|
||||||
<SimpleProcessViewer :flow-node="simpleModel" :tasks="tasks" :process-instance="processInstance"/>
|
<SimpleProcessViewer
|
||||||
|
:flow-node="simpleModel"
|
||||||
|
:tasks="tasks"
|
||||||
|
:process-instance="processInstance"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -12,47 +16,19 @@ defineOptions({ name: 'BpmProcessInstanceSimpleViewer' })
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
loading: propTypes.bool.def(false), // 是否加载中
|
loading: propTypes.bool.def(false), // 是否加载中
|
||||||
modelView: propTypes.object
|
modelView: propTypes.object,
|
||||||
|
simpleJson: propTypes.string // Simple 模型结构数据 (json 格式)
|
||||||
})
|
})
|
||||||
const simpleModel = ref()
|
const simpleModel = ref()
|
||||||
// 用户任务
|
// 用户任务
|
||||||
const tasks = ref([])
|
const tasks = ref([])
|
||||||
// 流程实例
|
// 流程实例
|
||||||
const processInstance = ref()
|
const processInstance = ref()
|
||||||
// /** 只有 loading 完成时,才去加载流程列表 */
|
|
||||||
// watch(
|
/** 监控模型视图 包括任务列表、进行中的活动节点编号等 */
|
||||||
// () => props.loading,
|
|
||||||
// async (value) => {
|
|
||||||
// if (value && props.id) {
|
|
||||||
// const modelView = await ProcessInstanceApi.getProcessInstanceBpmnModelView(props.id)
|
|
||||||
// if (modelView) {
|
|
||||||
// tasks.value = modelView.tasks
|
|
||||||
// processInstance.value = modelView.processInstance
|
|
||||||
// // 已经拒绝的活动节点编号集合,只包括 UserTask
|
|
||||||
// const rejectedTaskActivityIds: string[] = modelView.rejectedTaskActivityIds
|
|
||||||
// // 进行中的活动节点编号集合, 只包括 UserTask
|
|
||||||
// const unfinishedTaskActivityIds: string[] = modelView.unfinishedTaskActivityIds
|
|
||||||
// // 已经完成的活动节点编号集合, 包括 UserTask、Gateway 等
|
|
||||||
// const finishedActivityIds: string[] = modelView.finishedTaskActivityIds
|
|
||||||
// // 已经完成的连线节点编号集合,只包括 SequenceFlow
|
|
||||||
// const finishedSequenceFlowActivityIds: string[] = modelView.finishedSequenceFlowActivityIds
|
|
||||||
// setSimpleModelNodeTaskStatus(
|
|
||||||
// modelView.simpleModel,
|
|
||||||
// modelView.processInstance.status,
|
|
||||||
// rejectedTaskActivityIds,
|
|
||||||
// unfinishedTaskActivityIds,
|
|
||||||
// finishedActivityIds,
|
|
||||||
// finishedSequenceFlowActivityIds
|
|
||||||
// )
|
|
||||||
// simpleModel.value = modelView.simpleModel
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelView,
|
() => props.modelView,
|
||||||
async (newModelView) => {
|
async (newModelView) => {
|
||||||
if (newModelView) {
|
|
||||||
if (newModelView) {
|
if (newModelView) {
|
||||||
tasks.value = newModelView.tasks
|
tasks.value = newModelView.tasks
|
||||||
processInstance.value = newModelView.processInstance
|
processInstance.value = newModelView.processInstance
|
||||||
|
@ -75,9 +51,16 @@ watch(
|
||||||
simpleModel.value = newModelView.simpleModel
|
simpleModel.value = newModelView.simpleModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
/** 监控模型结构数据 */
|
||||||
|
watch(
|
||||||
|
() => props.simpleJson,
|
||||||
|
async (value) => {
|
||||||
|
if (value) {
|
||||||
|
simpleModel.value = JSON.parse(value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const setSimpleModelNodeTaskStatus = (
|
const setSimpleModelNodeTaskStatus = (
|
||||||
simpleModel: SimpleFlowNode | undefined,
|
simpleModel: SimpleFlowNode | undefined,
|
||||||
processStatus: number,
|
processStatus: number,
|
||||||
|
|
Loading…
Reference in New Issue