报告图表

This commit is contained in:
chenjianxing 2020-05-08 17:06:29 +08:00
parent b876ca0acc
commit 45ac65da59
1 changed files with 26 additions and 19 deletions

View File

@ -4,7 +4,6 @@
<template>
{{executeResult}}/{{charData}}
<ms-pie-chart v-if="isShow" :text="'测试结果统计图'" :name="'测试结果'" :data="charData"/>
</template>
@ -23,12 +22,12 @@
data() {
return {
dataMap: new Map([
["Pass", {value:235, name:'通过', itemStyle: {color: '#67C23A'}}],
["Blocking", {value:274, name:'阻塞', itemStyle: {color: '#E6A23C'}}],
["Skip", {value:335, name:'跳过', itemStyle: {color: '#909399'}}],
["Prepare", {value:265, name:'未开始', itemStyle: {color: '#DEDE10'}}],
["Failure", {value:310, name:'失败', itemStyle: {color: '#F56C6C'}}],
["Underway", {value:245, name:'进行中', itemStyle: {color: 'lightskyblue'}}]
["Pass", {name:'通过', itemStyle: {color: '#67C23A'}}],
["Blocking", {name:'阻塞', itemStyle: {color: '#E6A23C'}}],
["Skip", {name:'跳过', itemStyle: {color: '#909399'}}],
["Prepare", {name:'未开始', itemStyle: {color: '#DEDE10'}}],
["Failure", {name:'失败', itemStyle: {color: '#F56C6C'}}],
["Underway", {name:'进行中', itemStyle: {color: 'lightskyblue'}}]
]),
charData: [],
isShow: true
@ -36,11 +35,29 @@
},
props: {
executeResult: {
type: Array
type: Array,
default() {
return [
{status: 'Pass', count: '235'},
{status: 'Blocking', count: '274'},
{status: 'Skip', count: '335'},
{status: 'Prepare', count: '265'},
{status: 'Failure', count: '310'},
{status: 'Underway', count: '245'},
]
}
}
},
watch: {
executeResult() {
this.getCharData();
}
},
created() {
this.getCharData();
},
methods: {
getCharData() {
this.charData = [];
this.executeResult.forEach(item => {
let data = this.dataMap.get(item.status);
@ -48,17 +65,7 @@
this.charData.push(data);
});
this.reload();
}
},
created() {
this.charData.push(this.dataMap.get('Pass'));
this.charData.push(this.dataMap.get('Blocking'));
this.charData.push(this.dataMap.get('Skip'));
this.charData.push(this.dataMap.get('Prepare'));
this.charData.push(this.dataMap.get('Failure'));
this.charData.push(this.dataMap.get('Underway'));
},
methods: {
},
reload() {
this.isShow = false;
this.$nextTick(function () {