refactor: 优化项目创建相关代码

This commit is contained in:
Captain.B 2021-06-01 10:43:18 +08:00 committed by 刘瑞斌
parent 89b24fe0cc
commit 089db4d33d
30 changed files with 62 additions and 54 deletions

View File

@ -1,9 +1,7 @@
package io.metersphere.base.mapper.ext; package io.metersphere.base.mapper.ext;
import io.metersphere.api.dto.automation.ApiScenarioRequest;
import io.metersphere.base.domain.User; import io.metersphere.base.domain.User;
import io.metersphere.controller.request.UserRequest; import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.resourcepool.UserBatchProcessRequest;
import io.metersphere.notice.domain.UserDetail; import io.metersphere.notice.domain.UserDetail;
import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -29,4 +27,6 @@ public interface ExtUserMapper {
List<String> selectAllId(); List<String> selectAllId();
List<String> selectIdsByQuery(@Param("request") UserRequest request); List<String> selectIdsByQuery(@Param("request") UserRequest request);
void updateLastProjectIdIfNull(@Param("projectId") String projectId, @Param("userId") String userId);
} }

View File

@ -102,4 +102,9 @@
from user from user
<include refid="queryWhereCondition"/> <include refid="queryWhereCondition"/>
</select> </select>
<update id="updateLastProjectIdIfNull">
update user set last_project_id = #{projectId} where id = #{userId}
and (last_project_id is null or last_project_id = '')
</update>
</mapper> </mapper>

View File

@ -6,6 +6,7 @@ import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.RsaKey; import io.metersphere.commons.utils.RsaKey;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.LoginRequest; import io.metersphere.controller.request.LoginRequest;
import io.metersphere.dto.UserDTO;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.BaseDisplayService; import io.metersphere.service.BaseDisplayService;
@ -33,11 +34,13 @@ public class LoginController {
@GetMapping(value = "/isLogin") @GetMapping(value = "/isLogin")
public ResultHolder isLogin() { public ResultHolder isLogin() {
if (SecurityUtils.getSubject().isAuthenticated()) { if (SecurityUtils.getSubject().isAuthenticated()) {
SessionUser user = SessionUtils.getUser(); UserDTO user = userService.getUserDTO(SessionUtils.getUserId());
if (StringUtils.isBlank(user.getLanguage())) { if (StringUtils.isBlank(user.getLanguage())) {
user.setLanguage(LocaleContextHolder.getLocale().toString()); user.setLanguage(LocaleContextHolder.getLocale().toString());
} }
return ResultHolder.success(user); SessionUser sessionUser = SessionUser.fromUser(user);
SessionUtils.putUser(sessionUser);
return ResultHolder.success(sessionUser);
} }
return ResultHolder.error(rsaKey.getPublicKey()); return ResultHolder.error(rsaKey.getPublicKey());
} }

View File

@ -10,6 +10,7 @@ import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtOrganizationMapper; import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
import io.metersphere.base.mapper.ext.ExtProjectMapper; import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtUserGroupMapper; import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.commons.constants.UserGroupConstants; import io.metersphere.commons.constants.UserGroupConstants;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.ServiceUtils;
@ -81,6 +82,8 @@ public class ProjectService {
private ExtOrganizationMapper extOrganizationMapper; private ExtOrganizationMapper extOrganizationMapper;
@Resource @Resource
private ExtUserGroupMapper extUserGroupMapper; private ExtUserGroupMapper extUserGroupMapper;
@Resource
private ExtUserMapper extUserMapper;
public Project addProject(Project project) { public Project addProject(Project project) {
if (StringUtils.isBlank(project.getName())) { if (StringUtils.isBlank(project.getName())) {
@ -118,6 +121,9 @@ public class ProjectService {
userGroup.setSourceId(project.getId()); userGroup.setSourceId(project.getId());
userGroupMapper.insert(userGroup); userGroupMapper.insert(userGroup);
// 创建新项目检查当前用户 last_project_id
extUserMapper.updateLastProjectIdIfNull(project.getId(), SessionUtils.getUserId());
return project; return project;
} }

View File

@ -125,7 +125,6 @@
} }
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.userOptions = response.data; this.userOptions = response.data;
}); });

View File

@ -587,7 +587,6 @@ export default {
}, },
getPrincipalOptions(option) { getPrincipalOptions(option) {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
option.push(...response.data); option.push(...response.data);
this.userFilters = response.data.map(u => { this.userFilters = response.data.map(u => {

View File

@ -783,7 +783,6 @@
this.reload(); this.reload();
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -239,7 +239,6 @@
this.httpForm.request = createComponent("DubboSampler"); this.httpForm.request = createComponent("DubboSampler");
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -406,7 +406,6 @@
} }
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.valueArr.userId = response.data; this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => { this.userFilters = response.data.map(u => {

View File

@ -116,7 +116,6 @@
this.$emit("createRootModel"); this.$emit("createRootModel");
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -178,7 +178,6 @@
this.httpForm.request = createComponent("DubboSampler"); this.httpForm.request = createComponent("DubboSampler");
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -107,7 +107,6 @@
}, },
methods: { methods: {
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -246,7 +246,6 @@
}); });
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -133,7 +133,6 @@
}, },
methods: { methods: {
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -559,7 +559,6 @@ export default {
} }
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.valueArr.userId = response.data; this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => { this.userFilters = response.data.map(u => {

View File

@ -129,7 +129,6 @@ export default {
let workspace = data.filter(r => r.id === this.currentUser.lastWorkspaceId); let workspace = data.filter(r => r.id === this.currentUser.lastWorkspaceId);
if (workspace.length > 0) { if (workspace.length > 0) {
this.currentWorkspaceName = workspace[0].name; this.currentWorkspaceName = workspace[0].name;
localStorage.setItem(WORKSPACE_ID, workspace[0].id);
} }
} }
}); });

View File

@ -241,11 +241,12 @@ export default {
this.$post("/workspace/" + saveType, this.form, () => { this.$post("/workspace/" + saveType, this.form, () => {
this.dialogWsAddVisible = false; this.dialogWsAddVisible = false;
this.dialogWsUpdateVisible = false; this.dialogWsUpdateVisible = false;
this.list();
if (saveType == 'add') { if (saveType == 'add') {
Message.success(this.$t('commons.save_success')); Message.success(this.$t('commons.save_success'));
window.location.reload();
} else if (saveType == 'update') { } else if (saveType == 'update') {
Message.success(this.$t('commons.modify_success')); Message.success(this.$t('commons.modify_success'));
this.list();
} }
}); });
} else { } else {

View File

@ -134,7 +134,8 @@
</template> </template>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" :visible.sync="memberVisible" width="70%" :destroy-on-close="true" @close="close" <el-dialog :close-on-click-modal="false" :visible.sync="memberVisible" width="70%" :destroy-on-close="true"
@close="close"
class="dialog-css"> class="dialog-css">
<div style="height: 60vh;overflow: auto"> <div style="height: 60vh;overflow: auto">
<ms-table-header :condition.sync="dialogCondition" @create="open" @search="list" :have-search="false" <ms-table-header :condition.sync="dialogCondition" @create="open" @search="list" :have-search="false"
@ -164,7 +165,8 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" <el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="updateVisible" width="30%"
:destroy-on-close="true"
@close="handleClose"> @close="handleClose">
<el-form :model="form" label-position="right" label-width="100px" size="small" ref="updateUserForm"> <el-form :model="form" label-position="right" label-width="100px" size="small" ref="updateUserForm">
<el-form-item label="ID" prop="id"> <el-form-item label="ID" prop="id">
@ -198,10 +200,12 @@
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" title="添加成员" :visible.sync="dialogMemberVisible" width="30%" :destroy-on-close="true" <el-dialog :close-on-click-modal="false" title="添加成员" :visible.sync="dialogMemberVisible" width="30%"
:destroy-on-close="true"
@close="handleMemberClose"> @close="handleMemberClose">
<el-form :model="memberForm" ref="form" :rules="rules" label-position="right" label-width="100px" size="small"> <el-form :model="memberForm" ref="form" :rules="rules" label-position="right" label-width="100px" size="small">
<el-form-item :label="$t('commons.member')" prop="memberSign" :rules="{required: true, message: $t('member.input_id_or_email'), trigger: 'change'}"> <el-form-item :label="$t('commons.member')" prop="memberSign"
:rules="{required: true, message: $t('member.input_id_or_email'), trigger: 'change'}">
<el-autocomplete <el-autocomplete
class="input-with-autocomplete" class="input-with-autocomplete"
v-model="memberForm.memberSign" v-model="memberForm.memberSign"
@ -214,8 +218,8 @@
style="width: 100%" style="width: 100%"
> >
<template v-slot:default="scope"> <template v-slot:default="scope">
<span class="workspace-member-name">{{scope.item.id}}</span> <span class="workspace-member-name">{{ scope.item.id }}</span>
<span class="workspace-member-email">{{scope.item.email}}</span> <span class="workspace-member-email">{{ scope.item.email }}</span>
</template> </template>
</el-autocomplete> </el-autocomplete>
</el-form-item> </el-form-item>
@ -290,7 +294,7 @@ export default {
ApiEnvironmentConfig, ApiEnvironmentConfig,
MsTableOperatorButton, MsTableOperatorButton,
MsDeleteConfirm, MsDeleteConfirm,
MsMainContainer,MsRolesTag, MsMainContainer, MsRolesTag,
MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter
}, },
data() { data() {
@ -424,8 +428,12 @@ export default {
this.form.protocal = protocol; this.form.protocal = protocol;
this.result = this.$post("/project/" + saveType, this.form, () => { this.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false; this.createVisible = false;
this.list();
Message.success(this.$t('commons.save_success')); Message.success(this.$t('commons.save_success'));
if (saveType === 'add') {
window.location.reload();
} else {
this.list();
}
}); });
} else { } else {
return false; return false;
@ -481,12 +489,12 @@ export default {
let param = { let param = {
name: '', name: '',
workspaceId: this.items[i].id workspaceId: this.items[i].id
} };
let path = "user/ws/member/list/all"; let path = "user/ws/member/list/all";
this.$post(path, param, res => { this.$post(path, param, res => {
let member = res.data; let member = res.data;
this.$set(this.items[i], "memberSize", member.length); this.$set(this.items[i], "memberSize", member.length);
}) });
} }
this.total = data.itemCount; this.total = data.itemCount;
}); });
@ -525,7 +533,7 @@ export default {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => { this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let groups = response.data; let groups = response.data;
this.$set(this.memberLineData[i], "groups", groups); this.$set(this.memberLineData[i], "groups", groups);
}) });
} }
this.dialogTotal = data.itemCount; this.dialogTotal = data.itemCount;
}); });
@ -548,7 +556,7 @@ export default {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => { this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let groups = response.data; let groups = response.data;
this.$set(this.memberLineData[i], "groups", groups); this.$set(this.memberLineData[i], "groups", groups);
}) });
} }
this.dialogTotal = data.itemCount; this.dialogTotal = data.itemCount;
}); });
@ -559,7 +567,7 @@ export default {
let groupIds = this.form.groups.map(r => r.id); let groupIds = this.form.groups.map(r => r.id);
this.result = this.$post('/user/group/list', {type: GROUP_PROJECT, resourceId: this.projectId}, response => { this.result = this.$post('/user/group/list', {type: GROUP_PROJECT, resourceId: this.projectId}, response => {
this.$set(this.form, "allgroups", response.data); this.$set(this.form, "allgroups", response.data);
}) });
// 使 // 使
this.$set(this.form, 'groupIds', groupIds); this.$set(this.form, 'groupIds', groupIds);
}, },
@ -569,7 +577,7 @@ export default {
cancelButtonText: this.$t('commons.cancel'), cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.result = this.$get('/user/project/member/delete/' + this.currentProjectId + '/' + encodeURIComponent(row.id),() => { this.result = this.$get('/user/project/member/delete/' + this.currentProjectId + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success')); this.$success(this.$t('commons.remove_success'));
this.dialogSearch(); this.dialogSearch();
}); });
@ -590,7 +598,7 @@ export default {
phone: this.form.phone, phone: this.form.phone,
groupIds: this.form.groupIds, groupIds: this.form.groupIds,
projectId: this.currentProjectId projectId: this.currentProjectId
} };
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
this.result = this.$post("/project/member/update", param, () => { this.result = this.$post("/project/member/update", param, () => {
@ -606,7 +614,7 @@ export default {
if (valid) { if (valid) {
let userIds = []; let userIds = [];
let userId = this.memberForm.userId; let userId = this.memberForm.userId;
let email = this.memberForm.memberSign; let email = this.memberForm.memberSign;
let member = this.userList.find(user => user.id === email || user.email === email); let member = this.userList.find(user => user.id === email || user.email === email);
if (!member) { if (!member) {
this.$warning(this.$t('member.no_such_user')); this.$warning(this.$t('member.no_such_user'));
@ -624,7 +632,7 @@ export default {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.dialogSearch(); this.dialogSearch();
this.dialogMemberVisible = false; this.dialogMemberVisible = false;
}) });
} }
}); });
}, },
@ -632,10 +640,13 @@ export default {
this.$get('/user/list/', response => { this.$get('/user/list/', response => {
this.dialogMemberVisible = true; this.dialogMemberVisible = true;
this.userList = response.data; this.userList = response.data;
}) });
this.result = this.$post('/user/group/list', {type: GROUP_PROJECT, resourceId: this.currentProjectId}, response => { this.result = this.$post('/user/group/list', {
type: GROUP_PROJECT,
resourceId: this.currentProjectId
}, response => {
this.$set(this.memberForm, "groups", response.data); this.$set(this.memberForm, "groups", response.data);
}) });
}, },
handleMemberClose() { handleMemberClose() {
this.dialogMemberVisible = false; this.dialogMemberVisible = false;

View File

@ -22,6 +22,7 @@
import TestcaseTemplateItem from "../../../track/plan/view/comonents/report/TestcaseTemplateItem"; import TestcaseTemplateItem from "../../../track/plan/view/comonents/report/TestcaseTemplateItem";
import {WORKSPACE_ID} from '../../../../../common/js/constants'; import {WORKSPACE_ID} from '../../../../../common/js/constants';
import MsMainContainer from "../../../common/components/MsMainContainer"; import MsMainContainer from "../../../common/components/MsMainContainer";
import {getCurrentWorkspaceId} from "@/common/js/utils";
export default { export default {
name: "TestCaseReportTemplate", name: "TestCaseReportTemplate",
@ -45,7 +46,7 @@
}, },
methods: { methods: {
initData() { initData() {
this.condition.workspaceId = localStorage.getItem(WORKSPACE_ID); this.condition.workspaceId = getCurrentWorkspaceId();
this.result = this.$post('/case/report/template/list', this.condition, response => { this.result = this.$post('/case/report/template/list', this.condition, response => {
this.templates = response.data; this.templates = response.data;
}); });

View File

@ -151,7 +151,6 @@ export default {
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.userOptions = response.data; this.userOptions = response.data;
}); });

View File

@ -702,7 +702,6 @@
this.form.testId = ''; this.form.testId = '';
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.maintainerOptions = response.data; this.maintainerOptions = response.data;
}); });

View File

@ -655,7 +655,6 @@ export default {
this.$refs.testBatchMove.open(this.treeNodes, Array.from(this.selectRows).map(row => row.id), this.moduleOptions); this.$refs.testBatchMove.open(this.treeNodes, Array.from(this.selectRows).map(row => row.id), this.moduleOptions);
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.valueArr.maintainer = response.data; this.valueArr.maintainer = response.data;
}); });

View File

@ -125,7 +125,7 @@
import {WORKSPACE_ID} from '@/common/js/constants'; import {WORKSPACE_ID} from '@/common/js/constants';
import TestPlanStatusButton from "../common/TestPlanStatusButton"; import TestPlanStatusButton from "../common/TestPlanStatusButton";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {getCurrentProjectID, getCurrentWorkspaceId, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
export default { export default {
@ -196,7 +196,7 @@ export default {
this.$warning(this.$t('test_track.plan.input_plan_name')); this.$warning(this.$t('test_track.plan.input_plan_name'));
return; return;
} }
param.workspaceId = localStorage.getItem(WORKSPACE_ID); param.workspaceId = getCurrentWorkspaceId();
if (this.form.tags instanceof Array) { if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags); this.form.tags = JSON.stringify(this.form.tags);
} }
@ -221,7 +221,7 @@ export default {
this.$warning(this.$t('test_track.plan.input_plan_name')); this.$warning(this.$t('test_track.plan.input_plan_name'));
return; return;
} }
param.workspaceId = localStorage.getItem(WORKSPACE_ID); param.workspaceId = getCurrentWorkspaceId();
if (this.form.tags instanceof Array) { if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags); this.form.tags = JSON.stringify(this.form.tags);
} }
@ -248,7 +248,6 @@ export default {
return true; return true;
}, },
setPrincipalOptions() { setPrincipalOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.principalOptions = response.data; this.principalOptions = response.data;
}); });

