删除计划前校验

This commit is contained in:
chenjianxing 2020-04-27 09:43:08 +08:00
parent 4b96010d3a
commit e4b02ec997
9 changed files with 31 additions and 11 deletions

View File

@ -8,10 +8,12 @@ import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.testcase.PlanCaseRelevanceRequest;
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
import io.metersphere.controller.request.testcase.QueryTestPlanRequest;
import io.metersphere.dto.TestPlanDTO;
import io.metersphere.i18n.Translator;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@ -62,8 +64,14 @@ public class TestPlanService {
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
}
public int deleteTestPlan(String testPalnId) {
return testPlanMapper.deleteByPrimaryKey(testPalnId);
public int deleteTestPlan(String testPlanId) {
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(testPlanId);
List<TestPlanTestCase> testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample);
if (testPlanTestCases.size() > 0) {
MSException.throwException(Translator.get("before_delete_plan"));
}
return testPlanMapper.deleteByPrimaryKey(testPlanId);
}
public List<TestPlanDTO> listTestPlan(QueryTestPlanRequest request) {

View File

@ -1 +1,2 @@
test_case_exist=
test_case_exist=
before_delete_plan=

View File

@ -22,4 +22,5 @@ organization_id_is_null=Organization ID cannot be null
max_thread_insufficient=The number of concurrent users exceeds
cannot_edit_load_test_running=Cannot modify the running test
test_not_found=Test cannot be found:
test_not_running=Test is not running
test_not_running=Test is not running
before_delete_plan=There is an associated test case under this plan, please unlink it first!

View File

@ -22,4 +22,5 @@ organization_id_is_null=\u7EC4\u7EC7 ID \u4E0D\u80FD\u4E3A\u7A7A
max_thread_insufficient=\u5E76\u53D1\u7528\u6237\u6570\u8D85\u989D
cannot_edit_load_test_running=\u4E0D\u80FD\u4FEE\u6539\u6B63\u5728\u8FD0\u884C\u7684\u6D4B\u8BD5
test_not_found=\u6D4B\u8BD5\u4E0D\u5B58\u5728:
test_not_running=\u6D4B\u8BD5\u672A\u8FD0\u884C
test_not_running=\u6D4B\u8BD5\u672A\u8FD0\u884C
before_delete_plan=\u8BE5\u8BA1\u5212\u4E0B\u5B58\u5728\u5173\u8054\u6D4B\u8BD5\u7528\u4F8B\uFF0C\u8BF7\u5148\u53D6\u6D88\u5173\u8054\uFF01

View File

@ -179,7 +179,8 @@
this.getProjectByCaseId(caseId);
this.$get('/test/case/get/' + caseId, response => {
if (response.data) {
this.openTestCaseEditDialog(response.data);
this.testCaseReadOnly = false;
this.$refs.testCaseEditDialog.open(response.data);
}
});
},

View File

@ -2,7 +2,7 @@
<div>
<el-dialog :title="operationType == 'edit' ? $t('test_track.case.edit_case') : $t('test_track.case.create')" :visible.sync="dialogFormVisible" width="65%">
<el-dialog :title="operationType == 'edit' ? ( readOnly ? $t('test_track.case.view_case') : $t('test_track.case.edit_case')) : $t('test_track.case.create')" :visible.sync="dialogFormVisible" width="65%">
<el-form :model="form" :rules="rules" ref="caseFrom">

View File

@ -91,7 +91,9 @@
<el-table-column
:label="$t('commons.operating')">
<template v-slot:default="scope">
<ms-table-operator @editClick="handleEdit(scope.row, scope.$index)" @deleteClick="handleDelete(scope.row)"/>
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="handleEdit(scope.row)" />
<ms-table-operator-button :tip="$t('test_track.plan_view.cancel_relevance')" icon="el-icon-unlock" type="danger" @exec="handleDelete(scope.row)"/>
<!--<ms-table-operator @editClick="handleEdit(scope.row, scope.$index)" @deleteClick="handleDelete(scope.row)"/>-->
</template>
</el-table-column>
</el-table>
@ -125,10 +127,12 @@
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
import MethodTableItem from "../../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
export default {
name: "TestPlanTestCaseList",
components: {
MsTableOperatorButton,
MsTableOperator,
MethodTableItem,
TypeTableItem,

View File

@ -187,9 +187,10 @@ export default {
case: {
test_case: "Test case",
move: "Move case",
case_list: "Test Case List",
create_case: "Create Case",
edit_case: "Edit Case",
case_list: "Test case list",
create_case: "Create case",
edit_case: "Edit case",
view_case: "Test case",
no_project: "There is no project in this workspace, please create the project first",
priority: "Priority",
type: "Type",
@ -283,6 +284,7 @@ export default {
change_executor: "Change executor",
select_executor: "Select executor",
select_execute_result: "Select execute result",
cancel_relevance: "Cancel relevance",
confirm_cancel_relevance: "Confirm cancel relevance",
select_manipulate: "Select the data you want to manipulate",
}

View File

@ -235,6 +235,7 @@ export default {
case_list: "用例列表",
create_case: "创建用例",
edit_case: "编辑用例",
view_case: "查看用例",
no_project: "该工作空间下无项目,请先创建项目",
priority: "优先级",
type: "类型",
@ -326,6 +327,7 @@ export default {
change_executor: "更改执行人",
select_executor: "请选择执行人",
select_execute_result: "选择执行结果",
cancel_relevance: "取消关联",
confirm_cancel_relevance: "确认取消关联",
select_manipulate: "请选择需要操作的数据",
}