fix(系统设置): 系统级别用户组所属工作空间展示问题

--bug=1032890 --user=宋昌昌 [系统设置]github#27552创建用户组页面字段含义和选项值存在差异 https://www.tapd.cn/55049933/s/1436627
This commit is contained in:
song-cc-rock 2023-11-15 11:11:53 +08:00 committed by 刘瑞斌
parent b42d9a1399
commit dc6a1f095e
2 changed files with 18 additions and 20 deletions

View File

@ -58,6 +58,6 @@ export function getFieldTemplateApiOption(projectId) {
return get(projectId ? `/project/field/template/api/option/${projectId}` : `/project/field/template/api/option`);
}
export function getproject() {
export function getProject() {
return get('/project/list');
}

View File

@ -42,9 +42,9 @@
<script>
import {GROUP_SYSTEM} from "metersphere-frontend/src/utils/constants";
import {createUserGroup, modifyUserGroup} from "../../../api/user-group";
import {getWorkspaces} from "../../../api/workspace";
import {getproject} from "../../../api/project";
import {createUserGroup, modifyUserGroup} from "@/api/user-group";
import {getWorkspaces} from "@/api/workspace";
import {getProject} from "@/api/project";
export default {
name: "EditUserGroup",
@ -122,11 +122,11 @@ export default {
},
open(row, type, title) {
this.workspaces = [];
this.initWorkspace(row.scopeId);
this.showLabel = '';
this.title = title;
this.isSystem = false;
this.show = true;
this.dialogVisible = true;
this.dialogType = type;
this.form = Object.assign({}, row);
if (type !== 'create') {
@ -138,10 +138,7 @@ export default {
this.show = !this.form.global;
}
}
this.getWorkspace();
if(type === 'edit'){
this.getproject();
}
this.dialogVisible = true;
},
cancel() {
this.dialogVisible = false;
@ -158,28 +155,29 @@ export default {
this.isSystem = false;
}
},
getWorkspace() {
initWorkspace(scopeId) {
//
getWorkspaces().then(res => {
let data = res.data;
if (data) {
this.workspaces = data;
let name = this.workspaces.find(item => item.id === this.form.scopeId)
if (name) {
let workspace = this.workspaces.find(item => item.id === scopeId);
if (workspace) {
//
this.showLabel = this.$t('project.owning_workspace');
} else {
//
this.showLabel = this.$t('project.owning_project');
getProject().then(res => {
let data = res.data;
if (data) {
this.workspaces = data;
}
})
}
}
})
},
getproject() {
getproject().then(res => {
let data = res.data;
if (data) {
this.workspaces = this.workspaces.concat(data);
}
})
}
}
}
</script>