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.

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