SettingPanel.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <!-- <transition name="slide-fade"> -->
  3. <div
  4. v-if="rightVisiable"
  5. class="bs-right-panel-wrap"
  6. >
  7. <div class="bs-set-title">
  8. <SettingTitle>{{ chartSettingShow ? `${title}设置` : '大屏设置' }}</SettingTitle>
  9. </div>
  10. <div :class="!rightVisiable ? 'bs-page-right bs-page-right-fold' : 'bs-page-right'">
  11. <RightSetting
  12. v-if="chartSettingShow"
  13. @closeRightPanel="close"
  14. @updateSetting="updateSetting"
  15. @updateDataSetting="updateDataSetting"
  16. >
  17. <template #dataSetSelect="{value}">
  18. <slot
  19. name="dataSetSelect"
  20. :value="value"
  21. />
  22. </template>
  23. </RightSetting>
  24. <OverallSetting
  25. v-if="!chartSettingShow"
  26. ref="OverallSetting"
  27. @close="close"
  28. @styleHandler="styleHandler"
  29. />
  30. </div>
  31. </div>
  32. <!-- </transition> -->
  33. </template>
  34. <script>
  35. import SettingTitle from 'data-room-ui/SettingTitle/index.vue'
  36. import RightSetting from 'data-room-ui/BigScreenDesign/RightSetting/index.vue'
  37. import OverallSetting from 'data-room-ui/BigScreenDesign/OverallSetting/index.vue'
  38. import { mapState } from 'vuex'
  39. export default {
  40. name: '',
  41. components: {
  42. SettingTitle,
  43. RightSetting,
  44. OverallSetting
  45. },
  46. props: {
  47. rightVisiable: {
  48. type: Boolean,
  49. default: false
  50. },
  51. pageInfoVisiable: {
  52. type: Boolean,
  53. default: false
  54. },
  55. headerShow: {
  56. type: Boolean,
  57. default: true
  58. },
  59. height: {
  60. type: String,
  61. default: '100vh'
  62. }
  63. },
  64. data () {
  65. return {
  66. count: 0,
  67. right: 0
  68. }
  69. },
  70. watch: {
  71. rightVisiable (value) {
  72. const leftElement = document.querySelector('.bs-left-panel')
  73. const contentElement = document.querySelector('.grid-wrap-box')
  74. // const rightElement = document.querySelector('.bs-right-panel-wrap')
  75. const mapElement = document.querySelector('.minimap')
  76. if (value) {
  77. if (parseInt(window.getComputedStyle(mapElement).right) > parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width)) {
  78. // 此时距离超出可视范围
  79. this.count = 1
  80. this.right = window.getComputedStyle(mapElement).right
  81. mapElement.style.right = parseInt(window.getComputedStyle(leftElement).width) + parseInt(window.getComputedStyle(contentElement).width) - 320 - parseInt(window.getComputedStyle(mapElement).width) + 'px'
  82. }
  83. } else {
  84. if (this.count === 1) {
  85. mapElement.style.right = this.right
  86. this.count--
  87. }
  88. }
  89. }
  90. },
  91. computed: {
  92. ...mapState('bigScreen', {
  93. activeItem: state => state.activeItemConfig,
  94. activeCode: state => state.activeCode
  95. }),
  96. chartSettingShow () {
  97. return this.rightVisiable && this.activeCode
  98. },
  99. title () {
  100. if (this.activeItem.type === 'customComponent') {
  101. return this.activeItem?.category
  102. } else if (this.activeItem.type === 'remoteComponent') {
  103. return this.activeItem?.title
  104. } else {
  105. return this.activeItem?.name
  106. }
  107. // if(this.activeItem)
  108. }
  109. },
  110. mounted () { },
  111. methods: {
  112. styleHandler (config) {
  113. this.$emit('styleHandler', config)
  114. },
  115. toggleShow () {
  116. this.$emit('update:rightVisiable', !this.rightVisiable)
  117. },
  118. close () {
  119. this.$emit('update:rightVisiable', false)
  120. },
  121. updateSetting (config) {
  122. this.$emit('updateSetting', config)
  123. },
  124. updateDataSetting (config) {
  125. this.$emit('updateDataSetting', config)
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .bs-right-panel-wrap {
  132. //z-index: 1000;
  133. display: flex;
  134. flex-direction: column;
  135. background-color: var(--bs-background-1);
  136. .bs-set-title {
  137. background-color: var(--bs-background-2);
  138. color: var(--bs-el-title);
  139. height: 40px;
  140. font-size: 14px;
  141. border-bottom: 2px solid var(--bs-background-1);
  142. display: flex;
  143. align-items: center;
  144. z-index: 1000;
  145. .bs-set-title-text {
  146. position: relative;
  147. padding-left: 12px;
  148. display: inline-block;
  149. &:after{
  150. position: absolute;
  151. left: 0;
  152. top: 50%;
  153. transform: translateY(-50%);
  154. content: '';
  155. width: 4px;
  156. height: 14px;
  157. background-color: var(--bs-el-color-primary);
  158. }
  159. }
  160. }
  161. .bs-folder-wrap {
  162. width: 20px;
  163. position: relative;
  164. i {
  165. position: absolute;
  166. top: 50%;
  167. left: 0;
  168. transform: translateY(-50%);
  169. font-size: 20px;
  170. color: #fff;
  171. cursor: pointer;
  172. z-index: 1;
  173. }
  174. &:hover {
  175. background: rgba(143, 225, 255, .1)
  176. }
  177. }
  178. .bs-page-right {
  179. height: calc(100vh - 80px);
  180. width: 320px;
  181. box-sizing: border-box;
  182. background-color: var(--bs-background-2);
  183. .config-title {
  184. display: flex;
  185. height: 40px;
  186. line-height: 40px;
  187. padding: 0 10px;
  188. color: #fff;
  189. font-size: 14px;
  190. /* border-bottom: 1px solid #ebeef5; */
  191. .config-title-text {
  192. display: inline-block;
  193. max-width: 200px;
  194. overflow: hidden;
  195. text-overflow: ellipsis;
  196. white-space: nowrap;
  197. }
  198. }
  199. >* {
  200. color: #fff;
  201. }
  202. // 左侧居中伸缩图标
  203. &::after {
  204. content: '';
  205. position: absolute;
  206. top: 0;
  207. left: -10px;
  208. width: 10px;
  209. height: 100%;
  210. background: #fff;
  211. cursor: pointer;
  212. z-index: 1;
  213. }
  214. }
  215. .bs-page-right-fold {
  216. width: 0;
  217. overflow: hidden;
  218. }
  219. .slider-zoom {
  220. position: absolute;
  221. bottom: 10px;
  222. right: -10px;
  223. }
  224. }
  225. .slide-fade-enter-active {
  226. transition: all .3s ease;
  227. }
  228. .slide-fade-leave-active {
  229. transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
  230. }
  231. .slide-fade-enter,
  232. .slide-fade-leave-to
  233. /* .slide-fade-leave-active for below version 2.1.8 */
  234. {
  235. transform: translateX(10px);
  236. opacity: 0;
  237. }
  238. ::v-deep .el-scrollbar__view{
  239. height: calc(100vh - 80px);
  240. overflow-x: unset;
  241. }
  242. </style>