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