refactor: 用户下拉框选项显示id和邮箱

This commit is contained in:
chenjianxing 2022-05-17 11:51:24 +08:00 committed by f2c-ci-robot[bot]
parent 466163b0f9
commit f1840643a8
10 changed files with 43 additions and 18 deletions

View File

@ -30,4 +30,6 @@ public interface ExtUserGroupMapper {
int checkSourceRole(@Param("sourceId") String sourceId, @Param("userId") String userId, @Param("groupId") String groupId);
List<UserGroupInfoDTO> getUserGroupInfo();
List<User> getProjectMemberOption(@Param("projectId") String projectId);
}

View File

@ -80,5 +80,11 @@
INNER JOIN `group` g ON ug.group_id = g.id
order by ug.create_time ASC;
</select>
<select id="getProjectMemberOption" resultType="io.metersphere.base.domain.User">
SELECT DISTINCT * FROM (
SELECT u.id, u.name, u.email FROM user_group JOIN `user` u ON user_group.user_id = u.id
WHERE user_group.source_id = #{projectId}
order by user_group.update_time desc
) temp
</select>
</mapper>

View File

@ -147,6 +147,11 @@ public class UserController {
return userService.getProjectMemberList(request);
}
@GetMapping("/project/member/option/{projectId}")
public List<User> getProjectMemberOption(@PathVariable String projectId) {
return userService.getProjectMemberOption(projectId);
}
/**
* 获取工作空间成员用户 不分页
*/

View File

@ -1405,4 +1405,8 @@ public class UserService {
}
return "ok";
}
public List<User> getProjectMemberOption(String projectId) {
return extUserGroupMapper.getProjectMemberOption(projectId);
}
}

View File

@ -30,7 +30,7 @@
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.name + ' (' + item.id + ')'"
:label="item.name + ' (' + item.email + ')'"
:value="item.id">
</el-option>
</el-select>
@ -60,7 +60,7 @@
import {API_STATUS} from "../../model/JsonData";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
import {getCurrentProjectID} from "@/common/js/utils";
import {getProjectMemberOption} from "@/network/user";
export default {
name: "MsBasisApi",
@ -163,8 +163,8 @@
}
},
getMaintainerOptions() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data;
getProjectMemberOption(data => {
this.maintainerOptions = data;
});
},
reload() {

View File

@ -61,7 +61,7 @@
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.name + ' (' + item.id + ')'"
:label="item.name + ' (' + item.email + ')'"
:value="item.id">
</el-option>
</el-select>
@ -201,6 +201,7 @@ import HttpApiVersionDiff from "./version/HttpApiVersionDiff";
import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {getProjectMemberOption} from "@/network/user";
const {Body} = require("@/business/components/api/definition/model/ApiTestModel");
const Sampler = require("@/business/components/api/definition/components/jmeter/components/sampler/sampler");
@ -443,8 +444,8 @@ export default {
});
},
getMaintainerOptions() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data;
getProjectMemberOption(data => {
this.maintainerOptions = data;
});
},
setParameter() {

View File

@ -37,7 +37,7 @@
<el-option
v-for="item in maintainerOptions"
:key="item.id"
:label="item.name + ' (' + item.id + ')'"
:label="item.name + ' (' + item.email + ')'"
:value="item.id">
</el-option>
</el-select>
@ -65,10 +65,9 @@
<script>
import {API_STATUS} from "../../model/JsonData";
import {WORKSPACE_ID} from '../../../../../../common/js/constants';
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
import {getCurrentProjectID} from "@/common/js/utils";
import {getProjectMemberOption} from "@/network/user";
export default {
name: "MsTcpBasicApi",
@ -182,8 +181,8 @@
}
},
getMaintainerOptions() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data;
getProjectMemberOption(data => {
this.maintainerOptions = data;
});
},
reload() {

View File

@ -87,7 +87,7 @@
<el-option
v-for="(item) in memberOptions"
:key="item.id"
:label="item.name + ' (' + item.id + ')'"
:label="item.name + ' (' + item.email + ')'"
:value="item.id">
</el-option>
</el-select>
@ -115,6 +115,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import {getCurrentProjectID} from "@/common/js/utils";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
import MsMarkDownText from "@/business/components/track/case/components/MsMarkDownText";
import {getProjectMemberOption} from "@/network/user";
export default {
name: "CustomFiledComponent",
@ -131,8 +132,8 @@ export default {
};
},
mounted() {
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.memberOptions = response.data;
getProjectMemberOption((data) => {
this.memberOptions = data;
});
},
methods: {

View File

@ -1,6 +1,6 @@
<template>
<div>
<span class="user-select-left">{{ user.name }} ({{ user.id }})</span>
<span class="user-select-left">{{ user.name }} ({{ user.email }})</span>
<span class="user-select-right">{{ user.email }}</span>
</div>
</template>

View File

@ -2,6 +2,7 @@ import {getCurrentProjectID} from "@/common/js/utils";
import {post} from "@/common/js/ajax";
import axios from "axios";
import {ORGANIZATION_ID, PROJECT_ID, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
import {baseGet} from "@/network/base-network";
export function getProjectMember(callBack) {
return new Promise((resolve) => {
@ -33,3 +34,9 @@ export function logout() {
window.location.href = "/login";
});
}
let baseUrl = '/user/';
export function getProjectMemberOption(callback) {
return baseGet(baseUrl + 'project/member/option/' + getCurrentProjectID(), callback);
}