kpi-du-pont-analysis.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div :class="$style.mainDiv">
  3. <a-card :class="$style.mainDiv">
  4. <div v-if="spinning" :class="$style.loadingDiv">
  5. <a-spin :spinning="spinning" tip="数据加载中..."></a-spin>
  6. </div>
  7. <div v-else>
  8. <div :class="$style.title">{{ title }}</div>
  9. <div :class="[$style.treeDiv, { [$style.isOnlyNode]: !duPontData[0].children }]">
  10. <vue-okr-tree :data="duPontData" :render-content="renderContent" />
  11. </div>
  12. </div>
  13. </a-card>
  14. </div>
  15. </template>
  16. <script>
  17. import { message } from '@/common/one-ui'
  18. import { VueOkrTree } from 'vue-okr-tree'
  19. import 'vue-okr-tree/dist/vue-okr-tree.css'
  20. import kpiDuPontAnalysisService from './kpi-du-pont-analysis-service'
  21. import components from './_import-components/kpi-du-pont-analysis-import'
  22. export default {
  23. name: 'KpiDuPontAnalysis',
  24. metaInfo: {
  25. title: '指标监测-杜邦分析',
  26. },
  27. components: {
  28. vueOkrTree: VueOkrTree,
  29. ...components,
  30. },
  31. data() {
  32. return {
  33. title: '', // 杜邦分析标题
  34. spinning: false,
  35. duPontData: [
  36. {
  37. label: '净资产收益率',
  38. content: '6%',
  39. children: [
  40. {
  41. label: '总资产净利率',
  42. content: '1.69%',
  43. children: [
  44. {
  45. label: '销售净利率',
  46. content: '0.03%',
  47. children: [
  48. {
  49. label: '净利润',
  50. content: '248010.00元',
  51. },
  52. {
  53. label: '销售收入',
  54. content: '972.68元',
  55. },
  56. ],
  57. },
  58. {
  59. label: '总资产周转率',
  60. content: '49.92%',
  61. children: [
  62. {
  63. label: '销售收入',
  64. content: '932.68元',
  65. },
  66. {
  67. label: '资产总额',
  68. content: '195,582.62元',
  69. },
  70. ],
  71. },
  72. ],
  73. },
  74. {
  75. label: '权益乘数',
  76. content: '3.54',
  77. children: [
  78. {
  79. label: '负债',
  80. content: '1,474.18元',
  81. },
  82. {
  83. label: '资产',
  84. content: '2053,62元',
  85. },
  86. ],
  87. },
  88. ],
  89. },
  90. ],
  91. }
  92. },
  93. created() {
  94. // 加载数据
  95. this.fnLoadData()
  96. },
  97. methods: {
  98. // 获取基础数据和分析数据
  99. fnLoadData() {
  100. this.spinning = true
  101. this.title = this.$route.query.title
  102. // 获取监测数据
  103. return kpiDuPontAnalysisService
  104. .fnLoadData({
  105. indiId: parseFloat(this.$route.query.id),
  106. })
  107. .then((res) => {
  108. this.spinning = false
  109. this.duPontData = [res]
  110. })
  111. .catch(() => {
  112. message.error('获取检测数据接口错误,请联系管理员')
  113. })
  114. },
  115. // tree节点自定义渲染
  116. renderContent(h, node) {
  117. return (
  118. <div class='diy-wrapper'>
  119. <div class='diy-con-name'>{node.data.text}</div>
  120. <div class='diy-con-content'>{node.data.props.content}</div>
  121. </div>
  122. )
  123. },
  124. },
  125. }
  126. </script>
  127. <style module lang="scss">
  128. @use '@/common/design' as *;
  129. .main-div {
  130. height: 100%;
  131. .title {
  132. text-align: center;
  133. font-size: 18px;
  134. font-weight: bold;
  135. margin: 20px 0;
  136. }
  137. :global(.ant-card-body) {
  138. height: 100%;
  139. }
  140. .loading-div {
  141. text-align: center;
  142. margin-top: 18%;
  143. }
  144. .tree-div {
  145. margin: 50px 0;
  146. :global(.org-chart-container) {
  147. > :global(.org-chart-node-children) {
  148. display: inline-block;
  149. }
  150. }
  151. :global(.org-chart-node-label-inner) {
  152. width: 160px !important;
  153. border: 1px solid #d3d3d3;
  154. }
  155. }
  156. .is-only-node {
  157. :global(.is-leaf) {
  158. &:before {
  159. display: none;
  160. }
  161. }
  162. }
  163. }
  164. </style>