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.

197 lines
5.5 KiB

3 years ago
3 years ago
  1. <template>
  2. <section>
  3. <el-dialog fullscreen :title="dialogTitle" append-to-body modal-append-to-body width="80%" top="20px" :visible.sync="visible">
  4. <el-row :gutter="5" v-if="visible">
  5. <el-col :span="18">
  6. <div>
  7. <div class="main" id="testDayTimesCalc"
  8. style="width:100%;height:600px;margin:0 auto;"></div>
  9. <div class="progress"></div>
  10. </div>
  11. </el-col>
  12. <el-col :span="6" class="border">
  13. <el-form :model="filters" class="padding">
  14. <el-form-item label="归属产品" >
  15. <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="xmIteration?xmIteration.id:null" @clear="onProductClear"></xm-product-select>
  16. <span v-else>{{xmProductCpd.id}} <span v-if="xmProductCpd.productName"><br/>{{ xmProductCpd.productName }} </span> </span>
  17. </el-form-item>
  18. <el-form-item label="日期区间">
  19. <br>
  20. <mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startExecDate" end-key="endExecDate"></mdp-date-range>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" @click="getXmTestDayTimesList">查询</el-button>
  24. </el-form-item>
  25. </el-form>
  26. </el-col>
  27. </el-row>
  28. </el-dialog>
  29. </section>
  30. </template>
  31. <script>
  32. import util from '@/common/js/util';//全局公共库
  33. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  34. import { mapGetters } from 'vuex'
  35. import { getXmTestDayTimesList } from '@/api/xm/core/xmTestPlanCase';
  36. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//新增界面
  37. export default {
  38. components: {
  39. XmProductSelect,
  40. },
  41. props:['xmProduct','xmProject'],
  42. computed: {
  43. ...mapGetters([
  44. 'userInfo','roles'
  45. ]),
  46. datesCpd(){
  47. if(this.xmTestDayTimesList.length==0){
  48. return []
  49. }else{
  50. return this.xmTestDayTimesList.map(i=>i.execDate)
  51. }
  52. },
  53. testDayTimesCpd(){
  54. if(this.xmTestDayTimesList.length==0){
  55. return []
  56. }else{
  57. return this.xmTestDayTimesList.map(i=>i.hadExec)
  58. }
  59. },
  60. dialogTitle(){
  61. var productName="";
  62. if(this.filters.product && this.filters.product.id){
  63. if(this.filters.product.productName){
  64. productName=this.filters.product.productName
  65. }else{
  66. productName=this.filters.product.id
  67. }
  68. }
  69. if(productName){
  70. return `产品【${productName}】测试用例每日执行次数统计`
  71. }else{
  72. return "测试用例每日执行次数统计"
  73. }
  74. },
  75. xmProductCpd(){
  76. if(this.xmProduct && this.xmProduct.id){
  77. return this.xmProduct
  78. }
  79. return null;
  80. }
  81. },
  82. watch: {
  83. datesCpd(){
  84. this.$nextTick(()=>{
  85. this.drawCharts();
  86. })
  87. }
  88. },
  89. data() {
  90. return {
  91. filters:{
  92. category:'',
  93. product:null,
  94. project:null,
  95. },
  96. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  97. load:{ list: false, edit: false, del: false, add: false },//查询中...
  98. dateRanger:[],
  99. maxTableHeight:300,
  100. visible:false,
  101. xmTestDayTimesList:[],
  102. }//end return
  103. },//end data
  104. methods: {
  105. getXmTestDayTimesList(){
  106. if(!this.filters.product){
  107. this.$notify({position:'bottom-left',showClose:true,message:'请先选中产品',type:'warning'})
  108. return;
  109. }
  110. var params={productId:this.filters.product.id}
  111. if(this.filters.startExecDate && this.filters.endExecDate){
  112. params.startExecDate=this.filters.startExecDate;
  113. params.endExecDate=this.filters.endExecDate;
  114. }
  115. getXmTestDayTimesList(params).then(res=>{
  116. this.xmTestDayTimesList=res.data.tips.isOk?res.data.data:this.xmTestDayTimesList;
  117. })
  118. },
  119. open(params){
  120. this.visible=true;
  121. this.filters.product=params.xmProduct
  122. this.filters.project=params.xmProject
  123. this.filters.Product=params.xmProduct
  124. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  125. this.$nextTick(()=>{
  126. this.getXmTestDayTimesList();
  127. })
  128. },
  129. drawCharts() {
  130. this.myChart = this.$echarts.init(document.getElementById("testDayTimesCalc"));
  131. this.myChart.setOption(
  132. {
  133. legend: {
  134. right: 40,
  135. data: ['新提出','执行中','已解决','已关闭']
  136. },
  137. xAxis: {
  138. type: 'category',
  139. data: this.datesCpd
  140. },
  141. yAxis: {
  142. type: 'value'
  143. },
  144. series: [
  145. {
  146. name:'已执行',
  147. data: this.testDayTimesCpd,
  148. type: 'bar',
  149. smooth: true,
  150. }
  151. ]
  152. }
  153. )
  154. },
  155. onProductSelected(product){
  156. this.filters.product=product
  157. this.xmTestDayTimesList=[];
  158. },
  159. onProductClear(){
  160. this.filters.product=null
  161. this.xmTestDayTimesList=[];
  162. },
  163. },//end method
  164. mounted() {
  165. /**
  166. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  167. this.dicts=res.data.data;
  168. })
  169. */
  170. //this.charts();
  171. //this.drawCharts();
  172. }//end mounted
  173. }
  174. </script>
  175. <style scoped>
  176. .image {
  177. width: 100%;
  178. display: block;
  179. }
  180. </style>