dataSetSetting.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. :to-add="isAdd"
  27. :do-edit="doEdit"
  28. :is-delete="isDelete"
  29. :ds-id="dataSetId"
  30. :multiple="multiple"
  31. :ds-value="DataDsValue"
  32. />
  33. </el-tab-pane>
  34. <slot
  35. name="dataSetSelect"
  36. :value="DataDsValue"
  37. />
  38. </el-tabs>
  39. <DataSetManagement
  40. v-else
  41. ref="dataSetSetting"
  42. class="bs-data-set-management"
  43. :is-border="true"
  44. :is-dialog="true"
  45. :to-add="isAdd"
  46. :do-edit="doEdit"
  47. :is-delete="isDelete"
  48. :ds-id="dataSetId"
  49. :multiple="multiple"
  50. :ds-value="DataDsValue"
  51. />
  52. <span
  53. slot="footer"
  54. class="dialog-footer"
  55. >
  56. <el-button
  57. class="bs-el-button-default"
  58. @click="dataSetVisible = false"
  59. >
  60. 取消
  61. </el-button>
  62. <el-button
  63. type="primary"
  64. @click="sure"
  65. >
  66. 确定
  67. </el-button>
  68. </span>
  69. </el-dialog>
  70. </template>
  71. <script>
  72. import DataSetManagement from 'data-room-ui/DataSetManagement'
  73. export default {
  74. name: 'DataSetSetting',
  75. components: { DataSetManagement },
  76. props: {
  77. config: {
  78. type: Object,
  79. default: () => {
  80. }
  81. },
  82. dsId: {
  83. type: String,
  84. default: ''
  85. },
  86. multiple: {
  87. type: Boolean,
  88. default: false
  89. },
  90. dsValue: {
  91. type: [Array, Object],
  92. default: () => ([])
  93. }
  94. },
  95. data () {
  96. return {
  97. dataSetVisible: false,
  98. dataSetId: null,
  99. newDataDsValue: '',
  100. tabsActiveName: 'dataSet',
  101. // 组件实例
  102. componentInstance: null,
  103. // 是否使用了插槽
  104. isUseSlot: false
  105. }
  106. },
  107. computed: {
  108. DataDsValue () {
  109. if (this.multiple) {
  110. return this.dsValue
  111. } else {
  112. return {
  113. id: this.dsId
  114. }
  115. }
  116. },
  117. isAdd () {
  118. let a = -1
  119. if (window.BS_CONFIG?.datasetAuth) {
  120. a = window.BS_CONFIG?.datasetAuth.findIndex(item => item === 'unAdd')
  121. }
  122. if (a === -1) {
  123. return true
  124. } else {
  125. return false
  126. }
  127. },
  128. doEdit () {
  129. let a = -1
  130. if (window.BS_CONFIG?.datasetAuth) {
  131. a = window.BS_CONFIG?.datasetAuth.findIndex(item => item === 'unEdit')
  132. }
  133. if (a === -1) {
  134. return true
  135. } else {
  136. return false
  137. }
  138. },
  139. isDelete () {
  140. let a = -1
  141. if (window.BS_CONFIG?.datasetAuth) {
  142. a = window.BS_CONFIG?.datasetAuth.findIndex(item => item === 'unDelete')
  143. }
  144. if (a === -1) {
  145. return true
  146. } else {
  147. return false
  148. }
  149. }
  150. },
  151. mounted () {
  152. this.dataSetId = this.dsId
  153. // 判断是否使用了插槽
  154. if (this.$scopedSlots && this.$scopedSlots.dataSetSelect && this.$scopedSlots.dataSetSelect()) {
  155. this.isUseSlot = true
  156. } else {
  157. this.isUseSlot = false
  158. }
  159. },
  160. methods: {
  161. openedInit () {
  162. // 将内置的组件实例赋值给componentInstance
  163. this.componentInstance = this.$refs.dataSetSetting
  164. this.newDataDsValue = this.DataDsValue
  165. },
  166. handleClickTabs (vueComponent, event) {
  167. this.componentInstance = vueComponent.$children[0]
  168. },
  169. sure () {
  170. this.dataSetVisible = false
  171. const getSelectDs = this.componentInstance.getSelectDs()
  172. if (Object.prototype.hasOwnProperty.call(getSelectDs, 'id')) {
  173. this.dataSetId = getSelectDs.id
  174. }
  175. this.$emit('getDsId', this.dataSetId)
  176. this.$emit('getSelectDs', getSelectDs)
  177. }
  178. }
  179. }
  180. </script>
  181. <style lang="scss"></style>
  182. <style lang="scss" scoped>
  183. @import '../assets/style/bsTheme.scss';
  184. ::v-deep .big-screen-router-view-wrap {
  185. padding-left: 16px !important;
  186. }
  187. ::v-deep .el-tabs__header {
  188. margin-bottom: 0;
  189. }
  190. .data-set-wrap {
  191. ::v-deep .el-dialog__body {
  192. position: relative;
  193. padding: 0 !important;
  194. // min-height: 550px;
  195. overflow: hidden;
  196. }
  197. ::v-deep .bs-container {
  198. padding: 0;
  199. min-height: 500px;
  200. background-color: var(--bs-background-2) !important;
  201. .el-table {
  202. max-height: calc(90vh - 340px);
  203. }
  204. .bs-table-box {
  205. margin-bottom: 0px;
  206. }
  207. .ztree {
  208. max-height: none !important;
  209. }
  210. }
  211. .bs-data-set-management {
  212. ::v-deep .bs-container {
  213. margin-left: 0 !important;
  214. }
  215. ::v-deep .layout {
  216. position: absolute !important;
  217. }
  218. ::v-deep .ztree {
  219. height: auto !important;
  220. }
  221. ::v-deep .bs-table-box {
  222. height: auto !important;
  223. }
  224. ::v-deep .bs-el-pagination {
  225. right: 6px !important;
  226. }
  227. ::v-deep .data-set-scrollbar {
  228. height: 515px !important;
  229. }
  230. }
  231. }
  232. ::v-deep .bs-pagination {
  233. bottom: 5px !important;
  234. }
  235. ::v-deep .left-box {
  236. .el-scrollbar {
  237. height: calc(100vh - 405px) !important;
  238. }
  239. }
  240. </style>