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.

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