fix(系统设置): 创建用户选项目与空间联动
--user=郭雨琦 --bug=1007537 系统设置-系统-用户,新增用户添加到项目里,则默认添加到项目所属的工作空间成员里 https://www.tapd.cn/55049933/prong/stories/view/1155049933001007537
This commit is contained in:
parent
29eafe4531
commit
499469a3e2
|
@ -29,7 +29,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import Setting from "@/business/components/settings/router";
|
||||
import MsPersonFromSetting from "@/business/components/settings/personal/PersonFromSetting";
|
||||
import MsApiKeys from "@/business/components/settings/personal/ApiKeys";
|
||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||
|
@ -41,7 +40,7 @@
|
|||
import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo";
|
||||
import AzureDevopsUserInfo from "@/business/components/settings/personal/AzureDevopsUserInfo";
|
||||
import {getIntegrationService} from "@/network/organization";
|
||||
import {AZURE_DEVOPS, JIRA, TAPD, TokenKey, ZEN_TAO} from "@/common/js/constants";
|
||||
import { TokenKey } from "@/common/js/constants";
|
||||
|
||||
export default {
|
||||
name: "MsPersonRouter",
|
||||
|
@ -50,22 +49,7 @@
|
|||
'reload',
|
||||
],
|
||||
data(){
|
||||
let getMenus = function (group) {
|
||||
let menus = [];
|
||||
Setting.children.forEach(child => {
|
||||
if (child.meta[group] === true) {
|
||||
let menu = {index: Setting.path + "/" + child.path};
|
||||
menu.title = child.meta.title;
|
||||
menu.roles = child.meta.roles;
|
||||
menu.permissions = child.meta.permissions;
|
||||
menu.valid = child.meta.valid;
|
||||
menus.push(menu);
|
||||
}
|
||||
});
|
||||
return menus;
|
||||
};
|
||||
return{
|
||||
//persons: getMenus('person'),
|
||||
activeIndex: '',
|
||||
ruleForm:{},
|
||||
hasJira: false,
|
||||
|
@ -89,13 +73,13 @@
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$EventBus.$on('siwtchActive', (item) => {
|
||||
this.$EventBus.$on('siwtchActive', (item) => {
|
||||
if(item){
|
||||
this.activeIndex = item
|
||||
}
|
||||
})
|
||||
this.isXpack = hasLicense();
|
||||
},
|
||||
},
|
||||
beforeDestroy(){
|
||||
this.$EventBus.$off("siwtchActive")
|
||||
},
|
||||
|
@ -170,10 +154,6 @@
|
|||
},
|
||||
updateUser(updateUserForm) {
|
||||
let param = {};
|
||||
if(!this.form.id){
|
||||
console.log(this.$refs.personFrom)
|
||||
//this.form.id = this.$refs.personFrom.form.id
|
||||
}
|
||||
Object.assign(param, this.form);
|
||||
param.platformInfo = JSON.stringify(this.form.platformInfo);
|
||||
this.result = this.$post(this.updatePath, param, response => {
|
||||
|
@ -226,9 +206,3 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-main-container {
|
||||
padding: 5px 10px;
|
||||
height: calc(100vh - 320px);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
:prop="'groups.' + index + '.type'"
|
||||
:rules="{required: true, message: $t('user.select_group'), trigger: 'change'}"
|
||||
>
|
||||
<el-select filterable v-model="group.type" :placeholder="$t('user.select_group')" :disabled="!!group.type"
|
||||
<el-select filterable v-model="group.type" :placeholder="$t('user.select_group')"
|
||||
class="edit-user-select" @change="getResource(group.type, index)">
|
||||
<el-option
|
||||
v-for="item in activeGroup(group)"
|
||||
|
@ -47,7 +47,7 @@
|
|||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
||||
>
|
||||
<el-select filterable v-model="group.ids" :placeholder="$t('workspace.select')" multiple
|
||||
class="edit-user-select">
|
||||
class="edit-user-select" @change="updateWorkSpace(group.index,group.type)">
|
||||
<el-option
|
||||
v-for="item in group.workspaces"
|
||||
:key="item.id"
|
||||
|
@ -63,7 +63,7 @@
|
|||
:rules="{required: true, message: $t('user.select_project'), trigger: 'change'}"
|
||||
>
|
||||
<el-select filterable v-model="group.ids" :placeholder="$t('user.select_project')" multiple
|
||||
class="edit-user-select" >
|
||||
class="edit-user-select" @change="setWorkSpaceIds(group.ids,group.projects)">
|
||||
<el-option
|
||||
v-for="item in group.projects"
|
||||
:key="item.id"
|
||||
|
@ -164,6 +164,8 @@ export default {
|
|||
projects: [],
|
||||
type: "Add",
|
||||
title: "创建用户",
|
||||
currentWSGroupIndex:-1,
|
||||
currentGroupWSIds:new Set,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -193,6 +195,8 @@ export default {
|
|||
this.createVisible = false;
|
||||
this.form = {groups: [{type: ''}]};
|
||||
this.btnAddRole = false;
|
||||
this.currentWSGroupIndex=-1;
|
||||
this.currentGroupWSIds=new Set;
|
||||
},
|
||||
activeGroup(roleInfo) {
|
||||
return this.userGroup.filter(function (group) {
|
||||
|
@ -310,12 +314,17 @@ export default {
|
|||
if (type === 'PROJECT') {
|
||||
for (let i = 0; i < this.form.groups.length; i++) {
|
||||
let group = this.form.groups[i];
|
||||
if (i === this.currentWSGroupIndex) {
|
||||
this.form.groups[i].ids = [];
|
||||
}
|
||||
let _type = group.type.split("+")[1];
|
||||
if (_type === 'WORKSPACE') {
|
||||
isHaveWorkspace = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (type === 'WORKSPACE') {
|
||||
isHaveWorkspace = true;
|
||||
}
|
||||
this.result = this.$get('/workspace/list/resource/' + id + "/" + type, res => {
|
||||
let data = res.data;
|
||||
|
@ -349,9 +358,17 @@ export default {
|
|||
roleInfo.selects.push(id);
|
||||
})
|
||||
roleInfo.type = "ws_member+WORKSPACE";
|
||||
roleInfo.ids = [];
|
||||
if (this.currentGroupWSIds.size > 0) {
|
||||
roleInfo.ids = [];
|
||||
this.currentGroupWSIds.forEach(item =>{
|
||||
roleInfo.ids.push(item);
|
||||
})
|
||||
} else {
|
||||
roleInfo.ids = [];
|
||||
}
|
||||
let groups = this.form.groups;
|
||||
groups.push(roleInfo);
|
||||
this.currentWSGroupIndex = index+1;
|
||||
this._setResource(data, index+1, 'WORKSPACE');
|
||||
}
|
||||
})
|
||||
|
@ -359,6 +376,28 @@ export default {
|
|||
getLabel(index) {
|
||||
let a = index + 1;
|
||||
return this.$t('commons.group') + a;
|
||||
},
|
||||
setWorkSpaceIds(ids,projects){
|
||||
projects.forEach(project => {
|
||||
ids.forEach(item =>{
|
||||
if(item === project.id){
|
||||
this.currentGroupWSIds.add(project.workspaceId);
|
||||
if(this.form.groups[this.currentWSGroupIndex].ids.indexOf(project.workspaceId) === -1){
|
||||
this.form.groups[this.currentWSGroupIndex].ids.push(project.workspaceId);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
updateWorkSpace(index,type){
|
||||
let _type = type.split("+")[1];
|
||||
if (_type === 'WORKSPACE') {
|
||||
this.currentGroupWSIds.forEach(item =>{
|
||||
this.form.groups[index].ids.push(item);
|
||||
})
|
||||
}else {
|
||||
this.form.groups[index].ids = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue