mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 13:09:28 +08:00
Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
db0fa8a810
@ -12,7 +12,7 @@ public interface ExtTestCaseReviewMapper {
|
||||
|
||||
List<TestCaseReviewDTO> list(@Param("request") QueryCaseReviewRequest params);
|
||||
|
||||
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId, @Param("userId") String userId);
|
||||
List<TestCaseReviewDTO> listByWorkspaceId(@Param("workspaceId") String workspaceId, @Param("userId") String userId, @Param("projectId") String projectId);
|
||||
|
||||
List<TestReviewDTOWithMetric> listRelate(@Param("request") QueryTestReviewRequest request);
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
and test_case_review.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
and project.workspace_id = #{request.workspaceId}
|
||||
<if test="request.projectId != null">
|
||||
and test_case_review_project.project_id = #{request.projectId}
|
||||
</if>
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
@ -32,6 +35,9 @@
|
||||
test_case_review.id = test_case_review_project.review_id
|
||||
and test_case_review_project.project_id = project.id
|
||||
and project.workspace_id = #{workspaceId}
|
||||
<if test="projectId != null">
|
||||
and test_case_review_project.project_id = #{projectId}
|
||||
</if>
|
||||
and (
|
||||
(test_case_review_users.review_id = test_case_review.id
|
||||
and test_case_review_users.user_id = #{userId} )
|
||||
@ -51,6 +57,9 @@
|
||||
<if test="request.reviewerId != null">
|
||||
and test_case_review_users.user_id = #{request.reviewerId}
|
||||
</if>
|
||||
<if test="request.projectId != null">
|
||||
and test_case_review_project.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.creator != null">
|
||||
and (test_case_review.creator = #{request.creator}
|
||||
<if test="request.reviewIds != null and request.reviewIds.size() > 0">
|
||||
|
@ -114,6 +114,9 @@
|
||||
<if test="request.workspaceId != null">
|
||||
AND test_plan.workspace_id = #{request.workspaceId}
|
||||
</if>
|
||||
<if test="request.projectId != null">
|
||||
AND test_plan_project.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.id != null">
|
||||
AND test_plan.id = #{request.id}
|
||||
</if>
|
||||
@ -160,16 +163,22 @@
|
||||
</select>
|
||||
|
||||
<select id="listRelate" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric">
|
||||
select test_plan.* from test_plan
|
||||
where test_plan.workspace_id = #{request.workspaceId}
|
||||
and (test_plan.principal = #{request.principal}
|
||||
<if test="request.planIds != null and request.planIds.size() > 0">
|
||||
or test_plan.id in
|
||||
<foreach collection="request.planIds" item="planId" open="(" close=")" separator=",">
|
||||
#{planId}
|
||||
</foreach>
|
||||
</if>
|
||||
)
|
||||
select distinct test_plan.* from test_plan
|
||||
inner join test_plan_project on test_plan.id = test_plan_project.test_plan_id
|
||||
<where>
|
||||
test_plan.workspace_id = #{request.workspaceId}
|
||||
<if test="request.projectId != null">
|
||||
and test_plan_project.project_id = #{request.projectId}
|
||||
</if>
|
||||
and (test_plan.principal = #{request.principal}
|
||||
<if test="request.planIds != null and request.planIds.size() > 0">
|
||||
or test_plan.id in
|
||||
<foreach collection="request.planIds" item="planId" open="(" close=")" separator=",">
|
||||
#{planId}
|
||||
</foreach>
|
||||
</if>
|
||||
)
|
||||
</where>
|
||||
order by test_plan.update_time desc
|
||||
</select>
|
||||
|
||||
|
@ -19,7 +19,7 @@ public interface ExtTestPlanTestCaseMapper {
|
||||
|
||||
List<TestPlanCaseDTO> listByNodes(@Param("request") QueryTestPlanCaseRequest request);
|
||||
|
||||
List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
|
||||
List<String> findRelateTestPlanId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
|
||||
|
||||
List<TestPlanCaseDTO> getRecentTestedTestCase(@Param("request") QueryTestPlanCaseRequest request);
|
||||
|
||||
|
@ -270,8 +270,15 @@
|
||||
select distinct plan_id from test_plan_test_case
|
||||
inner join test_plan
|
||||
on test_plan_test_case.plan_id = test_plan.id
|
||||
where test_plan_test_case.executor = #{userId}
|
||||
and test_plan.workspace_id = #{workspaceId}
|
||||
inner join test_plan_project
|
||||
on test_plan.id = test_plan_project.test_plan_id
|
||||
<where>
|
||||
test_plan_test_case.executor = #{userId}
|
||||
and test_plan.workspace_id = #{workspaceId}
|
||||
<if test="projectId != null">
|
||||
and test_plan_project.project_id = #{projectId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getRecentTestedTestCase" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||
select test_plan_test_case.*, test_case.*
|
||||
|
@ -11,7 +11,7 @@ public interface ExtTestReviewCaseMapper {
|
||||
|
||||
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
|
||||
List<String> getStatusByReviewId(String reviewId);
|
||||
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId);
|
||||
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
|
||||
|
||||
/**
|
||||
* 根据项目 ids 查询 TestReviewCaseDTO 列表
|
||||
|
@ -206,6 +206,7 @@
|
||||
inner join project on project.id = test_case_review_project.project_id
|
||||
where test_case_review_test_case.review_id = #{userId}
|
||||
and project.workspace_id = #{workspaceId}
|
||||
and test_case_review_project.project_id = #{projectId}
|
||||
</select>
|
||||
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
|
||||
select distinct * from test_case_review_test_case, test_case
|
||||
|
@ -68,4 +68,8 @@ public class SessionUtils {
|
||||
public static String getCurrentOrganizationId() {
|
||||
return Optional.ofNullable(getUser()).orElse(new SessionUser()).getLastOrganizationId();
|
||||
}
|
||||
|
||||
public static String getCurrentProjectId() {
|
||||
return Optional.ofNullable(getUser()).orElse(new SessionUser()).getLastProjectId();
|
||||
}
|
||||
}
|
||||
|
@ -81,8 +81,7 @@ public class TestCaseReviewController {
|
||||
|
||||
@PostMapping("/list/all")
|
||||
public List<TestCaseReview> listAll() {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
return testCaseReviewService.listCaseReviewAll(currentWorkspaceId);
|
||||
return testCaseReviewService.listCaseReviewAll();
|
||||
}
|
||||
|
||||
@PostMapping("/relevance")
|
||||
|
@ -35,4 +35,6 @@ public class QueryCaseReviewRequest extends TestCaseReviewTestCase {
|
||||
private String method;
|
||||
|
||||
private Map<String, Object> combine;
|
||||
|
||||
private String projectId;
|
||||
}
|
||||
|
@ -156,6 +156,7 @@ public class TestCaseReviewService {
|
||||
|
||||
public List<TestCaseReviewDTO> listCaseReview(QueryCaseReviewRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extTestCaseReviewMapper.list(request);
|
||||
}
|
||||
|
||||
@ -198,7 +199,7 @@ public class TestCaseReviewService {
|
||||
}
|
||||
|
||||
public List<TestCaseReviewDTO> recent(String currentWorkspaceId) {
|
||||
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId());
|
||||
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId());
|
||||
}
|
||||
|
||||
public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
|
||||
@ -346,21 +347,16 @@ public class TestCaseReviewService {
|
||||
testCaseReviewTestCaseMapper.deleteByExample(testCaseReviewTestCaseExample);
|
||||
}
|
||||
|
||||
public List<TestCaseReview> listCaseReviewAll(String currentWorkspaceId) {
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
|
||||
List<Project> projects = projectMapper.selectByExample(projectExample);
|
||||
List<String> projectIds = projects.stream().map(Project::getId).collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
TestCaseReviewProjectExample testCaseReviewProjectExample = new TestCaseReviewProjectExample();
|
||||
testCaseReviewProjectExample.createCriteria().andProjectIdIn(projectIds);
|
||||
List<TestCaseReviewProject> testCaseReviewProjects = testCaseReviewProjectMapper.selectByExample(testCaseReviewProjectExample);
|
||||
List<String> reviewIds = testCaseReviewProjects.stream().map(TestCaseReviewProject::getReviewId).collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(reviewIds)) {
|
||||
public List<TestCaseReview> listCaseReviewAll() {
|
||||
TestCaseReviewProjectExample reviewProjectExample = new TestCaseReviewProjectExample();
|
||||
TestCaseReviewProjectExample.Criteria criteria = reviewProjectExample.createCriteria();
|
||||
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
|
||||
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
|
||||
List<TestCaseReviewProject> testCaseReviewProjects = testCaseReviewProjectMapper.selectByExample(reviewProjectExample);
|
||||
if (!CollectionUtils.isEmpty(testCaseReviewProjects)) {
|
||||
List<String> caseReviewIds = testCaseReviewProjects.stream().map(TestCaseReviewProject::getReviewId).collect(Collectors.toList());
|
||||
TestCaseReviewExample testCaseReviewExample = new TestCaseReviewExample();
|
||||
testCaseReviewExample.createCriteria().andIdIn(reviewIds);
|
||||
testCaseReviewExample.createCriteria().andIdIn(caseReviewIds);
|
||||
return testCaseReviewMapper.selectByExample(testCaseReviewExample);
|
||||
}
|
||||
}
|
||||
@ -481,7 +477,8 @@ public class TestCaseReviewService {
|
||||
request.setReviewerId(user.getId());
|
||||
}
|
||||
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId(), user.getLastProjectId()));
|
||||
|
||||
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
|
||||
@ -545,9 +542,11 @@ public class TestCaseReviewService {
|
||||
|
||||
if (userIds.size() > 0) {
|
||||
for (String id : userIds) {
|
||||
stringBuilder.append(userMap.get(id)).append("、");
|
||||
if (StringUtils.isNotBlank(userMap.get(id))) {
|
||||
stringBuilder.append(userMap.get(id)).append("、");
|
||||
}
|
||||
}
|
||||
name = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
|
||||
name = stringBuilder.substring(0, stringBuilder.length() - 1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -220,27 +220,17 @@ public class TestCaseService {
|
||||
|
||||
|
||||
public List<TestCase> recentTestPlans(QueryTestCaseRequest request, int count) {
|
||||
|
||||
if (StringUtils.isBlank(request.getWorkspaceId())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId());
|
||||
|
||||
List<String> projectIds = projectMapper.selectByExample(projectExample).stream()
|
||||
.map(Project::getId).collect(Collectors.toList());
|
||||
|
||||
if (projectIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PageHelper.startPage(1, count, true);
|
||||
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
testCaseExample.createCriteria().andProjectIdIn(projectIds).andMaintainerEqualTo(request.getUserId());
|
||||
testCaseExample.setOrderByClause("update_time desc, sort desc");
|
||||
return testCaseMapper.selectByExample(testCaseExample);
|
||||
TestCaseExample.Criteria criteria = testCaseExample.createCriteria();
|
||||
criteria.andMaintainerEqualTo(request.getUserId());
|
||||
String projectId = SessionUtils.getCurrentProjectId();
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
criteria.andProjectIdEqualTo(projectId);
|
||||
testCaseExample.setOrderByClause("update_time desc, sort desc");
|
||||
return testCaseMapper.selectByExample(testCaseExample);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public Project getProjectByTestCaseId(String testCaseId) {
|
||||
|
@ -327,6 +327,10 @@ public class TestPlanService {
|
||||
|
||||
public List<TestPlanDTOWithMetric> listTestPlan(QueryTestPlanRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
String projectId = SessionUtils.getCurrentProjectId();
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
request.setProjectId(projectId);
|
||||
}
|
||||
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
|
||||
calcTestPlanRate(testPlans);
|
||||
return testPlans;
|
||||
@ -392,17 +396,41 @@ public class TestPlanService {
|
||||
if (StringUtils.isBlank(currentWorkspaceId)) {
|
||||
return null;
|
||||
}
|
||||
TestPlanExample testPlanTestCaseExample = new TestPlanExample();
|
||||
testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId)
|
||||
.andPrincipalEqualTo(SessionUtils.getUserId());
|
||||
testPlanTestCaseExample.setOrderByClause("update_time desc");
|
||||
return testPlanMapper.selectByExample(testPlanTestCaseExample);
|
||||
TestPlanProjectExample testPlanProjectExample = new TestPlanProjectExample();
|
||||
TestPlanProjectExample.Criteria criteria = testPlanProjectExample.createCriteria();
|
||||
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
|
||||
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
|
||||
List<TestPlanProject> testPlanProjects = testPlanProjectMapper.selectByExample(testPlanProjectExample);
|
||||
if (!CollectionUtils.isEmpty(testPlanProjects)) {
|
||||
List<String> testPlanIds = testPlanProjects.stream().map(TestPlanProject::getTestPlanId).collect(Collectors.toList());
|
||||
TestPlanExample testPlanTestCaseExample = new TestPlanExample();
|
||||
testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId)
|
||||
.andIdIn(testPlanIds)
|
||||
.andPrincipalEqualTo(SessionUtils.getUserId());
|
||||
testPlanTestCaseExample.setOrderByClause("update_time desc");
|
||||
return testPlanMapper.selectByExample(testPlanTestCaseExample);
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<TestPlan> listTestAllPlan(String currentWorkspaceId) {
|
||||
TestPlanExample testPlanExample = new TestPlanExample();
|
||||
testPlanExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
|
||||
return testPlanMapper.selectByExample(testPlanExample);
|
||||
TestPlanProjectExample testPlanProjectExample = new TestPlanProjectExample();
|
||||
TestPlanProjectExample.Criteria criteria = testPlanProjectExample.createCriteria();
|
||||
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
|
||||
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
|
||||
List<TestPlanProject> testPlanProjects = testPlanProjectMapper.selectByExample(testPlanProjectExample);
|
||||
if (!CollectionUtils.isEmpty(testPlanProjects)) {
|
||||
List<String> testPlanIds = testPlanProjects.stream().map(TestPlanProject::getTestPlanId).collect(Collectors.toList());
|
||||
TestPlanExample testPlanExample = new TestPlanExample();
|
||||
TestPlanExample.Criteria testPlanCriteria = testPlanExample.createCriteria();
|
||||
testPlanCriteria.andWorkspaceIdEqualTo(currentWorkspaceId);
|
||||
testPlanCriteria.andIdIn(testPlanIds);
|
||||
return testPlanMapper.selectByExample(testPlanExample);
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<TestPlanDTOWithMetric> listRelateAllPlan() {
|
||||
@ -410,7 +438,8 @@ public class TestPlanService {
|
||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||
request.setPrincipal(user.getId());
|
||||
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId(), SessionUtils.getCurrentProjectId()));
|
||||
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.listRelate(request);
|
||||
calcTestPlanRate(testPlans);
|
||||
return testPlans;
|
||||
|
@ -123,7 +123,7 @@ public class TestPlanTestCaseService {
|
||||
|
||||
public void buildQueryRequest(QueryTestPlanCaseRequest request, int count) {
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
List<String> relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId());
|
||||
List<String> relateTestPlanIds = extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId(), SessionUtils.getCurrentProjectId());
|
||||
PageHelper.startPage(1, count, true);
|
||||
request.setPlanIds(relateTestPlanIds);
|
||||
request.setExecutor(user.getId());
|
||||
|
@ -46,6 +46,14 @@ export default {
|
||||
logoId: '_blank',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (localStorage.getItem("store")) {
|
||||
this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(localStorage.getItem("store"))))
|
||||
}
|
||||
window.addEventListener("beforeunload", () => {
|
||||
localStorage.setItem("store", JSON.stringify(this.$store.state))
|
||||
})
|
||||
},
|
||||
beforeCreate() {
|
||||
this.$get("/isLogin").then(response => {
|
||||
if (response.data.success) {
|
||||
|
@ -52,7 +52,7 @@
|
||||
</el-submenu>
|
||||
|
||||
|
||||
<el-menu-item v-show="$store.state.switch.value=='new'"
|
||||
<el-menu-item v-show="$store.state.switch.value=='old'"
|
||||
v-permission="['test_manager','test_user','test_viewer']" :index="'/api/monitor/view'">
|
||||
{{ $t('commons.monitor') }}
|
||||
</el-menu-item>
|
||||
@ -116,7 +116,6 @@ export default {
|
||||
apiTestProjectPath: '',
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.init();
|
||||
|
@ -8,10 +8,10 @@
|
||||
<el-dropdown-item command="personal">{{ $t('commons.personal_information') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="about">{{ $t('commons.about_us') }} <i class="el-icon-info"/></el-dropdown-item>
|
||||
<el-dropdown-item command="help">{{ $t('commons.help_documentation') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="old" :disabled=!isReadOnly @click.native="changeBar('old')">
|
||||
<el-dropdown-item command="old" :disabled=isReadOnly @click.native="changeBar('old')">
|
||||
{{ $t('commons.cut_back_old_version') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="new" :disabled=isReadOnly @click.native="changeBar('new')">
|
||||
<el-dropdown-item command="new" :disabled=!isReadOnly @click.native="changeBar('new')">
|
||||
{{ $t('commons.cut_back_new_version') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="logout">{{ $t('commons.exit_system') }}</el-dropdown-item>
|
||||
@ -32,7 +32,7 @@
|
||||
components: {AboutUs},
|
||||
data() {
|
||||
return {
|
||||
isReadOnly: true
|
||||
isReadOnly: this.$store.state.isReadOnly.flag
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -75,6 +75,7 @@
|
||||
},
|
||||
changeBar(item) {
|
||||
this.isReadOnly = !this.isReadOnly
|
||||
this.$store.commit('setFlag', this.isReadOnly);
|
||||
this.$store.commit('setValue', item);
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,6 @@
|
||||
<ms-container>
|
||||
|
||||
<ms-aside-container>
|
||||
<select-menu
|
||||
:data="projects"
|
||||
:current-data="currentProject"
|
||||
:title="$t('test_track.project')"
|
||||
@dataChange="changeProject"/>
|
||||
<node-tree
|
||||
class="node-tree"
|
||||
v-loading="result.loading"
|
||||
@ -17,13 +12,13 @@
|
||||
:draggable="nodeTreeDraggable"
|
||||
:select-node.sync="selectNode"
|
||||
@refreshTable="refreshTable"
|
||||
:current-project="currentProject"
|
||||
:current-project="{id:currentProject}"
|
||||
ref="nodeTree"/>
|
||||
</ms-aside-container>
|
||||
|
||||
<ms-main-container>
|
||||
<test-case-list
|
||||
:current-project="currentProject"
|
||||
:current-project="{id:currentProject}"
|
||||
:select-node-ids="selectNodeIds"
|
||||
:select-parent-nodes="selectParentNodes"
|
||||
@testCaseEdit="editTestCase"
|
||||
@ -41,7 +36,7 @@
|
||||
:read-only="testCaseReadOnly"
|
||||
:tree-nodes="treeNodes"
|
||||
:select-node="selectNode"
|
||||
:current-project="currentProject"
|
||||
:current-project="{id:currentProject}"
|
||||
ref="testCaseEditDialog">
|
||||
</test-case-edit>
|
||||
|
||||
@ -57,7 +52,7 @@
|
||||
|
||||
import NodeTree from '../common/NodeTree';
|
||||
import TestCaseEdit from './components/TestCaseEdit';
|
||||
import {CURRENT_PROJECT, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
|
||||
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
|
||||
import TestCaseList from "./components/TestCaseList";
|
||||
import SelectMenu from "../common/SelectMenu";
|
||||
import TestCaseMove from "./components/TestCaseMove";
|
||||
@ -90,11 +85,15 @@ export default {
|
||||
nodeTreeDraggable: true,
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
this.currentProject = localStorage.getItem(PROJECT_ID);
|
||||
},
|
||||
mounted() {
|
||||
this.init(this.$route);
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
// console.log(this.$route.params.projectId)
|
||||
this.init(to);
|
||||
},
|
||||
currentProject() {
|
||||
@ -105,7 +104,7 @@ export default {
|
||||
init(route) {
|
||||
let path = route.path;
|
||||
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
|
||||
this.getProjects();
|
||||
// this.getProjects();
|
||||
this.testCaseReadOnly = false;
|
||||
if (!checkoutTestManagerOrTestUser()) {
|
||||
this.testCaseReadOnly = true;
|
||||
@ -113,48 +112,49 @@ export default {
|
||||
let caseId = this.$route.params.caseId;
|
||||
this.openRecentTestCaseEditDialog(caseId);
|
||||
this.$router.push('/track/case/all');
|
||||
} else if (route.params.projectId) {
|
||||
this.getProjects();
|
||||
this.getProjectById(route.params.projectId);
|
||||
}
|
||||
// else if (route.params.projectId) {
|
||||
// this.getProjects();
|
||||
// this.getProjectById(route.params.projectId);
|
||||
// }
|
||||
},
|
||||
getProjects() {
|
||||
this.$get("/project/listAll", (response) => {
|
||||
this.projects = response.data;
|
||||
let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
if (lastProject) {
|
||||
let hasCurrentProject = false;
|
||||
for (let i = 0; i < this.projects.length; i++) {
|
||||
if (this.projects[i].id == lastProject.id) {
|
||||
this.currentProject = lastProject;
|
||||
hasCurrentProject = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasCurrentProject) {
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
} else {
|
||||
if (this.projects.length > 0) {
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
}
|
||||
// this.checkProject();
|
||||
});
|
||||
},
|
||||
checkProject() {
|
||||
if (this.currentProject === null) {
|
||||
this.$alert(this.$t('test_track.case.no_project'), {
|
||||
confirmButtonText: this.$t('project.create'),
|
||||
callback: action => {
|
||||
this.$router.push("/track/project/create");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
changeProject(project) {
|
||||
this.setCurrentProject(project);
|
||||
},
|
||||
// getProjects() {
|
||||
// this.$get("/project/listAll", (response) => {
|
||||
// this.projects = response.data;
|
||||
// let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
// if (lastProject) {
|
||||
// let hasCurrentProject = false;
|
||||
// for (let i = 0; i < this.projects.length; i++) {
|
||||
// if (this.projects[i].id == lastProject.id) {
|
||||
// this.currentProject = lastProject;
|
||||
// hasCurrentProject = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (!hasCurrentProject) {
|
||||
// this.setCurrentProject(this.projects[0]);
|
||||
// }
|
||||
// } else {
|
||||
// if (this.projects.length > 0) {
|
||||
// this.setCurrentProject(this.projects[0]);
|
||||
// }
|
||||
// }
|
||||
// // this.checkProject();
|
||||
// });
|
||||
// },
|
||||
// checkProject() {
|
||||
// if (this.currentProject === null) {
|
||||
// this.$alert(this.$t('test_track.case.no_project'), {
|
||||
// confirmButtonText: this.$t('project.create'),
|
||||
// callback: action => {
|
||||
// this.$router.push("/track/project/create");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// changeProject(project) {
|
||||
// this.setCurrentProject(project);
|
||||
// },
|
||||
nodeChange(nodeIds, pNodes) {
|
||||
this.selectNodeIds = nodeIds;
|
||||
this.selectParentNodes = pNodes;
|
||||
@ -182,21 +182,21 @@ export default {
|
||||
this.testCaseReadOnly = true;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
getProjectByCaseId(caseId) {
|
||||
return this.$get('/test/case/project/' + caseId, async response => {
|
||||
this.setCurrentProject(response.data);
|
||||
});
|
||||
},
|
||||
// getProjectByCaseId(caseId) {
|
||||
// return this.$get('/test/case/project/' + caseId, async response => {
|
||||
// this.setCurrentProject(response.data);
|
||||
// });
|
||||
// },
|
||||
refresh() {
|
||||
this.selectNodeIds = [];
|
||||
this.selectParentNodes = [];
|
||||
this.selectNode = {};
|
||||
this.$refs.testCaseList.initTableData();
|
||||
this.refreshTable();
|
||||
this.getNodeTree();
|
||||
},
|
||||
openRecentTestCaseEditDialog(caseId) {
|
||||
if (caseId) {
|
||||
this.getProjectByCaseId(caseId);
|
||||
// this.getProjectByCaseId(caseId);
|
||||
this.$get('/test/case/get/' + caseId, response => {
|
||||
if (response.data) {
|
||||
this.$refs.testCaseEditDialog.open(response.data);
|
||||
@ -206,31 +206,31 @@ export default {
|
||||
this.$refs.testCaseEditDialog.open();
|
||||
}
|
||||
},
|
||||
getProjectById(id) {
|
||||
if (id && id != 'all') {
|
||||
this.$get('/project/get/' + id, response => {
|
||||
let project = response.data;
|
||||
this.setCurrentProject(project);
|
||||
// this.$router.push('/track/case/all');
|
||||
});
|
||||
}
|
||||
if (id === 'all') {
|
||||
this.refresh();
|
||||
}
|
||||
},
|
||||
setCurrentProject(project) {
|
||||
if (project) {
|
||||
this.currentProject = project;
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
|
||||
}
|
||||
this.refresh();
|
||||
},
|
||||
// getProjectById(id) {
|
||||
// if (id && id != 'all') {
|
||||
// this.$get('/project/get/' + id, response => {
|
||||
// let project = response.data;
|
||||
// this.setCurrentProject(project);
|
||||
// // this.$router.push('/track/case/all');
|
||||
// });
|
||||
// }
|
||||
// if (id === 'all') {
|
||||
// this.refresh();
|
||||
// }
|
||||
// },
|
||||
// setCurrentProject(project) {
|
||||
// if (project) {
|
||||
// this.currentProject = project;
|
||||
// localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
|
||||
// }
|
||||
// this.refresh();
|
||||
// },
|
||||
getNodeTree() {
|
||||
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
|
||||
this.nodeTreeDraggable = false;
|
||||
}
|
||||
if (this.currentProject) {
|
||||
this.result = this.$get("/case/node/list/" + this.currentProject.id, response => {
|
||||
this.result = this.$get("/case/node/list/" + this.currentProject, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ export default {
|
||||
param.nodePath = item.path;
|
||||
}
|
||||
});
|
||||
if (this.currentProject) {
|
||||
if (this.currentProject.id) {
|
||||
param.projectId = this.currentProject.id;
|
||||
}
|
||||
param.name = param.name.trim();
|
||||
@ -563,7 +563,7 @@ export default {
|
||||
},
|
||||
getTestOptions() {
|
||||
this.testOptions = [];
|
||||
if (this.currentProject && this.form.type != '' && this.form.type != 'functional') {
|
||||
if (this.currentProject.id && this.form.type != '' && this.form.type != 'functional') {
|
||||
this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
|
||||
this.testOptions = response.data;
|
||||
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
|
||||
|
@ -302,7 +302,9 @@ export default {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
this.getData();
|
||||
if (this.currentProject.id) {
|
||||
this.getData();
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
if (this.currentProject) {
|
||||
|
@ -135,14 +135,14 @@ export default {
|
||||
},
|
||||
init() {
|
||||
let path = this.$route.path;
|
||||
if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) {
|
||||
this.testCaseProjectPath = path;
|
||||
//不激活项目菜单栏
|
||||
this.isProjectActivation = false;
|
||||
this.reload();
|
||||
} else {
|
||||
this.isProjectActivation = true;
|
||||
}
|
||||
// if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) {
|
||||
// this.testCaseProjectPath = path;
|
||||
// //不激活项目菜单栏
|
||||
// this.isProjectActivation = false;
|
||||
// this.reload();
|
||||
// } else {
|
||||
// this.isProjectActivation = true;
|
||||
// }
|
||||
if (path.indexOf("/track/plan/view") >= 0) {
|
||||
this.testPlanViewPath = path;
|
||||
this.reload();
|
||||
@ -151,6 +151,10 @@ export default {
|
||||
this.testCaseEditPath = path;
|
||||
this.reload();
|
||||
}
|
||||
if (path.indexOf("/track/review/view") >= 0) {
|
||||
this.testCaseReviewEditPath = path;
|
||||
this.reload();
|
||||
}
|
||||
},
|
||||
registerEvents() {
|
||||
TrackEvent.$on(LIST_CHANGE, () => {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import MsProject from "@/business/components/settings/project/MsProject";
|
||||
|
||||
const TestTrack = () => import('@/business/components/track/TestTrack')
|
||||
const TrackHome = () => import('@/business/components/track/home/TrackHome')
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8
|
||||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
@ -39,10 +39,22 @@ const Switch = {
|
||||
}
|
||||
}
|
||||
|
||||
const IsReadOnly = {
|
||||
state: {
|
||||
flag: true
|
||||
},
|
||||
mutations: {
|
||||
setFlag(state, value) {
|
||||
state.flag = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
api: API,
|
||||
common: Common,
|
||||
switch: Switch,
|
||||
isReadOnly: IsReadOnly,
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user