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.

323 lines
10 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <section>
  3. <el-row :gutter="5" >
  4. <el-col :span="18">
  5. <div>
  6. <div class="main" id="testPlanCaseExecStatusDist"
  7. style="width:100%;height:600px;margin:0 auto;"></div>
  8. <div class="progress"></div>
  9. </div>
  10. </el-col>
  11. <el-col :span="6" class="border">
  12. <el-form :model="filters" class="padding">
  13. <el-form-item label="测试库" v-if="xmTestCasedb && xmTestCasedb.id" >
  14. <span >{{xmTestCasedb.id}} <span v-if="xmTestCasedb.name"><br/>{{ xmTestCasedb.name }} </span> </span>
  15. </el-form-item>
  16. <el-form-item label="归属项目" >
  17. <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>
  18. <span v-else>{{xmProject.id}} <span v-if="xmProject.name"><br/>{{ xmProject.name }} </span> </span>
  19. </el-form-item>
  20. <el-form-item label="归属产品" >
  21. <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>
  22. <span v-else>{{xmProductCpd.id}} <span v-if="xmProductCpd.productName"><br/>{{ xmProductCpd.productName }} </span> </span>
  23. </el-form-item>
  24. <el-form-item label="归属迭代" v-if="xmIteration && xmIteration.id">
  25. <span> {{xmIteration.id}}
  26. <span v-if="xmIteration.iterationName"><br/>{{ xmIteration.iterationName }} </span>
  27. </span>
  28. </el-form-item>
  29. <el-form-item label="归属迭代" v-else-if="filters.product && filters.product.id">
  30. <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>
  31. </el-form-item>
  32. <el-form-item label="测试计划" v-if="xmTestPlan && xmTestPlan.id">
  33. <span> {{xmTestPlan.id}}
  34. <span v-if="xmTestPlan.name"><br/>{{ xmTestPlan.name }} </span>
  35. </span>
  36. </el-form-item>
  37. <el-form-item label="测试计划" v-else-if="filters.product && filters.product.id">
  38. <span v-if="filters.testPlan">{{ filters.testPlan.name }}</span>
  39. <el-button v-if="filters.testPlan" type="text" @click="filters.testPlan=null" plain icon="el-icon-circle-close">清除</el-button>
  40. <el-button v-if="!filters.testPlan" type="text" @click="$refs['xmTestPlanSelectRef'].open()" plain>选择计划</el-button>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button type="primary" icon="el-icon-search" @click="searchXmTestCaseToPlanCalcList">查询</el-button>
  44. </el-form-item>
  45. </el-form>
  46. </el-col>
  47. </el-row>
  48. <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 >
  49. </section>
  50. </template>
  51. <script>
  52. import util from '@/common/js/util';//全局公共库
  53. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  54. import { mapGetters } from 'vuex'
  55. import { getXmTestCaseToPlanCalcList } from '@/api/xm/core/xmTestPlanCase';
  56. import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//项目
  57. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品
  58. import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
  59. import xmTestPlanSelect from '@/views/xm/core/xmTestPlan/XmTestPlanSelect';//计划选择器
  60. export default {
  61. components: {
  62. XmProjectSelect,XmProductSelect,XmIterationSelect,xmTestPlanSelect,
  63. },
  64. props:['xmProject','xmProduct','xmIteration','xmTestCasedb','xmTestPlan'],
  65. computed: {
  66. ...mapGetters([
  67. 'userInfo','roles'
  68. ]),
  69. xmTestCaseToPlanCalcListCpd(){
  70. if(!this.xmTestCaseToPlanCalcList || this.xmTestCaseToPlanCalcList.length==0){
  71. return []
  72. }else{
  73. var names=this.legendCpd;
  74. var datas=[]
  75. this.xmTestCaseToPlanCalcList.forEach(i=>{
  76. var nameIndex=0;
  77. if(i.useTimes<=2){
  78. nameIndex=i.useTimes
  79. }else if(i.useTimes>=3 && i.useTimes<=5){
  80. nameIndex=3
  81. }else if(i.useTimes>5 && i.useTimes<=10){
  82. nameIndex=4
  83. }else if(i.useTimes>10){
  84. nameIndex=5
  85. }
  86. var data={name:names[nameIndex],value:i.caseNum}
  87. datas.push(data)
  88. })
  89. return datas;
  90. }
  91. },
  92. title(){
  93. var preName=""
  94. if(this.filters.testPlan && this.filters.testPlan.id){
  95. preName=`测试计划【${this.filters.testPlan.name}`
  96. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  97. preName=`测试库【${this.filters.testCasedb.name}`
  98. }else if(this.filters.iteration && this.filters.iteration.id){
  99. preName=`迭代【${this.filters.iteration.iterationName}`
  100. }else if(this.filters.project && this.filters.project.id){
  101. if(this.filters.project.name){
  102. preName=`项目【${this.filters.project.name}`
  103. }else{
  104. preName=`项目【${this.filters.project.id}`
  105. }
  106. }else if(this.filters.product && this.filters.product.id){
  107. if(this.filters.product.productName){
  108. preName=`产品【${this.filters.product.productName}`
  109. }else{
  110. preName=`产品【${this.filters.product.id}`
  111. }
  112. }
  113. return preName+'测试用例规划分析'
  114. },
  115. /**0-未测,1-通过,2-受阻,3-忽略,4-失败 */
  116. legendCpd(){
  117. return ['0次','1次','2次','3-5次','5-10次','10次以上']
  118. },
  119. xmProductCpd(){
  120. if(this.xmTestPlan && this.xmTestPlan.id){
  121. return {id:this.xmTestPlan.productId,productName:this.xmTestPlan.productName}
  122. }
  123. if(this.xmProduct && this.xmProduct.id){
  124. return this.xmProduct
  125. }
  126. return null;
  127. }
  128. },
  129. watch: {
  130. xmTestCaseToPlanCalcListCpd(){
  131. this.drawCharts();
  132. }
  133. },
  134. data() {
  135. return {
  136. filters:{
  137. product:null,
  138. project:null,
  139. testPlan:null,
  140. iteration:null,
  141. testCasedb:null,
  142. },
  143. dicts:{testStepTcode:[]},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  144. load:{ list: false, edit: false, del: false, add: false },//查询中...
  145. dateRanger:[],
  146. maxTableHeight:300,
  147. visible:false,
  148. xmTestCaseToPlanCalcList:[],
  149. conditionBtnVisible:false,
  150. }//end return
  151. },//end data
  152. methods: {
  153. formatDict(itemId,val){
  154. var dict=this.dicts[itemId]
  155. if(dict){
  156. var item=dict.find(i=>i.id==val)
  157. if(item){
  158. return item.name
  159. }
  160. }
  161. return val;
  162. },
  163. drawCharts() {
  164. this.myChart = this.$echarts.init(document.getElementById("testPlanCaseExecStatusDist"));
  165. this.myChart.setOption(
  166. {
  167. title: {
  168. text: this.title,
  169. left: 'center'
  170. },
  171. tooltip: {
  172. trigger: 'item',
  173. },
  174. toolbox: {
  175. show: true,
  176. right:"20px",
  177. feature: {
  178. dataView: { show: true, readOnly: false },
  179. saveAsImage: { show: true },
  180. }
  181. },
  182. calculable: true,
  183. legend: {
  184. top:'5%',
  185. left: 'center',
  186. data:this.legendCpd,
  187. },
  188. series: [
  189. {
  190. type: 'pie',
  191. radius: '50%',
  192. data: this.xmTestCaseToPlanCalcListCpd,
  193. emphasis: {
  194. itemStyle: {
  195. shadowBlur: 10,
  196. shadowOffsetX: 0,
  197. shadowColor: 'rgba(0, 0, 0, 0.5)'
  198. }
  199. },
  200. label: {
  201. show: true,
  202. },
  203. }
  204. ]
  205. }
  206. )
  207. },
  208. onXmQuestionSomeFieldsChange(fieldName,$event){
  209. this.xmTestCaseToPlanCalcList=[]
  210. },
  211. searchXmTestCaseToPlanCalcList(){
  212. var params={ }
  213. if(this.filters.product && this.filters.product.id){
  214. params.productId=this.filters.product.id
  215. }
  216. if(this.filters.project && this.filters.project.id){
  217. params.projectId=this.filters.project.id
  218. }
  219. if(this.filters.iteration && this.filters.iteration.id){
  220. params.linkIterationId=this.filters.iteration.id
  221. }
  222. if(this.filters.testPlan && this.filters.testPlan.id){
  223. params.planId=this.filters.testPlan.id
  224. }
  225. if(this.filters.testCasedb && this.filters.testCasedb.id){
  226. params.casedbId=this.filters.testCasedb.id
  227. }
  228. getXmTestCaseToPlanCalcList(params).then(res=>{
  229. this.xmTestCaseToPlanCalcList=res.data.data
  230. })
  231. },
  232. onProjectSelected(project){
  233. this.filters.project=project
  234. },
  235. onProjectClear(){
  236. this.filters.project=null
  237. },
  238. onProductSelected(product){
  239. this.filters.product=product
  240. },
  241. onProductClear(){
  242. this.filters.product=null
  243. },
  244. onIterationSelected(iteration){
  245. this.filters.iteration=iteration
  246. },
  247. onIterationClear(){
  248. this.filters.iteration=null
  249. },
  250. onXmTestPlanSelected(xmTestPlan){
  251. this.filters.testPlan=xmTestPlan
  252. },
  253. onXmTestPlanClear(){
  254. this.filters.testPlan=null
  255. },
  256. initData(){
  257. if(this.xmTestPlan){
  258. this.filters.testPlan=this.xmTestPlan
  259. }
  260. },
  261. sizeAutoChange(){
  262. this.myChart.resize();
  263. },
  264. open(){
  265. this.visible=true;
  266. this.filters.testPlan=this.xmTestPlan
  267. this.filters.product=this.xmProduct
  268. this.filters.project=this.xmProject
  269. this.filters.iteration=this.xmIteration
  270. this.filters.testCasedb=this.xmTestCasedb
  271. this.searchXmTestCaseToPlanCalcList();
  272. }
  273. },//end method
  274. mounted() {
  275. initSimpleDicts('all',['testStepTcode'] ).then(res=>{
  276. this.dicts=res.data.data;
  277. })
  278. this.initData();
  279. this.open();
  280. }//end mounted
  281. }
  282. </script>
  283. <style scoped>
  284. .image {
  285. width: 100%;
  286. display: block;
  287. }
  288. </style>