shikeying
2023-04-07 c192f834c4e092bc7c0f2722c343c25c1be619ab
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
<template>
  <div class="app-container">
    <el-timeline>
      <el-timeline-item v-for="(item ,idx) in activities" :key="idx">
        <h4>{{ item.content }}</h4>
        <p v-if="showAppendix(item.appendix)"><el-link target="_blank" :href="getAppendix(item.appendix).path" type="primary">{{ getAppendix(item.appendix).name }}</el-link></p>
        <p class="timeline-user"><span>{{ item.createUserName }}</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>{{ getFormatDate(item.createTime) }}</span></p>
      </el-timeline-item>
    </el-timeline>
  </div>
</template>
 
<script>
import { getReamrkList } from '@/api/common.js'
import { formatDate } from '@/utils/date.js'
export default {
  props: {
    setting: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  data() {
    return {
      activities: []
    }
  },
  watch: {
    setting: {
      handler(v, o) {
        if (v.businessId !== o.businessId) {
          this.init()
        }
      },
      deep: true
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      if (this.setting.businessType && this.setting.businessId && this.setting.type) {
        getReamrkList(this.setting).then(res => {
          this.activities = res.data
        })
      }
    },
    showAppendix(appendix) {
      if (appendix) {
        return true
      }
      return false
    },
    getAppendix(appendix) {
      const appendixArray = JSON.parse(appendix)
      return {
        path: globalConf.ftpUrl + appendixArray[0].path,
        name: appendixArray[0].name
      }
    },
    getFormatDate(time) {
      return formatDate(time, 'yyyy-MM-dd hh:mm:ss')
    }
  }
}
</script>
 
<style scoped>
 
</style>