dataStatistics.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="data-main">
  3. <article>
  4. <div class="data-num">
  5. <div class="data-add red">
  6. <img :src="bugImg">
  7. </div>
  8. <div class="data-detail">
  9. <b v-if="bugData">{{ bugData.total }}</b>
  10. <span>缺陷数量</span>
  11. </div>
  12. </div>
  13. <div class="data-line" />
  14. <div class="data-chart">
  15. <normal-echart :chart-id="'chartThird'" :option="echartsOption3" />
  16. </div>
  17. </article>
  18. <createdBug v-if="bug_open" ref="createdBug" />
  19. </div>
  20. </template>
  21. <script>
  22. import normalEchart from '@/components/chart/normalEchart'
  23. import createdBug from '@/views/projectManage/bugList/file/createdBug'
  24. import { getTaskSumData } from '@/api/taskIndex'
  25. import bugImg from '@/assets/detailPage/缺陷修复@2x.png'
  26. export default {
  27. components: {
  28. normalEchart,
  29. createdBug
  30. },
  31. data() {
  32. return {
  33. bugImg: bugImg,
  34. edit: false,
  35. dataChart1: false,
  36. echartsOption3: null,
  37. requirement: {},
  38. bug_open: false, // 新建缺陷
  39. bugData: null // 缺陷数据
  40. }
  41. },
  42. mounted() {
  43. this.getProjectSumData()
  44. },
  45. methods: {
  46. async getProjectSumData() { // 获取数据
  47. const res = await getTaskSumData(this.$route.query.id)
  48. if (res.code === 200) {
  49. this.bugData = res.data.bugData
  50. this.setDataChart(this.bugData.detail, 'echartsOption3')
  51. }
  52. },
  53. setDataChart(data, obj) {
  54. this[obj] = {
  55. color: ['#3AA1FF'],
  56. tooltip: { trigger: 'axis', axisPointer: { type: 'line' }}, // 默认为直线,可选为:'line' | 'shadow'
  57. grid: { left: '15%', right: '15%', top: '15%', bottom: '10%', containLabel: true },
  58. xAxis: [{ type: 'category', data: data.xaxis, axisTick: { alignWithLabel: true }}],
  59. yAxis: [{ type: 'value', axisLine: { show: false }, splitLine: { lineStyle: { type: 'dashed' }}}],
  60. series: [
  61. {
  62. name: data.yaxis[0].name, type: 'bar', barWidth: '20px', data: data.yaxis[0].data || [],
  63. itemStyle: { normal: { label: { show: true, formatter: '{c}', position: 'top' }}}
  64. }
  65. ]
  66. }
  67. },
  68. created_bug() { // 缺陷创建
  69. this.bug_open = true
  70. this.$nextTick(() => {
  71. this.$refs.createdBug.init(1)
  72. })
  73. },
  74. change() {
  75. this.$emit('change')
  76. }
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .data-main {
  82. padding: 61px 0 41px 0;
  83. }
  84. article{
  85. width: 85%;
  86. height: 260px;
  87. min-width: 1043px;
  88. margin: 0 auto 20px auto;
  89. box-shadow:0px 0px 11px rgba(238,240,245,1);
  90. border-radius:7px;
  91. display: flex;
  92. align-items: center;
  93. justify-content: space-between;
  94. .data-num {
  95. width: 41%;
  96. height: 100%;
  97. display: flex;
  98. align-items: center;
  99. justify-content: space-between;
  100. padding: 0 127px 0 62px;
  101. .data-add {
  102. height: 92px;
  103. width: 92px;
  104. border-radius: 50%;
  105. position: relative;
  106. display: flex;
  107. justify-content: center;
  108. align-items: center;
  109. img {
  110. height: 36px;
  111. width: 36px;
  112. }
  113. }
  114. .blue {
  115. background-color:rgba(64,158,255,0.15);
  116. }
  117. .green {
  118. background-color:rgba(126,211,33,0.15);
  119. }
  120. .red {
  121. background-color: rgba(245,108,108, 0.15);
  122. }
  123. .data-detail {
  124. color: #333333;
  125. display: flex;
  126. width: 70px;
  127. flex-direction: column;
  128. align-items: center;
  129. b{
  130. font-size: 75px;
  131. }
  132. span {
  133. font-size: 16px;
  134. }
  135. }
  136. }
  137. .data-line {
  138. width:0px;
  139. height:156px;
  140. border:1px solid rgba(112,112,112,1);
  141. opacity:0.15;
  142. }
  143. .data-chart {
  144. width: 58%;
  145. height: 100%;
  146. }
  147. }
  148. </style>