index.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="yh-workflow-dialog">
  3. <el-dialog v-model="visible" title="审批流程" width="70%" @closed="$emit('closed')">
  4. <div v-loading="loading" style="flex: 1; overflow: auto;">
  5. <el-empty v-if="!steps || !steps.length"></el-empty>
  6. <el-steps v-else :active="active" finish-status="success">
  7. <el-step v-for="item in steps" :key="item.historyActivityId" :title="item.historyActivityName" icon="UserFilled" :status="item.class">
  8. <template v-if="item.historyActivityType == 'startEvent' || item.historyActivityType == 'endEvent'" #icon>
  9. <el-icon size="25"><tjm-icon-mdi-circle-outline></tjm-icon-mdi-circle-outline></el-icon>
  10. </template>
  11. <template v-if="item.assigneeName" #description>
  12. <el-text class="title" truncated>{{ item.assigneeName }}</el-text>
  13. <div class="time">{{ item.createTime }}</div>
  14. <el-text v-if="item.desc" class="title" truncated>{{ item.desc }}</el-text>
  15. </template>
  16. </el-step>
  17. </el-steps>
  18. </div>
  19. </el-dialog>
  20. </div>
  21. </template>
  22. <script>
  23. import API from "@/api/workflow";
  24. export default {
  25. data() {
  26. return {
  27. visible: true,
  28. loading: false,
  29. active: 0,
  30. steps: []
  31. }
  32. },
  33. methods: {
  34. getDetail({ processTaskId, processInstanceId }) {
  35. if (processTaskId && processInstanceId) {
  36. this.loading = true;
  37. API.detail(processTaskId, processInstanceId).then(res => {
  38. this.loading = false;
  39. this.steps = res.flows.slice() || [];
  40. this.active = res.flows.findIndex(f => f.class == "process") + 1;
  41. }).catch(() => this.loading = false);
  42. }
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .yh-workflow-dialog :deep(.el-dialog) {
  49. position: absolute;
  50. top: 40%;
  51. left: 50%;
  52. transform: translate(-50%, -40%);
  53. max-height: calc(100% - 30px);
  54. max-width: calc(100% - 30px);
  55. margin: 0 !important;
  56. .el-dialog__body {
  57. height: 60vh;
  58. padding: 0 20px;
  59. display: flex;
  60. align-items: center;
  61. .el-steps .el-step {
  62. max-width: 220px;
  63. .el-step__main {
  64. white-space: nowrap;
  65. .el-step__description {
  66. color: var(--el-text-color-primary);
  67. .title {
  68. font-size: inherit;
  69. color: inherit;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. </style>