diff --git a/frontend/src/views/dataset/group/Group.vue b/frontend/src/views/dataset/group/Group.vue index bcdaf184a8..2e088cd9c4 100644 --- a/frontend/src/views/dataset/group/Group.vue +++ b/frontend/src/views/dataset/group/Group.vue @@ -545,9 +545,7 @@ import { isKettleRunning, alter } from '@/api/dataset/dataset' -import { - getDatasetRelationship, -} from '@/api/chart/chart.js' +import { getDatasetRelationship } from '@/api/chart/chart.js' import msgContent from '@/views/system/datasource/MsgContent.vue' import GroupMoveSelector from './GroupMoveSelector' @@ -556,6 +554,7 @@ import { queryAuthModel } from '@/api/authModel/authModel' import { engineMode } from '@/api/system/engine' import _ from 'lodash' import msgCfm from '@/components/msgCfm/index' +import { checkPermission } from '@/utils/permission' export default { name: 'Group', @@ -925,8 +924,14 @@ export default { } const { queryType = 'dataset', id } = data - getDatasetRelationship(id).then((res) => { - if (res.data.subRelation?.length) { + if (checkPermission(['relationship:read'])) { + let hasSubRelation = false + await getDatasetRelationship(id).then((res) => { + if (res.data.subRelation?.length) { + hasSubRelation = true + } + }) + if (hasSubRelation) { options.title = this.$t('datasource.delete_this_dataset') options.link = this.$t('datasource.click_to_check') options.content = this.$t('datasource.cannot_be_deleted_dataset') @@ -937,8 +942,8 @@ export default { this.withLink(options, this.$t('commons.delete')) return } - this.handlerConfirm(options) - }) + } + this.handlerConfirm(options) }, linkTo(query) { window.open(this.$router.resolve({ diff --git a/frontend/src/views/system/datasource/DsTree.vue b/frontend/src/views/system/datasource/DsTree.vue index d774c7a2b7..b3aa20e810 100644 --- a/frontend/src/views/system/datasource/DsTree.vue +++ b/frontend/src/views/system/datasource/DsTree.vue @@ -339,13 +339,12 @@ import { listDriverByType, updateDriver } from '@/api/system/datasource' -import { - getDatasourceRelationship, -} from '@/api/chart/chart.js' +import { getDatasourceRelationship } from '@/api/chart/chart.js' import msgContent from './MsgContent.vue' import deTextarea from '@/components/deCustomCm/DeTextarea.vue' import msgCfm from '@/components/msgCfm' +import { checkPermission } from '@/utils/permission' export default { name: 'DsTree', components: { deTextarea }, @@ -754,15 +753,17 @@ export default { } const { queryType = 'datasource', name: label, id } = datasource if (this.showView === 'Datasource') { - await this.getDatasourceRelationship({ queryType, label, id }) - if (this.treeData.length) { - params.title = this.$t('datasource.this_data_source') - params.link = this.$t('datasource.click_to_check') - params.content = this.$t('datasource.cannot_be_deleted_datasource') - params.templateDel = msgContent - params.linkTo = this.linkTo.bind(this, { queryType, id }) - this.withLink(params) - return + if (checkPermission(['relationship:read'])) { + await this.getDatasourceRelationship({ queryType, label, id }) + if (this.treeData.length) { + params.title = this.$t('datasource.this_data_source') + params.link = this.$t('datasource.click_to_check') + params.content = this.$t('datasource.cannot_be_deleted_datasource') + params.templateDel = msgContent + params.linkTo = this.linkTo.bind(this, { queryType, id }) + this.withLink(params) + return + } } } this.handlerConfirm(params) diff --git a/frontend/src/views/system/relationship/index.vue b/frontend/src/views/system/relationship/index.vue index 49a3c4b8ff..e94c940330 100644 --- a/frontend/src/views/system/relationship/index.vue +++ b/frontend/src/views/system/relationship/index.vue @@ -340,6 +340,7 @@ export default { }, queryTypeChange(val) { this.formInline.dataSourceName = '' + this.dataSourceNameList = [] switch (val) { case 'datasource': this.listDatasource() @@ -427,4 +428,4 @@ export default { } } } - \ No newline at end of file +