SettingPanel.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. }
  105. else{
  106. return this.activeItem?.name
  107. }
  108. // if(this.activeItem)
  109. }
  110. },
  111. mounted () { },
  112. methods: {
  113. styleHandler (config) {
  114. this.$emit('styleHandler', config)
  115. },
  116. toggleShow () {
  117. this.$emit('update:rightVisiable', !this.rightVisiable)
  118. },
  119. close () {
  120. this.$emit('update:rightVisiable', false)
  121. },
  122. updateSetting (config) {
  123. this.$emit('updateSetting', config)
  124. },
  125. updateDataSetting (config) {
  126. this.$emit('updateDataSetting', config)
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .bs-right-panel-wrap {
  133. //z-index: 1000;
  134. display: flex;
  135. flex-direction: column;
  136. background-color: var(--bs-background-1);
  137. .bs-set-title {
  138. background-color: var(--bs-background-2);
  139. color: var(--bs-el-title);
  140. height: 40px;
  141. font-size: 14px;
  142. border-bottom: 2px solid var(--bs-background-1);
  143. display: flex;
  144. align-items: center;
  145. z-index
  146. .bs-set-title-text {
  147. position: relative;
  148. padding-left: 12px;
  149. display: inline-block;
  150. &:after{
  151. position: absolute;
  152. left: 0;
  153. top: 50%;
  154. transform: translateY(-50%);
  155. content: '';
  156. width: 4px;
  157. height: 14px;
  158. background-color: var(--bs-el-color-primary);
  159. }
  160. }
  161. }
  162. .bs-folder-wrap {
  163. width: 20px;
  164. position: relative;
  165. i {
  166. position: absolute;
  167. top: 50%;
  168. left: 0;
  169. transform: translateY(-50%);
  170. font-size: 20px;
  171. color: #fff;
  172. cursor: pointer;
  173. z-index: 1;
  174. }
  175. &:hover {
  176. background: rgba(143, 225, 255, .1)
  177. }
  178. }
  179. .bs-page-right {
  180. height: calc(100vh - 80px);
  181. width: 320px;
  182. box-sizing: border-box;
  183. background-color: var(--bs-background-2);
  184. .config-title {
  185. display: flex;
  186. height: 40px;
  187. line-height: 40px;
  188. padding: 0 10px;
  189. color: #fff;
  190. font-size: 14px;
  191. /* border-bottom: 1px solid #ebeef5; */
  192. .config-title-text {
  193. display: inline-block;
  194. max-width: 200px;
  195. overflow: hidden;
  196. text-overflow: ellipsis;
  197. white-space: nowrap;
  198. }
  199. }
  200. >* {
  201. color: #fff;
  202. }
  203. // 左侧居中伸缩图标
  204. &::after {
  205. content: '';
  206. position: absolute;
  207. top: 0;
  208. left: -10px;
  209. width: 10px;
  210. height: 100%;
  211. background: #fff;
  212. cursor: pointer;
  213. z-index: 1;
  214. }
  215. }
  216. .bs-page-right-fold {
  217. width: 0;
  218. overflow: hidden;
  219. }
  220. .slider-zoom {
  221. position: absolute;
  222. bottom: 10px;
  223. right: -10px;
  224. }
  225. }
  226. .slide-fade-enter-active {
  227. transition: all .3s ease;
  228. }
  229. .slide-fade-leave-active {
  230. transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
  231. }
  232. .slide-fade-enter,
  233. .slide-fade-leave-to
  234. /* .slide-fade-leave-active for below version 2.1.8 */
  235. {
  236. transform: translateX(10px);
  237. opacity: 0;
  238. }
  239. ::v-deep .el-scrollbar__view{
  240. height: calc(100vh - 80px);
  241. overflow-x: unset;
  242. }
  243. </style>