index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <el-row :gutter="20" class="throughputModule">
  3. <el-col :span="6">
  4. <div class="itemBox whole throughput" style="background: #EEF0F5">
  5. <div class="tab">
  6. <span
  7. v-for="item in wholeTabList"
  8. :key="item"
  9. class="tabItem"
  10. :class="wholeTab === item && 'active'"
  11. @click="changeTab('wholeTab', item)"
  12. >{{ item }}</span>
  13. </div>
  14. <div class="list">
  15. <div
  16. v-for="item in mainData.throughputList"
  17. :key="item.pointer"
  18. class="listItem flex-center-between"
  19. @click.stop="$emit(
  20. 'checkDetialModal',
  21. { list: [...mainData.throughputList], activeLabel: item.label }
  22. )"
  23. >
  24. <!-- <div v-html="item.text" />
  25. <div v-html="item.pointer" /> -->
  26. <div>
  27. {{ item.label }}
  28. <span :class="Number(item.chainRatio) > 0 ? 'textRed count' : 'textBlue count'">{{ item.countStr }}</span>
  29. <span>
  30. {{ item.label.includes('率') ? '%' : '个' }}
  31. </span>
  32. </div>
  33. <div class="throughputRate">
  34. <span>环比:</span>
  35. <span :class="Number(item.chainRatio) > 0 ? 'item-up' : 'item-down'">
  36. <i v-if="Number(item.chainRatio) > 0" class="el-icon-caret-top" />
  37. <i v-else class="el-icon-caret-bottom" />
  38. {{ item.chainRatio }}%
  39. </span>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </el-col>
  45. <el-col :span="7">
  46. <div class="itemBox">
  47. <div class="titleLevel3 mb25">需求方向分布图</div>
  48. <div class="chartViewHeight">
  49. <normal-echart v-if="requirementDirectionChartOption" :chart-id="'chart3'" :option="requirementDirectionChartOption" @onClick="changeList" />
  50. </div>
  51. </div>
  52. </el-col>
  53. <el-col :span="6">
  54. <div class="itemBox">
  55. <div class="titleLevel3 mb25">需求积压率</div>
  56. <div class="chartSearchbar inlineBetween mt15">
  57. <div style="width: 200px">
  58. <el-select
  59. v-model="requirementBacklogType"
  60. size="small"
  61. filterable
  62. style="width: 115px"
  63. @change="$emit('search', { requirementBacklogType })"
  64. >
  65. <el-option v-for="(t, index) in requirementBacklogOptionList" :key="index" :label="t" :value="t" />
  66. </el-select>
  67. </div>
  68. </div>
  69. <div class="chartViewHeight" style="height: 178px">
  70. <normal-echart v-if="requirementBacklogRateChartOption" :chart-id="'chart4'" :option="requirementBacklogRateChartOption" @onClick="changeList" />
  71. </div>
  72. </div>
  73. </el-col>
  74. <el-col :span="5">
  75. <div class="itemBox">
  76. <div class="titleLevel3 mb25">版本需求</div>
  77. <div class="tab">
  78. <span
  79. v-for="item in verTabList"
  80. :key="item"
  81. class="tabItem"
  82. :class="verTab === item && 'active'"
  83. @click="changeTab('verTab', item)"
  84. >{{ item }}</span>
  85. </div>
  86. <div class="chartViewHeight" style="height: 189px">
  87. <normal-echart v-if="versionRequirementChartOption" :chart-id="'chart5'" :option="versionRequirementChartOption" @onClick="changeList" />
  88. </div>
  89. </div>
  90. </el-col>
  91. </el-row>
  92. </template>
  93. <script>
  94. import normalEchart from '@/components/chart/normalEchart'
  95. import { getOption } from '@/utils/options'
  96. export default {
  97. components: {
  98. normalEchart
  99. },
  100. props: {
  101. datas: {
  102. type: Object,
  103. required: true,
  104. default: () => {}
  105. }
  106. },
  107. data() {
  108. return {
  109. requirementDirectionChartOption: null,
  110. requirementBacklogRateChartOption: null,
  111. versionRequirementChartOption: null,
  112. echartsOption1: null,
  113. echartsOption2: null,
  114. viewType: null,
  115. verTabList: ['青桔端', '滴滴小程序'],
  116. verTab: '青桔端',
  117. wholeTabList: ['需求', '任务', '项目'],
  118. wholeTab: '需求',
  119. requirementBacklogOptionList: ['研发积压', '测试积压', '产品积压'],
  120. requirementBacklogType: '研发积压',
  121. mainData: {},
  122. needCheckDetialModalList: [
  123. '新增需求', '上线需求', '延期需求', '紧急需求率', '新增任务', '上线任务', '延期任务', '新增项目', '上线项目'
  124. ]
  125. }
  126. },
  127. watch: {
  128. datas() {
  129. this.resetBaseData()
  130. }
  131. },
  132. mounted() {
  133. this.resetBaseData()
  134. this.echartsOption1 = getOption([1, 2, 3], [4, 5, 6], 'bar')
  135. this.echartsOption2 = getOption([1, 2, 3], [4, 5, 6], 'line')
  136. },
  137. methods: {
  138. resetBaseData() {
  139. const {
  140. throughputList, // 需求任务项目
  141. requirementDirectionChart, // 需求方向分布图
  142. requirementBacklogRateChart, // 积压率
  143. versionRequirementChart // 版本需求
  144. } = this.datas
  145. // 需求任务项目
  146. if (throughputList) {
  147. this.mainData = { ...this.mainData, throughputList }
  148. }
  149. if (requirementDirectionChart) {
  150. const { xaxis, yaxis } = requirementDirectionChart
  151. this.requirementDirectionChartOption = getOption(xaxis, yaxis.data, 'bar')
  152. }
  153. // 积压率
  154. if (requirementBacklogRateChart) {
  155. const { xaxis, yaxis } = requirementBacklogRateChart
  156. this.requirementBacklogRateChartOption = getOption(xaxis, yaxis.data, 'line')
  157. }
  158. if (versionRequirementChart) {
  159. const { xaxis, yaxis } = versionRequirementChart
  160. this.versionRequirementChartOption = getOption(xaxis, yaxis.data, 'bar')
  161. }
  162. },
  163. changeList() {},
  164. changeTab(type, value) {
  165. this[type] = value
  166. this.$emit('search', { [type]: value })
  167. }
  168. }
  169. }
  170. </script>
  171. <style scoped lang='less'>
  172. .throughputModule {
  173. .throughput {
  174. color: #333;
  175. .throughputRate {
  176. min-width: 100px;
  177. }
  178. .count {
  179. font-weight: 600;
  180. }
  181. }
  182. .item-up {
  183. color:#F32850
  184. }
  185. .item-down {
  186. color:#9FFF39
  187. }
  188. .itemBox {
  189. box-shadow: 0px 6px 50px rgba(0, 0, 0, 0.05);
  190. padding: 10px 10px;
  191. border-radius: 6px;
  192. &.whole {
  193. padding: 10px 0px;
  194. height: 276px;
  195. .tab {
  196. padding: 0 20px;
  197. }
  198. .list {
  199. margin-top: 8px;
  200. .listItem {
  201. height: 38px;
  202. line-height: 38px;
  203. width: 100%;
  204. background: #fff;
  205. margin: 7px 0px;
  206. padding: 0 20px;
  207. }
  208. }
  209. }
  210. .tab {
  211. .tabItem {
  212. margin-right: 15px;
  213. cursor: pointer;
  214. &.active {
  215. color: #409EFF;
  216. }
  217. }
  218. }
  219. }
  220. .chartSearchbar {
  221. margin-top: 20px;
  222. }
  223. .chartViewHeight {
  224. height: 210px;
  225. width: 100%;
  226. }
  227. }
  228. </style>