Browse Source

优化测试报告

master
陈裕财 3 years ago
parent
commit
a20144ea88
  1. 218
      src/views/xm/core/xmTestPlan/XmTestPlanSelect.vue
  2. 48
      src/views/xm/rpt/reportIndex.vue
  3. 254
      src/views/xm/rpt/testPlan/testPlanCaseExecStatusDist.vue
  4. 188
      src/views/xm/rpt/testPlan/testPlanCaseUserDist.vue

218
src/views/xm/core/xmTestPlan/XmTestPlanSelect.vue

@ -0,0 +1,218 @@
<template>
<section class="page-container border padding" ref="xmTestPlanTable">
<el-dialog append-to-body modal-append-to-body width="60%" top="20px" :visible.sync="visible">
<el-row>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询" clearable></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmTestPlans" icon="el-icon-search">查询</el-button>
</el-row>
<el-row class="padding-top">
<!--列表 XmTestPlan 测试计划-->
<el-table :data="xmTestPlans" :height="maxTableHeight" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<!--
<el-table-column sortable prop="username" width="55" show-overflow-tooltip fixed="left">
<span class="cell-text"> {{scope.row.username}}} </span>
<span class="cell-bar"><el-input style="display:inline;" v-model="scope.row.username" placeholder="" @change="editSomeFields(scope.row,'username',$event)" :maxlength="22"></el-input></span>
</el-table-column>
-->
<el-table-column prop="name" label="计划名称" min-width="250" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.name}} </span>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="120" show-overflow-tooltip>
<template slot-scope="scope">
<mdp-select-dict-tag :dict="dicts['testPlanStatus']" v-model="scope.row.status" effect="dark" @change="editSomeFields(scope.row,'status',$event)"></mdp-select-dict-tag>
</template>
</el-table-column>
<el-table-column prop="stime" label="开始时间" width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.stime}} </span>
</template>
</el-table-column>
<el-table-column prop="etime" label="结束时间" width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.etime}} </span>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template slot-scope="scope">
<el-button type="primary" @click="select(scope.row)">选择</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
</el-dialog>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmTestPlan } from '@/api/xm/core/xmTestPlan';
import { mapGetters } from 'vuex'
export default {
name:'xmTestPlanSelect',
components: {
},
props:['xmTestCasedb'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTestPlans()
}
}
},
data() {
return {
visible:false,
filters: {
key: ''
},
xmTestPlans: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:true,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
testPlanStatus:[],testPlanTcode:[],testStepTcode:[],priority:[],bizFlowState:[]
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmTestPlan
addForm: {
id:'',name:'',casedbId:'',casedbName:'',projectId:'',projectName:'',cuserid:'',cusername:'',ctime:'',stime:'',etime:'',status:'',tcode:'',totalCases:'',okCases:'',errCases:'',igCases:'',blCases:'',productId:'',productName:'',flowState:''
},
editFormVisible: false,//
editForm: {
id:'',name:'',casedbId:'',casedbName:'',projectId:'',projectName:'',cuserid:'',cusername:'',ctime:'',stime:'',etime:'',status:'',tcode:'',totalCases:'',okCases:'',errCases:'',igCases:'',blCases:'',productId:'',productName:'',flowState:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTestPlans();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTestPlans();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmTestPlans();
},
searchXmTestPlans(){
this.pageInfo.count=true;
this.getXmTestPlans();
},
// XmTestPlan
getXmTestPlans() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
if(this.xmTestCasedb && this.xmTestCasedb.id){
params.casedbId=this.xmTestCasedb.id
}
this.load.list = true;
listXmTestPlan(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTestPlans = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
//xmTestPlan
selsChange: function (sels) {
this.sels = sels;
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
open(){
this.visible=true
},
select(row){
this.$emit("select",row)
this.visible=false
}
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
//this.searchXmTestPlans();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTestPlanTable.$el)
});
}
}
</script>
<style scoped>
</style>

48
src/views/xm/rpt/reportIndex.vue

