This commit is contained in:
shiziyuan9527 2020-05-29 17:02:49 +08:00
commit ab19dc0627
13 changed files with 79 additions and 29 deletions

View File

@ -130,13 +130,15 @@ public class ProjectService {
}
private void checkProjectExist (Project project) {
ProjectExample example = new ProjectExample();
example.createCriteria()
.andNameEqualTo(project.getName())
.andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andIdNotEqualTo(project.getId());
if (projectMapper.selectByExample(example).size() > 0) {
MSException.throwException(Translator.get("project_name_already_exists"));
if (project.getName() != null) {
ProjectExample example = new ProjectExample();
example.createCriteria()
.andNameEqualTo(project.getName())
.andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andIdNotEqualTo(project.getId());
if (projectMapper.selectByExample(example).size() > 0) {
MSException.throwException(Translator.get("project_name_already_exists"));
}
}
}

View File

@ -97,13 +97,15 @@ public class TestCaseService {
}
private void checkTestCaseExist (TestCaseWithBLOBs testCase) {
TestCaseExample example = new TestCaseExample();
example.createCriteria()
.andNameEqualTo(testCase.getName())
.andProjectIdEqualTo(testCase.getProjectId())
.andIdNotEqualTo(testCase.getId());
if (testCaseMapper.selectByExample(example).size() > 0) {
MSException.throwException(Translator.get("test_case_already_exists"));
if (testCase.getName() != null) {
TestCaseExample example = new TestCaseExample();
example.createCriteria()
.andNameEqualTo(testCase.getName())
.andProjectIdEqualTo(testCase.getProjectId())
.andIdNotEqualTo(testCase.getId());
if (testCaseMapper.selectByExample(example).size() > 0) {
MSException.throwException(Translator.get("test_case_already_exists"));
}
}
}

View File

@ -95,13 +95,15 @@ public class TestPlanService {
}
private void checkTestPlanExist (TestPlan testPlan) {
TestPlanExample example = new TestPlanExample();
example.createCriteria()
.andNameEqualTo(testPlan.getName())
.andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andIdNotEqualTo(testPlan.getId());
if (testPlanMapper.selectByExample(example).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists"));
if (testPlan.getName() != null) {
TestPlanExample example = new TestPlanExample();
example.createCriteria()
.andNameEqualTo(testPlan.getName())
.andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
.andIdNotEqualTo(testPlan.getId());
if (testPlanMapper.selectByExample(example).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists"));
}
}
}

View File

@ -7,11 +7,11 @@
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<el-input v-model="item.name" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.key')"/>
:placeholder="$t('api_test.key')" show-word-limit/>
</el-col>
<el-col>
<el-input v-model="item.value" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.value')"/>
:placeholder="$t('api_test.value')" show-word-limit/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"

View File

@ -7,11 +7,11 @@
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col>
<ms-api-variable-input v-model="item.name" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.variable_name')"/>
:placeholder="$t('api_test.variable_name')" show-word-limit/>
</el-col>
<el-col>
<el-input v-model="item.value" size="small" maxlength="100" @change="change"
:placeholder="$t('api_test.value')"/>
:placeholder="$t('api_test.value')" show-word-limit/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"

View File

@ -66,7 +66,7 @@
line-height: 32px;
position: absolute;
top: 0;
right: 25px;
right: 70px;
margin-right: -20px;
display: flex;
align-items: center;

View File

@ -160,6 +160,10 @@
},
editTestCase(testCase) {
this.testCaseReadOnly = false;
if (this.treeNodes.length < 1) {
this.$warning('请先新建模块');
return;
}
this.$refs.testCaseEditDialog.open(testCase);
},
copyTestCase(testCase) {

View File

@ -232,11 +232,23 @@
}
},
methods: {
handleClose(done) {
listenGoBack() {
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.goBack, false);
}
},
goBack() {
this.handleClose();
},
handleClose() {
//
window.removeEventListener('popstate', this.goBack, false);
this.showDialog = false;
},
cancel() {
this.showDialog = false;
this.handleClose();
this.$emit('refreshTable');
},
statusChange(status) {
@ -299,6 +311,7 @@
},
openTestCaseEdit(testCase) {
this.showDialog = true;
this.listenGoBack();
this.initData(testCase);
},
initTest() {

View File

@ -91,6 +91,16 @@
}
},
methods: {
listenGoBack() {
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.goBack, false);
}
},
goBack() {
this.handleClose();
},
open(id, isReport) {
if (isReport) {
this.isReport = isReport;
@ -112,6 +122,7 @@
this.initComponents();
}
this.showDialog = true;
this.listenGoBack();
},
initComponents() {
this.componentMap.forEach((value, key) =>{
@ -134,6 +145,7 @@
});
},
handleClose() {
window.removeEventListener('popstate', this.goBack, false);
this.showDialog = false;
},
change(evt) {
@ -221,7 +233,7 @@
}
this.$post(url + this.type, param, () =>{
this.$success(this.$t('commons.save_success'));
this.showDialog = false;
this.handleClose();
this.$emit('refresh');
});
},

View File

@ -78,12 +78,23 @@
}
},
methods: {
listenGoBack() {
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.goBack, false);
}
},
goBack() {
this.handleClose();
},
open(id) {
if (id) {
this.reportId = id;
}
this.getReport();
this.showDialog = true;
this.listenGoBack();
},
getReport() {
this.result = this.$get('/case/report/get/' + this.reportId, response => {
@ -113,6 +124,7 @@
});
},
handleClose() {
window.removeEventListener('popstate', this.goBack, false);
this.showDialog = false;
},
handleEdit() {

View File

@ -397,6 +397,7 @@ export default {
delete: "Delete case",
save_create_continue: "Save and create continue",
please_create_project: "No project available, please create the project first",
create_module_first: "Please create module first",
import: {
import: "Import test case",
case_import: "Import test case",

View File

@ -394,6 +394,7 @@ export default {
delete: "删除用例",
save_create_continue: "保存并继续创建",
please_create_project: "暂无项目,请先创建项目",
create_module_first: "请先新建模块",
import: {
import: "导入用例",
case_import: "导入测试用例",

View File

@ -396,6 +396,7 @@ export default {
delete: "删除用例",
save_create_continue: "保存並繼續創建",
please_create_project: "暫無項目,請先創建項目",
create_module_first: "請先新建模塊",
import: {
import: "導入用例",
case_import: "導入測試用例",