You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

300 lines
7.2 KiB

<template>
<section>
<el-row :gutter="5" >
<el-col :span="18">
<div>
<div class="echart-box" :id="this.id"></div>
<div class="progress"></div>
</div>
</el-col>
<el-col :span="6" class="border">
<el-form :model="filters" class="padding" :style="{width:'100%',maxHeight:maxTableHeight+'px',overflow: 'auto'}" ref="filtersRef">
<el-form-item label="日期区间">
<br>
<mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="listXmBranchStateHis">查询</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//全局公共库
import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
import { mapGetters } from 'vuex'
import { listXmBranchStateHis } from '@/api/xm/core/xmBranchStateHis';
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品选择界面
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
export default {
components: {
XmIterationSelect,XmProductSelect,
},
props:['id','xmProduct','xmProject','xmIteration'],
computed: {
...mapGetters([
'userInfo','roles'
]),
datesCpd(){
if(this.xmProductStateHiss.length==0){
return []
}else{
return this.xmProductStateHiss.map(i=>i.bizDate)
}
},
closedBugsCpd(){
if(this.xmProductStateHiss.length==0){
return []
}else{
return this.xmProductStateHiss.map(i=>i.closedBugs)
}
},
activeBugsCpd(){
if(this.xmProductStateHiss.length==0){
return []
}else{
return this.xmProductStateHiss.map(i=> i.activeBugs)
}
},
confirmedBugsCpd(){
if(this.xmProductStateHiss.length==0){
return []
}else{
return this.xmProductStateHiss.map(i=> i.confirmedBugs)
}
},
resolvedBugsCpd(){
if(this.xmProductStateHiss.length==0){
return []
}else{
return this.xmProductStateHiss.map(i=>i.resolvedBugs)
}
},
titleCpd(){
return '企业缺陷每日趋势图'
},
xmProductCpd(){
if(this.xmIteration && this.xmIteration.id){
return {id:this.xmIteration.productId,productName:this.xmIteration.productName}
}
if(this.xmProduct && this.xmProduct.id){
return this.xmProduct
}
return null;
}
},
watch: {
datesCpd(){
this.$nextTick(()=>{
this.drawCharts();
})
}
},
data() {
return {
filters:{
category:'',
product:null,
project:null,
testPlan:null,
iteration:null,
testCasedb:null,
},
dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
load:{ list: false, edit: false, del: false, add: false },//查询中...
dateRanger:[],
maxTableHeight:300,
visible:false,
xmProductStateHiss:[],
}//end return
},//end data
methods: {
listXmBranchStateHis(){
var params={orderBy:'biz_date asc'}
if(this.filters.startBizDate && this.filters.endBizDate){
params.startBizDate=this.filters.startBizDate;
params.endBizDate=this.filters.endBizDate;
}
listXmBranchStateHis(params).then(res=>{
this.xmProductStateHiss=res.data.tips.isOk?res.data.data:this.xmProductStateHiss;
})
},
open(){
this.visible=true;
this.filters.testPlan=this.xmTestPlan
this.filters.product=this.xmProduct
this.filters.project=this.xmProject
this.filters.iteration=this.xmIteration
this.filters.testCasedb=this.xmTestCasedb
if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
this.$nextTick(()=>{
this.listXmBranchStateHis();
})
},
drawCharts() {
this.myChart = this.$echarts.init(document.getElementById(this.id));
this.myChart.setOption(
{
title: {
text: this.titleCpd,
left: 'center'
},
tooltip: {
trigger: 'axis',
},
barMaxWidth: 100,
toolbox: {
show: true,
top:"5%",
right:"10px",
feature: {
dataView: { show: true, readOnly: false },
magicType: { show: true, type: ['line', 'bar'] },
saveAsImage: { show: true }
}
},
calculable: true,
legend: {
bottom: 'bottom',
data: ['新提出','执行中','已解决','已关闭']
},
xAxis: {
type: 'category',
data: this.datesCpd
},
yAxis: {
type: 'value'
},
series: [
{
name:'新提出',
data: this.activeBugsCpd,
type: 'line',
smooth: true,
itemStyle: {
normal: {
// 折点颜色样式
color: 'orange',
lineStyle: {
// 折线颜色样式
color: 'orange'
}
}
},
},
{
name:'执行中',
data: this.confirmedBugsCpd,
type: 'line',
smooth: true,
itemStyle: {
normal: {
// 折点颜色样式
color: 'blue',
lineStyle: {
// 折线颜色样式
color: 'blue'
}
}
},
},
{
name:'已解决',
data: this.resolvedBugsCpd,
type: 'line',
smooth: true,
itemStyle: {
normal: {
// 折点颜色样式
color: 'green',
lineStyle: {
// 折线颜色样式
color: 'green'
}
}
},
},
{
name:'已关闭',
data: this.closedBugsCpd,
type: 'line',
smooth: true,
itemStyle: {
normal: {
// 折点颜色样式
color: 'red',
lineStyle: {
// 折线颜色样式
color: 'red'
}
}
},
}
]
}
)
},
onProductSelected(product){
this.filters.product=product
this.xmProductStateHiss=[];
},
onProductClear(){
this.filters.product=null
this.xmProductStateHiss=[];
},
onIterationSelected(iteration){
this.filters.iteration=iteration
this.xmProductStateHiss=[];
},
onIterationClear(){
this.filters.iteration=null
this.xmProductStateHiss=[];
}
},//end method
mounted() {
/**
initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
this.dicts=res.data.data;
})
*/
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
//this.charts();
this.open();
}//end mounted
}
</script>
<style scoped>
.image {
width: 100%;
display: block;
}
</style>