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.

299 lines
7.2 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
  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="filters" 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','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. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  106. load:{ list: false, edit: false, del: false, add: false },//查询中...
  107. dateRanger:[],
  108. maxTableHeight:300,
  109. visible:false,
  110. xmProductStateHiss:[],
  111. }//end return
  112. },//end data
  113. methods: {
  114. listXmBranchStateHis(){
  115. var params={orderBy:'biz_date asc'}
  116. if(this.filters.startBizDate && this.filters.endBizDate){
  117. params.startBizDate=this.filters.startBizDate;
  118. params.endBizDate=this.filters.endBizDate;
  119. }
  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.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  132. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  133. this.$nextTick(()=>{
  134. this.listXmBranchStateHis();
  135. })
  136. },
  137. drawCharts() {
  138. this.myChart = this.$echarts.init(document.getElementById(this.id));
  139. this.myChart.setOption(
  140. {
  141. title: {
  142. text: this.titleCpd,
  143. left: 'center'
  144. },
  145. tooltip: {
  146. trigger: 'axis',
  147. },
  148. barMaxWidth: 100,
  149. toolbox: {
  150. show: true,
  151. top:"5%",
  152. right:"10px",
  153. feature: {
  154. dataView: { show: true, readOnly: false },
  155. magicType: { show: true, type: ['line', 'bar'] },
  156. saveAsImage: { show: true }
  157. }
  158. },
  159. calculable: true,
  160. legend: {
  161. bottom: 'bottom',
  162. data: ['新提出','执行中','已解决','已关闭']
  163. },
  164. xAxis: {
  165. type: 'category',
  166. data: this.datesCpd
  167. },
  168. yAxis: {
  169. type: 'value'
  170. },
  171. series: [
  172. {
  173. name:'新提出',
  174. data: this.activeBugsCpd,
  175. type: 'line',
  176. smooth: true,
  177. itemStyle: {
  178. normal: {
  179. // 折点颜色样式
  180. color: 'orange',
  181. lineStyle: {
  182. // 折线颜色样式
  183. color: 'orange'
  184. }
  185. }
  186. },
  187. },
  188. {
  189. name:'执行中',
  190. data: this.confirmedBugsCpd,
  191. type: 'line',
  192. smooth: true,
  193. itemStyle: {
  194. normal: {
  195. // 折点颜色样式
  196. color: 'blue',
  197. lineStyle: {
  198. // 折线颜色样式
  199. color: 'blue'
  200. }
  201. }
  202. },
  203. },
  204. {
  205. name:'已解决',
  206. data: this.resolvedBugsCpd,
  207. type: 'line',
  208. smooth: true,
  209. itemStyle: {
  210. normal: {
  211. // 折点颜色样式
  212. color: 'green',
  213. lineStyle: {
  214. // 折线颜色样式
  215. color: 'green'
  216. }
  217. }
  218. },
  219. },
  220. {
  221. name:'已关闭',
  222. data: this.closedBugsCpd,
  223. type: 'line',
  224. smooth: true,
  225. itemStyle: {
  226. normal: {
  227. // 折点颜色样式
  228. color: 'red',
  229. lineStyle: {
  230. // 折线颜色样式
  231. color: 'red'
  232. }
  233. }
  234. },
  235. }
  236. ]
  237. }
  238. )
  239. },
  240. onProductSelected(product){
  241. this.filters.product=product
  242. this.xmProductStateHiss=[];
  243. },
  244. onProductClear(){
  245. this.filters.product=null
  246. this.xmProductStateHiss=[];
  247. },
  248. onIterationSelected(iteration){
  249. this.filters.iteration=iteration
  250. this.xmProductStateHiss=[];
  251. },
  252. onIterationClear(){
  253. this.filters.iteration=null
  254. this.xmProductStateHiss=[];
  255. }
  256. },//end method
  257. mounted() {
  258. /**
  259. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  260. this.dicts=res.data.data;
  261. })
  262. */
  263. this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  264. //this.charts();
  265. this.open();
  266. }//end mounted
  267. }
  268. </script>
  269. <style scoped>
  270. .image {
  271. width: 100%;
  272. display: block;
  273. }
  274. </style>