From bd320ff0026f12d99ebc2fe12b6be39298df7978 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 8 Jun 2020 13:17:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B7=A5=E4=BD=9C=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/project/MsProject.vue | 15 ------- .../organization/OrganizationWorkspace.vue | 37 ++++++++--------- .../settings/system/SystemWorkspace.vue | 41 +++++++++---------- frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 1 + frontend/src/i18n/zh-TW.js | 1 + 6 files changed, 41 insertions(+), 55 deletions(-) diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index cc6640cbf7..74b55841fc 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -181,21 +181,6 @@ this.list(); }); }, - del(row) { - this.getRelatedResource(row.id).then(tip => { - this.$confirm(tip + this.$t('project.delete_confirm'), this.$t('commons.prompt'), { - confirmButtonText: this.$t('commons.confirm'), - cancelButtonText: this.$t('commons.cancel'), - type: 'warning' - }).then(() => { - this.$get('/project/delete/' + row.id, () => { - Message.success(this.$t('commons.delete_success')); - this.list(); - }); - }).catch(() => { - }); - }); - }, search() { this.list(); }, diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index fab60134bc..66b1c6489e 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -16,7 +16,7 @@ @@ -144,6 +144,8 @@ + + @@ -158,10 +160,12 @@ import MsTableOperatorButton from "../../common/components/MsTableOperatorButton"; import MsDialogFooter from "../../common/components/MsDialogFooter"; import {getCurrentUser, getCurrentWorkspaceId, refreshSessionAndCookies} from "../../../../common/js/utils"; + import MsDeleteConfirm from "../../common/components/MsDeleteConfirm"; export default { name: "MsOrganizationWorkspace", components: { + MsDeleteConfirm, MsCreateBox, MsTablePagination, MsTableHeader, @@ -204,24 +208,19 @@ this.dialogWsAddVisible = true; this.form = Object.assign({}, row); }, - del(row) { - this.$confirm(this.$t('workspace.delete_confirm'), '', { - confirmButtonText: this.$t('commons.confirm'), - cancelButtonText: this.$t('commons.cancel'), - type: 'warning' - }).then(() => { - this.$get('/workspace/delete/' + row.id, () => { - let lastWorkspaceId = getCurrentWorkspaceId(); - let sourceId = row.id; - if (lastWorkspaceId === sourceId) { - let sign = DEFAULT; - refreshSessionAndCookies(sign, sourceId); - } - this.$success(this.$t('commons.delete_success')); - this.list(); - }); - }).catch(() => { - + handleDelete(workspace) { + this.$refs.deleteConfirm.open(workspace); + }, + _handleDelete(workspace) { + this.$get('/workspace/delete/' + workspace.id, () => { + let lastWorkspaceId = getCurrentWorkspaceId(); + let sourceId = workspace.id; + if (lastWorkspaceId === sourceId) { + let sign = DEFAULT; + refreshSessionAndCookies(sign, sourceId); + } + this.$success(this.$t('commons.delete_success')); + this.list(); }); }, list() { diff --git a/frontend/src/business/components/settings/system/SystemWorkspace.vue b/frontend/src/business/components/settings/system/SystemWorkspace.vue index 8c8c6a4fbf..dac3154b78 100644 --- a/frontend/src/business/components/settings/system/SystemWorkspace.vue +++ b/frontend/src/business/components/settings/system/SystemWorkspace.vue @@ -19,7 +19,7 @@ @@ -184,6 +184,8 @@ + + @@ -198,10 +200,12 @@ import MsDialogFooter from "../../common/components/MsDialogFooter"; import {getCurrentUser, getCurrentWorkspaceId, refreshSessionAndCookies} from "../../../../common/js/utils"; import {DEFAULT, WORKSPACE} from "../../../../common/js/constants"; + import MsDeleteConfirm from "../../common/components/MsDeleteConfirm"; export default { name: "MsSystemWorkspace", components: { + MsDeleteConfirm, MsCreateBox, MsTablePagination, MsTableHeader, @@ -311,26 +315,6 @@ } }) }, - del(row) { - this.$confirm(this.$t('workspace.delete_confirm'), this.$t('commons.prompt'), { - confirmButtonText: this.$t('commons.confirm'), - cancelButtonText: this.$t('commons.cancel'), - type: 'warning' - }).then(() => { - this.$get('/workspace/special/delete/' + row.id, () => { - let lastWorkspaceId = getCurrentWorkspaceId(); - let sourceId = row.id; - if (lastWorkspaceId === sourceId) { - let sign = DEFAULT; - refreshSessionAndCookies(sign, sourceId); - } - Message.success(this.$t('commons.delete_success')); - this.list(); - }); - }).catch(() => { - - }); - }, handleClose() { this.memberForm = {}; }, @@ -384,6 +368,21 @@ // 编辑时填充角色信息 this.$set(this.memberForm, 'roleIds', roleIds); }, + handleDelete(workspace) { + this.$refs.deleteConfirm.open(workspace); + }, + _handleDelete(workspace) { + this.$get('/workspace/special/delete/' + workspace.id, () => { + let lastWorkspaceId = getCurrentWorkspaceId(); + let sourceId = workspace.id; + if (lastWorkspaceId === sourceId) { + let sign = DEFAULT; + refreshSessionAndCookies(sign, sourceId); + } + Message.success(this.$t('commons.delete_success')); + this.list(); + }); + }, delMember(row) { this.$confirm(this.$t('member.remove_member'), '', { confirmButtonText: this.$t('commons.confirm'), diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 684f414be6..c306085553 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -102,6 +102,7 @@ export default { workspace: { 'create': 'Create Workspace', 'update': 'Update Workspace', + 'delete': 'Delete Workspace', 'delete_confirm': 'Are you sure you want to delete this workspace?', 'add': 'Add Workspace', 'input_name': 'Please enter a workspace name', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index f97faa3c69..37092a6a43 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -101,6 +101,7 @@ export default { workspace: { 'create': '创建工作空间', 'update': '修改工作空间', + 'delete': '删除工作空间', 'delete_confirm': '删除工作空间会关联删除该工作空间下的资源,确定要删除吗?', 'add': '添加工作空间', 'input_name': '请输入工作空间名称', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 19c518aa88..be9ed94923 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -101,6 +101,7 @@ export default { workspace: { 'create': '創建工作空間', 'update': '修改工作空間', + 'delete': '刪除工作空間', 'delete_confirm': '刪除工作空間會關聯刪除該工作空間下的資源,確定要刪除嗎?', 'add': '添加工作空間', 'input_name': '請輸入工作空間名稱',