View File

@ -39,7 +39,6 @@
}, },
methods: { methods: {
setMaintainerOptions() { setMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.executorOptions = response.data; this.executorOptions = response.data;
}); });

View File

@ -16,6 +16,7 @@
<script> <script>
import TestcaseTemplateItem from "./report/TestcaseTemplateItem"; import TestcaseTemplateItem from "./report/TestcaseTemplateItem";
import {WORKSPACE_ID} from "../../../../../../common/js/constants"; import {WORKSPACE_ID} from "../../../../../../common/js/constants";
import {getCurrentWorkspaceId} from "@/common/js/utils";
export default { export default {
name: "TestReportTemplateList", name: "TestReportTemplateList",
components: {TestcaseTemplateItem}, components: {TestcaseTemplateItem},
@ -30,7 +31,7 @@
initData() { initData() {
let condition = {}; let condition = {};
condition.queryDefault = true; condition.queryDefault = true;
condition.workspaceId = localStorage.getItem(WORKSPACE_ID); condition.workspaceId = getCurrentWorkspaceId();
this.result = this.$post('/case/report/template/list', condition, response => { this.result = this.$post('/case/report/template/list', condition, response => {
this.templates = response.data; this.templates = response.data;
}); });

View File

@ -350,7 +350,6 @@ export default {
this.$refs.headerCustom.open(list); this.$refs.headerCustom.open(list);
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.valueArr.userId = response.data; this.valueArr.userId = response.data;
this.userFilters = response.data.map(u => { this.userFilters = response.data.map(u => {

View File

@ -681,7 +681,6 @@ export default {
this.$refs.batchEdit.open(); this.$refs.batchEdit.open();
}, },
getMaintainerOptions() { getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => {
this.valueArr.executor = response.data; this.valueArr.executor = response.data;
this.executorFilters = response.data.map(u => { this.executorFilters = response.data.map(u => {

View File

@ -54,7 +54,7 @@
import TemplateComponentBar from "./TemplateComponentBar"; import TemplateComponentBar from "./TemplateComponentBar";
import TemplateComponentEditHeader from "./TemplateComponentEditHeader"; import TemplateComponentEditHeader from "./TemplateComponentEditHeader";
import {WORKSPACE_ID} from '../../../../../../../common/js/constants'; import {WORKSPACE_ID} from '../../../../../../../common/js/constants';
import {jsonToMap, mapToJson} from "../../../../../../../common/js/utils"; import {getCurrentWorkspaceId, jsonToMap, mapToJson} from "../../../../../../../common/js/utils";
import TemplateComponent from "./TemplateComponent/TemplateComponent"; import TemplateComponent from "./TemplateComponent/TemplateComponent";
export default { export default {
@ -262,10 +262,10 @@
if (this.type == 'edit') { if (this.type == 'edit') {
param.id = this.template.id; param.id = this.template.id;
} else { } else {
param.workspaceId = localStorage.getItem(WORKSPACE_ID); param.workspaceId = getCurrentWorkspaceId();
} }
if (this.template.workspaceId) { if (this.template.workspaceId) {
param.workspaceId = localStorage.getItem(WORKSPACE_ID); param.workspaceId = getCurrentWorkspaceId();
} }
if (this.metric && this.metric.startTime) { if (this.metric && this.metric.startTime) {
param.startTime = this.metric.startTime.getTime(); param.startTime = this.metric.startTime.getTime();

View File

@ -232,7 +232,6 @@ export default {
}); });
}, },
setReviewerOptions() { setReviewerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.result = this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => { this.result = this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()},response => {
this.reviewerOptions = response.data; this.reviewerOptions = response.data;
}); });

@ -1 +1 @@
Subproject commit 526400764fc45b12dd81f5b89137f8bc5a012f4d Subproject commit 1ac463ed7ef667d3f75c3ba64fab8331ecaa02c2