ProcessInstanceBpmnViewer.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <el-card v-loading="loading" class="box-card">
  3. <template #header>
  4. <span class="el-icon-picture-outline">流程图</span>
  5. </template>
  6. <MyProcessViewer
  7. key="designer"
  8. :activityData="activityList"
  9. :prefix="bpmnControlForm.prefix"
  10. :processInstanceData="processInstance"
  11. :taskData="tasks"
  12. :value="bpmnXml"
  13. v-bind="bpmnControlForm"
  14. />
  15. </el-card>
  16. </template>
  17. <script lang="ts" setup>
  18. import { propTypes } from '@/utils/propTypes'
  19. import { MyProcessViewer } from '@/components/bpmnProcessDesigner/package'
  20. import * as ActivityApi from '@/api/bpm/activity'
  21. defineOptions({ name: 'BpmProcessInstanceBpmnViewer' })
  22. const props = defineProps({
  23. loading: propTypes.bool, // 是否加载中
  24. id: propTypes.string, // 流程实例的编号
  25. processInstance: propTypes.any, // 流程实例的信息
  26. tasks: propTypes.array, // 流程任务的数组
  27. bpmnXml: propTypes.string // BPMN XML
  28. })
  29. const bpmnControlForm = ref({
  30. prefix: 'flowable'
  31. })
  32. const activityList = ref([]) // 任务列表
  33. /** 只有 loading 完成时,才去加载流程列表 */
  34. watch(
  35. () => props.loading,
  36. async (value) => {
  37. if (value && props.id) {
  38. activityList.value = await ActivityApi.getActivityList({
  39. processInstanceId: props.id
  40. })
  41. }
  42. }
  43. )
  44. </script>
  45. <style>
  46. .box-card {
  47. width: 100%;
  48. margin-bottom: 20px;
  49. }
  50. </style>