SettingPanel.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. 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. .bs-set-title-text {
  145. position: relative;
  146. padding-left: 12px;
  147. display: inline-block;
  148. &:after{
  149. position: absolute;
  150. left: 0;
  151. top: 50%;
  152. transform: translateY(-50%);
  153. content: '';
  154. width: 4px;
  155. height: 14px;
  156. background-color: var(--bs-el-color-primary);
  157. }
  158. }
  159. }
  160. .bs-folder-wrap {
  161. width: 20px;
  162. position: relative;
  163. i {
  164. position: absolute;
  165. top: 50%;
  166. left: 0;
  167. transform: translateY(-50%);
  168. font-size: 20px;
  169. color: #fff;
  170. cursor: pointer;
  171. z-index: 1;
  172. }
  173. &:hover {
  174. background: rgba(143, 225, 255, .1)
  175. }
  176. }
  177. .bs-page-right {
  178. height: calc(100vh - 80px);
  179. width: 320px;
  180. box-sizing: border-box;
  181. background-color: var(--bs-background-2);
  182. .config-title {
  183. display: flex;
  184. height: 40px;
  185. line-height: 40px;
  186. padding: 0 10px;
  187. color: #fff;
  188. font-size: 14px;
  189. /* border-bottom: 1px solid #ebeef5; */
  190. .config-title-text {
  191. display: inline-block;
  192. max-width: 200px;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. white-space: nowrap;
  196. }
  197. }
  198. >* {
  199. color: #fff;
  200. }
  201. // 左侧居中伸缩图标
  202. &::after {
  203. content: '';
  204. position: absolute;
  205. top: 0;
  206. left: -10px;
  207. width: 10px;
  208. height: 100%;
  209. background: #fff;
  210. cursor: pointer;
  211. z-index: 1;
  212. }
  213. }
  214. .bs-page-right-fold {
  215. width: 0;
  216. overflow: hidden;
  217. }
  218. .slider-zoom {
  219. position: absolute;
  220. bottom: 10px;
  221. right: -10px;
  222. }
  223. }
  224. .slide-fade-enter-active {
  225. transition: all .3s ease;
  226. }
  227. .slide-fade-leave-active {
  228. transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
  229. }
  230. .slide-fade-enter,
  231. .slide-fade-leave-to
  232. /* .slide-fade-leave-active for below version 2.1.8 */
  233. {
  234. transform: translateX(10px);
  235. opacity: 0;
  236. }
  237. ::v-deep .el-scrollbar__view{
  238. height: calc(100vh - 80px);
  239. overflow-x: unset;
  240. }
  241. </style>