itemCell.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="item-cell">
  3. <view @click="openDetail">
  4. <view class="header">
  5. <view class="left-title">
  6. <text>{{ (item.username || '') + proType + '审批' }}</text>
  7. <u-icon name="arrow-right"></u-icon>
  8. </view>
  9. <view class="right-status" :style="`color:${statusColor}`">
  10. {{ processStatus[item.status] }}
  11. </view>
  12. </view>
  13. <view class="info-tips">
  14. <view> {{ proType }}时间:接口暂无字段 </view>
  15. <view>提交时间:{{ item.createTime }}</view>
  16. </view>
  17. </view>
  18. <!-- tabs我审批&&当前登录人的审批状态为true -->
  19. <view class="footer" v-if="type === 1 && item.audit">
  20. <u-line></u-line>
  21. <view class="sp-btn">
  22. <c-button
  23. style="width: 60px; border-radius: 10px; margin: 0"
  24. size="small"
  25. color="#FF9935"
  26. @click="approval"
  27. >
  28. 审批
  29. </c-button>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. import processTypes from '@/utils/types/processTypes'; // 流程类型
  36. import processStatus from '@/utils/types/processStatus.js'; // 流程状态
  37. export default {
  38. name: 'itemCell',
  39. props: {
  40. type: Number,
  41. item: {
  42. default: () => ({}),
  43. type: Object,
  44. },
  45. },
  46. data() {
  47. return {
  48. processStatus, // 流程状态
  49. };
  50. },
  51. computed: {
  52. statusColor() {
  53. const colors = {
  54. 0: '#FF9935', // '待审批'
  55. 1: '#11C59D', // '已归档'
  56. 2: '#436FF6', // '已撤销'
  57. 3: '#FF5E59', // '已驳回'
  58. 4: '#FF9935', // '审批中'
  59. };
  60. return colors[this.item.processType || 0];
  61. },
  62. proType() {
  63. // item.processType 流程类型 不是流程状态
  64. return processTypes[this.item.processType] || '';
  65. },
  66. },
  67. methods: {
  68. openDetail() {
  69. this.$emit('click', this.item.id);
  70. },
  71. approval() {
  72. this.$emit('approval', {
  73. ...this.item,
  74. });
  75. },
  76. },
  77. };
  78. </script>
  79. <style scoped lang="scss">
  80. .item-cell {
  81. background-color: #fff;
  82. padding: 20rpx;
  83. border-radius: $bd-radius;
  84. margin-bottom: 20rpx;
  85. &:last-child {
  86. margin-bottom: 0;
  87. }
  88. .header {
  89. display: flex;
  90. justify-content: space-between;
  91. font-size: 14px;
  92. .left-title {
  93. display: flex;
  94. color: #333333;
  95. }
  96. .right-status {
  97. }
  98. }
  99. .info-tips {
  100. color: #7b7e8c;
  101. font-size: 12px;
  102. margin-top: 20rpx;
  103. line-height: 22px;
  104. }
  105. .footer {
  106. margin-top: 20rpx;
  107. .sp-btn {
  108. display: flex;
  109. justify-content: flex-end;
  110. margin-top: 20rpx;
  111. }
  112. }
  113. }
  114. </style>