dataSetSetting.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <el-dialog
  3. :close-on-click-modal="false"
  4. :append-to-body="true"
  5. title="数据集设置"
  6. :visible.sync="dataSetVisible"
  7. width="80%"
  8. class="bs-dialog-wrap data-set-wrap bs-el-dialog"
  9. >
  10. <el-tabs
  11. v-if="isUseSlot"
  12. v-model="tabsActiveName"
  13. class="bs-el-tabs"
  14. @tab-click="handleClickTabs"
  15. >
  16. <el-tab-pane
  17. label="数据集"
  18. name="dataSet"
  19. >
  20. <DataSetManagement
  21. ref="dataSetSetting"
  22. class="bs-data-set-management"
  23. :is-border="true"
  24. :is-dialog="true"
  25. :ds-id="dataSetId"
  26. :multiple="multiple"
  27. :ds-value="DataDsValue"
  28. />
  29. </el-tab-pane>
  30. <slot name="dataSetSelect" />
  31. </el-tabs>
  32. <DataSetManagement
  33. v-else
  34. ref="dataSetSetting"
  35. class="bs-data-set-management"
  36. :is-border="true"
  37. :is-dialog="true"
  38. :ds-id="dataSetId"
  39. :multiple="multiple"
  40. :ds-value="DataDsValue"
  41. />
  42. <span
  43. slot="footer"
  44. class="dialog-footer"
  45. >
  46. <el-button
  47. class="bs-el-button-default"
  48. @click="dataSetVisible = false"
  49. >
  50. 取消
  51. </el-button>
  52. <el-button
  53. type="primary"
  54. @click="sure"
  55. >
  56. 确定
  57. </el-button>
  58. </span>
  59. </el-dialog>
  60. </template>
  61. <script>
  62. import DataSetManagement from 'data-room-ui/DataSetManagement'
  63. export default {
  64. name: 'DataSetSetting',
  65. components: { DataSetManagement },
  66. props: {
  67. config: {
  68. type: Object,
  69. default: () => {
  70. }
  71. },
  72. dsId: {
  73. type: String,
  74. default: ''
  75. },
  76. multiple: {
  77. type: Boolean,
  78. default: false
  79. },
  80. dsValue: {
  81. type: [Array, Object],
  82. default: () => ([])
  83. }
  84. },
  85. data () {
  86. return {
  87. dataSetVisible: false,
  88. dataSetId: null,
  89. tabsActiveName: 'dataSet',
  90. // 组件实例
  91. componentInstance: null,
  92. // 是否使用了插槽
  93. isUseSlot: false
  94. }
  95. },
  96. computed: {
  97. DataDsValue () {
  98. if (this.multiple) {
  99. return this.dsValue
  100. } else {
  101. return {
  102. id: this.dsId
  103. }
  104. }
  105. }
  106. },
  107. mounted () {
  108. this.dataSetId = this.dsId
  109. // 将内置的组件实例赋值给componentInstance
  110. this.componentInstance = this.$refs.dataSetSetting
  111. // 判断是否使用了插槽
  112. if (this.$scopedSlots && this.$scopedSlots.dataSetSelect && this.$scopedSlots.dataSetSelect()) {
  113. this.isUseSlot = true
  114. } else {
  115. this.isUseSlot = false
  116. }
  117. },
  118. methods: {
  119. handleClickTabs (vueComponent, event) {
  120. this.componentInstance = vueComponent.$children[0]
  121. },
  122. sure () {
  123. this.dataSetVisible = false
  124. const getSelectDs = this.componentInstance.getSelectDs()
  125. console.log('getSelectDs', getSelectDs)
  126. if (Object.prototype.hasOwnProperty.call(getSelectDs, 'id')) {
  127. this.dataSetId = getSelectDs.id
  128. }
  129. this.$emit('getDsId', this.dataSetId)
  130. this.$emit('getSelectDs', getSelectDs)
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss"></style>
  136. <style lang="scss" scoped>
  137. @import '../assets/style/bsTheme.scss';
  138. ::v-deep .big-screen-router-view-wrap {
  139. padding-left: 16px !important;
  140. }
  141. ::v-deep .el-tabs__header{
  142. margin-bottom: 0;
  143. }
  144. .data-set-wrap {
  145. ::v-deep .el-dialog__body {
  146. position: relative;
  147. padding: 0 !important;
  148. min-height: 550px;
  149. overflow: hidden;
  150. }
  151. ::v-deep .bs-container {
  152. padding: 0;
  153. min-height: 550px;
  154. .el-table {
  155. max-height: calc(90vh - 350px);
  156. }
  157. .bs-table-box {
  158. margin-bottom: 0px;
  159. }
  160. .ztree {
  161. max-height: none !important;
  162. }
  163. }
  164. .bs-data-set-management {
  165. ::v-deep .bs-container {
  166. margin-left: 0 !important;
  167. }
  168. ::v-deep .layout {
  169. position: absolute !important;
  170. }
  171. ::v-deep .ztree {
  172. height: auto !important;
  173. }
  174. ::v-deep .bs-table-box {
  175. height: auto !important;
  176. }
  177. ::v-deep .bs-el-pagination {
  178. right: 6px !important;
  179. }
  180. ::v-deep .data-set-scrollbar {
  181. height: 515px !important;
  182. }
  183. }
  184. }
  185. </style>