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`); return get(projectId ? `/project/field/template/api/option/${projectId}` : `/project/field/template/api/option`);
} }
export function getproject() { export function getProject() {
return get('/project/list'); return get('/project/list');
} }

View File

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