2021-03-13 13:01:28 +08:00
|
|
|
<template>
|
2022-11-18 11:07:06 +08:00
|
|
|
<div class="dashboard-card">
|
|
|
|
<el-card shadow="never" class="box-card" style="height: 100%">
|
|
|
|
<div slot="header" class="clearfix">
|
2024-10-30 16:24:23 +08:00
|
|
|
<span class="dashboard-title">{{
|
|
|
|
$t("test_track.home.case_maintenance")
|
|
|
|
}}</span>
|
2022-11-15 16:25:14 +08:00
|
|
|
</div>
|
2022-11-18 11:07:06 +08:00
|
|
|
|
|
|
|
<div v-loading="loading" element-loading-background="#FFFFFF">
|
2024-10-30 16:24:23 +08:00
|
|
|
<div
|
|
|
|
v-if="loadError"
|
|
|
|
style="
|
|
|
|
width: 100%;
|
|
|
|
height: 300px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
style="height: 100px; width: 100px"
|
|
|
|
src="/assets/module/figma/icon_load_error.svg"
|
|
|
|
/>
|
|
|
|
<span class="addition-info-title" style="color: #646a73">{{
|
|
|
|
$t("home.dashboard.public.load_error")
|
|
|
|
}}</span>
|
2022-11-18 11:07:06 +08:00
|
|
|
</div>
|
2023-12-25 23:10:01 +08:00
|
|
|
<div v-if="!loadError">
|
2022-11-18 11:07:06 +08:00
|
|
|
<el-container>
|
2024-10-30 16:24:23 +08:00
|
|
|
<ms-chart
|
|
|
|
ref="chart1"
|
|
|
|
:options="caseOption"
|
|
|
|
:autoresize="true"
|
|
|
|
style="width: 100%; height: 340px"
|
|
|
|
></ms-chart>
|
2022-11-18 11:07:06 +08:00
|
|
|
</el-container>
|
|
|
|
</div>
|
2022-11-15 16:25:14 +08:00
|
|
|
</div>
|
2022-11-18 11:07:06 +08:00
|
|
|
</el-card>
|
|
|
|
</div>
|
2021-03-13 13:01:28 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-10-10 13:41:39 +08:00
|
|
|
import MsChart from "metersphere-frontend/src/components/chart/MsChart";
|
2024-10-30 16:24:23 +08:00
|
|
|
import { getCurrentProjectID } from "metersphere-frontend/src/utils/token";
|
|
|
|
import { getTrackCaseBar } from "@/api/track";
|
2021-03-13 13:01:28 +08:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "CaseMaintenance",
|
2024-10-30 16:24:23 +08:00
|
|
|
components: { MsChart },
|
2021-03-13 13:01:28 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2022-11-15 16:25:14 +08:00
|
|
|
loading: false,
|
|
|
|
loadError: false,
|
2024-10-30 16:24:23 +08:00
|
|
|
caseOption: {},
|
|
|
|
};
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
|
|
|
activated() {
|
|
|
|
this.search();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
search() {
|
|
|
|
this.loading = true;
|
|
|
|
this.loadError = false;
|
|
|
|
let selectProjectId = getCurrentProjectID();
|
|
|
|
getTrackCaseBar(selectProjectId)
|
2024-10-30 16:24:23 +08:00
|
|
|
.then((r) => {
|
2022-11-15 16:25:14 +08:00
|
|
|
this.loading = false;
|
|
|
|
this.loadError = false;
|
|
|
|
let data = r.data;
|
|
|
|
this.setBarOption(data);
|
2024-10-30 16:24:23 +08:00
|
|
|
})
|
|
|
|
.catch(() => {
|
2022-11-15 16:25:14 +08:00
|
|
|
this.loading = false;
|
|
|
|
this.loadError = true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
setBarOption(data) {
|
|
|
|
let xAxis = [];
|
2024-10-30 16:24:23 +08:00
|
|
|
data.map((d) => {
|
2022-11-15 16:25:14 +08:00
|
|
|
if (!xAxis.includes(d.xAxis)) {
|
|
|
|
xAxis.push(d.xAxis);
|
|
|
|
}
|
|
|
|
});
|
2024-10-30 16:24:23 +08:00
|
|
|
let yAxis1 = data
|
|
|
|
.filter((d) => d.groupName === "FUNCTIONCASE")
|
|
|
|
.map((d) => [d.xAxis, d.yAxis]);
|
|
|
|
let yAxis2 = data
|
|
|
|
.filter((d) => d.groupName === "RELEVANCECASE")
|
|
|
|
.map((d) => [d.xAxis, d.yAxis]);
|
2022-11-15 16:25:14 +08:00
|
|
|
let option = {
|
|
|
|
tooltip: {
|
2024-10-30 16:24:23 +08:00
|
|
|
trigger: "axis",
|
2022-11-15 16:25:14 +08:00
|
|
|
axisPointer: {
|
2024-10-30 16:24:23 +08:00
|
|
|
type: "shadow",
|
|
|
|
},
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
|
|
|
xAxis: {
|
2024-10-30 16:24:23 +08:00
|
|
|
type: "category",
|
2022-11-16 15:18:58 +08:00
|
|
|
data: xAxis,
|
2024-10-30 16:24:23 +08:00
|
|
|
axisTick: {
|
|
|
|
show: false, // 不显示坐标轴刻度线
|
2022-11-16 15:18:58 +08:00
|
|
|
},
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
|
|
|
yAxis: {
|
2024-10-30 16:24:23 +08:00
|
|
|
type: "value",
|
2022-11-15 16:25:14 +08:00
|
|
|
axisLine: {
|
2024-10-30 16:24:23 +08:00
|
|
|
show: false,
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
|
|
|
axisTick: {
|
2024-10-30 16:24:23 +08:00
|
|
|
show: false,
|
2022-11-24 17:07:44 +08:00
|
|
|
},
|
|
|
|
min: 0,
|
2024-10-30 16:24:23 +08:00
|
|
|
max: data.length === 0 ? 40 : null,
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
2022-11-18 11:07:06 +08:00
|
|
|
grid: {
|
|
|
|
left: 0,
|
|
|
|
containLabel: true,
|
2022-11-21 18:22:45 +08:00
|
|
|
top: 80,
|
2022-11-18 11:07:06 +08:00
|
|
|
right: 24,
|
2024-10-30 16:24:23 +08:00
|
|
|
bottom: 24,
|
2022-11-18 11:07:06 +08:00
|
|
|
},
|
2022-11-15 16:25:14 +08:00
|
|
|
legend: {
|
2022-11-16 15:18:58 +08:00
|
|
|
itemWidth: 8,
|
|
|
|
itemHeight: 8,
|
2024-10-30 16:24:23 +08:00
|
|
|
data: [
|
|
|
|
{
|
|
|
|
icon: "rect",
|
|
|
|
name: this.$t("test_track.home.function_case_count"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: "rect",
|
|
|
|
name: this.$t("test_track.home.relevance_case_count"),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
orient: "horizontal",
|
|
|
|
left: "0",
|
|
|
|
top: "24",
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
|
|
|
series: [
|
|
|
|
{
|
2024-10-30 16:24:23 +08:00
|
|
|
name: this.$t("test_track.home.function_case_count"),
|
2022-11-15 16:25:14 +08:00
|
|
|
data: yAxis1,
|
2024-10-30 16:24:23 +08:00
|
|
|
type: "bar",
|
2022-11-15 16:25:14 +08:00
|
|
|
barWidth: 16,
|
2022-11-24 14:49:28 +08:00
|
|
|
barMinHeight: 5,
|
2022-11-15 16:25:14 +08:00
|
|
|
itemStyle: {
|
2024-10-30 16:24:23 +08:00
|
|
|
color: "#AA4FBF",
|
|
|
|
barBorderRadius: [2, 2, 0, 0],
|
|
|
|
},
|
2022-11-15 16:25:14 +08:00
|
|
|
},
|
|
|
|
{
|
2024-10-30 16:24:23 +08:00
|
|
|
name: this.$t("test_track.home.relevance_case_count"),
|
2022-11-15 16:25:14 +08:00
|
|
|
data: yAxis2,
|
2024-10-30 16:24:23 +08:00
|
|
|
type: "bar",
|
2022-11-15 16:25:14 +08:00
|
|
|
barWidth: 16,
|
2022-11-24 14:49:28 +08:00
|
|
|
barMinHeight: 5,
|
2022-11-16 15:18:58 +08:00
|
|
|
itemStyle: {
|
2024-10-30 16:24:23 +08:00
|
|
|
color: "#F9CB2E",
|
|
|
|
barBorderRadius: [2, 2, 0, 0],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-11-15 16:25:14 +08:00
|
|
|
};
|
|
|
|
this.caseOption = option;
|
|
|
|
},
|
2024-10-30 16:24:23 +08:00
|
|
|
},
|
|
|
|
};
|
2021-03-13 13:01:28 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2024-10-30 16:24:23 +08:00
|
|
|
.no-shadow-card {
|
|
|
|
-webkit-box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0.1);
|
|
|
|
box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0.1);
|
2021-03-13 13:01:28 +08:00
|
|
|
}
|
|
|
|
|
2024-10-30 16:24:23 +08:00
|
|
|
.el-card :deep(.el-card__header) {
|
|
|
|
border-bottom: 0px solid #ebeef5;
|
2021-03-13 13:01:28 +08:00
|
|
|
padding-bottom: 0px;
|
|
|
|
}
|
|
|
|
</style>
|