性能测试报告 筛选排序

This commit is contained in:
shiziyuan9527 2020-06-01 21:34:49 +08:00
parent 9f3a21756a
commit b5c220f9a6
4 changed files with 40 additions and 11 deletions

View File

@ -31,8 +31,23 @@
<if test="reportRequest.workspaceId != null">
AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR}
</if>
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
and ltr.${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where>
ORDER BY ltr.update_time DESC
<if test="reportRequest.orders != null and reportRequest.orders.size() > 0">
order by
<foreach collection="reportRequest.orders" separator="," item="order">
ltr.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getReportTestAndProInfo" resultType="io.metersphere.dto.ReportDTO">

View File

@ -1,11 +1,17 @@
package io.metersphere.performance.controller.request;
import io.metersphere.controller.request.OrderRequest;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Getter
@Setter
public class ReportRequest {
private String name;
private String workspaceId;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
}

View File

@ -12,6 +12,7 @@ import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.constants.ReportKeys;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.dto.LogDetailDTO;
import io.metersphere.dto.ReportDTO;
import io.metersphere.performance.base.*;
@ -51,6 +52,7 @@ public class ReportService {
}
public List<ReportDTO> getReportList(ReportRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extLoadTestReportMapper.getReportList(request);
}

View File

@ -10,14 +10,15 @@
<el-input type="text" size="small" :placeholder="$t('report.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition" @change="search" clearable/>
v-model="condition.name" @change="search" clearable/>
</span>
</el-row>
</div>
</template>
<el-table :data="tableData" class="test-content"
:default-sort="{prop: 'createTime', order: 'descending'}"
@sort-change="sort"
@filter-change="filter"
>
<el-table-column
prop="name"
@ -47,6 +48,8 @@
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="updateTime"-->
<!-- sortable-->
<!-- width="250"-->
<!-- :label="$t('commons.update_time')">-->
<!-- <template v-slot:default="scope">-->
@ -55,7 +58,7 @@
<!-- </el-table-column>-->
<el-table-column
prop="status"
:filter-method="filter"
column-key="status"
:filters="statusFilters"
:label="$t('commons.status')">
<template v-slot:default="{row}">
@ -83,6 +86,7 @@
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceReportStatus from "./PerformanceReportStatus";
import {_filter, _sort} from "../../../../common/js/utils";
export default {
name: "PerformanceTestReport",
@ -95,7 +99,7 @@
result: {},
queryPath: "/performance/report/list/all",
deletePath: "/performance/report/delete/",
condition: "",
condition: {},
projectId: null,
tableData: [],
multipleSelection: [],
@ -115,10 +119,7 @@
},
methods: {
initTableData() {
let param = {
name: this.condition,
};
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
@ -161,8 +162,13 @@
this.initTableData();
});
},
filter(value, row) {
return row.status === value;
sort(column) {
_sort(column, this.condition);
this.initTableData();
},
filter(filters) {
_filter(filters, this.condition);
this.initTableData();
},
}
}