From 69b66bdacc5f1da371fcd4ecf491037571b04fbd Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 1 Jun 2021 11:22:41 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=88=9B=E5=BB=BA=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/OrganizationWorkspace.vue | 7 +- .../settings/system/Organization.vue | 64 ++++++++++++------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index e379913e49..df0ce8e3aa 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -23,7 +23,9 @@
+ :show-delete="workspaceId !== scope.row.id" + @editClick="edit(scope.row)" + @deleteClick="handleDelete(scope.row)"/>
@@ -224,6 +226,9 @@ export default { computed: { currentUser: () => { return getCurrentUser(); + }, + workspaceId() { + return getCurrentWorkspaceId(); } }, methods: { diff --git a/frontend/src/business/components/settings/system/Organization.vue b/frontend/src/business/components/settings/system/Organization.vue index 2d6fdacfd2..48b87dda0f 100644 --- a/frontend/src/business/components/settings/system/Organization.vue +++ b/frontend/src/business/components/settings/system/Organization.vue @@ -3,7 +3,8 @@ @@ -24,7 +25,9 @@
+ :show-delete="organizationId !== scope.row.id" + @editClick="edit(scope.row)" + @deleteClick="handleDelete(scope.row)"/>
@@ -34,7 +37,8 @@
- @@ -64,7 +68,8 @@ - @@ -85,7 +90,8 @@ - - - @@ -214,6 +222,11 @@ export default { MsDialogFooter, MsTableOperatorButton }, + computed: { + organizationId() { + return getCurrentOrganizationId(); + } + }, data() { return { queryPath: '/organization/list', @@ -259,7 +272,7 @@ export default { ] }, orgId: "" - } + }; }, activated() { this.initTableData(); @@ -278,15 +291,15 @@ export default { }); this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => { this.$set(this.memberForm, "groups", response.data); - }) + }); }, dataFilter(val) { if (val) { this.memberForm.userList = this.memberForm.copyUserList.filter((item) => { if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) { - return true + return true; } - }) + }); } else { this.memberForm.userList = this.memberForm.copyUserList; } @@ -305,7 +318,7 @@ export default { // }) this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => { this.$set(this.memberForm, "allgroups", response.data); - }) + }); // 编辑时填充角色信息 this.$set(this.memberForm, 'groupIds', groupIds); listenGoBack(this.closeFunc); @@ -328,7 +341,7 @@ export default { this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => { let groups = response.data; this.$set(this.memberLineData[i], "groups", groups); - }) + }); } this.dialogTotal = data.itemCount; }); @@ -345,9 +358,12 @@ export default { this.memberLineData = data.listObject; let url = "/userrole/list/org/" + row.id; for (let i = 0; i < this.memberLineData.length; i++) { - this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.memberLineData[i].id }, response => { + this.result = this.$post('/user/group/list', { + type: GROUP_ORGANIZATION, + resourceId: this.memberLineData[i].id + }, response => { this.$set(this.memberLineData[i], "groups", response.data); - }) + }); } this.dialogTotal = data.itemCount; }); @@ -390,7 +406,7 @@ export default { if (currentUser.id === userId) { refreshSessionAndCookies(ORGANIZATION, sourceId); } - this.$success(this.$t('commons.remove_success')) + this.$success(this.$t('commons.remove_success')); this.cellClick(this.currentRow); }); }).catch(() => { @@ -408,7 +424,7 @@ export default { } else { return false; } - }) + }); }, updateOrganization(updateOrganizationForm) { this.$refs[updateOrganizationForm].validate(valid => { @@ -421,7 +437,7 @@ export default { } else { return false; } - }) + }); }, initTableData() { this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => { @@ -431,15 +447,15 @@ export default { let param = { name: '', organizationId: this.tableData[i].id - } + }; let path = "user/special/org/member/list/all"; this.$post(path, param, res => { let member = res.data; this.$set(this.tableData[i], "memberSize", member.length); - }) + }); } this.total = data.itemCount; - }) + }); }, closeFunc() { this.memberLineData = []; @@ -469,7 +485,7 @@ export default { refreshSessionAndCookies(sign, sourceId); this.cellClick(this.currentRow); this.dialogOrgMemberAddVisible = false; - }) + }); } else { return false; } @@ -483,7 +499,7 @@ export default { phone: this.memberForm.phone, groupIds: this.memberForm.groupIds, organizationId: this.currentRow.id - } + }; this.$refs[formName].validate((valid) => { if (valid) { this.result = this.$post("/organization/member/update", param, () => { @@ -496,7 +512,7 @@ export default { }, } -} +};