Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
9e5aad7831
|
@ -23,15 +23,15 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
|
||||
Set<String> testCaseNames;
|
||||
|
||||
Set<String> userNames;
|
||||
Set<String> userIds;
|
||||
|
||||
public TestCaseDataListener(TestCaseService testCaseService, String projectId,
|
||||
Set<String> testCaseNames, Set<String> userNames, Class<TestCaseExcelData> clazz) {
|
||||
Set<String> testCaseNames, Set<String> userIds, Class<TestCaseExcelData> clazz) {
|
||||
super(clazz);
|
||||
this.testCaseService = testCaseService;
|
||||
this.projectId = projectId;
|
||||
this.testCaseNames = testCaseNames;
|
||||
this.userNames = userNames;
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
if ( nodePath.trim().contains(" ")) {
|
||||
stringBuilder.append("所属模块不能包含空格");
|
||||
}
|
||||
if (!userNames.contains(data.getMaintainer())) {
|
||||
if (!userIds.contains(data.getMaintainer())) {
|
||||
stringBuilder.append("该工作空间下无该用户:" + data.getMaintainer() + ";");
|
||||
}
|
||||
if (testCaseNames.contains(data.getName())) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import io.metersphere.excel.domain.TestCaseExcelData;
|
|||
import io.metersphere.excel.listener.EasyExcelListener;
|
||||
import io.metersphere.excel.listener.TestCaseDataListener;
|
||||
import io.metersphere.excel.utils.EasyExcelUtil;
|
||||
import io.metersphere.user.SessionUser;
|
||||
import io.metersphere.user.SessionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
|
@ -181,10 +182,10 @@ public class TestCaseService {
|
|||
UserExample userExample = new UserExample();
|
||||
userExample.createCriteria().andLastWorkspaceIdEqualTo(currentWorkspaceId);
|
||||
List<User> users = userMapper.selectByExample(userExample);
|
||||
Set<String> userNames = users.stream().map(User::getName).collect(Collectors.toSet());
|
||||
Set<String> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
|
||||
|
||||
EasyExcelListener easyExcelListener = new TestCaseDataListener(this, projectId,
|
||||
testCaseNames, userNames, TestCaseExcelData.class);
|
||||
testCaseNames, userIds, TestCaseExcelData.class);
|
||||
EasyExcelFactory.read(file.getInputStream(), TestCaseExcelData.class, easyExcelListener).sheet().doRead();
|
||||
|
||||
List<ExcelErrData<TestCaseExcelData>> errList = easyExcelListener.getErrList();
|
||||
|
@ -228,6 +229,7 @@ public class TestCaseService {
|
|||
StringBuilder path = new StringBuilder("");
|
||||
List<String> types = Arrays.asList("functional", "performance", "api");
|
||||
List<String> methods = Arrays.asList("manual", "auto");
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
TestCaseExcelData data = new TestCaseExcelData();
|
||||
data.setName("测试用例" + i);
|
||||
|
@ -239,7 +241,7 @@ public class TestCaseService {
|
|||
data.setPrerequisite("前置条件选填");
|
||||
data.setStepDesc("1. 每个步骤以换行分隔\n2. 步骤前可标序号\n3. 测试步骤和结果选填");
|
||||
data.setStepResult("1. 每条结果以换行分隔\n2. 结果前可标序号\n3. 测试步骤和结果选填");
|
||||
data.setMaintainer("admin");
|
||||
data.setMaintainer(user.getId());
|
||||
data.setRemark("备注选填");
|
||||
list.add(data);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<span>
|
||||
<ms-table-operator-button icon="el-icon-edit"
|
||||
@click="editClick" @click.stop="editClickStop"/>
|
||||
:exec="editClick" @click.stop="editClickStop"/>
|
||||
<ms-table-operator-button icon="el-icon-delete" type="danger"
|
||||
@click="deletClick" @click.stop="deleteClickStop"/>
|
||||
:exec="deleteClick" @click.stop="deleteClickStop"/>
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
@ -20,7 +20,7 @@
|
|||
editClickStop() {
|
||||
this.$emit('editClickStop');
|
||||
},
|
||||
deletClick() {
|
||||
deleteClick() {
|
||||
this.$emit('deleteClick');
|
||||
},
|
||||
deleteClickStop() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-button @click="click"
|
||||
<el-button @click="exec"
|
||||
@click.stop="clickStop" :type="type"
|
||||
:icon="icon" size="mini" circle/>
|
||||
:icon="icon" size="mini" circle></el-button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -17,12 +17,12 @@
|
|||
type: {
|
||||
type: String,
|
||||
default: 'primary'
|
||||
},
|
||||
exec: {
|
||||
type: Function
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
click() {
|
||||
this.$emit('click');
|
||||
},
|
||||
clickStop() {
|
||||
this.$emit('clickStop');
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
:current-project="currentProject"
|
||||
:selectNodeIds="selectNodeIds"
|
||||
:selectNodeNames="selectNodeNames"
|
||||
@openTestCaseEditDialog="openTestCaseEditDialog"
|
||||
@testCaseEdit="openTestCaseEditDialog"
|
||||
@testCaseEdit="editTestCase"
|
||||
@testCaseDetail="showTestCaseDetail"
|
||||
@refresh="refresh"
|
||||
ref="testCaseList">
|
||||
</test-case-list>
|
||||
|
@ -32,6 +32,7 @@
|
|||
|
||||
<test-case-edit
|
||||
@refresh="refresh"
|
||||
:read-only="testCaseReadOnly"
|
||||
:tree-nodes="treeNodes"
|
||||
ref="testCaseEditDialog">
|
||||
</test-case-edit>
|
||||
|
@ -60,7 +61,8 @@
|
|||
currentProject: null,
|
||||
treeNodes: [],
|
||||
selectNodeIds: [],
|
||||
selectNodeNames: []
|
||||
selectNodeNames: [],
|
||||
testCaseReadOnly: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -136,7 +138,12 @@
|
|||
refreshTable() {
|
||||
this.$refs.testCaseList.initTableData();
|
||||
},
|
||||
openTestCaseEditDialog(testCase) {
|
||||
editTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
showTestCaseDetail(testCase) {
|
||||
this.testCaseReadOnly = true;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
getProjectByCaseId(caseId) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
:label="$t('test_track.case.name')"
|
||||
:label-width="formLabelWidth"
|
||||
prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
<el-input :disabled="readOnly" v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
|||
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
|
||||
<el-select
|
||||
v-model="form.module"
|
||||
:disabled="readOnly"
|
||||
:placeholder="$t('test_track.case.input_module')"
|
||||
filterable>
|
||||
<el-option
|
||||
|
@ -37,7 +38,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="$t('test_track.case.maintainer')" :label-width="formLabelWidth" prop="maintainer">
|
||||
<el-select v-model="form.maintainer" :placeholder="$t('test_track.case.input_maintainer')" filterable>
|
||||
<el-select :disabled="readOnly" v-model="form.maintainer" :placeholder="$t('test_track.case.input_maintainer')" filterable>
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
|
@ -49,7 +50,7 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.case.priority')" :label-width="formLabelWidth" prop="priority">
|
||||
<el-select v-model="form.priority" clearable :placeholder="$t('test_track.case.input_priority')">
|
||||
<el-select :disabled="readOnly" v-model="form.priority" clearable :placeholder="$t('test_track.case.input_priority')">
|
||||
<el-option label="P0" value="P0"></el-option>
|
||||
<el-option label="P1" value="P1"></el-option>
|
||||
<el-option label="P2" value="P2"></el-option>
|
||||
|
@ -62,7 +63,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="$t('test_track.case.type')" :label-width="formLabelWidth" prop="type">
|
||||
<el-select v-model="form.type" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-select :disabled="readOnly" v-model="form.type" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-option :label="$t('commons.functional')" value="functional"></el-option>
|
||||
<el-option :label="$t('commons.performance')" value="performance"></el-option>
|
||||
<el-option :label="$t('commons.api')" value="api"></el-option>
|
||||
|
@ -71,7 +72,7 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.case.method')" :label-width="formLabelWidth" prop="method">
|
||||
<el-select v-model="form.method" :placeholder="$t('test_track.case.input_method')">
|
||||
<el-select :disabled="readOnly" v-model="form.method" :placeholder="$t('test_track.case.input_method')">
|
||||
<el-option :label="$t('test_track.case.manual')" value="manual"></el-option>
|
||||
<el-option :label="$t('test_track.case.auto')" value="auto"></el-option>
|
||||
</el-select>
|
||||
|
@ -85,7 +86,7 @@
|
|||
<el-row type="flex" justify="center" style="margin-top: 10px;">
|
||||
<el-col :span="20">
|
||||
<el-form-item>
|
||||
<el-input v-model="form.prerequisite"
|
||||
<el-input :disabled="readOnly" v-model="form.prerequisite"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 4}"
|
||||
:rows="2"
|
||||
|
@ -111,6 +112,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<el-input
|
||||
size="mini"
|
||||
v-if="!readOnly"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="scope.row.desc"
|
||||
|
@ -123,6 +125,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<el-input
|
||||
size="mini"
|
||||
v-if="!readOnly"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="scope.row.result"
|
||||
|
@ -135,6 +138,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="readOnly"
|
||||
icon="el-icon-plus"
|
||||
circle size="mini"
|
||||
@click="handleAddStep(scope.$index, scope.row)"></el-button>
|
||||
|
@ -143,7 +147,7 @@
|
|||
icon="el-icon-delete"
|
||||
circle size="mini"
|
||||
@click="handleDeleteStep(scope.$index, scope.row)"
|
||||
:disabled="scope.$index == 0 ? true : false"></el-button>
|
||||
:disabled="readOnly || scope.$index == 0 ? true : false"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -159,6 +163,7 @@
|
|||
<el-input v-model="form.remark"
|
||||
:autosize="{ minRows: 2, maxRows: 4}"
|
||||
type="textarea"
|
||||
:disabled="readOnly"
|
||||
:rows="2"
|
||||
:placeholder="$t('commons.input_content')"></el-input>
|
||||
</el-form-item>
|
||||
|
@ -167,7 +172,7 @@
|
|||
</el-form>
|
||||
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
<ms-dialog-footer v-if="!readOnly"
|
||||
@cancel="dialogFormVisible = false"
|
||||
@confirm="saveCase"/>
|
||||
</template>
|
||||
|
@ -227,6 +232,10 @@
|
|||
props: {
|
||||
treeNodes: {
|
||||
type: Array
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -319,22 +328,27 @@
|
|||
}
|
||||
},
|
||||
resetForm() {
|
||||
|
||||
//防止点击修改后,点击新建触发校验
|
||||
if (this.$refs['caseFrom']) {
|
||||
this.$refs['caseFrom'].resetFields();
|
||||
this.$refs['caseFrom'].validate((valid) => {
|
||||
this.$refs['caseFrom'].resetFields();
|
||||
this.form.name = '';
|
||||
this.form.module = '';
|
||||
this.form.type = '';
|
||||
this.form.method = '';
|
||||
this.form.maintainer = '';
|
||||
this.form.priority = '';
|
||||
this.form.prerequisite = '';
|
||||
this.form.remark = '';
|
||||
this.form.steps = [{
|
||||
num: 1 ,
|
||||
desc: '',
|
||||
result: ''
|
||||
}];
|
||||
return true;
|
||||
});
|
||||
}
|
||||
this.form.name = '';
|
||||
this.form.module = '';
|
||||
this.form.type = '';
|
||||
this.form.method = '';
|
||||
this.form.maintainer = '';
|
||||
this.form.priority = '';
|
||||
this.form.prerequisite = '';
|
||||
this.form.remark = '';
|
||||
this.form.steps = [{
|
||||
num: 1 ,
|
||||
desc: '',
|
||||
result: ''
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
@row-click="showDetail"
|
||||
class="test-content">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
|
@ -60,14 +61,7 @@
|
|||
:label="$t('test_track.case.module')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
sortable
|
||||
:label="$t('commons.create_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
sortable
|
||||
|
@ -178,7 +172,7 @@
|
|||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('openTestCaseEditDialog');
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
|
@ -210,6 +204,9 @@
|
|||
filter(value, row, column) {
|
||||
const property = column['property'];
|
||||
return row[property] === value;
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,4 +234,8 @@
|
|||
width: 240px;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue