diff --git a/frontend/src/business/components/settings/common/AddMember.vue b/frontend/src/business/components/settings/common/AddMember.vue new file mode 100644 index 0000000000..42309a0bab --- /dev/null +++ b/frontend/src/business/components/settings/common/AddMember.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/frontend/src/business/components/settings/organization/OrganizationMember.vue b/frontend/src/business/components/settings/organization/OrganizationMember.vue index 7c324240a8..378df3aa31 100644 --- a/frontend/src/business/components/settings/organization/OrganizationMember.vue +++ b/frontend/src/business/components/settings/organization/OrganizationMember.vue @@ -48,49 +48,7 @@ :total="total"/> - - - - - - - - - - - - - - - - - - - - + @@ -148,10 +106,12 @@ import UserCascader from "@/business/components/settings/system/components/UserCascader"; import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn"; import {GROUP_ORGANIZATION} from "@/common/js/constants"; + import AddMember from "@/business/components/settings/common/AddMember"; export default { name: "MsOrganizationMember", - components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag, MsTableOperator, MsDialogFooter, + components: { + AddMember, MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag, MsTableOperator, MsDialogFooter, MsTableHeaderSelectPopover,UserCascader,ShowMoreBtn}, activated() { this.initTableData(); @@ -198,6 +158,11 @@ userList: [] } }, + computed: { + orgId() { + return getCurrentOrganizationId(); + } + }, methods: { currentUser: () => { return getCurrentUser(); @@ -303,39 +268,16 @@ }); }, create() { - let orgId = this.currentUser().lastOrganizationId; - if (!orgId) { - this.$warning(this.$t('organization.select_organization')); - return false; - } - this.form = {}; - this.createVisible = true; - this.result = this.$get('/user/list/', response => { - this.userList = response.data; - }); - this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: orgId}, response => { - this.$set(this.form, "groups", response.data); - }) + this.$refs.addMember.open(); listenGoBack(this.handleClose); }, - submitForm(formName) { - this.$refs[formName].validate((valid) => { - let orgId = this.currentUser().lastOrganizationId; - if (valid) { - let param = { - userIds: this.form.ids, - groupIds: this.form.groupIds, - organizationId: orgId - }; - this.result = this.$post("user/org/member/add", param, () => { - this.$success(this.$t('commons.save_success')); - this.initTableData(); - this.createVisible = false; - }) - } else { - return false; - } - }); + submitForm(param) { + param['organizationId'] = this.orgId; + this.result = this.$post("user/org/member/add", param, () => { + this.$success(this.$t('commons.save_success')); + this.initTableData(); + this.$refs.addMember.close(); + }) }, initWorkspaceBatchProcessDataStruct(isShow){ let organizationId = getCurrentOrganizationId(); diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index 1a7f20bfeb..ecc4d85633 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -102,51 +102,7 @@ - - - - - - - - - - - - - - - - - - + { - this.userList = response.data; - }); - this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: getCurrentOrganizationId()}, response => { - this.$set(this.memberForm, "groups", response.data); - }); + this.$refs.addMember.open(); listenGoBack(this.close); }, cellClick(row) { @@ -408,33 +362,12 @@ export default { closeFunc() { this.form = {}; }, - submitForm(formName) { - this.$refs[formName].validate((valid) => { - if (valid) { - // let userIds = []; - // let userId = this.memberForm.userId; - // let email = this.memberForm.memberSign; - // let member = this.userList.find(user => user.id === email || user.email === email); - // if (!member) { - // this.$warning(this.$t('member.no_such_user')); - // return false; - // } else { - // userId = member.id; - // } - // userIds.push(userId); - let param = { - userIds: this.memberForm.userIds, - groupIds: this.memberForm.groupIds, - workspaceId: this.currentWorkspaceRow.id - }; - this.result = this.$post("user/ws/member/add", param, () => { - this.$success(this.$t('commons.save_success')); - this.cellClick(this.currentWorkspaceRow); - this.dialogWsMemberAddVisible = false; - }); - } else { - return false; - } + submitForm(param) { + param['workspaceId'] = this.currentWorkspaceRow.id; + this.result = this.$post("user/ws/member/add", param, () => { + this.$success(this.$t('commons.save_success')); + this.cellClick(this.currentWorkspaceRow); + this.$refs.addMember.close(); }); }, editMember(row) { diff --git a/frontend/src/business/components/settings/project/EditMember.vue b/frontend/src/business/components/settings/project/EditMember.vue index e596d17283..a9f8d20cd2 100644 --- a/frontend/src/business/components/settings/project/EditMember.vue +++ b/frontend/src/business/components/settings/project/EditMember.vue @@ -1,55 +1,15 @@ diff --git a/frontend/src/business/components/settings/workspace/MsProject.vue b/frontend/src/business/components/settings/workspace/MsProject.vue index 8c31e1a158..d7220c3926 100644 --- a/frontend/src/business/components/settings/workspace/MsProject.vue +++ b/frontend/src/business/components/settings/workspace/MsProject.vue @@ -199,52 +199,7 @@ - - - - - - - - - - - - - - - - - - - + @@ -285,6 +240,7 @@ import MsResourceFiles from "@/business/components/performance/test/components/R import TemplateSelect from "@/business/components/settings/workspace/template/TemplateSelect"; import {PROJECT_CONFIGS} from "@/business/components/common/components/search/search-components"; import MsRolesTag from "@/business/components/common/components/MsRolesTag"; +import AddMember from "@/business/components/settings/common/AddMember"; export default { name: "MsProject", @@ -298,7 +254,8 @@ export default { MsTableOperatorButton, MsDeleteConfirm, MsMainContainer, MsRolesTag, - MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter + MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter, + AddMember }, inject: [ 'reloadTopMenus' @@ -367,6 +324,9 @@ export default { }, projectId() { return getCurrentProjectID(); + }, + orgId() { + return getCurrentOrganizationId(); } }, destroyed() { @@ -616,33 +576,16 @@ export default { } }); }, - submitForm() { - this.$refs['form'].validate((valid) => { - if (valid) { - let param = { - userIds: this.memberForm.userIds, - groupIds: this.memberForm.groupIds, - projectId: this.currentProjectId - }; - this.result = this.$post("user/project/member/add", param, () => { - this.$success(this.$t('commons.save_success')); - this.dialogSearch(); - this.dialogMemberVisible = false; - }); - } + submitForm(param) { + param['projectId'] = this.currentProjectId; + this.result = this.$post("user/project/member/add", param, () => { + this.$success(this.$t('commons.save_success')); + this.dialogSearch(); + this.$refs.addMember.close(); }); }, open() { - this.$get('/user/list/', response => { - this.dialogMemberVisible = true; - this.userList = response.data; - }); - this.result = this.$post('/user/group/list', { - type: GROUP_PROJECT, - resourceId: getCurrentOrganizationId() - }, response => { - this.$set(this.memberForm, "groups", response.data); - }); + this.$refs.addMember.open(); }, handleMemberClose() { this.dialogMemberVisible = false; diff --git a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue index 63c009731e..7ffaefc825 100644 --- a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue +++ b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue @@ -49,46 +49,7 @@ :total="total"/> - - - - - - - - - - - - - - - - - - + @@ -150,10 +111,12 @@ import UserCascader from "@/business/components/settings/system/components/UserCascader"; import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn"; import {GROUP_WORKSPACE} from "@/common/js/constants"; + import AddMember from "@/business/components/settings/common/AddMember"; export default { name: "MsMember", - components: {MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag, MsTableOperator, MsDialogFooter, + components: { + AddMember, MsCreateBox, MsTablePagination, MsTableHeader, MsRolesTag, MsTableOperator, MsDialogFooter, MsTableHeaderSelectPopover,UserCascader,ShowMoreBtn}, data() { return { @@ -191,6 +154,11 @@ ], } }, + computed: { + orgId() { + return getCurrentOrganizationId(); + } + }, activated: function () { this.initTableData(); }, @@ -301,7 +269,7 @@ }); }, create() { - this.form = {}; + // this.form = {}; // let param = { // name: this.condition.name, // organizationId: this.currentUser().lastOrganizationId @@ -315,31 +283,24 @@ // this.createVisible = true; // this.userList = response.data; // }) - this.$get('/user/list/', response => { - this.createVisible = true; - this.userList = response.data; - }) - this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: getCurrentOrganizationId()}, response => { - this.$set(this.form, "groups", response.data); - }) + // this.$get('/user/list/', response => { + // this.createVisible = true; + // this.userList = response.data; + // }) + // this.result = this.$post('/user/group/list', {type: GROUP_WORKSPACE, resourceId: getCurrentOrganizationId()}, response => { + // this.$set(this.form, "groups", response.data); + // }) + this.$refs.addMember.open(); listenGoBack(this.handleClose); }, - submitForm(formName) { - this.$refs[formName].validate((valid) => { - if (valid) { - let param = { - userIds: this.form.userIds, - groupIds: this.form.groupIds, - workspaceId: getCurrentWorkspaceId() - }; - this.result = this.$post("user/ws/member/add", param, () => { - this.$success(this.$t('commons.save_success')); - this.initTableData(); - this.selectRows.clear(); - this.createVisible = false; - }) - } - }); + submitForm(param) { + param['workspaceId'] = getCurrentWorkspaceId(); + this.result = this.$post("user/ws/member/add", param, () => { + this.$success(this.$t('commons.save_success')); + this.initTableData(); + this.selectRows.clear(); + this.$refs.addMember.close(); + }) }, querySearch(queryString, cb) { var userList = this.userList;