Configuration.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div
  3. class="configuration-wrap"
  4. :class="{
  5. 'active': activeCodes.includes(config.code) && (!isPreview),
  6. 'hover': hoverCode === config.code && (!isPreview)
  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="!isPreview && 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. isPreview () {
  43. return (this.$route.path === window?.BS_CONFIG?.routers?.previewUrl) || (this.$route.path === '/big-screen/preview')
  44. }
  45. },
  46. data () {
  47. return {
  48. }
  49. },
  50. mounted () {},
  51. methods: {
  52. ...mapMutations('bigScreen', [
  53. 'changeHoverCode',
  54. 'changeActiveCode',
  55. 'changeChartConfig',
  56. 'addItem',
  57. 'delItem',
  58. 'resetPresetLine',
  59. 'changeLayout',
  60. 'changeZIndex',
  61. 'changeLocked'
  62. ]),
  63. // 改变hover的组件
  64. changeHover (code) {
  65. this.changeHoverCode(code)
  66. },
  67. // 改变激活的组件
  68. changeActive (config) {
  69. this.changeActiveCode(config.code)
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .configuration-wrap {
  76. height: 100%;
  77. width: 100%;
  78. border: 1px solid transparent;
  79. cursor: move;
  80. .opt-icon-wrap {
  81. z-index: 100;
  82. display: flex;
  83. position: absolute;
  84. right: 10px;
  85. top: 10px;
  86. &:hover{
  87. cursor: pointer;
  88. }
  89. .obt-item{
  90. padding: 0 5px;
  91. }
  92. }
  93. .point-text {
  94. position: absolute;
  95. top: -36px;
  96. left: -110px;
  97. background: #f2f2f2;
  98. border-radius: 6px;
  99. display: inline-block;
  100. width: 100px;
  101. text-align: center;
  102. padding: 2px;
  103. color: #8a7878;
  104. font-size: 18px;
  105. }
  106. .locked-status {
  107. position: absolute;
  108. right: 4px;
  109. top: 4px;
  110. background: rgba(0, 0, 0, 0.3);
  111. z-index: 100;
  112. display: flex;
  113. align-items: center;
  114. justify-content: center;
  115. color: #fff;
  116. font-size: 20px;
  117. }
  118. }
  119. .hover {
  120. border: 1px dashed var(--bs-el-color-primary);
  121. }
  122. .active {
  123. border: 1px solid #ff40e2;
  124. }
  125. </style>