From 037cfed585676cd6bf43e378890b83fd484358b8 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Tue, 3 Jan 2023 17:43:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A1=80=E6=BA=90=E5=85=B3=E7=B3=BB):=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AE=E6=BA=90=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=97=B6=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=A1=80=E6=BA=90=E5=85=B3=E7=B3=BB=E7=9A=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=88=99=E4=B8=8D=E6=8F=90=E7=A4=BA=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/dataset/group/Group.vue | 19 ++++++++------ .../src/views/system/datasource/DsTree.vue | 25 ++++++++++--------- .../src/views/system/relationship/index.vue | 3 ++- 3 files changed, 27 insertions(+), 20 deletions(-) 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 +