Configuration.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div
  3. class="configuration-wrap"
  4. :class="{
  5. 'active': activeCodes.includes(config.code),
  6. 'hover': hoverCode === config.code
  7. }"
  8. @mouseenter.stop="changeHover(config.code)"
  9. @mouseleave="changeHover('')"
  10. @click.stop="changeActive(config)"
  11. @contextmenu="onContextmenu($event, config)"
  12. >
  13. <!-- <span class="point-text" v-show="hoverCode === config.code"> {{ getPoint(config) }}</span>-->
  14. <span
  15. v-show="config.locked"
  16. class="locked-status el-icon-lock"
  17. />
  18. <slot />
  19. </div>
  20. </template>
  21. <script>
  22. import { mapState, mapMutations } from 'vuex'
  23. import chartContextMenu from 'data-room-ui/js/mixins/chartContextMenu'
  24. export default {
  25. name: 'Configuration',
  26. mixins: [chartContextMenu],
  27. props: {
  28. config: {
  29. type: Object,
  30. default: () => ({})
  31. }
  32. },
  33. computed: {
  34. ...mapState({
  35. activeCode: state => state.bigScreen.activeCode,
  36. activeCodes: state => state.bigScreen.activeCodes,
  37. hoverCode: state => state.bigScreen.hoverCode,
  38. activeItemConfig: state => state.bigScreen.activeItemConfig,
  39. chartList: state => state.bigScreen.pageInfo.chartList,
  40. presetLine: state => state.bigScreen.presetLine
  41. })
  42. },
  43. data () {
  44. return {
  45. }
  46. },
  47. mounted () {},
  48. methods: {
  49. ...mapMutations('bigScreen', [
  50. 'changeHoverCode',
  51. 'changeActiveCode',
  52. 'changeChartConfig',
  53. 'addItem',
  54. 'delItem',
  55. 'resetPresetLine',
  56. 'changeLayout',
  57. 'changeZIndex',
  58. 'changeLocked'
  59. ]),
  60. // 改变hover的组件
  61. changeHover (code) {
  62. this.changeHoverCode(code)
  63. },
  64. // 改变激活的组件
  65. changeActive (config) {
  66. this.changeActiveCode(config.code)
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .configuration-wrap {
  73. height: 100%;
  74. width: 100%;
  75. border: 1px solid transparent;
  76. cursor: move;
  77. .opt-icon-wrap {
  78. z-index: 100;
  79. display: flex;
  80. position: absolute;
  81. right: 10px;
  82. top: 10px;
  83. &:hover{
  84. cursor: pointer;
  85. }
  86. .obt-item{
  87. padding: 0 5px;
  88. }
  89. }
  90. .point-text {
  91. position: absolute;
  92. top: -36px;
  93. left: -110px;
  94. background: #f2f2f2;
  95. border-radius: 6px;
  96. display: inline-block;
  97. width: 100px;
  98. text-align: center;
  99. padding: 2px;
  100. color: #8a7878;
  101. font-size: 18px;
  102. }
  103. .locked-status {
  104. position: absolute;
  105. right: 4px;
  106. top: 4px;
  107. background: rgba(0, 0, 0, 0.3);
  108. z-index: 100;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. color: #fff;
  113. font-size: 20px;
  114. }
  115. }
  116. .hover {
  117. border: 1px dashed var(--bs-el-color-primary);
  118. }
  119. .active {
  120. border: 1px solid var(--bs-el-color-primary);
  121. }
  122. </style>