点击测试用例展示详情

This commit is contained in:
chenjianxing 2020-04-24 09:42:48 +08:00
parent 2f81508a0e
commit bccc1e3b1c
3 changed files with 38 additions and 21 deletions

View File

@ -22,8 +22,8 @@
:current-project="currentProject" :current-project="currentProject"
:selectNodeIds="selectNodeIds" :selectNodeIds="selectNodeIds"
:selectNodeNames="selectNodeNames" :selectNodeNames="selectNodeNames"
@openTestCaseEditDialog="openTestCaseEditDialog" @testCaseEdit="editTestCase"
@testCaseEdit="openTestCaseEditDialog" @testCaseDetail="showTestCaseDetail"
@refresh="refresh" @refresh="refresh"
ref="testCaseList"> ref="testCaseList">
</test-case-list> </test-case-list>
@ -32,6 +32,7 @@
<test-case-edit <test-case-edit
@refresh="refresh" @refresh="refresh"
:read-only="testCaseReadOnly"
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
ref="testCaseEditDialog"> ref="testCaseEditDialog">
</test-case-edit> </test-case-edit>
@ -60,7 +61,8 @@
currentProject: null, currentProject: null,
treeNodes: [], treeNodes: [],
selectNodeIds: [], selectNodeIds: [],
selectNodeNames: [] selectNodeNames: [],
testCaseReadOnly: true
} }
}, },
mounted() { mounted() {
@ -136,7 +138,12 @@
refreshTable() { refreshTable() {
this.$refs.testCaseList.initTableData(); 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); this.$refs.testCaseEditDialog.open(testCase);
}, },
getProjectByCaseId(caseId) { getProjectByCaseId(caseId) {

View File

@ -13,7 +13,7 @@
:label="$t('test_track.case.name')" :label="$t('test_track.case.name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input v-model="form.name"></el-input> <el-input :disabled="readOnly" v-model="form.name"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -21,6 +21,7 @@
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module"> <el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
<el-select <el-select
v-model="form.module" v-model="form.module"
:disabled="readOnly"
:placeholder="$t('test_track.case.input_module')" :placeholder="$t('test_track.case.input_module')"
filterable> filterable>
<el-option <el-option
@ -37,7 +38,7 @@
<el-row> <el-row>
<el-col :span="10" :offset="1"> <el-col :span="10" :offset="1">
<el-form-item :label="$t('test_track.case.maintainer')" :label-width="formLabelWidth" prop="maintainer"> <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 <el-option
v-for="item in maintainerOptions" v-for="item in maintainerOptions"
:key="item.id" :key="item.id"
@ -49,7 +50,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('test_track.case.priority')" :label-width="formLabelWidth" prop="priority"> <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="P0" value="P0"></el-option>
<el-option label="P1" value="P1"></el-option> <el-option label="P1" value="P1"></el-option>
<el-option label="P2" value="P2"></el-option> <el-option label="P2" value="P2"></el-option>
@ -62,7 +63,7 @@
<el-row> <el-row>
<el-col :span="10" :offset="1"> <el-col :span="10" :offset="1">
<el-form-item :label="$t('test_track.case.type')" :label-width="formLabelWidth" prop="type"> <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.functional')" value="functional"></el-option>
<el-option :label="$t('commons.performance')" value="performance"></el-option> <el-option :label="$t('commons.performance')" value="performance"></el-option>
<el-option :label="$t('commons.api')" value="api"></el-option> <el-option :label="$t('commons.api')" value="api"></el-option>
@ -71,7 +72,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('test_track.case.method')" :label-width="formLabelWidth" prop="method"> <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.manual')" value="manual"></el-option>
<el-option :label="$t('test_track.case.auto')" value="auto"></el-option> <el-option :label="$t('test_track.case.auto')" value="auto"></el-option>
</el-select> </el-select>
@ -85,7 +86,7 @@
<el-row type="flex" justify="center" style="margin-top: 10px;"> <el-row type="flex" justify="center" style="margin-top: 10px;">
<el-col :span="20"> <el-col :span="20">
<el-form-item> <el-form-item>
<el-input v-model="form.prerequisite" <el-input :disabled="readOnly" v-model="form.prerequisite"
type="textarea" type="textarea"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4}"
:rows="2" :rows="2"
@ -111,6 +112,7 @@
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-input <el-input
size="mini" size="mini"
v-if="!readOnly"
type="textarea" type="textarea"
:rows="2" :rows="2"
v-model="scope.row.desc" v-model="scope.row.desc"
@ -123,6 +125,7 @@
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-input <el-input
size="mini" size="mini"
v-if="!readOnly"
type="textarea" type="textarea"
:rows="2" :rows="2"
v-model="scope.row.result" v-model="scope.row.result"
@ -135,6 +138,7 @@
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-button <el-button
type="primary" type="primary"
:disabled="readOnly"
icon="el-icon-plus" icon="el-icon-plus"
circle size="mini" circle size="mini"
@click="handleAddStep(scope.$index, scope.row)"></el-button> @click="handleAddStep(scope.$index, scope.row)"></el-button>
@ -143,7 +147,7 @@
icon="el-icon-delete" icon="el-icon-delete"
circle size="mini" circle size="mini"
@click="handleDeleteStep(scope.$index, scope.row)" @click="handleDeleteStep(scope.$index, scope.row)"
:disabled="scope.$index == 0 ? true : false"></el-button> :disabled="readOnly || scope.$index == 0 ? true : false"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -159,6 +163,7 @@
<el-input v-model="form.remark" <el-input v-model="form.remark"
:autosize="{ minRows: 2, maxRows: 4}" :autosize="{ minRows: 2, maxRows: 4}"
type="textarea" type="textarea"
:disabled="readOnly"
:rows="2" :rows="2"
:placeholder="$t('commons.input_content')"></el-input> :placeholder="$t('commons.input_content')"></el-input>
</el-form-item> </el-form-item>
@ -167,7 +172,7 @@
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer v-if="!readOnly"
@cancel="dialogFormVisible = false" @cancel="dialogFormVisible = false"
@confirm="saveCase"/> @confirm="saveCase"/>
</template> </template>
@ -227,6 +232,10 @@
props: { props: {
treeNodes: { treeNodes: {
type: Array type: Array
},
readOnly: {
type: Boolean,
default: true
} }
}, },
methods: { methods: {

View File

@ -19,6 +19,7 @@
<el-table <el-table
:data="tableData" :data="tableData"
@row-click="showDetail"
class="test-content"> class="test-content">
<el-table-column <el-table-column
prop="name" prop="name"
@ -60,14 +61,7 @@
:label="$t('test_track.case.module')" :label="$t('test_track.case.module')"
show-overflow-tooltip> show-overflow-tooltip>
</el-table-column> </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 <el-table-column
prop="updateTime" prop="updateTime"
sortable sortable
@ -178,7 +172,7 @@
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
testCaseCreate() { testCaseCreate() {
this.$emit('openTestCaseEditDialog'); this.$emit('testCaseEdit');
}, },
handleEdit(testCase) { handleEdit(testCase) {
this.$emit('testCaseEdit', testCase); this.$emit('testCaseEdit', testCase);
@ -210,6 +204,9 @@
filter(value, row, column) { filter(value, row, column) {
const property = column['property']; const property = column['property'];
return row[property] === value; return row[property] === value;
},
showDetail(row, event, column) {
this.$emit('testCaseDetail', row);
} }
} }
} }
@ -237,4 +234,8 @@
width: 240px; width: 240px;
} }
.el-table {
cursor:pointer;
}
</style> </style>