From 57013b97495950a3d666c76a1684f4cc66bd6f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Mon, 6 Feb 2023 01:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/xm/rpt/index/CompsCard.vue | 57 ++++++--- src/views/xm/rpt/index/CompsCardHisDetail.vue | 17 ++- src/views/xm/rpt/index/CompsSet.vue | 119 ++++++++++++------ src/views/xm/rpt/index/indexForTest.vue | 2 +- 4 files changed, 124 insertions(+), 71 deletions(-) diff --git a/src/views/xm/rpt/index/CompsCard.vue b/src/views/xm/rpt/index/CompsCard.vue index a35d1420..12193df0 100644 --- a/src/views/xm/rpt/index/CompsCard.vue +++ b/src/views/xm/rpt/index/CompsCard.vue @@ -2,7 +2,7 @@
- + @@ -29,7 +29,7 @@
- +
@@ -77,7 +77,7 @@ import { addXmRptData } from '@/api/xm/core/xmRptData'; import { listXmRptConfig,editXmRptConfig,addXmRptConfig } from '@/api/xm/core/xmRptConfig'; -import rptComps from './comps.js';//组件库 +import rptComps from './comps.js';//组件库 export default { components: { @@ -90,9 +90,6 @@ export default { props:['xmTestCasedb','xmTestPlan','xmProduct','xmProject','xmIteration','category','showParams','showCheckedOnly'], computed: { ...mapGetters(['userInfo']), - compIds(){ - return this.compCfgList.map(k=>k.compId) - }, rptConfigParamsCpd(){ //业务类型1-产品报告,2-迭代报告,3-测试计划报告,4-项目报告,5-企业报告 var params={bizType:'5',bizId:this.userInfo.branchId,name:this.userInfo.branchName} @@ -112,16 +109,15 @@ export default { params.bizType='4'; params.bizId=this.xmProject.id params.name=this.xmProject.name - }else if(this.category=='测试级'){ - if(this.xmTestPlan && this.xmTestPlan.id){ - params.bizType='3'; - params.bizId=this.xmTestPlan.id - params.name=this.xmTestPlan.name - }else{ + }else if(this.category=='测试库级'){ params.bizType='6'; params.bizId=this.xmTestCasedb.id params.name=this.xmTestCasedb.name - } + }else if(this.category=='测试计划级'){ + params.bizType='3'; + params.bizId=this.xmTestPlan.id + params.name=this.xmTestPlan.name + } return params; }, @@ -160,7 +156,7 @@ export default { xmRptConfig:{id:'',name:'',bizType:'',bizId:'',cfg:[]}, xmRptData:{id:'',rptName:'',bizId:'',bizType:'',bizDate:'',rptData:[]}, xmRptDataInit:{id:'',rptName:'',bizId:'',bizType:'',bizDate:'',rptData:[]}, - compCfgList:[], + compCfgList:[], maxTableHeight:300, // 布局列数 layoutColNum: 12, @@ -301,17 +297,19 @@ export default { if(this.xmRptConfig && this.xmRptConfig.id && this.xmRptConfig.cfg){ var cfgJson=JSON.parse(this.xmRptConfig.cfg) cfgJson.forEach(k=>k.id=k.compId+seq.sn()) - this.compCfgList=cfgJson; + this.compCfgList=cfgJson; + this.$refs.compsSet.setCheckeds(this.compCfgList.map(k=>k.compId),true) }else{ var defList=this.$refs['compsSet'].rptListCpd if(defList && defList.length>3){ defList=defList.slice(0,3); } defList.forEach(k=>k.id=k.compId+seq.sn()) - this.compCfgList=JSON.parse(JSON.stringify(defList)) + this.compCfgList=JSON.parse(JSON.stringify(defList)) + this.$refs.compsSet.setCheckeds(this.compCfgList.map(k=>k.compId),true) } }, - onCompSelect(comp){ + onCompSelect(comp){ if(this.compCfgList.some(k=>k.compId==comp.compId)){ var compCfg=this.compCfgList.find(k=>k.compId==comp.compId) this.$nextTick(()=>{ @@ -391,8 +389,9 @@ export default { doDelete(compCfg){ var index=this.compCfgList.findIndex(k=>k.id==compCfg.id) if(index>=0){ - this.compCfgList.splice(index,1) - } + this.compCfgList.splice(index,1) + } + this.$refs.compsSet.setChecked(compCfg.compId,false) }, sizeAutoChange(k){ @@ -406,7 +405,8 @@ export default { this.xmRptConfig.name=this.xmRptData.rptName var cfgList=JSON.parse(this.xmRptData.rptData) cfgList.forEach(k=>k.id=k.compId+seq.sn()) - this.compCfgList=cfgList + this.compCfgList=cfgList + this.$refs.compsSet.setCheckeds(this.compCfgList.map(k=>k.compId),true) } } }, @@ -417,6 +417,23 @@ export default { }) }, + onSort(evt,datas){ + datas.forEach((d,index)=>{ + var comp=this.compCfgList.find(k=>k.compId==d.compId) + if(comp){ + comp.index=index + } + }) + this.compCfgList.sort((i1,i2)=>{ + return i1.index-i2.index + }) + var compCfg=this.compCfgList.find(k=>k.compId==datas[evt.newIndex].compId) + this.$nextTick(()=>{ + setTimeout(()=>{ + this.scrollToComp(compCfg) + },200) + }) + } }, diff --git a/src/views/xm/rpt/index/CompsCardHisDetail.vue b/src/views/xm/rpt/index/CompsCardHisDetail.vue index c21f2168..683b7fbe 100644 --- a/src/views/xm/rpt/index/CompsCardHisDetail.vue +++ b/src/views/xm/rpt/index/CompsCardHisDetail.vue @@ -2,7 +2,7 @@
- + @@ -20,7 +20,7 @@
- +
@@ -45,10 +45,7 @@ export default { }, props:['showParams','xmRptData'], computed: { - ...mapGetters(['userInfo']), - compIds(){ - return this.compCfgList.map(k=>k.compId) - }, + ...mapGetters(['userInfo']), //业务类型1-产品报告,2-迭代报告,3-测试计划报告,4-项目报告,5-企业报告,6-测试库报告 category(){ if( !this.xmRptData || !this.xmRptData.id){ @@ -62,7 +59,7 @@ export default { return "迭代级" } if(this.xmRptData.bizType=='3'){ - return "测试级" + return "测试计划级" } if(this.xmRptData.bizType=='4'){ return "项目级" @@ -71,7 +68,7 @@ export default { return "企业级" } if(this.xmRptData.bizType=='6'){ - return "测试计划级" + return "测试库级" } } @@ -118,9 +115,11 @@ export default { if(this.xmRptData && this.xmRptData.rptData){ var cfgJson=JSON.parse(this.xmRptData.rptData) cfgJson.forEach(k=>k.id=k.compId+seq.sn()) - this.compCfgList=cfgJson; + this.compCfgList=cfgJson; + this.$refs.compsSet.setCheckeds(this.compCfgList.map(k=>k.compId),true) }else{ this.compCfgList=[] + this.$refs.compsSet.setCheckeds([],true) } }, onCompSelect(comp){ diff --git a/src/views/xm/rpt/index/CompsSet.vue b/src/views/xm/rpt/index/CompsSet.vue index 1a21e057..331903a1 100644 --- a/src/views/xm/rpt/index/CompsSet.vue +++ b/src/views/xm/rpt/index/CompsSet.vue @@ -8,21 +8,27 @@
@@ -47,24 +55,26 @@ import areaStack from '../images/area-stack.png' import ranjintu from '../images/ranjintu.png' import datasetLink from '../images/dataset-link.png' import bar from '../images/bar.png' +import draggable from 'vuedraggable' import { mapGetters } from 'vuex' import store from '@/store' export default { - props: ['compIds','category','showCheckedOnly'], + props: ['category','showCheckedOnly'], + components:{ + draggable + }, computed: { ...mapGetters(['userInfo']), compsCpd(){ - var comps=this.rptListCpd; - if(this.compIds && this.compIds.length>0){ - comps.forEach(i=>{ - i.isChecked=this.compIds.some(k=>k==i.compId) - }) - } + var comps=this.rptListCpd; if(this.showCheckedOnly){ comps=comps.filter(k=>k.isChecked) - } + } + comps.sort((i1,i2)=>{ + return i1.index-i2.index + }) return comps; }, rptListCpd(){ @@ -94,7 +104,9 @@ export default { }, watch: { - + compsCpd(){ + this.datas= this.compsCpd; + } }, data() { @@ -104,6 +116,7 @@ export default { filters:{ category:'企业级' }, + datas:[], comps: [ {isChecked:false,isCurr:false,rptName:'迭代总结',category:'迭代级',compId:'xmIterationRptOverview',desc:'显示迭代总体情况',img:pieSimple }, {isChecked:false,isCurr:false,rptName:'迭代燃尽图',category:'迭代级',compId:'xmIterationBurnout',desc:'跟踪迭代的剩余工作量按日期变化趋势,识别迭代当前进度情况',img:ranjintu }, @@ -148,28 +161,28 @@ export default { {isChecked:false,isCurr:false,rptName:'项目结算工时每月趋势',category:'项目级',compId:'xmProjectWorkloadSetMonthList',desc:'统计项目每月登记工时、结算工时数量分布情况',img:datasetLink }, - //测试级报表 + //测试库级报表 {isChecked:false,isCurr:false,rptName:'测试计划总结',category:'测试计划级',compId:'xmTestPlanRptOverview',desc:'显示测试计划总体情况',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'测试库总体测试总结',category:'测试级',compId:'xmTestCasedbRptOverview',desc:'显示测试库总体情况',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'测试库总体测试总结',category:'测试库级',compId:'xmTestCasedbRptOverview',desc:'显示测试库总体情况',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'测试用例规划分析',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseToPlanCalc',desc:'显示用例被规划到测试计划中的次数统计',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'测试用例需求覆盖分析',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseMenuSort',initGroupBy:'menu_id',desc:'统计测试用例需求覆盖情况',img:bar }, - {isChecked:false,isCurr:false,rptName:'测试用例模块覆盖分析',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseFuncSort',initGroupBy:'func_id',desc:'统计测试用例覆盖各个模块的情况',img:bar }, - {isChecked:false,isCurr:false,rptName:'测试用例负责人排行榜',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseCuserSort',initGroupBy:'cuserid',desc:'统计测试团队每个人负责的测试用例数并进行排序',img:bar }, + {isChecked:false,isCurr:false,rptName:'测试用例规划分析',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseToPlanCalc',desc:'显示用例被规划到测试计划中的次数统计',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'测试用例需求覆盖分析',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseMenuSort',initGroupBy:'menu_id',desc:'统计测试用例需求覆盖情况',img:bar }, + {isChecked:false,isCurr:false,rptName:'测试用例模块覆盖分析',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseFuncSort',initGroupBy:'func_id',desc:'统计测试用例覆盖各个模块的情况',img:bar }, + {isChecked:false,isCurr:false,rptName:'测试用例负责人排行榜',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestCaseCuserSort',initGroupBy:'cuserid',desc:'统计测试团队每个人负责的测试用例数并进行排序',img:bar }, - {isChecked:false,isCurr:false,rptName:'测试用例执行状态分布',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestPlanCaseExecStatusDist',desc:'按测试用例执行结果统计,通过、失败、忽略、阻塞',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'测试用例执行用户分布',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestPlanCaseUserDist',desc:'统计测试用例负责人用例执行情况',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷回归分布',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionRetestDist',desc:'统计项目中缺陷在回归测试中分布情况,跟踪缺陷的重新打开率;',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'测试次数每日统计',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmTestDayTimesCalc',desc:'统计每日测试用例执行数量',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷状态分布',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionStateDist',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'测试用例执行状态分布',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestPlanCaseExecStatusDist',desc:'按测试用例执行结果统计,通过、失败、忽略、阻塞',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'测试用例执行用户分布',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestPlanCaseUserDist',desc:'统计测试用例负责人用例执行情况',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷回归分布',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionRetestDist',desc:'统计项目中缺陷在回归测试中分布情况,跟踪缺陷的重新打开率;',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'测试次数每日统计',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmTestDayTimesCalc',desc:'统计每日测试用例执行数量',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷状态分布',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionStateDist',desc:'跟踪新提出、执行中、已解决、已关闭状态的缺陷数量按日期变化趋势,识别缺陷处理工作情况',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'缺陷排行榜',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷提出人排行榜',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionAskUserSort',initGroupBy:'ask_userid',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷负责人排行榜',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionHandlerUserSort',initGroupBy:'handler_userid',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷模块排行榜',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionFuncSort',initGroupBy:'func_id',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷需求排行榜',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionMenuSort',initGroupBy:'menu_id',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, - {isChecked:false,isCurr:false,rptName:'缺陷属性分布',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionAttDist',desc:'统计所有缺陷任意属性数量分布情况(实时数据)',img:pieSimple }, - {isChecked:false,isCurr:false,rptName:'缺陷年龄分布',category:'测试计划级,测试级,项目级,产品级,迭代级,企业级',compId:'xmQuestionAgeDist',desc:'统计所有缺陷按照年龄的分布情况,跟踪缺陷的生命周期和响应情况',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'缺陷排行榜',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionSort',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷提出人排行榜',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionAskUserSort',initGroupBy:'ask_userid',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷负责人排行榜',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionHandlerUserSort',initGroupBy:'handler_userid',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷模块排行榜',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionFuncSort',initGroupBy:'func_id',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷需求排行榜',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionMenuSort',initGroupBy:'menu_id',desc:'从缺陷提出人、创建人、负责人、故事等维度统计缺陷数量排行榜(实时数据)',img:bar }, + {isChecked:false,isCurr:false,rptName:'缺陷属性分布',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionAttDist',desc:'统计所有缺陷任意属性数量分布情况(实时数据)',img:pieSimple }, + {isChecked:false,isCurr:false,rptName:'缺陷年龄分布',category:'测试计划级,测试库级,项目级,产品级,迭代级,企业级',compId:'xmQuestionAgeDist',desc:'统计所有缺陷按照年龄的分布情况,跟踪缺陷的生命周期和响应情况',img:pieSimple }, ], maxTableHeight:300, @@ -178,21 +191,45 @@ export default { }, methods: { - + setChecked(compId,checked){ + var com=this.comps.find(c=>c.compId==compId) + if(com){ + com.isChecked=checked + } + }, + setCheckeds(compIds,checked){ + debugger; + this.comps.forEach(k=>{ + if(compIds.some(c=>c==k.compId)){ + k.isChecked=checked + }else{ + k.isChecked=!checked + } + }) + }, onCategroySelect(){ this.selectItem(this.rptListCpd[0]) }, - selectItem(item){ + selectItem(item){ debugger; this.comps.forEach(k=>k.isCurr=false) item.isCurr=true + item.isChecked=true; this.$emit("row-click",item) + }, + datadragEnd(evt){ + debugger; + evt.preventDefault(); + console.log('拖动前的索引 :' + evt.oldIndex) + console.log('拖动后的索引 :' + evt.newIndex) + this.$emit('sort',evt,this.datas) } }, mounted(){ store.dispatch("toggleSideBar",false) + this.comps.forEach((k,index)=>k.index=index) //this.comps.forEach(k=>k.id=k.id?k.id:k.compId) this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el) if(this.category){ @@ -203,7 +240,7 @@ export default { }else if(this.xmIteration && this.xmIteration.id){ this.filters.category="迭代级" }else if(this.xmTestCasedb && this.xmTestCasedb.id){ - this.filters.category="测试级" + this.filters.category="测试库级" }else if(this.xmProject && this.xmProject.id){ this.filters.category="项目级" }else if(this.xmProduct && this.xmProduct.id){ diff --git a/src/views/xm/rpt/index/indexForTest.vue b/src/views/xm/rpt/index/indexForTest.vue index e6157ed1..9b05e364 100644 --- a/src/views/xm/rpt/index/indexForTest.vue +++ b/src/views/xm/rpt/index/indexForTest.vue @@ -1,6 +1,6 @@