3328350766
6 天以前 761eb03d6b3bebd0b197179564c84d89d3d12a0d
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!--
 * @description: 时间线
-->
<template>
  <el-dialog
    title="历史操作"
    :visible.sync="dialogVisible"
    width="50%"
    :modal="true"
    :modal-append-to-body="false"
    :appen-to-body="true"
    class="bs-dialog-wrap bs-el-dialog"
  >
    <div class="layer-list-wrap">
      <!-- el-table 三列,动作,时间,操作。操作栏中是回退 -->
      <el-table
        :data="chartList"
        border
        style="width: 100%"
        class="bs-el-table"
        :row-class-name="tableRowClassName"
      >
        <el-table-column
          prop="timelineTitle"
          label="动作"
          class-name="bs-el-table-column"
        />
        <el-table-column
          prop="updateTime"
          label="时间"
          width="180"
          class-name="bs-el-table-column"
        />
        <el-table-column
          prop="operation"
          label="操作"
          width="100"
          class-name="bs-el-table-column"
        >
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              @click="rollback(scope.$index)"
            >
              回退
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <span
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        class="bs-el-button-default"
        @click="dialogVisible = false"
      >
        取消
      </el-button>
      <el-button
        type="primary"
        @click="clearTimeline"
      >
        清除历史
      </el-button>
    </span>
  </el-dialog>
</template>
<script>
import { mapState, mapMutations } from 'vuex'
export default {
  name: 'HistoryList',
  props: {},
  data () {
    return {
      dialogVisible: false
    }
  },
  computed: {
    ...mapState({
      chartList: state => state.bigScreen.timelineStore,
      currentTimeLine: state => state.bigScreen.currentTimeLine
    })
  },
  mounted () {},
  methods: {
    ...mapMutations({
      clearTimeline: 'bigScreen/clearTimeline',
      rollbackTimeline: 'bigScreen/rollbackTimeline'
    }),
    init () {
      this.dialogVisible = true
    },
    rollback (index) {
      this.rollbackTimeline(index)
      this.dialogVisible = false
    },
    tableRowClassName ({ row, rowIndex }) {
      if (rowIndex === this.currentTimeLine - 1) {
        return 'choosed-row'
      }
      return ''
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '../../BigScreenDesign/fonts/iconfont.css';
@import '../../assets/style/bsTheme.scss';
.layer-list-wrap {
  ::v-deep .choosed-row {
    .bs-el-table-column {
      border-color: var(--bs-el-border) !important;
      background: var(--bs-background-2) !important;
      background-color: var(--bs-background-2) !important;
      opacity: 0.7;
    }
  }
}
</style>