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.

381 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
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="showParams?23:24">
  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="showParams?1:0" 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;margin-right:10px;z-index: 99999;" icon="el-icon-more" @click="filterVisible=!filterVisible"></el-button>
  13. <el-row>
  14. <el-button type="danger" icon="el-icon-delete" @click="$emit('delete',cfg)">从报告移出该报表</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="归属产品">
  20. <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>
  21. <span v-else>{{xmProductCpd.id}} <span v-if="xmProductCpd.productName"><br/>{{ xmProductCpd.productName }} </span> </span>
  22. </el-form-item>
  23. <el-form-item label="归属迭代" v-if="xmIteration && xmIteration.id">
  24. <span> {{xmIteration.id}}
  25. <span v-if="xmIteration.iterationName"><br/>{{ xmIteration.iterationName }} </span>
  26. </span>
  27. </el-form-item>
  28. <el-form-item label="归属迭代" v-else-if="filters.product && filters.product.id">
  29. <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>
  30. </el-form-item>
  31. <el-form-item label="日期区间">
  32. <br>
  33. <mdp-date-range v-model="params" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button type="primary" style="float:right;" icon="el-icon-search" @click="listXmIterationStateHis">查询</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </el-row>
  40. </el-popover>
  41. </el-col>
  42. </el-row>
  43. </section>
  44. </template>
  45. <script>
  46. import util from '@/common/js/util';//全局公共库
  47. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  48. import { mapGetters } from 'vuex'
  49. import { listXmIterationStateHis } from '@/api/xm/core/xmIterationStateHis';
  50. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品选择界面
  51. import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
  52. export default {
  53. components: {
  54. XmIterationSelect,XmProductSelect,
  55. },
  56. props:['id','cfg','category','showToolBar','showParams','isRptCfg','rptDatas','xmProduct','xmProject','xmIteration'],
  57. computed: {
  58. ...mapGetters([
  59. 'userInfo','roles'
  60. ]),
  61. datesCpd(){
  62. if(this.rawDatas.length==0){
  63. return []
  64. }else{
  65. return this.rawDatas.map(i=>i.bizDate)
  66. }
  67. },
  68. closedBugsCpd(){
  69. if(this.rawDatas.length==0){
  70. return []
  71. }else{
  72. return this.rawDatas.map(i=>i.closedBugs)
  73. }
  74. },
  75. activeBugsCpd(){
  76. if(this.rawDatas.length==0){
  77. return []
  78. }else{
  79. return this.rawDatas.map(i=> i.activeBugs)
  80. }
  81. },
  82. confirmedBugsCpd(){
  83. if(this.rawDatas.length==0){
  84. return []
  85. }else{
  86. return this.rawDatas.map(i=> i.confirmedBugs)
  87. }
  88. },
  89. resolvedBugsCpd(){
  90. if(this.rawDatas.length==0){
  91. return []
  92. }else{
  93. return this.rawDatas.map(i=>i.resolvedBugs)
  94. }
  95. },
  96. titleCpd(){
  97. var preName=""
  98. if(this.filters.testPlan && this.filters.testPlan.id){
  99. preName=`测试计划【${this.filters.testPlan.name}`
  100. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  101. preName=`测试库【${this.filters.testCasedb.name}`
  102. }else if(this.filters.iteration && this.filters.iteration.id){
  103. preName=`迭代【${this.filters.iteration.iterationName}`
  104. }else if(this.filters.product && this.filters.product.id){
  105. if(this.filters.product.productName){
  106. preName=`产品【${this.filters.product.productName}`
  107. }else{
  108. preName=`产品【${this.filters.product.id}`
  109. }
  110. }else if(this.filters.project && this.filters.project.id){
  111. if(this.filters.project.name){
  112. preName=`项目【${this.filters.project.name}`
  113. }else{
  114. preName=`项目【${this.filters.project.id}`
  115. }
  116. }
  117. return preName+'缺陷每日趋势图'
  118. },
  119. xmProductCpd(){
  120. if(this.xmIteration && this.xmIteration.id){
  121. return {id:this.xmIteration.productId,productName:this.xmIteration.productName}
  122. }
  123. if(this.xmProduct && this.xmProduct.id){
  124. return this.xmProduct
  125. }
  126. return null;
  127. }
  128. },
  129. watch: {
  130. datesCpd(){
  131. this.$nextTick(()=>{
  132. this.drawCharts();
  133. })
  134. }
  135. },
  136. data() {
  137. return {
  138. filterVisible:false,
  139. filters:{
  140. category:'',
  141. product:null,
  142. project:null,
  143. testPlan:null,
  144. iteration:null,
  145. testCasedb:null,
  146. },
  147. params:{
  148. },
  149. title:'',//报表配置项
  150. remark:'', //报表配置项
  151. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  152. load:{ list: false, edit: false, del: false, add: false },//查询中...
  153. dateRanger:[],
  154. maxTableHeight:300,
  155. visible:false,
  156. rawDatas:[],
  157. }//end return
  158. },//end data
  159. methods: {
  160. listXmIterationStateHis(){
  161. if(!this.filters.product){
  162. this.$notify({position:'bottom-left',showClose:true,message:'请先选中产品',type:'warning'})
  163. return;
  164. }
  165. if(!this.filters.iteration){
  166. this.$notify({position:'bottom-left',showClose:true,message:'请先选中迭代',type:'warning'})
  167. return;
  168. }
  169. var params={...this.params,orderBy:'biz_date asc'}
  170. listXmIterationStateHis(params).then(res=>{
  171. this.rawDatas=res.data.tips.isOk?res.data.data:this.rawDatas;
  172. })
  173. },
  174. open(){
  175. this.visible=true;
  176. this.filters.testPlan=this.xmTestPlan
  177. this.filters.product=this.xmProduct
  178. this.filters.project=this.xmProject
  179. this.filters.iteration=this.xmIteration
  180. this.filters.testCasedb=this.xmTestCasedb
  181. if( this.filters.testPlan && this.filters.testPlan.id){
  182. this.params.planId= this.filters.testPlan.id
  183. }
  184. if( this.filters.product && this.filters.product.id){
  185. this.params.productId= this.filters.product.id
  186. }
  187. if( this.filters.project && this.filters.project.id){
  188. this.params.projectId= this.filters.project.id
  189. }
  190. if( this.filters.iteration && this.filters.iteration.id){
  191. this.params.iterationId= this.filters.iteration.id
  192. }
  193. if( this.filters.testCasedb && this.filters.testCasedb.id){
  194. this.params.casedbId= this.filters.testCasedb.id
  195. }
  196. if(this.cfg && this.cfg.id){
  197. this.params=this.cfg.params
  198. this.title=this.cfg.title
  199. this.remark=this.cfg.remark
  200. }
  201. if(this.showToolBar && !this.title){
  202. this.title="企业工作项每日趋势图"
  203. }
  204. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  205. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  206. this.$nextTick(()=>{
  207. this.listXmIterationStateHis();
  208. })
  209. },
  210. drawCharts() {
  211. this.myChart = this.$echarts.init(document.getElementById(this.id));
  212. this.myChart.setOption(
  213. {
  214. title: {
  215. text: this.titleCpd,
  216. left: 'center'
  217. },
  218. tooltip: {
  219. trigger: 'axis'
  220. },
  221. barMaxWidth: 100,
  222. toolbox: {
  223. show: true,
  224. top:"5%",
  225. right:"10px",
  226. feature: {
  227. dataView: { show: true, readOnly: false },
  228. magicType: { show: true, type: ['line', 'bar'] },
  229. saveAsImage: { show: true }
  230. }
  231. },
  232. calculable: true,
  233. legend: {
  234. bottom: 'bottom',
  235. data: ['新提出','执行中','已解决','已关闭']
  236. },
  237. xAxis: {
  238. type: 'category',
  239. data: this.datesCpd
  240. },
  241. yAxis: {
  242. type: 'value'
  243. },
  244. series: [
  245. {
  246. name:'新提出',
  247. data: this.activeBugsCpd,
  248. type: 'line',
  249. smooth: true,
  250. itemStyle: {
  251. normal: {
  252. // 折点颜色样式
  253. color: 'orange',
  254. lineStyle: {
  255. // 折线颜色样式
  256. color: 'orange'
  257. }
  258. }
  259. },
  260. },
  261. {
  262. name:'执行中',
  263. data: this.confirmedBugsCpd,
  264. type: 'line',
  265. smooth: true,
  266. itemStyle: {
  267. normal: {
  268. // 折点颜色样式
  269. color: 'blue',
  270. lineStyle: {
  271. // 折线颜色样式
  272. color: 'blue'
  273. }
  274. }
  275. },
  276. },
  277. {
  278. name:'已解决',
  279. data: this.resolvedBugsCpd,
  280. type: 'line',
  281. smooth: true,
  282. itemStyle: {
  283. normal: {
  284. // 折点颜色样式
  285. color: 'green',
  286. lineStyle: {
  287. // 折线颜色样式
  288. color: 'green'
  289. }
  290. }
  291. },
  292. },
  293. {
  294. name:'已关闭',
  295. data: this.closedBugsCpd,
  296. type: 'line',
  297. smooth: true,
  298. itemStyle: {
  299. normal: {
  300. // 折点颜色样式
  301. color: 'red',
  302. lineStyle: {
  303. // 折线颜色样式
  304. color: 'red'
  305. }
  306. }
  307. },
  308. }
  309. ]
  310. }
  311. )
  312. },
  313. onProductSelected(product){
  314. this.filters.product=product
  315. },
  316. onProductClear(){
  317. this.filters.product=null
  318. },
  319. onIterationSelected(iteration){
  320. this.filters.iteration=iteration
  321. },
  322. onIterationClear(){
  323. this.filters.iteration=null
  324. }
  325. },//end method
  326. mounted() {
  327. /**
  328. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  329. this.dicts=res.data.data;
  330. })
  331. */
  332. //this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  333. //this.charts();
  334. this.open();
  335. }//end mounted
  336. }
  337. </script>
  338. <style scoped>
  339. .image {
  340. width: 100%;
  341. display: block;
  342. }
  343. </style>