dataSetSetting.vue 4.2 KB

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