From ac5ad75f0b7feca05043e3b7044e78a3899ff6bd Mon Sep 17 00:00:00 2001 From: xuyucheng Date: Thu, 5 May 2022 16:39:41 +0800 Subject: [PATCH] mode --- src/components/table.js | 25 ++-- .../companyDetails/businessInformation.js | 24 ++-- .../company/companyDetails/creditAnalysis.js | 75 ++++++------ .../company/companyDetails/esgAnalysis.js | 2 +- .../companyDetails/financialAnalysis.js | 108 ++++++++++-------- .../company/companyDetails/financialData.js | 29 ++--- .../manage/company/companyDetails/index.css | 7 ++ .../manage/company/companyDetails/index.js | 18 +-- .../company/companyDetails/operationalRisk.js | 59 +++++----- 9 files changed, 193 insertions(+), 154 deletions(-) diff --git a/src/components/table.js b/src/components/table.js index 77370aa..94b5842 100644 --- a/src/components/table.js +++ b/src/components/table.js @@ -18,7 +18,7 @@ class FeTable extends Component { data: props.data, columns: props.columns, total: props.total, - defaultPageSize: props.defaultPageSize ||10, + defaultPageSize: props.defaultPageSize || 10, current: props.current || 1, minHeight: props.minHeight || 'auto' } @@ -34,23 +34,28 @@ class FeTable extends Component { } // 页码的回调 - onChange = (current,pageSize) =>{ - return this.props.pageChange(current,pageSize) + onChange = (current, pageSize) => { + return this.props.pageChange(current, pageSize) } // 每页条数的回调 - onShowSizeChange = (current,pageSize) =>{ - return this.props.onShowSizeChange(current,pageSize) + onShowSizeChange = (current, pageSize) => { + return this.props.onShowSizeChange(current, pageSize) } render() { return ( - {return { - onClick: event => this.jumpRow(event, record) - } - }} pagination={{defaultPageSize:this.state.defaultPageSize,current:this.state.current,total: this.state.total,onChange:this.onChange.bind(this),showSizeChanger:true, - onShowSizeChange:this.onShowSizeChange.bind(this),pageSizeOptions:['5','10']}}/> +
+
{ + return { + onClick: event => this.jumpRow(event, record) + } + }} pagination={{ + defaultPageSize: this.state.defaultPageSize, current: this.state.current, total: this.state.total, onChange: this.onChange.bind(this), showSizeChanger: true, + onShowSizeChange: this.onShowSizeChange.bind(this), pageSizeOptions: ['5', '10'] + }} /> + ) } diff --git a/src/pages/home/branch/manage/company/companyDetails/businessInformation.js b/src/pages/home/branch/manage/company/companyDetails/businessInformation.js index 15f8e34..eeb4042 100644 --- a/src/pages/home/branch/manage/company/companyDetails/businessInformation.js +++ b/src/pages/home/branch/manage/company/companyDetails/businessInformation.js @@ -1,28 +1,26 @@ import React, { useState, useEffect } from 'react' -import { Descriptions } from 'antd' +import { Descriptions, Tag } from 'antd' import api from "@/api/request" import FeTable from "@/components/table" import "./index.css" import { getColumn } from "@/utils/utils" function BusinessInformation(props) { - const [value, setValue] = useState({ }) - const [stockholderPage,setStockholderPage] = useState({ + const [value, setValue] = useState({}) + const [stockholderPage, setStockholderPage] = useState({ current: 1, pageSize: 10 }) - const [memberPage,setMemberPage] = useState({ + const [memberPage, setMemberPage] = useState({ current: 1, pageSize: 10 }) useEffect(() => { - if (!Array.isArray(props.updateTime)) { - if (props.table === '工商信息') { - api.post("/admin/company/basic_info", { cid: props.cid, update_time: props.updateTime }).then(res => { - setValue(res) - }) - } + if (props.table === '工商信息' && props.updateTime) { + api.post("/admin/company/basic_info", { cid: props.cid, update_time: props.updateTime }).then(res => { + setValue(res) + }) } }, [props.cid, props.updateTime, props.table]) @@ -63,12 +61,12 @@ function BusinessInformation(props) {

工商信息

{value['工商信息'] && Object.keys(value['工商信息']).map((key, index) => { - return key !== "经营范围" ? {value['工商信息'][key]} : null + return key !== "经营范围" ? {key}{value['工商信息'][key]} : null })} - {value['工商信息'] && {value['工商信息']['经营范围']}} + {value['工商信息'] && 经营范围{value['工商信息']['经营范围']}}

股东信息

- {value['股东信息'] && } + {value['股东信息'] && }

主要成员

{value['主要成员'] && } diff --git a/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js b/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js index 853f513..dad9256 100644 --- a/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js +++ b/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import { Row, Col, Descriptions } from 'antd' +import { Row, Col, Descriptions, Empty,Tag } from 'antd' import api from "@/api/request" import "./index.css" import { getColumn } from "@/utils/utils" @@ -12,19 +12,22 @@ function CreditAnalysis(props) { const [value, setValue] = useState({}) useEffect(() => { - if (props.table === '综合信用分析') { + if (props.table === '综合信用分析'&&props.updateTime) { api.post("/admin/company/cc_rating", { cid: props.cid, update_time: props.updateTime }).then(res => { setValue(res) - if(Object.keys(res).length !== 0){ + if (Object.keys(res).length !== 0) { initRadar("radar", res['指标雷达']) } }) } - }, [props.cid,props.updateTime,props.table]) + }, [props.cid, props.updateTime, props.table]) function initRadar(id, param) { - const myChart = echarts.init(document.getElementById(id)) + let myChart = echarts.getInstanceByDom(document.getElementById(id)) + if (!myChart) { + myChart = echarts.init(document.getElementById(id)) + } myChart.setOption({ tooltip: { show: true, @@ -43,7 +46,7 @@ function CreditAnalysis(props) { max: param['最大分数'][key] } }) - }, + }, series: [ { name: 'Budget vs spending', @@ -67,37 +70,43 @@ function CreditAnalysis(props) { return ( <> - - {value['评价ID']} - {value['企业名称']} - - -
-
- - - - {value["信用分析"] && Object.keys(value['信用分析']).map(key => { - return {value['信用分析'][key]} - })} + { + Object.keys(value).length !== 0 ? <> + + 评价ID:{value['评价ID']} + 企业名称:{value['企业名称']} - - - - { - value['指标表格'] && Object.keys(value['指标表格']).map(key => { - return - - {value['指标表格'] && Object.keys(value['指标表格'][key]).map(k => { - return {value['指标表格'][key][k]} + + +
+ + + + {value["信用分析"] && Object.keys(value['信用分析']).map((key,index) => { + return {value['信用分析'][key]} })} - }) - } - -

历史级别

- + + + { + value['指标表格'] && Object.keys(value['指标表格']).map((key,index) => { + return + + {value['指标表格'] && Object.keys(value['指标表格'][key]).map((k,i) => { + return {value['指标表格'][key][k]} + })} + + + }) + } + +

历史级别

+ + + : + } + ) } diff --git a/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js b/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js index 52aff74..bdd05d8 100644 --- a/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js +++ b/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js @@ -153,7 +153,7 @@ function EsgAnalysis(props) {

维度得分情况

*/} - + ) } diff --git a/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js b/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js index cc8897f..15381c0 100644 --- a/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js +++ b/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react' import "./index.css" -import { Row, Col, Descriptions } from 'antd' +import { Row, Col, Descriptions, Empty,Tag } from 'antd' import * as echarts from 'echarts/lib/echarts' import "echarts/lib/chart/bar"; import 'echarts/lib/component/grid' @@ -16,12 +16,12 @@ function FinancialAnalysis(props) { const [size, setSize] = useState(10) useEffect(() => { - if (props.table === '财务分析') { + if (props.table === '财务分析' && props.updateTime) { api.post("/admin/company/financial_analysis", { cid: props.cid, update_time: props.updateTime }).then(res => { setValue(res) if (Object.keys(res).length !== 0) { var data = {} - res["财务得分年度比较"].forEach(item => { + res["财务得分年度比较"] && res["财务得分年度比较"].forEach(item => { data[Object.keys(item)[0]] = item[Object.keys(item)[0]] }) initDoubleBar("bar-1", data) @@ -34,7 +34,10 @@ function FinancialAnalysis(props) { }, [props.cid, props.updateTime, props.table]) function initDoubleBar(id, param) { - const myChart = echarts.init(document.getElementById(id)) + let myChart = echarts.getInstanceByDom(document.getElementById(id)) + if (!myChart) { + myChart = echarts.init(document.getElementById(id)) + } myChart.setOption({ tooltip: { show: true, @@ -101,7 +104,10 @@ function FinancialAnalysis(props) { } function initBar(id, param) { - const myChart = echarts.init(document.getElementById(id)) + let myChart = echarts.getInstanceByDom(document.getElementById(id)) + if (!myChart) { + myChart = echarts.init(document.getElementById(id)) + } myChart.setOption({ tooltip: { show: true, @@ -158,54 +164,60 @@ function FinancialAnalysis(props) { }] }) - window.onresize = function () { - myChart.resize() + window.onresize = function () { + myChart.resize() + } } -} -function pageChange(current, pageSize) { - setPage(current) - setSize(pageSize) -} + function pageChange(current, pageSize) { + setPage(current) + setSize(pageSize) + } -function onShowSizeChange(current, pageSize) { - setPage(current) - setSize(pageSize) -} + function onShowSizeChange(current, pageSize) { + setPage(current) + setSize(pageSize) + } -function getPageData(data, page, size) { - return data.slice((page - 1) * size, page * size) -} + function getPageData(data, page, size) { + return data.slice((page - 1) * size, page * size) + } -return ( - <> - - {value['评价ID']} - {value['财报期']} - - -
-

财务得分去年比较

-
- - -

财务得分同行比较

-
- - - - -

财务得分较去年变化

-
- - -

财务得分较同行差异

-
- - - {value['指标详情'] && } - -) + return ( + <> + { + Object.keys(value).length !== 0 ? <> + + 评价ID:{value['评价ID']} + 财报期:{value['财报期']} + + + +

财务得分去年比较

+
+ + +

财务得分同行比较

+
+ + + + +

财务得分较去年变化

+
+ + +

财务得分较同行差异

+
+ + + {value['指标详情'] && } + + : + } + + + ) } export default FinancialAnalysis \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/financialData.js b/src/pages/home/branch/manage/company/companyDetails/financialData.js index 88d4e66..2dd9709 100644 --- a/src/pages/home/branch/manage/company/companyDetails/financialData.js +++ b/src/pages/home/branch/manage/company/companyDetails/financialData.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react' import api from "@/api/request" +import { Empty } from 'antd' import "./index.css" import FeTable from "@/components/table" @@ -10,7 +11,7 @@ function FinancialData(props) { const [supplement, setSupplement] = useState([]) useEffect(() => { - if (props.table === '财务数据') { + if (props.table === '财务数据' && props.updateTime[0] !== undefined) { const pro = [] const ass = [] const fin = [] @@ -26,7 +27,7 @@ function FinancialData(props) { setAssets(ass) setFinancial(fin) setSupplement(sup) - }, 100) + }, 0) }, { cid: props.cid, report_date: props.updateTime[i] }) } } @@ -80,23 +81,25 @@ function FinancialData(props) { }) return obj }) - data.shift() - return - } return ( <> -

资产负债表

- {profits.length !== 0 && analysisArray(profits)} -

利润表

- {assets.length !== 0 && analysisArray(assets)} -

财务指标

- {financial.length !== 0 && analysisArray(financial)} -

补充数据表

- {supplement.length !== 0 && analysisArray(supplement)} + { + Array.isArray(props.updateTime) && props.updateTime[0] !== undefined ? <> +

资产负债表

+ {profits.length !== 0 && analysisArray(profits)} +

利润表

+ {assets.length !== 0 && analysisArray(assets)} +

财务指标

+ {financial.length !== 0 && analysisArray(financial)} +

补充数据表

+ {supplement.length !== 0 && analysisArray(supplement)} + : + } + ) } diff --git a/src/pages/home/branch/manage/company/companyDetails/index.css b/src/pages/home/branch/manage/company/companyDetails/index.css index 8cca235..7c69d7f 100644 --- a/src/pages/home/branch/manage/company/companyDetails/index.css +++ b/src/pages/home/branch/manage/company/companyDetails/index.css @@ -14,4 +14,11 @@ .ant-checkbox-wrapper{ margin: 5px 0; +} + +.spin-box{ + height: 100%; + display: flex; + justify-content: center; + align-items: center; } \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/index.js b/src/pages/home/branch/manage/company/companyDetails/index.js index ac9d77f..a51564a 100644 --- a/src/pages/home/branch/manage/company/companyDetails/index.js +++ b/src/pages/home/branch/manage/company/companyDetails/index.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import { Card, Tabs, Row, Layout, Descriptions, Checkbox, Radio } from 'antd' +import { Card, Tabs, Row, Layout, Descriptions, Checkbox, Radio,Tag } from 'antd' import api from "@/api/request" import BusinessInformation from './businessInformation'; import FinancialData from "./financialData" @@ -68,21 +68,21 @@ function CompanyDetails(props) {

{value['企业名称']}

- - {props.cid} + + 企业ID:{props.cid} - - {value['账户邮箱']} + + 账户邮箱:{value['账户邮箱']} - - {value['所属行业']} + + 所属行业:{value['所属行业']} {tab.map(item => { return - - {tabPane === '财务数据' ? item.content(props.cid, updateTimeArray, tabPane) : item.content(props.cid, targetUpdateTime, tabPane)} + + {tabPane === '财务数据' ? item.content(props.cid, updateTimeArray, tabPane) : item.content(props.cid, targetUpdateTime, tabPane)}

更新日期

{ diff --git a/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js b/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js index 7b77fd9..89cb238 100644 --- a/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js +++ b/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import { Descriptions, Row, Col, Drawer, Button } from 'antd' +import { Descriptions, Row, Col, Drawer, Button, Empty,Tag } from 'antd' import FeTable from "@/components/table" import api from "@/api/request" import { getColumn } from "@/utils/utils" @@ -26,11 +26,11 @@ function OperationalRisk(props) { const [visible, setVisible] = useState(false); const [expand, setExpand] = useState([]) - useEffect(() => { - if (props.table === '经营风险') { + if (props.table === '经营风险' && props.updateTime) { api.post("/admin/company/operating_risk", { cid: props.cid, update_time: props.updateTime }).then(res => { setValue(res) + }) } }, [props.cid, props.updateTime, props.table]) @@ -126,30 +126,35 @@ function OperationalRisk(props) { return ( <> - - {value['评价ID']} - {value['风险级别']} - {value['风险分数']} - {value['列入失信名单']} - - -

-

合规风险

- {value['合规风险统计'] && } - {value['合规风险统计'] &&
} -

变更记录

- {value['变更记录统计'] && } - {value['变更记录统计'] &&
} - -
-

经营风险

- {value['经营风险统计'] && } - {value['经营风险统计'] &&
} -

周边风险

- {value['周边风险统计'] && } - {value['周边风险统计'] &&
} - - + { + Object.keys(value).length !== 0 ? <> + + 评价ID:{value['评价ID']} + 风险级别:{value['风险级别']} + 风险分数:{value['风险分数']} + 列入失信名单:{value['列入失信名单']} + + +
+

合规风险

+ {value['合规风险统计'] && } + {value['合规风险统计'] &&
} +

变更记录

+ {value['变更记录统计'] && } + {value['变更记录统计'] &&
} + +
+

经营风险

+ {value['经营风险统计'] && } + {value['经营风险统计'] &&
} +

周边风险

+ {value['周边风险统计'] && } + {value['周边风险统计'] &&
} + + + + : + } ) }