index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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 v-loading="listLoading" 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="requirementBacklogRateChartOption" :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: 222px">
  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: 232px">
  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: 264px; font-size: 50px; text-align: center; padding-top: 30%;">
  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. listLoading: {
  123. type: Boolean,
  124. required: false,
  125. default: false
  126. }
  127. },
  128. data() {
  129. return {
  130. requirementDirectionChartOption: null,
  131. requirementBacklogRateChartOption: null,
  132. versionRequirementChartOption: null,
  133. viewType: null,
  134. // verTabList: ['青桔端', '滴滴小程序'],
  135. verTab: '',
  136. wholeTabList: ['需求', '任务', '项目'],
  137. wholeTab: '需求',
  138. requirementBacklogOptionList: ['研发积压', '测试积压', '产品积压'],
  139. requirementBacklogType: '研发积压',
  140. mainData: {},
  141. needCheckDetialModalList: [
  142. '新增需求', '上线需求', '延期需求', '紧急需求率', '新增任务', '上线任务', '延期任务', '新增项目', '上线项目'
  143. ]
  144. }
  145. },
  146. watch: {
  147. datas() {
  148. this.resetBaseData()
  149. }
  150. },
  151. mounted() {
  152. this.resetBaseData()
  153. },
  154. methods: {
  155. resetBaseData() {
  156. const {
  157. throughputList, // 需求任务项目
  158. requirementDirectionChart, // 需求方向分布图
  159. requirementBacklogRateChart, // 积压率
  160. versionRequirementChart // 版本需求
  161. } = this.datas
  162. // 需求任务项目
  163. if (throughputList) {
  164. this.mainData = { ...this.mainData, throughputList }
  165. }
  166. if (requirementDirectionChart) {
  167. const { xaxis, yaxis } = requirementDirectionChart
  168. this.requirementDirectionChartOption = getOption(xaxis, yaxis[0].data, 'bar', { endValue: 6 })
  169. }
  170. // 积压率
  171. if (requirementBacklogRateChart) {
  172. const { xaxis, yaxis } = requirementBacklogRateChart
  173. this.requirementBacklogRateChartOption = getOption(xaxis, yaxis[0].data, 'line', { endValue: 6 })
  174. }
  175. if (versionRequirementChart) {
  176. this.mainData = { ...this.mainData, versionRequirementChart }
  177. this.verTab = versionRequirementChart[0] && versionRequirementChart[0].label
  178. const obj = {}
  179. versionRequirementChart.forEach(t => {
  180. obj[t.label] = getOption(t.xaxis, t.yaxis[0].data, 'bar', { endValue: 6 })
  181. })
  182. this.versionRequirementChartOption = obj
  183. }
  184. },
  185. changeList() {},
  186. changeTab(type, value) {
  187. this[type] = value
  188. this.$emit('search', { [type]: value })
  189. }
  190. }
  191. }
  192. </script>
  193. <style scoped lang='less'>
  194. .throughputModule {
  195. .throughput {
  196. color: #333;
  197. .throughputRate {
  198. min-width: 100px;
  199. }
  200. .count {
  201. font-weight: 600;
  202. }
  203. }
  204. .item-up {
  205. color:#F32850
  206. }
  207. .item-down {
  208. //color:#9FFF39
  209. color:#7Ed321
  210. }
  211. .itemBox {
  212. box-shadow: 0px 6px 50px rgba(0, 0, 0, 0.05);
  213. padding: 10px 10px;
  214. border-radius: 6px;
  215. &.whole {
  216. padding: 10px 0px;
  217. height: 330px;
  218. .tab {
  219. padding: 0 20px;
  220. }
  221. .list {
  222. margin-top: 8px;
  223. .listItem {
  224. height: 38px;
  225. line-height: 38px;
  226. width: 100%;
  227. background: #fff;
  228. margin: 7px 0px;
  229. padding: 0 20px;
  230. }
  231. }
  232. }
  233. .tab {
  234. .tabItem {
  235. margin-right: 15px;
  236. cursor: pointer;
  237. &.active {
  238. color: #409EFF;
  239. }
  240. }
  241. }
  242. }
  243. .chartSearchbar {
  244. margin-top: 10px;
  245. margin-bottom: 10px;
  246. }
  247. .chartViewHeight {
  248. height: 264px;
  249. width: 100%;
  250. }
  251. }
  252. </style>