pyt
2025-04-03 f516ebfa8ccf3a4286d5efc934812517e0e45b0b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
  <div class="approval-process">
    <el-timeline>
      <el-timeline-item
        v-for="(activity, index) in processData"
        :key="index"
        :type="activity.type"
        :timestamp="activity.time"
      >
        {{ activity.content }}
      </el-timeline-item>
    </el-timeline>
  </div>
</template>
 
<script>
export default {
  name: 'ApprovalProcess',
  props: {
    status: {
      type: String,
      default: 'pending', // pending-等待审核, approved-已通过
      validator: value => ['pending', 'approved'].includes(value)
    },
    submitTime: {
      type: String,
      default: ''
    },
    approver: {
      type: String,
      default: ''
    },
    approveTime: {
      type: String,
      default: ''
    }
  },
  computed: {
    processData() {
      const baseData = [
        {
          content: '提交审批',
          time: this.submitTime,
          type: 'primary'
        }
      ]
 
      if (this.status === 'approved') {
        baseData.push({
          content: `${this.approver}审批通过`,
          time: this.approveTime,
          type: 'success'
        })
      } else {
        baseData.push({
          content: '等待审核',
          time: this.submitTime,
          type: 'warning'
        })
      }
 
      return baseData
    }
  }
}
</script>
 
<style scoped lang="less">
.approval-process {
  padding: 20px;
  height: 100%;
  overflow-y: auto;
}
</style>