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.
 
 
 
 

296 lines
9.7 KiB

<template>
<section>
<el-row :gutter="5" >
<el-col :span="18">
<div>
<div class="echart-box" id="testDayTimesCalc"></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="测试库" v-if="xmTestCasedb && xmTestCasedb.id" >
<span >{{xmTestCasedb.id}} <span v-if="xmTestCasedb.name"><br/>{{ xmTestCasedb.name }} </span> </span>
</el-form-item>
<el-form-item label="归属项目" >
<xm-project-select v-if="!xmProject" ref="xmProjectSelect" style="display:inline;" :auto-select="false" :link-product-id="xmProductCpd?xmProductCpd.id:null" @row-click="onProjectSelected" @clear="onProjectClear"></xm-project-select>
<span v-else>{{xmProject.id}} <span v-if="xmProject.name"><br/>{{ xmProject.name }} </span> </span>
</el-form-item>
<el-form-item label="归属产品" >
<xm-product-select v-if="!xmProductCpd || !xmProductCpd.id" ref="xmProductSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProductSelected" :iterationId="xmTestPlan?xmTestPlan.id:null" @clear="onProductClear"></xm-product-select>
<span v-else>{{xmProductCpd.id}} <span v-if="xmProductCpd.productName"><br/>{{ xmProductCpd.productName }} </span> </span>
</el-form-item>
<el-form-item label="归属迭代" v-if="xmIteration && xmIteration.id">
<span> {{xmIteration.id}}
<span v-if="xmIteration.iterationName"><br/>{{ xmIteration.iterationName }} </span>
</span>
</el-form-item>
<el-form-item label="归属迭代" v-else-if="filters.product && filters.product.id">
<xm-iteration-select ref="xmIterationSelect" :auto-select="false" :product-id="filters.product?filters.product.id:null" :link-project-id="xmProject?xmProject.id:null" placeholder="迭代" @row-click="onIterationSelected" @clear="onIterationClear"></xm-iteration-select>
</el-form-item>
<el-form-item label="测试计划" v-if="xmTestPlan && xmTestPlan.id">
<span> {{xmTestPlan.id}}
<span v-if="xmTestPlan.name"><br/>{{ xmTestPlan.name }} </span>
</span>
</el-form-item>
<el-form-item label="测试计划" v-else-if="filters.product && filters.product.id">
<span v-if="filters.testPlan">{{ filters.testPlan.name }}</span>
<el-button v-if="filters.testPlan" type="text" @click="filters.testPlan=null" plain icon="el-icon-circle-close">清除</el-button>
<el-button v-if="!filters.testPlan" type="text" @click="$refs['xmTestPlanSelectRef'].open()" plain>选择计划</el-button>
</el-form-item>
<el-form-item label="日期区间">
<br>
<mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startExecDate" end-key="endExecDate"></mdp-date-range>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getXmTestDayTimesList">查询</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<xm-test-plan-select ref="xmTestPlanSelectRef" :casedb-id="xmTestCasedb?xmTestCasedb.id:null" :product-id="xmProduct?xmProduct.id:null" :project-id="xmProject?xmProject.id:null" placeholder="迭代" @select="onXmTestPlanSelected" @clear="onXmTestPlanClear"></xm-test-plan-select >
</section>
</template>
<script>
import util from '@/common/js/util';//全局公共库
import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
import { mapGetters } from 'vuex'
import { getXmTestDayTimesList } from '@/api/xm/core/xmTestPlanCase';
import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//项目
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
import xmTestPlanSelect from '@/views/xm/core/xmTestPlan/XmTestPlanSelect';//计划选择器
export default {
components: {
XmProjectSelect,XmProductSelect,XmIterationSelect,xmTestPlanSelect,
},
props:['xmProject','xmProduct','xmIteration','xmTestCasedb','xmTestPlan'],
computed: {
...mapGetters([
'userInfo','roles'
]),
datesCpd(){
if(!this.xmTestDayTimesList || this.xmTestDayTimesList.length==0){
return []
}else{
return this.xmTestDayTimesList.map(i=>i.execDate)
}
},
testDayTimesCpd(){
if(!this.xmTestDayTimesList || this.xmTestDayTimesList.length==0){
return []
}else{
return this.xmTestDayTimesList.map(i=>i.hadExec)
}
},
title(){
var preName=""
if(this.filters.testPlan && this.filters.testPlan.id){
preName=`测试计划【${this.filters.testPlan.name}`
}else if(this.filters.testCasedb && this.filters.testCasedb.id){
preName=`测试库【${this.filters.testCasedb.name}`
}else if(this.filters.iteration && this.filters.iteration.id){
preName=`迭代【${this.filters.iteration.iterationName}`
}else if(this.filters.project && this.filters.project.id){
if(this.filters.project.name){
preName=`项目【${this.filters.project.name}`
}else{
preName=`项目【${this.filters.project.id}`
}
}else if(this.filters.product && this.filters.product.id){
if(this.filters.product.productName){
preName=`产品【${this.filters.product.productName}`
}else{
preName=`产品【${this.filters.product.id}`
}
}
return preName+ "测试用例每日执行次数统计"
},
xmProductCpd(){
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,
xmTestDayTimesList:[],
}//end return
},//end data
methods: {
getXmTestDayTimesList(){
var params={ }
if(this.filters.product && this.filters.product.id){
params.productId=this.filters.product.id
}
if(this.filters.project && this.filters.project.id){
params.projectId=this.filters.project.id
}
if(this.filters.iteration && this.filters.iteration.id){
params.linkIterationId=this.filters.iteration.id
}
if(this.filters.testPlan && this.filters.testPlan.id){
params.planId=this.filters.testPlan.id
}
if(this.filters.testCasedb && this.filters.testCasedb.id){
params.casedbId=this.filters.testCasedb.id
}
getXmTestDayTimesList(params).then(res=>{
this.xmTestDayTimesList=res.data.tips.isOk?res.data.data:this.xmTestDayTimesList;
})
},
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();
this.$nextTick(()=>{
this.getXmTestDayTimesList();
})
},
drawCharts() {
this.myChart = this.$echarts.init(document.getElementById("testDayTimesCalc"));
this.myChart.setOption(
{
title: {
text: this.title,
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,
xAxis: {
type: 'category',
data: this.datesCpd
},
yAxis: {
type: 'value'
},
series: [
{
name:'次数',
data: this.testDayTimesCpd,
type: 'line',
label:{
show: true,
},
smooth: true,
}
]
}
)
},
onProjectSelected(project){
this.filters.project=project
},
onProjectClear(){
this.filters.project=null
},
onProductSelected(product){
this.filters.product=product
},
onProductClear(){
this.filters.product=null
},
onIterationSelected(iteration){
this.filters.iteration=iteration
},
onIterationClear(){
this.filters.iteration=null
},
onXmTestPlanSelected(xmTestPlan){
this.filters.testPlan=xmTestPlan
},
onXmTestPlanClear(){
this.filters.testPlan=null
},
},//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>