@ -50,7 +50,13 @@
<xm-question-sort ref="xmQuestionSort" :xm-product="xmProduct" :xm-project="xmProject" :xm-iteration="xmIteration"></xm-question-sort> <xm-question-sort ref="xmQuestionSort" :xm-product="xmProduct" :xm-project="xmProject" :xm-iteration="xmIteration"></xm-question-sort>
<xm-product-work-item-day-list ref="xmProductWorkItemDayList" :xm-product="xmProduct" :xm-project="xmProject"></xm-product-work-item-day-list> <xm-product-work-item-day-list ref="xmProductWorkItemDayList" :xm-product="xmProduct" :xm-project="xmProject"></xm-product-work-item-day-list>
<xm-iteration-work-item-day-list ref="xmIterationWorkItemDayList" :xm-product="xmProduct" :xm-project="xmProject" :xm-iteration="xmIteration"></xm-iteration-work-item-day-list> <xm-iteration-work-item-day-list ref="xmIterationWorkItemDayList" :xm-product="xmProduct" :xm-project="xmProject" :xm-iteration="xmIteration"></xm-iteration-work-item-day-list>
</section>
<!--测试计划-->
<xm-test-plan-case-exec-status-dist ref="xmTestPlanCaseExecStatusDist" :xm-product="xmProduct" :xm-project="xmProject" :xm-test-casedb="xmTestCasedb" :xm-test-plan="xmTestPlan"></xm-test-plan-case-exec-status-dist>
<xm-test-plan-case-user-dist ref="xmTestPlanCaseUserDist" :xm-product="xmProduct" :xm-project="xmProject" :xm-test-casedb="xmTestCasedb" :xm-test-plan="xmTestPlan"></xm-test-plan-case-user-dist>
</section>
</template> </template>
<script> <script>
@ -86,6 +92,10 @@
import xmQuestionAgeDist from './product/questionAgeDist' import xmQuestionAgeDist from './product/questionAgeDist'
import xmQuestionSort from './product/questionSort' import xmQuestionSort from './product/questionSort'
import xmTestPlanCaseExecStatusDist from './testPlan/testPlanCaseExecStatusDist'
import xmTestPlanCaseUserDist from './testPlan/testPlanCaseUserDist'
import pieSimple from './images/pie-simple.png' import pieSimple from './images/pie-simple.png'
import lineStack from './images/line-stack.png' import lineStack from './images/line-stack.png'
import areaStack from './images/area-stack.png' import areaStack from './images/area-stack.png'
@ -97,9 +107,12 @@
components: { components: {
xmIterationBurnout,xmMenuDayTrend,xmMenuDayAccumulate,xmMenuAttDist,xmMenuAgeDist,xmMenuSort,xmProductWorkItemDayList,xmTaskDayTrend,xmTaskDayAccumulate,xmTaskAttDist,xmTaskAgeDist,xmTaskSort,xmProjectWorkItemDayList,xmProjectWorkloadSetDayList,xmProjectWorkloadSetMonthList,xmQuestionDayTrend,xmQuestionDayAccumulate,xmQuestionAttDist,xmQuestionAgeDist,xmQuestionSort, xmIterationBurnout,xmMenuDayTrend,xmMenuDayAccumulate,xmMenuAttDist,xmMenuAgeDist,xmMenuSort,xmProductWorkItemDayList,xmTaskDayTrend,xmTaskDayAccumulate,xmTaskAttDist,xmTaskAgeDist,xmTaskSort,xmProjectWorkItemDayList,xmProjectWorkloadSetDayList,xmProjectWorkloadSetMonthList,xmQuestionDayTrend,xmQuestionDayAccumulate,xmQuestionAttDist,xmQuestionAgeDist,xmQuestionSort,
xmIterationXmMenuDayTrend,xmIterationXmMenuDayAccumulate,xmIterationWorkItemDayList,xmIterationXmQuestionDayTrend,xmIterationXmQuestionDayAccumulate
xmIterationXmMenuDayTrend,xmIterationXmMenuDayAccumulate,xmIterationWorkItemDayList,xmIterationXmQuestionDayTrend,xmIterationXmQuestionDayAccumulate,
xmTestPlanCaseExecStatusDist,xmTestPlanCaseUserDist
}, },
props:['xmProduct','xmIteration','xmProject','xmTestCasedb'],
props:['xmProduct','xmIteration','xmProject','xmTestCasedb','xmTestPlan'],
computed: { computed: {
...mapGetters([ ...mapGetters([
'userInfo','roles' 'userInfo','roles'
@ -177,16 +190,23 @@
{rptName:'项目结算工时每月趋势',category:'项目级',ref:'xmProjectWorkloadSetMonthList',desc:'统计项目每月登记工时、结算工时数量分布情况',img:datasetLink }, {rptName:'项目结算工时每月趋势',category:'项目级',ref:'xmProjectWorkloadSetMonthList',desc:'统计项目每月登记工时、结算工时数量分布情况',img:datasetLink },
// //
{rptName:'需求每日趋势',category:'测试库',ref:'xmMenuDayTrend',desc:'跟踪未开始、执行中、已完成、已关闭状态的需求数量按日期变化趋势,识别需求工作情况',img:lineStack },
{rptName:'需求每日累积',category:'测试库',ref:'xmMenuDayAccumulate',desc:'跟踪未开始、执行中、已完成、已关闭状态的需求数量按日期累积情况,识别需求工作的瓶颈',img:areaStack },
{rptName:'需求属性分布',category:'测试库',ref:'xmMenuAttDist',desc:'统计所有需求任意属性数量分布情况(实时数据)',img:pieSimple },
{rptName:'需求年龄分布',category:'测试库',ref:'xmMenuAgeDist',desc:'统计所有需求年龄分布情况(实时数据)',img:pieSimple },
{rptName:'需求排行榜',category:'测试库',ref:'xmMenuSort',desc:'需求提出人、负责人的用户故事数量排行(实时数据)',img:bar },
{rptName:'缺陷每日趋势',category:'测试库',ref:'xmQuestionDayTrend',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:lineStack },
{rptName:'缺陷每日累积',category:'测试库',ref:'xmQuestionDayAccumulate',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期累积情况,识别缺陷处理工作的瓶颈',img:areaStack },
{rptName:'缺陷属性分布',category:'测试库',ref:'xmQuestionAttDist',desc:'统计所有缺陷任意属性数量分布情况(实时数据)',img:pieSimple },
{rptName:'缺陷年龄分布',category:'测试库',ref:'xmQuestionAgeDist',desc:'统计所有缺陷年龄分布情况(实时数据)',img:pieSimple },
{rptName:'缺陷排行榜',category:'测试库',ref:'xmQuestionSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar },
{rptName:'测试用例执行状态分布',category:'测试计划级',ref:'xmTestPlanCaseExecStatusDist',desc:'按测试用例执行结果统计,通过、失败、忽略、阻塞',img:pieSimple },
{rptName:'测试用例执行用户分布',category:'测试计划级',ref:'xmTestPlanCaseUserDist',desc:'统计测试用例负责人用例执行情况',img:bar },
{rptName:'缺陷回归分布',category:'测试计划级',ref:'xmQuestionReTestingDist',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:lineStack },
{rptName:'测试次数每日统计',category:'测试计划级',ref:'xmTestDayTimesCalc',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:lineStack },
{rptName:'缺陷状态分布',category:'测试计划级',ref:'xmQuestionStateDist',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:lineStack },
{rptName:'缺陷每日趋势',category:'测试计划级',ref:'xmQuestionDayTrend',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:lineStack },
{rptName:'缺陷每日累积',category:'测试计划级',ref:'xmQuestionDayAccumulate',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期累积情况,识别缺陷处理工作的瓶颈',img:areaStack },
{rptName:'缺陷属性分布',category:'测试计划级',ref:'xmQuestionAttDist',desc:'统计所有缺陷任意属性数量分布情况(实时数据)',img:pieSimple },
{rptName:'缺陷年龄分布',category:'测试计划级',ref:'xmQuestionAgeDist',desc:'统计所有缺陷年龄分布情况(实时数据)',img:pieSimple },
{rptName:'缺陷提出人排行榜',category:'测试计划级',ref:'xmQuestionAskUserSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar },
{rptName:'缺陷负责人排行榜',category:'测试计划级',ref:'xmQuestionHandlerUserSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar },
{rptName:'缺陷模块排行榜',category:'测试计划级',ref:'xmQuestionSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar },
{rptName:'缺陷需求排行榜',category:'测试计划级',ref:'xmQuestionSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar },
], ],
}//end return }//end return
@ -212,7 +232,7 @@
if(this.xmIteration && this.xmIteration.id){ if(this.xmIteration && this.xmIteration.id){
this.filters.category="迭代级" this.filters.category="迭代级"
}else if(this.xmTestCasedb && this.xmTestCasedb.id){ }else if(this.xmTestCasedb && this.xmTestCasedb.id){
this.filters.category="测试"
this.filters.category="测试计划级"
}else if(this.xmProject && this.xmProject.id){ }else if(this.xmProject && this.xmProject.id){
this.filters.category="项目级" this.filters.category="项目级"
}else if(this.xmProduct && this.xmProduct.id){ }else if(this.xmProduct && this.xmProduct.id){

254
src/views/xm/rpt/testPlan/testPlanCaseExecStatusDist.vue

@ -0,0 +1,254 @@
<template>
<section>
<el-dialog fullscreen :title="title" append-to-body modal-append-to-body width="80%" top="20px" :visible.sync="visible">
<el-row :gutter="5">
<el-col :span="18">
<div>
<div class="main" id="testPlanCaseExecStatusDist"
style="width:100%;height:600px;margin:0 auto;"></div>
<div class="progress"></div>
</div>
</el-col>
<el-col :span="6" class="border padding">
<el-form :model="filters">
<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="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 type="primary" @click="$refs['xmTestPlanSelectRef'].open()">选择计划</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchXmTestPlanCaseExecStatusDist">查询</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</el-dialog>
<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 { getXmTestPlanCaseExecStatusDist } from '@/api/xm/core/xmTestPlanCase';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';//
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//
import xmTestPlanSelect from '@/views/xm/core/xmTestPlan/XmTestPlanSelect';//
export default {
components: {
XmIterationSelect,XmProductSelect,xmTestPlanSelect,
},
props:['xmProject','xmProduct','xmTestCasedb','xmTestPlan'],
computed: {
...mapGetters([
'userInfo','roles'
]),
xmTestPlanCaseExecStatusDistsCpd(){
if(this.xmTestPlanCaseExecStatusDists.length==0){
return []
}else{
var datas=[]
this.xmTestPlanCaseExecStatusDists.forEach(i=>{
var data={}
var itemId="testStepTcode";
data.name=this.formatDict(itemId,i.execStatus)
data.value=i.totalCnt
datas.push(data)
})
return datas;
}
},
title(){
return '测试用例执行结果数量分布'
},
/**0-未测,1-通过,2-受阻,3-忽略,4-失败 */
legendCpd(){
var itemId="testStepTcode";
return this.dicts[itemId].map(i=>this.formatDict(itemId,i.id))
},
xmProductCpd(){
if(this.xmTestPlan && this.xmTestPlan.id){
return {id:this.xmTestPlan.productId,productName:this.xmTestPlan.productName}
}
if(this.xmProduct && this.xmProduct.id){
return this.xmProduct
}
return null;
}
},
watch: {
xmTestPlanCaseExecStatusDistsCpd(){
this.drawCharts();
}
},
data() {
return {
filters:{
testPlan:null,
product:null,
project:null,
},
dicts:{testStepTcode:[]},// 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,
xmTestPlanCaseExecStatusDists:[],
conditionBtnVisible:false,
}//end return
},//end data
methods: {
formatDict(itemId,val){
var dict=this.dicts[itemId]
if(dict){
var item=dict.find(i=>i.id==val)
if(item){
return item.name
}
}
return val;
},
drawCharts() {
this.myChart = this.$echarts.init(document.getElementById("testPlanCaseExecStatusDist"));
this.myChart.setOption(
{
title: {
text: this.title,
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
top:'5%',
left: 'center',
data:this.legendCpd,
},
series: [
{
type: 'pie',
radius: '50%',
data: this.xmTestPlanCaseExecStatusDistsCpd,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
label: {
show: true,
position: 'center'
},
}
]
}
)
},
onXmQuestionSomeFieldsChange(fieldName,$event){
this.xmTestPlanCaseExecStatusDists=[]
},
searchXmTestPlanCaseExecStatusDist(){
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.project && this.filters.project.id){
params.projectId=this.filters.project.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
}
getXmTestPlanCaseExecStatusDist(params).then(res=>{
this.xmTestPlanCaseExecStatusDists=res.data.data
})
},
onProductSelected(product){
this.filters.product=product
},
onProductClear(){
this.filters.product=null
},
onXmTestPlanSelected(xmTestPlan){
this.filters.testPlan=xmTestPlan
},
onXmTestPlanClear(){
this.filters.testPlan=null
},
initData(){
if(this.xmTestPlan){
this.filters.testPlan=this.xmTestPlan
}
},
sizeAutoChange(){
this.myChart.resize();
},
open(params){
this.visible=true;
this.filters.testPlan=this.xmTestPlan
this.filters.product=this.xmProduct
this.filters.project=this.xmProject
this.filters.testCasedb=this.xmTestCasedb
if(this.xmTestPlan && this.xmTestPlan.id){
this.searchXmTestPlanCaseExecStatusDist();
}
}
},//end method
mounted() {
initSimpleDicts('all',['testStepTcode'] ).then(res=>{
this.dicts=res.data.data;
})
this.initData();
}//end mounted
}
</script>
<style scoped>
.image {
width: 100%;
display: block;
}
</style>

188
src/views/xm/rpt/testPlan/testPlanCaseUserDist.vue

@ -0,0 +1,188 @@
<template>
<section>
<el-row class="padding">
<span>{{'成员执行结果分布'}}</span>
<el-popover trigger="manual" v-model="conditionBtnVisible" style="float:right;" width="300">
<el-button slot="reference" icon="el-icon-more" @click="conditionBtnVisible=!conditionBtnVisible"></el-button>
<el-form :model="filters">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchXmTestPlanCaseUserDist">查询</el-button>
</el-form-item>
</el-form>
</el-popover>
</el-row>
<el-row>
<div>
<div class="main" :id="id"
style="width:100%;height:600px;margin:0 auto;"></div>
<div class="progress"></div>
</div>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { mapGetters } from 'vuex'
import { getXmTestPlanCaseUserDist } from '@/api/xm/core/xmTestPlanCase';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';//
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//
export default {
components: {
XmIterationSelect,XmProductSelect,
},
props:['xmTestCasedb','xmTestPlan'],
computed: {
...mapGetters([
'userInfo','roles'
]),
xmTestPlanCaseUserDistsCpd(){
if(this.xmTestPlanCaseUserDists.length==0){
return []
}else{
return this.xmTestPlanCaseUserDists
}
},
title(){
return '成员执行结果数量分布'
},
legendCpd(){
return ['已执行','未执行']
},
id(){
return 'testPlanCaseUserDist-001'
},
},
watch: {
xmTestPlanCaseUserDistsCpd(){
this.drawCharts();
}
},
data() {
return {
filters:{
planId:'',
},
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,
xmTestPlanCaseUserDists:[],
conditionBtnVisible:false,
}//end return
},//end data
methods: {
formatDict(itemId,val){
var dict=this.dicts[itemId]
if(dict){
var item=dict.find(i=>i.id==val)
if(item){
return item.name
}
}
return val;
},
drawCharts() {
this.myChart = this.$echarts.init(document.getElementById(this.id));
this.myChart.setOption(
{
title: {
text: this.title,
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
top:'5%',
left: 'center',
data:this.legendCpd,
},
series: [
{
type: 'pie',
radius: '50%',
data: this.xmTestPlanCaseUserDistsCpd,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
label: {
show: true,
position: 'center'
},
}
]
}
)
},
onXmQuestionSomeFieldsChange(fieldName,$event){
this.xmTestPlanCaseUserDists=[]
},
searchXmTestPlanCaseUserDist(){
var params={...this.filters}
getXmTestPlanCaseUserDist(params).then(res=>{
this.xmTestPlanCaseUserDists=res.data.data
})
},
onProductSelected(product){
this.filters.product=product
},
onProductClear(){
this.filters.product=null
},
onIterationSelected(iteration){
this.filters.iteration=iteration
},
onIterationClear(){
this.filters.iteration=null
},
initData(){
if(this.xmTestPlan){
this.filters.productId=this.xmTestPlan.productId
this.filters.projectId=this.xmTestPlan.projectId
this.filters.planId=this.xmTestPlan.id
}
},
sizeAutoChange(){
this.myChart.resize();
}
},//end method
mounted() {
initSimpleDicts('all',['testPlanTcode'] ).then(res=>{
this.dicts=res.data.data;
})
this.initData();
this.searchXmTestPlanCaseUserDist();
//this.charts();
//this.drawCharts();
}//end mounted
}
</script>
<style scoped>
.image {
width: 100%;
display: block;
}
</style>
Loading…
Cancel
Save