index.vue 7.3 KB

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