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
9.7 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
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="testDayTimesCalc"
  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 label="日期区间">
  43. <br>
  44. <mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startExecDate" end-key="endExecDate"></mdp-date-range>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" @click="getXmTestDayTimesList">查询</el-button>
  48. </el-form-item>
  49. </el-form>
  50. </el-col>
  51. </el-row>
  52. <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 >
  53. </section>
  54. </template>
  55. <script>
  56. import util from '@/common/js/util';//全局公共库
  57. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  58. import { mapGetters } from 'vuex'
  59. import { getXmTestDayTimesList } from '@/api/xm/core/xmTestPlanCase';
  60. import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//项目
  61. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品
  62. import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
  63. import xmTestPlanSelect from '@/views/xm/core/xmTestPlan/XmTestPlanSelect';//计划选择器
  64. export default {
  65. components: {
  66. XmProjectSelect,XmProductSelect,XmIterationSelect,xmTestPlanSelect,
  67. },
  68. props:['xmProject','xmProduct','xmIteration','xmTestCasedb','xmTestPlan'],
  69. computed: {
  70. ...mapGetters([
  71. 'userInfo','roles'
  72. ]),
  73. datesCpd(){
  74. if(!this.xmTestDayTimesList || this.xmTestDayTimesList.length==0){
  75. return []
  76. }else{
  77. return this.xmTestDayTimesList.map(i=>i.execDate)
  78. }
  79. },
  80. testDayTimesCpd(){
  81. if(!this.xmTestDayTimesList || this.xmTestDayTimesList.length==0){
  82. return []
  83. }else{
  84. return this.xmTestDayTimesList.map(i=>i.hadExec)
  85. }
  86. },
  87. title(){
  88. var preName=""
  89. if(this.filters.testPlan && this.filters.testPlan.id){
  90. preName=`测试计划【${this.filters.testPlan.name}`
  91. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  92. preName=`测试库【${this.filters.testCasedb.name}`
  93. }else if(this.filters.iteration && this.filters.iteration.id){
  94. preName=`迭代【${this.filters.iteration.iterationName}`
  95. }else if(this.filters.project && this.filters.project.id){
  96. if(this.filters.project.name){
  97. preName=`项目【${this.filters.project.name}`
  98. }else{
  99. preName=`项目【${this.filters.project.id}`
  100. }
  101. }else if(this.filters.product && this.filters.product.id){
  102. if(this.filters.product.productName){
  103. preName=`产品【${this.filters.product.productName}`
  104. }else{
  105. preName=`产品【${this.filters.product.id}`
  106. }
  107. }
  108. return preName+ "测试用例每日执行次数统计"
  109. },
  110. xmProductCpd(){
  111. if(this.xmProduct && this.xmProduct.id){
  112. return this.xmProduct
  113. }
  114. return null;
  115. }
  116. },
  117. watch: {
  118. datesCpd(){
  119. this.$nextTick(()=>{
  120. this.drawCharts();
  121. })
  122. }
  123. },
  124. data() {
  125. return {
  126. filters:{
  127. category:'',
  128. product:null,
  129. project:null,
  130. testPlan:null,
  131. iteration:null,
  132. testCasedb:null,
  133. },
  134. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  135. load:{ list: false, edit: false, del: false, add: false },//查询中...
  136. dateRanger:[],
  137. maxTableHeight:300,
  138. visible:false,
  139. xmTestDayTimesList:[],
  140. }//end return
  141. },//end data
  142. methods: {
  143. getXmTestDayTimesList(){
  144. var params={ }
  145. if(this.filters.product && this.filters.product.id){
  146. params.productId=this.filters.product.id
  147. }
  148. if(this.filters.project && this.filters.project.id){
  149. params.projectId=this.filters.project.id
  150. }
  151. if(this.filters.iteration && this.filters.iteration.id){
  152. params.linkIterationId=this.filters.iteration.id
  153. }
  154. if(this.filters.testPlan && this.filters.testPlan.id){
  155. params.planId=this.filters.testPlan.id
  156. }
  157. if(this.filters.testCasedb && this.filters.testCasedb.id){
  158. params.casedbId=this.filters.testCasedb.id
  159. }
  160. getXmTestDayTimesList(params).then(res=>{
  161. this.xmTestDayTimesList=res.data.tips.isOk?res.data.data:this.xmTestDayTimesList;
  162. })
  163. },
  164. open(){
  165. this.visible=true;
  166. this.filters.testPlan=this.xmTestPlan
  167. this.filters.product=this.xmProduct
  168. this.filters.project=this.xmProject
  169. this.filters.iteration=this.xmIteration
  170. this.filters.testCasedb=this.xmTestCasedb
  171. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  172. this.$nextTick(()=>{
  173. this.getXmTestDayTimesList();
  174. })
  175. },
  176. drawCharts() {
  177. this.myChart = this.$echarts.init(document.getElementById("testDayTimesCalc"));
  178. this.myChart.setOption(
  179. {
  180. title: {
  181. text: this.title,
  182. left: 'center'
  183. },
  184. tooltip: {
  185. trigger: 'axis',
  186. },
  187. barMaxWidth: 100,
  188. toolbox: {
  189. show: true,
  190. right:"20px",
  191. feature: {
  192. dataView: { show: true, readOnly: false },
  193. magicType: { show: true, type: ['line', 'bar'] },
  194. saveAsImage: { show: true }
  195. }
  196. },
  197. calculable: true,
  198. xAxis: {
  199. type: 'category',
  200. data: this.datesCpd
  201. },
  202. yAxis: {
  203. type: 'value'
  204. },
  205. series: [
  206. {
  207. name:'次数',
  208. data: this.testDayTimesCpd,
  209. type: 'line',
  210. label:{
  211. show: true,
  212. },
  213. smooth: true,
  214. markPoint: {
  215. data: [
  216. { type: 'max', name: 'Max' },
  217. { type: 'min', name: 'Min' }
  218. ]
  219. },
  220. }
  221. ]
  222. }
  223. )
  224. },
  225. onProjectSelected(project){
  226. this.filters.project=project
  227. },
  228. onProjectClear(){
  229. this.filters.project=null
  230. },
  231. onProductSelected(product){
  232. this.filters.product=product
  233. },
  234. onProductClear(){
  235. this.filters.product=null
  236. },
  237. onIterationSelected(iteration){
  238. this.filters.iteration=iteration
  239. },
  240. onIterationClear(){
  241. this.filters.iteration=null
  242. },
  243. onXmTestPlanSelected(xmTestPlan){
  244. debugger;
  245. this.filters.testPlan=xmTestPlan
  246. },
  247. onXmTestPlanClear(){
  248. this.filters.testPlan=null
  249. },
  250. },//end method
  251. mounted() {
  252. /**
  253. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  254. this.dicts=res.data.data;
  255. })
  256. */
  257. //this.charts();
  258. this.open();
  259. }//end mounted
  260. }
  261. </script>
  262. <style scoped>
  263. .image {
  264. width: 100%;
  265. display: block;
  266. }
  267. </style>