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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Setting from "@/business/components/settings/router";
|
|
||||||
import MsPersonFromSetting from "@/business/components/settings/personal/PersonFromSetting";
|
import MsPersonFromSetting from "@/business/components/settings/personal/PersonFromSetting";
|
||||||
import MsApiKeys from "@/business/components/settings/personal/ApiKeys";
|
import MsApiKeys from "@/business/components/settings/personal/ApiKeys";
|
||||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||||
|
@ -41,7 +40,7 @@
|
||||||
import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo";
|
import JiraUserInfo from "@/business/components/settings/personal/JiraUserInfo";
|
||||||
import AzureDevopsUserInfo from "@/business/components/settings/personal/AzureDevopsUserInfo";
|
import AzureDevopsUserInfo from "@/business/components/settings/personal/AzureDevopsUserInfo";
|
||||||
import {getIntegrationService} from "@/network/organization";
|
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 {
|
export default {
|
||||||
name: "MsPersonRouter",
|
name: "MsPersonRouter",
|
||||||
|
@ -50,22 +49,7 @@
|
||||||
'reload',
|
'reload',
|
||||||
],
|
],
|
||||||
data(){
|
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{
|
return{
|
||||||
//persons: getMenus('person'),
|
|
||||||
activeIndex: '',
|
activeIndex: '',
|
||||||
ruleForm:{},
|
ruleForm:{},
|
||||||
hasJira: false,
|
hasJira: false,
|
||||||
|
@ -170,10 +154,6 @@
|
||||||
},
|
},
|
||||||
updateUser(updateUserForm) {
|
updateUser(updateUserForm) {
|
||||||
let param = {};
|
let param = {};
|
||||||
if(!this.form.id){
|
|
||||||
console.log(this.$refs.personFrom)
|
|
||||||
//this.form.id = this.$refs.personFrom.form.id
|
|
||||||
}
|
|
||||||
Object.assign(param, this.form);
|
Object.assign(param, this.form);
|
||||||
param.platformInfo = JSON.stringify(this.form.platformInfo);
|
param.platformInfo = JSON.stringify(this.form.platformInfo);
|
||||||
this.result = this.$post(this.updatePath, param, response => {
|
this.result = this.$post(this.updatePath, param, response => {
|
||||||
|
@ -226,9 +206,3 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.ms-main-container {
|
|
||||||
padding: 5px 10px;
|
|
||||||
height: calc(100vh - 320px);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
:prop="'groups.' + index + '.type'"
|
:prop="'groups.' + index + '.type'"
|
||||||
:rules="{required: true, message: $t('user.select_group'), trigger: 'change'}"
|
: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)">
|
class="edit-user-select" @change="getResource(group.type, index)">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in activeGroup(group)"
|
v-for="item in activeGroup(group)"
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
||||||
>
|
>
|
||||||
<el-select filterable v-model="group.ids" :placeholder="$t('workspace.select')" multiple
|
<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
|
<el-option
|
||||||
v-for="item in group.workspaces"
|
v-for="item in group.workspaces"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
:rules="{required: true, message: $t('user.select_project'), trigger: 'change'}"
|
:rules="{required: true, message: $t('user.select_project'), trigger: 'change'}"
|
||||||
>
|
>
|
||||||
<el-select filterable v-model="group.ids" :placeholder="$t('user.select_project')" multiple
|
<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
|
<el-option
|
||||||
v-for="item in group.projects"
|
v-for="item in group.projects"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -164,6 +164,8 @@ export default {
|
||||||
projects: [],
|
projects: [],
|
||||||
type: "Add",
|
type: "Add",
|
||||||
title: "创建用户",
|
title: "创建用户",
|
||||||
|
currentWSGroupIndex:-1,
|
||||||
|
currentGroupWSIds:new Set,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -193,6 +195,8 @@ export default {
|
||||||
this.createVisible = false;
|
this.createVisible = false;
|
||||||
this.form = {groups: [{type: ''}]};
|
this.form = {groups: [{type: ''}]};
|
||||||
this.btnAddRole = false;
|
this.btnAddRole = false;
|
||||||
|
this.currentWSGroupIndex=-1;
|
||||||
|
this.currentGroupWSIds=new Set;
|
||||||
},
|
},
|
||||||
activeGroup(roleInfo) {
|
activeGroup(roleInfo) {
|
||||||
return this.userGroup.filter(function (group) {
|
return this.userGroup.filter(function (group) {
|
||||||
|
@ -310,12 +314,17 @@ export default {
|
||||||
if (type === 'PROJECT') {
|
if (type === 'PROJECT') {
|
||||||
for (let i = 0; i < this.form.groups.length; i++) {
|
for (let i = 0; i < this.form.groups.length; i++) {
|
||||||
let group = this.form.groups[i];
|
let group = this.form.groups[i];
|
||||||
|
if (i === this.currentWSGroupIndex) {
|
||||||
|
this.form.groups[i].ids = [];
|
||||||
|
}
|
||||||
let _type = group.type.split("+")[1];
|
let _type = group.type.split("+")[1];
|
||||||
if (_type === 'WORKSPACE') {
|
if (_type === 'WORKSPACE') {
|
||||||
isHaveWorkspace = true;
|
isHaveWorkspace = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (type === 'WORKSPACE') {
|
||||||
|
isHaveWorkspace = true;
|
||||||
}
|
}
|
||||||
this.result = this.$get('/workspace/list/resource/' + id + "/" + type, res => {
|
this.result = this.$get('/workspace/list/resource/' + id + "/" + type, res => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
|
@ -349,9 +358,17 @@ export default {
|
||||||
roleInfo.selects.push(id);
|
roleInfo.selects.push(id);
|
||||||
})
|
})
|
||||||
roleInfo.type = "ws_member+WORKSPACE";
|
roleInfo.type = "ws_member+WORKSPACE";
|
||||||
|
if (this.currentGroupWSIds.size > 0) {
|
||||||
roleInfo.ids = [];
|
roleInfo.ids = [];
|
||||||
|
this.currentGroupWSIds.forEach(item =>{
|
||||||
|
roleInfo.ids.push(item);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
roleInfo.ids = [];
|
||||||
|
}
|
||||||
let groups = this.form.groups;
|
let groups = this.form.groups;
|
||||||
groups.push(roleInfo);
|
groups.push(roleInfo);
|
||||||
|
this.currentWSGroupIndex = index+1;
|
||||||
this._setResource(data, index+1, 'WORKSPACE');
|
this._setResource(data, index+1, 'WORKSPACE');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -359,6 +376,28 @@ export default {
|
||||||
getLabel(index) {
|
getLabel(index) {
|
||||||
let a = index + 1;
|
let a = index + 1;
|
||||||
return this.$t('commons.group') + a;
|
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