index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <!--
  2. * @description: 时间线
  3. -->
  4. <template>
  5. <el-dialog
  6. title="历史操作"
  7. :visible.sync="dialogVisible"
  8. width="50%"
  9. :modal="true"
  10. :modal-append-to-body="false"
  11. :appen-to-body="true"
  12. class="bs-dialog-wrap bs-el-dialog"
  13. >
  14. <div class="layer-list-wrap">
  15. <!-- el-table 三列,动作,时间,操作。操作栏中是回退 -->
  16. <el-table
  17. :data="chartList"
  18. border
  19. style="width: 100%"
  20. class="bs-el-table"
  21. :row-class-name="tableRowClassName"
  22. >
  23. <el-table-column
  24. prop="timelineTitle"
  25. label="动作"
  26. class-name="bs-el-table-column"
  27. />
  28. <el-table-column
  29. prop="updateTime"
  30. label="时间"
  31. width="180"
  32. class-name="bs-el-table-column"
  33. />
  34. <el-table-column
  35. prop="operation"
  36. label="操作"
  37. width="100"
  38. class-name="bs-el-table-column"
  39. >
  40. <template slot-scope="scope">
  41. <el-button
  42. type="text"
  43. size="small"
  44. @click="rollback(scope.$index)"
  45. >
  46. 回退
  47. </el-button>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. </div>
  52. <span
  53. slot="footer"
  54. class="dialog-footer"
  55. >
  56. <el-button
  57. class="bs-el-button-default"
  58. @click="dialogVisible = false"
  59. >
  60. 取消
  61. </el-button>
  62. <el-button
  63. type="primary"
  64. @click="clearTimeline"
  65. >
  66. 清除历史
  67. </el-button>
  68. </span>
  69. </el-dialog>
  70. </template>
  71. <script>
  72. import { mapState, mapMutations } from 'vuex'
  73. export default {
  74. name: 'HistoryList',
  75. props: {},
  76. data () {
  77. return {
  78. dialogVisible: false
  79. }
  80. },
  81. computed: {
  82. ...mapState({
  83. chartList: state => state.bigScreen.timelineStore,
  84. currentTimeLine: state => state.bigScreen.currentTimeLine
  85. })
  86. },
  87. mounted () {},
  88. methods: {
  89. ...mapMutations({
  90. clearTimeline: 'bigScreen/clearTimeline',
  91. rollbackTimeline: 'bigScreen/rollbackTimeline'
  92. }),
  93. init () {
  94. this.dialogVisible = true
  95. },
  96. rollback (index) {
  97. this.rollbackTimeline(index)
  98. this.dialogVisible = false
  99. },
  100. tableRowClassName ({ row, rowIndex }) {
  101. if (rowIndex === this.currentTimeLine - 1) {
  102. return 'choosed-row'
  103. }
  104. return ''
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. @import '../../BigScreenDesign/fonts/iconfont.css';
  111. @import '../../assets/style/bsTheme.scss';
  112. .layer-list-wrap {
  113. ::v-deep .choosed-row {
  114. .bs-el-table-column {
  115. border-color: var(--bs-el-border) !important;
  116. background: var(--bs-background-2) !important;
  117. background-color: var(--bs-background-2) !important;
  118. opacity: 0.7;
  119. }
  120. }
  121. }
  122. </style>