Commit c4d3bfd4 authored by mengzixuan's avatar mengzixuan

Merge branch 'mengzixuan' of http://gitlab.91isoft.com:90/car-test/web into develop

parents df8aa863 beed826a
...@@ -67,7 +67,13 @@ ...@@ -67,7 +67,13 @@
<!-- @queryTable="getList"--> <!-- @queryTable="getList"-->
<!-- ></right-toolbar>--> <!-- ></right-toolbar>-->
<!-- </el-row>--> <!-- </el-row>-->
<el-table v-loading="loading" border :scroll-x="'1500px'" :data="tableData"> <el-table
v-loading="loading"
border
:scroll-x="'1500px'"
:data="tableData"
@sort-change="sortChange"
>
<el-table-column type="index" width="55" label="序号" align="center"> <el-table-column type="index" width="55" label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
...@@ -79,7 +85,12 @@ ...@@ -79,7 +85,12 @@
align="left" align="left"
prop="testScenario" prop="testScenario"
/> />
<el-table-column label="测试方法" sortable align="left" prop="testType" /> <el-table-column
label="测试方法"
sortable
align="left"
prop="testMethod"
/>
<el-table-column label="用例编号" align="left" prop="displayID" /> <el-table-column label="用例编号" align="left" prop="displayID" />
<el-table-column label="用例名称" align="left" prop="name" /> <el-table-column label="用例名称" align="left" prop="name" />
<!-- <el-table-column label="工具" align="left" prop="tools" /> --> <!-- <el-table-column label="工具" align="left" prop="tools" /> -->
...@@ -129,7 +140,8 @@ export default { ...@@ -129,7 +140,8 @@ export default {
return { return {
queryParams: { queryParams: {
offset: 0, offset: 0,
limit: 10 limit: 10,
searchKeywords: ''
}, },
total: 0, total: 0,
loading: false, loading: false,
...@@ -151,6 +163,10 @@ export default { ...@@ -151,6 +163,10 @@ export default {
postSort: [ postSort: [
{ required: true, message: '岗位顺序不能为空', trigger: 'blur' } { required: true, message: '岗位顺序不能为空', trigger: 'blur' }
] ]
},
orderBy: {
field: 'scenario',
order: 'DESC'
} }
} }
}, },
...@@ -160,13 +176,32 @@ export default { ...@@ -160,13 +176,32 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
sortChange(column, prop, order) {
this.queryParams.offset = 1 // 排序后返回第一页
if (column.order) {
this.orderBy.order = column.order === 'ascending' ? 'DESC' : 'ASC'
this.orderBy.field = column.prop
switch (column.prop) {
case 'testScenario':
this.orderBy.field = 'scenario'
break
case 'testMethod':
this.orderBy.field = 'method'
break
}
this.getList()
}
},
handleQuery() { handleQuery() {
this.queryParams.offset = 1 this.queryParams.offset = 1
this.getList() this.getList()
}, },
resetQuery() { resetQuery() {
this.queryParams.offset = 1 this.queryParams = {
this.queryParams.limit = 10 offset: 1,
limit: 10,
searchKeywords: ''
}
this.handleQuery() this.handleQuery()
}, },
/** 获取测试场景 */ /** 获取测试场景 */
...@@ -183,13 +218,17 @@ export default { ...@@ -183,13 +218,17 @@ export default {
}, },
/** 获取测试用例列表 */ /** 获取测试用例列表 */
getList() { getList() {
console.log(this.queryParams.limit)
const pageNum = (this.queryParams.offset - 1) * this.queryParams.limit const pageNum = (this.queryParams.offset - 1) * this.queryParams.limit
const data = { const data = {
offset: { offset: {
offset: pageNum, offset: pageNum,
limit: this.queryParams.limit limit: this.queryParams.limit
} },
orderBy: {
field: this.orderBy.field,
order: this.orderBy.order
},
search: this.queryParams.searchKeywords
} }
listTestCase(data).then(res => { listTestCase(data).then(res => {
this.tableData = res.data.useCases this.tableData = res.data.useCases
......
...@@ -105,14 +105,14 @@ ...@@ -105,14 +105,14 @@
<collapse-item <collapse-item
v-for="(item, key) in tableData" v-for="(item, key) in tableData"
:key="key" :key="key"
:name="item.chapter" :name="item.serial_number"
> >
<span slot="title" style="width: 100%"> <span slot="title" style="width: 100%">
<div class="standard-box"> <div class="standard-box">
<div class="standard-left"> <div class="standard-left">
<div class="standard">标准要求:</div> <div class="standard">标准要求:</div>
<div class="standard-title"> <div class="standard-title">
{{ item.chapter + item.text }} {{ item.serial_number + item.requirements }}
</div> </div>
</div> </div>
<div class="standard-result"> <div class="standard-result">
...@@ -130,22 +130,24 @@ ...@@ -130,22 +130,24 @@
<th>用例名称</th> <th>用例名称</th>
<th>对应输入</th> <th>对应输入</th>
</tr> </tr>
<template v-for="(keyPoint, keyPointKey) in item.testCaseList"> <template
v-for="(keyPoint, keyPointKey) in item.case_result_list"
>
<tr :key="keyPointKey"> <tr :key="keyPointKey">
<td rowspan="1"> <td rowspan="1">
{{ keyPoint.testScenario }} {{ keyPoint.scenario }}
</td> </td>
<td rowspan="1"> <td rowspan="1">
{{ keyPoint.testMethod }} {{ keyPoint.test_type }}
</td> </td>
<td rowspan="1"> <td rowspan="1">
{{ keyPoint.usecaseNo }} {{ keyPoint.serial_number }}
</td> </td>
<td rowspan="1"> <td rowspan="1">
{{ keyPoint.name }} {{ keyPoint.name }}
</td> </td>
<td rowspan="1"> <td rowspan="1">
{{ keyPoint.input }} {{ keyPoint.requirements }}
</td> </td>
</tr> </tr>
</template> </template>
...@@ -218,8 +220,9 @@ export default { ...@@ -218,8 +220,9 @@ export default {
getRows3, getRows3,
/** 全部展开 */ /** 全部展开 */
openAll() { openAll() {
console.log('tablkessss', this.tableData)
this.activeNames = this.tableData.map(i => { this.activeNames = this.tableData.map(i => {
return i.chapter return i.serial_number
}) })
}, },
/** 全部收起 */ /** 全部收起 */
...@@ -228,7 +231,7 @@ export default { ...@@ -228,7 +231,7 @@ export default {
}, },
testmMthod(i) { testmMthod(i) {
this.open = true this.open = true
this.activeValue = i.testMethod this.activeValue = i.test_method
}, },
getTest() { getTest() {
getBySubtaskId({ id: this.$route.query.id }).then(res => { getBySubtaskId({ id: this.$route.query.id }).then(res => {
......
...@@ -67,7 +67,13 @@ ...@@ -67,7 +67,13 @@
<!-- @queryTable="getList"--> <!-- @queryTable="getList"-->
<!-- ></right-toolbar>--> <!-- ></right-toolbar>-->
<!-- </el-row>--> <!-- </el-row>-->
<el-table v-loading="loading" border :scroll-x="'1500px'" :data="tableData"> <el-table
v-loading="loading"
border
:scroll-x="'1500px'"
:data="tableData"
@sort-change="sortChange"
>
<el-table-column type="index" width="55" label="序号" align="center"> <el-table-column type="index" width="55" label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
...@@ -79,7 +85,12 @@ ...@@ -79,7 +85,12 @@
align="left" align="left"
prop="testScenario" prop="testScenario"
/> />
<el-table-column label="测试方法" sortable align="left" prop="testType" /> <el-table-column
label="测试方法"
sortable
align="left"
prop="testMethod"
/>
<el-table-column label="用例编号" align="left" prop="displayID" /> <el-table-column label="用例编号" align="left" prop="displayID" />
<el-table-column label="用例名称" align="left" prop="name" /> <el-table-column label="用例名称" align="left" prop="name" />
<!-- <el-table-column label="工具" align="left" prop="tools" /> --> <!-- <el-table-column label="工具" align="left" prop="tools" /> -->
...@@ -129,7 +140,8 @@ export default { ...@@ -129,7 +140,8 @@ export default {
return { return {
queryParams: { queryParams: {
offset: 0, offset: 0,
limit: 10 limit: 10,
searchKeywords: ''
}, },
total: 0, total: 0,
loading: false, loading: false,
...@@ -151,6 +163,10 @@ export default { ...@@ -151,6 +163,10 @@ export default {
postSort: [ postSort: [
{ required: true, message: '岗位顺序不能为空', trigger: 'blur' } { required: true, message: '岗位顺序不能为空', trigger: 'blur' }
] ]
},
orderBy: {
field: 'scenario',
order: 'DESC'
} }
} }
}, },
...@@ -160,13 +176,32 @@ export default { ...@@ -160,13 +176,32 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
sortChange(column, prop, order) {
this.queryParams.offset = 1 // 排序后返回第一页
if (column.order) {
this.orderBy.order = column.order === 'ascending' ? 'DESC' : 'ASC'
this.orderBy.field = column.prop
switch (column.prop) {
case 'testScenario':
this.orderBy.field = 'scenario'
break
case 'testMethod':
this.orderBy.field = 'method'
break
}
this.getList()
}
},
handleQuery() { handleQuery() {
this.queryParams.offset = 1 this.queryParams.offset = 1
this.getList() this.getList()
}, },
resetQuery() { resetQuery() {
this.queryParams.offset = 1 this.queryParams = {
this.queryParams.limit = 10 offset: 1,
limit: 10,
searchKeywords: ''
}
this.handleQuery() this.handleQuery()
}, },
/** 获取测试场景 */ /** 获取测试场景 */
...@@ -183,13 +218,17 @@ export default { ...@@ -183,13 +218,17 @@ export default {
}, },
/** 获取测试用例列表 */ /** 获取测试用例列表 */
getList() { getList() {
console.log(this.queryParams.limit)
const pageNum = (this.queryParams.offset - 1) * this.queryParams.limit const pageNum = (this.queryParams.offset - 1) * this.queryParams.limit
const data = { const data = {
offset: { offset: {
offset: pageNum, offset: pageNum,
limit: this.queryParams.limit limit: this.queryParams.limit
} },
orderBy: {
field: this.orderBy.field,
order: this.orderBy.order
},
search: this.queryParams.searchKeywords
} }
listTestCase(data).then(res => { listTestCase(data).then(res => {
this.tableData = res.data.useCases this.tableData = res.data.useCases
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment