detail.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="havedone-container">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="流程详情" @clickLeft="back" background-color="#157A2C" color="#fff"></uni-nav-bar>
  4. <view class="list-wrapper">
  5. <rxl-timeline>
  6. <rxl-timeline-item v-for="(item, index) in tasks" :key="index" :color="getTimelineItemIcon(item)" :timestamp="item.createTime">
  7. <template #body>
  8. <p style="font-weight: 700;display: block;">{{item.taskDefinitionKey?'流程节点':'发起人'}}:{{ item.name }}</p>
  9. <view style="{ padding: '10px';display: flex;flex-direction: column; }">
  10. <span>
  11. <label v-if="item.assigneeUser"
  12. style="font-weight: normal;display: flex;flex-direction: row;">
  13. 审批人:{{ item.assigneeUser.nickname }}
  14. <u-tag style="margin-left: 10rpx;" type="info" :text="item.assigneeUser.deptName"
  15. size="mini"></u-tag>
  16. </label>
  17. </span>
  18. <span>
  19. <label v-if="item.endTime" style="font-weight: normal">审批时间:</label>
  20. <label v-if="item.endTime" style="color: #8a909c; font-weight: normal">
  21. {{ item.endTime }}</label>
  22. </span>
  23. <span>
  24. <label v-if="item.durationInMillis" style=" font-weight: normal">耗时:</label>
  25. <label v-if="item.durationInMillis" style="color: #8a909c; font-weight: normal">
  26. {{ getDateStar(item.durationInMillis) }}
  27. </label>
  28. </span>
  29. <p v-if="item.reason">
  30. <u-tag :type="getTimelineItemType(item)" :text="item.reason"></u-tag>
  31. </p>
  32. </view>
  33. </template>
  34. </rxl-timeline-item>
  35. </rxl-timeline>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. getTaskListByProcessinstanceid
  42. } from '@/api/wt/index.js'
  43. import {
  44. getDates
  45. } from '@/utils/utils.js'
  46. export default {
  47. components: {},
  48. data() {
  49. return {
  50. tasks: []
  51. }
  52. },
  53. onLoad(processInstanceId) {
  54. this.getInfo(processInstanceId)
  55. },
  56. methods: {
  57. async getInfo(processInstanceId) {
  58. // 审批记录
  59. let data = await getTaskListByProcessinstanceid(processInstanceId)
  60. // 移除已取消的审批
  61. data.forEach((task) => {
  62. if (task.result !== 4) {
  63. this.tasks.push(task);
  64. }
  65. });
  66. // 排序,将未完成的排在前面,已完成的排在后面;
  67. this.tasks.sort((a, b) => {
  68. // 有已完成的情况,按照完成时间倒序
  69. if (a.endTime && b.endTime) {
  70. return b.endTime - a.endTime;
  71. } else if (a.endTime) {
  72. return 1;
  73. } else if (b.endTime) {
  74. return -1;
  75. // 都是未完成,按照创建时间倒序
  76. } else {
  77. return b.createTime - a.createTime;
  78. }
  79. });
  80. // 需要审核的记录
  81. let userInfo = wx.getStorageSync("userInfo");
  82. this.tasks.forEach((task) => {
  83. if (task.result !== 1 && task.result !== 6) {
  84. // 只有待处理才需要
  85. return;
  86. }
  87. if (!task.assigneeUser || task.assigneeUser.id !== userInfo.userId) {
  88. // 自己不是处理人
  89. return;
  90. }
  91. });
  92. },
  93. getTimelineItemIcon(item) {
  94. if (item.result === 1) {
  95. return '';
  96. }
  97. if (item.result === 2) {
  98. return 'green';
  99. }
  100. return '';
  101. },
  102. getTimelineItemType(item) {
  103. if (item.result === 1) {
  104. return 'waiting';
  105. }
  106. if (item.result === 2) {
  107. return 'success';
  108. }
  109. if (item.result === 3) {
  110. return 'cancel';
  111. }
  112. if (item.result === 4) {
  113. return 'info';
  114. }
  115. if (item.result === 5) {
  116. return 'warn';
  117. }
  118. if (item.result === 6) {
  119. return 'default';
  120. }
  121. return '';
  122. },
  123. getDateStar(ms) {
  124. return getDates(ms);
  125. },
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. </style>