refactor: 批量添加到项目 可以指定用户组
--story=1003798 --user=lyh 6.批量添加到工作空间/项目 可以指定用户组 https://www.tapd.cn/55049933/s/1064580
This commit is contained in:
parent
18ecefd038
commit
1c1fc351e6
|
@ -21,5 +21,7 @@ public class UserBatchProcessRequest {
|
|||
List<String> batchProcessValue;
|
||||
String workspaceId;
|
||||
UserRequest condition;
|
||||
|
||||
String selectUserGroupId;
|
||||
}
|
||||
|
||||
|
|
|
@ -815,7 +815,22 @@ public class UserService {
|
|||
|
||||
private void batchAddUserToProject(UserBatchProcessRequest request) {
|
||||
List<String> userIds = this.selectIdByUserRequest(request);
|
||||
String toSetGroup = UserGroupConstants.READ_ONLY;
|
||||
String defaultGroup = UserGroupConstants.READ_ONLY;
|
||||
String toSetGroup = request.getSelectUserGroupId();
|
||||
if (StringUtils.isBlank(toSetGroup)) {
|
||||
toSetGroup = defaultGroup;
|
||||
} else {
|
||||
// 验证用户组ID有效性
|
||||
GroupExample groupExample = new GroupExample();
|
||||
groupExample.createCriteria()
|
||||
.andIdEqualTo(toSetGroup)
|
||||
.andTypeEqualTo(UserGroupType.PROJECT);
|
||||
List<Group> groups = groupMapper.selectByExample(groupExample);
|
||||
if (CollectionUtils.isEmpty(groups)) {
|
||||
toSetGroup = defaultGroup;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> projectIds = request.getBatchProcessValue();
|
||||
for (String userId : userIds) {
|
||||
UserGroupExample userGroupExample = new UserGroupExample();
|
||||
|
|
|
@ -447,7 +447,7 @@ export default {
|
|||
addUserGroupBatch(){
|
||||
this.$refs.groupCascaderDialog.open();
|
||||
},
|
||||
cascaderConfirm(batchProcessTypeParam, selectValueArr){
|
||||
cascaderConfirm(batchProcessTypeParam, selectValueArr, selectedUserGroup){
|
||||
if(selectValueArr.length === 0){
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
}
|
||||
|
@ -455,6 +455,7 @@ export default {
|
|||
params = this.buildBatchParam(params);
|
||||
params.batchType = batchProcessTypeParam;
|
||||
params.batchProcessValue = selectValueArr;
|
||||
params.selectUserGroupId = selectedUserGroup;
|
||||
this.$post('/user/special/batchProcessUserInfo', params, () => {
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.search();
|
||||
|
|
|
@ -2,12 +2,21 @@
|
|||
<el-dialog class="user-cascade" :title="title" :visible.sync="dialogVisible"
|
||||
@close="close" v-loading="loading">
|
||||
<div class="block">
|
||||
<el-select v-model="selectedUserGroup" clearable size="medium" style="width: 260px;"
|
||||
placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in projectUserGroups"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-alert
|
||||
:title="$t('user.add_project_batch_tip')"
|
||||
type="info"
|
||||
show-icon
|
||||
:closable="false"
|
||||
style="margin-bottom: 10px;"
|
||||
style="margin-bottom: 5px;margin-top: 5px;"
|
||||
>
|
||||
</el-alert>
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm">
|
||||
|
@ -35,6 +44,7 @@ import ElUploadList from "element-ui/packages/upload/src/upload-list";
|
|||
import MsTableButton from '../../../../components/common/components/MsTableButton';
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import {GROUP_PROJECT} from "@/common/js/constants";
|
||||
|
||||
export default {
|
||||
name: "User2ProjectCascader",
|
||||
|
@ -58,6 +68,8 @@ export default {
|
|||
],
|
||||
},
|
||||
selectedIds: [],
|
||||
selectedUserGroup: "",
|
||||
projectUserGroups: [],
|
||||
isResourceShow: 0,
|
||||
props: {
|
||||
multiple: true,
|
||||
|
@ -85,6 +97,9 @@ export default {
|
|||
default: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getProjectUserGroup();
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
removeGoBackListener(this.close);
|
||||
|
@ -107,7 +122,7 @@ export default {
|
|||
for (let i = 0; i < checkNodes.length; i++) {
|
||||
selectValueArr.push(checkNodes[i].value);
|
||||
}
|
||||
this.$emit('confirm', 'ADD_PROJECT', selectValueArr);
|
||||
this.$emit('confirm', 'ADD_PROJECT', selectValueArr, this.selectedUserGroup);
|
||||
this.loading = true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -131,6 +146,11 @@ export default {
|
|||
}
|
||||
resolve(data);
|
||||
})
|
||||
},
|
||||
getProjectUserGroup() {
|
||||
this.$post("/user/group/get", {type: GROUP_PROJECT}, (res) => {
|
||||
this.projectUserGroups = res.data ? res.data : [];
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue