123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <template>
- <div :class="$style.mainDiv">
- <a-card :class="$style.mainDiv">
- <div v-if="spinning" :class="$style.loadingDiv">
- <a-spin :spinning="spinning" tip="数据加载中..."></a-spin>
- </div>
- <div v-else>
- <div :class="$style.title">{{ title }}</div>
- <div :class="[$style.treeDiv, { [$style.isOnlyNode]: !duPontData[0].children }]">
- <vue-okr-tree :data="duPontData" :render-content="renderContent" />
- </div>
- </div>
- </a-card>
- </div>
- </template>
- <script>
- import { message } from '@/common/one-ui'
- import { VueOkrTree } from 'vue-okr-tree'
- import 'vue-okr-tree/dist/vue-okr-tree.css'
- import kpiDuPontAnalysisService from './kpi-du-pont-analysis-service'
- import components from './_import-components/kpi-du-pont-analysis-import'
- export default {
- name: 'KpiDuPontAnalysis',
- metaInfo: {
- title: '指标监测-杜邦分析',
- },
- components: {
- vueOkrTree: VueOkrTree,
- ...components,
- },
- data() {
- return {
- title: '', // 杜邦分析标题
- spinning: false,
- duPontData: [
- {
- label: '净资产收益率',
- content: '6%',
- children: [
- {
- label: '总资产净利率',
- content: '1.69%',
- children: [
- {
- label: '销售净利率',
- content: '0.03%',
- children: [
- {
- label: '净利润',
- content: '248010.00元',
- },
- {
- label: '销售收入',
- content: '972.68元',
- },
- ],
- },
- {
- label: '总资产周转率',
- content: '49.92%',
- children: [
- {
- label: '销售收入',
- content: '932.68元',
- },
- {
- label: '资产总额',
- content: '195,582.62元',
- },
- ],
- },
- ],
- },
- {
- label: '权益乘数',
- content: '3.54',
- children: [
- {
- label: '负债',
- content: '1,474.18元',
- },
- {
- label: '资产',
- content: '2053,62元',
- },
- ],
- },
- ],
- },
- ],
- }
- },
- created() {
- // 加载数据
- this.fnLoadData()
- },
- methods: {
- // 获取基础数据和分析数据
- fnLoadData() {
- this.spinning = true
- this.title = this.$route.query.title
- // 获取监测数据
- return kpiDuPontAnalysisService
- .fnLoadData({
- indiId: parseFloat(this.$route.query.id),
- })
- .then((res) => {
- this.spinning = false
- this.duPontData = [res]
- })
- .catch(() => {
- message.error('获取检测数据接口错误,请联系管理员')
- })
- },
- // tree节点自定义渲染
- renderContent(h, node) {
- return (
- <div class='diy-wrapper'>
- <div class='diy-con-name'>{node.data.text}</div>
- <div class='diy-con-content'>{node.data.props.content}</div>
- </div>
- )
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- .main-div {
- height: 100%;
- .title {
- text-align: center;
- font-size: 18px;
- font-weight: bold;
- margin: 20px 0;
- }
- :global(.ant-card-body) {
- height: 100%;
- }
- .loading-div {
- text-align: center;
- margin-top: 18%;
- }
- .tree-div {
- margin: 50px 0;
- :global(.org-chart-container) {
- > :global(.org-chart-node-children) {
- display: inline-block;
- }
- }
- :global(.org-chart-node-label-inner) {
- width: 160px !important;
- border: 1px solid #d3d3d3;
- }
- }
- .is-only-node {
- :global(.is-leaf) {
- &:before {
- display: none;
- }
- }
- }
- }
- </style>
|