ProcessInstanceTaskList.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. <el-col :offset="4" :span="16">
  7. <div class="block">
  8. <el-timeline>
  9. <el-timeline-item
  10. v-for="(item, index) in tasks"
  11. :key="index"
  12. :icon="getTimelineItemIcon(item)"
  13. :type="getTimelineItemType(item)"
  14. >
  15. <p style="font-weight: 700">任务:{{ item.name }}</p>
  16. <el-card :body-style="{ padding: '10px' }">
  17. <label v-if="item.assigneeUser" style="font-weight: normal; margin-right: 30px">
  18. 审批人:{{ item.assigneeUser.nickname }}
  19. <el-tag size="small" type="info">{{ item.assigneeUser.deptName }}</el-tag>
  20. </label>
  21. <label v-if="item.createTime" style="font-weight: normal">创建时间:</label>
  22. <label style="color: #8a909c; font-weight: normal">
  23. {{ formatDate(item?.createTime) }}
  24. </label>
  25. <label v-if="item.endTime" style="margin-left: 30px; font-weight: normal">
  26. 审批时间:
  27. </label>
  28. <label v-if="item.endTime" style="color: #8a909c; font-weight: normal">
  29. {{ formatDate(item?.endTime) }}
  30. </label>
  31. <label v-if="item.durationInMillis" style="margin-left: 30px; font-weight: normal">
  32. 耗时:
  33. </label>
  34. <label v-if="item.durationInMillis" style="color: #8a909c; font-weight: normal">
  35. {{ formatPast2(item?.durationInMillis) }}
  36. </label>
  37. <p v-if="item.reason">
  38. <el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
  39. </p>
  40. </el-card>
  41. </el-timeline-item>
  42. </el-timeline>
  43. </div>
  44. </el-col>
  45. </el-card>
  46. </template>
  47. <script lang="ts" name="BpmProcessInstanceTaskList" setup>
  48. import { formatDate, formatPast2 } from '@/utils/formatTime'
  49. import { propTypes } from '@/utils/propTypes'
  50. defineProps({
  51. loading: propTypes.bool, // 是否加载中
  52. tasks: propTypes.array // 流程任务的数组
  53. })
  54. /** 获得任务对应的 icon */
  55. const getTimelineItemIcon = (item) => {
  56. if (item.result === 1) {
  57. return 'el-icon-time'
  58. }
  59. if (item.result === 2) {
  60. return 'el-icon-check'
  61. }
  62. if (item.result === 3) {
  63. return 'el-icon-close'
  64. }
  65. if (item.result === 4) {
  66. return 'el-icon-remove-outline'
  67. }
  68. return ''
  69. }
  70. /** 获得任务对应的颜色 */
  71. const getTimelineItemType = (item) => {
  72. if (item.result === 1) {
  73. return 'primary'
  74. }
  75. if (item.result === 2) {
  76. return 'success'
  77. }
  78. if (item.result === 3) {
  79. return 'danger'
  80. }
  81. if (item.result === 4) {
  82. return 'info'
  83. }
  84. return ''
  85. }
  86. </script>