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.

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