wk-audit-flow-item.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="wk-audit-flow-item">
  3. <view class="audit-wrapper">
  4. <image
  5. v-if="user.userStr"
  6. :src="user.img"
  7. class="avatar" />
  8. <wk-avatar
  9. v-else
  10. :name="user.realname"
  11. :avatar="user.img"
  12. class="avatar" />
  13. <view class="audit-info">
  14. <view class="user">
  15. <view class="username">
  16. <text class="text">
  17. {{ user.realname }}
  18. </text>
  19. <text v-if="user.userStr" class="info">
  20. ({{ user.userStr }})
  21. </text>
  22. </view>
  23. <view v-if="user.examineTime" class="check-time">
  24. {{ user.examineTime }}
  25. </view>
  26. </view>
  27. <view class="audit-status">
  28. <image :src="auditStatus[itemData.examineStatus].icon" alt="" class="icon" />
  29. <text class="text">
  30. {{ auditStatus[itemData.examineStatus].label }}
  31. </text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {mapGetters} from 'vuex'
  39. export default {
  40. name: 'WkAuditFlowItem',
  41. props: {
  42. itemData: {
  43. type: Object,
  44. required: true
  45. },
  46. auditInfo: {
  47. type: Object,
  48. required: true
  49. }
  50. },
  51. data() {
  52. return {
  53. auditStatus: {
  54. 0: {label: '待审核', icon: this.$static('images/audit/await.png')},
  55. 1: {label: '通过', icon: this.$static('images/audit/pass.png')},
  56. 2: {label: '拒绝', icon: this.$static('images/audit/refuse.png')},
  57. 3: {label: '审核中', icon: this.$static('images/audit/await.png')},
  58. 4: {label: '撤回', icon: this.$static('images/audit/cancel.png')},
  59. 5: {label: '未提交', icon: this.$static('images/audit/create.png')},
  60. 6: {label: '创建', icon: this.$static('images/audit/create.png')},
  61. },
  62. }
  63. },
  64. computed: {
  65. ...mapGetters({
  66. calcAuditType: 'base/calcAuditType'
  67. }),
  68. user() {
  69. return this.calcUser()
  70. }
  71. },
  72. methods: {
  73. calcUser() {
  74. // if (this.itemData.flowId === 0) {
  75. // return this.auditInfo.createUser
  76. // } else {
  77. // }
  78. const status = Number(this.itemData.examineStatus) // 审核状态
  79. const userList = this.itemData.userList
  80. if (userList.length === 1) {
  81. return userList[0]
  82. } else {
  83. let userStr = userList.map(user => {
  84. return user.realname || user.username
  85. })
  86. return {
  87. img: this.$static('images/avatar.png'),
  88. realname: `${userList.length}人${this.getFlowAuditType(this.itemData)}`,
  89. userStr: userStr.join(',')
  90. }
  91. }
  92. },
  93. getFlowAuditType(flowItem) {
  94. return {
  95. 1: '依次审批',
  96. 2: '会签',
  97. 3: '或签'
  98. }[flowItem.type] || ''
  99. },
  100. }
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. .wk-audit-flow-item {
  105. padding: 0 10rpx;
  106. .audit-wrapper {
  107. @include left;
  108. .avatar {
  109. width: 86rpx;
  110. height: 86rpx;
  111. border-radius: 50%;
  112. overflow: hidden;
  113. }
  114. .audit-info {
  115. flex: 1;
  116. margin-left: 20rpx;
  117. .user {
  118. @include left;
  119. .username {
  120. flex: 1;
  121. font-size: 30rpx;
  122. overflow: hidden;
  123. @include left;
  124. .text {}
  125. .info {
  126. width: 0;
  127. flex: 1;
  128. font-size: 26rpx;
  129. color: $gray;
  130. @include ellipsis;
  131. }
  132. }
  133. .check-time {
  134. font-size: 24rpx;
  135. color: #999;
  136. }
  137. }
  138. .audit-status {
  139. margin-top: 10rpx;
  140. @include left;
  141. .icon {
  142. width: 36rpx;
  143. height: 36rpx;
  144. margin-right: 10rpx;
  145. }
  146. .text {
  147. font-size: 26rpx;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </style>