From e27868b73027c0be6bc28b517bfb755253a1ca39 Mon Sep 17 00:00:00 2001 From: xuyucheng Date: Thu, 21 Apr 2022 16:42:33 +0800 Subject: [PATCH] mode --- .../branch/manage/company/companyDetails.js | 133 -------------- .../companyDetails/businessInformation.js | 37 ++++ .../company/companyDetails/creditAnalysis.js | 105 +++++++++++ .../company/companyDetails/esgAnalysis.js | 161 +++++++++++++++++ .../companyDetails/evaluationRecords.js | 26 +++ .../companyDetails/financialAnalysis.js | 167 ++++++++++++++++++ .../company/companyDetails/financialData.js | 25 +++ .../manage/company/companyDetails/index.css | 13 ++ .../manage/company/companyDetails/index.js | 94 ++++++++++ .../company/companyDetails/operationalRisk.js | 45 +++++ src/pages/home/content.js | 2 +- src/utils/utils.js | 15 ++ 12 files changed, 689 insertions(+), 134 deletions(-) delete mode 100644 src/pages/home/branch/manage/company/companyDetails.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/businessInformation.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/evaluationRecords.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/financialData.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/index.css create mode 100644 src/pages/home/branch/manage/company/companyDetails/index.js create mode 100644 src/pages/home/branch/manage/company/companyDetails/operationalRisk.js create mode 100644 src/utils/utils.js diff --git a/src/pages/home/branch/manage/company/companyDetails.js b/src/pages/home/branch/manage/company/companyDetails.js deleted file mode 100644 index 97c1687..0000000 --- a/src/pages/home/branch/manage/company/companyDetails.js +++ /dev/null @@ -1,133 +0,0 @@ -import React, { Component } from 'react' -import { Descriptions, Card, Tag, } from 'antd' -import api from "@/api/request" -import FeTable from '@/components/table' -import Pdf from "@/components/pdf" -import { connect } from 'react-redux'; -import store from "@/store/index" -import { operationAction } from "@/action/index" - - -class CompanyDetails extends Component { - constructor(props) { - super(props) - this.state = { - data: {}, - businessInformation: [], - shareholdersInformation: [], - companyMember: [], - evaluationRecords: [], - file: "", - visible: false - } - } - - isJump = false - - componentDidMount() { - api.post("/admin/company/index", { cid: this.props.cid }) - .then(res => { - this.setState({ - data: res.result, - businessInformation: Object.keys(res.result["基本信息"]["工商信息"]).map((key, i) => { - return {res.result["基本信息"]["工商信息"][key]} - }), - shareholdersInformation: res.result["基本信息"]["股东信息"], - companyMember: res.result["基本信息"]["主要成员"], - evaluationRecords: res.result["评价记录"] - }) - }).catch(err => { - console.log(err) - }) - } - - analysisColumns(val, index) { - if (val !== [] && val) { - if (val[0]) { - const col = Object.keys(val[0]).map((key, i) => { - return key === "证书" || key === "报告" ? { - title: key, - dataIndex: key, - key: i, - align: 'center', - render: (record) => 预 览, - } : { - title: key, dataIndex: key, align: 'center', key: i - } - }) - if (index === 1) { - col.push({ - title: '详 情', - dataIndex: '详 情', - key: col.length, - align: 'center', - render: () => 详 情 - }) - } - return col - } - } - } - - handleClick(value) { - this.isJump = true - this.setState({ - visible: true, - }, () => { - api.BlobGet("/admin" + value).then(res => { - this.setState({ - file: res - }) - }) - }) - } - - setVisible(value) { - this.setState({ - visible: value - }) - } - - callback(e, value) { - if (!this.isJump) { - if (e === "详 情") { - const newPanes = [...this.props.panes] - const state = newPanes.every(item => { - return item.title === value["评价项目"] + '(' + value["评价ID"] + ')' ? false : true - }) - if (state) { - newPanes.push({ title: value["评价项目"] + '(' + value["评价ID"] + ')', content: "/manage/rate/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() }); - store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key))) - } else { - return null - } - } - } - this.isJump = false - } - - render() { - return ( - - - - 已认证:{this.state.data["已认证"]}}> - {this.state.businessInformation} - -

股东信息

- -

主要成员

- -

评价记录

- -
-
- ) - } -} - -const mapStateToProps = (state) => { - return state; -}; - -export default connect(mapStateToProps)(CompanyDetails); \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/businessInformation.js b/src/pages/home/branch/manage/company/companyDetails/businessInformation.js new file mode 100644 index 0000000..298f317 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/businessInformation.js @@ -0,0 +1,37 @@ +import React, { useState, useEffect } from 'react' +import { Descriptions } 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({}) + + 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) + }) + } + } + }, [props.cid,props.updateTime,props.table]) + + return ( + <> +

工商信息

+ + {value['工商信息'] && Object.keys(value['工商信息']).map((key, index) => { + return {value['工商信息'][key]} + })} + +

股东信息

+ +

主要成员

+ + + ) +} + +export default BusinessInformation \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js b/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js new file mode 100644 index 0000000..83d434e --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/creditAnalysis.js @@ -0,0 +1,105 @@ +import React, { useState, useEffect } from 'react' +import { Row, Col, Descriptions } from 'antd' +import api from "@/api/request" +import "./index.css" +import { getColumn } from "@/utils/utils" +import FeTable from "@/components/table" +import * as echarts from 'echarts/lib/echarts' +import "echarts/lib/chart/radar"; +import "echarts/lib/component/tooltip" + +function CreditAnalysis(props) { + const [value, setValue] = useState({}) + + useEffect(() => { + if (props.table === '综合信用分析') { + api.post("/admin/company/cc_rating", { cid: props.cid, update_time: props.updateTime }).then(res => { + setValue(res) + if(Object.keys(res).length !== 0){ + initRadar("radar", res['指标雷达']) + } + + }) + } + }, [props.cid,props.updateTime,props.table]) + + + function initRadar(id, param) { + const myChart = echarts.init(document.getElementById(id)) + myChart.setOption({ + tooltip: { + show: true, + trigger: "item", + showContent: true, + borderColor: "#fff", + }, + + label: { + show: false + }, + radar: { + indicator: Object.keys(param['最大分数']).map(key => { + return { + name: key, + max: param['最大分数'][key] + } + }) + }, + series: [ + { + name: 'Budget vs spending', + type: 'radar', + data: [ + { + name: "指标", + value: Object.keys(param['指标得分']).map(key => { + return param['指标得分'][key] + }) + } + ] + } + ] + }) + + window.onresize = function () { + myChart.resize() + } + } + + return ( + <> + + {value['评价ID']} + {value['企业名称']} + + + +
+ + + + {value["信用分析"] && Object.keys(value['信用分析']).map(key => { + return {value['信用分析'][key]} + })} + + +
+ + { + value['指标表格'] && Object.keys(value['指标表格']).map(key => { + return + + {value['指标表格'] && Object.keys(value['指标表格'][key]).map(k => { + return {value['指标表格'][key][k]} + })} + + + }) + } + + + + ) +} + +export default CreditAnalysis \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js b/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js new file mode 100644 index 0000000..2abf658 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/esgAnalysis.js @@ -0,0 +1,161 @@ +import React, { useState, useEffect } from 'react' +import { Row, Col, Descriptions,Empty } from 'antd' +import api from "@/api/request" +import "./index.css" +import { getColumn } from "@/utils/utils" +import FeTable from "@/components/table" +import * as echarts from 'echarts/lib/echarts' +import "echarts/lib/chart/pie"; +import "echarts/lib/component/tooltip" +import "echarts/lib/component/title" +import "echarts/lib/component/legend" + +const issueScore = [ + { + color: [ + "rgb(75,226,197,1)", + "rgb(75,226,197,0.5)", + "rgb(75,226,197,0.2)", + ], + radius: [ + ["50%", "55%"], + ["40%", "45%"], + ["30%", "35%"], + ], + name: "环境", + }, + { + color: [ + "rgb(125,155,221,1)", + "rgb(125,155,221,0.5)", + "rgb(125,155,221,0.2)", + ], + radius: [ + ["50%", "55%"], + ["40%", "45%"], + ["30%", "35%"], + ], + name: "社会", + }, + { + color: [ + "rgb(0,216,255,1)", + "rgb(0,216,255,0.5)", + "rgb(0,216,255,0.2)", + ], + radius: [ + ["50%", "55%"], + ["40%", "45%"], + ["30%", "35%"], + ], + name: "治理", + }, +] + +function EsgAnalysis(props) { + const [value, setValue] = useState({}) + + useEffect(() => { + if (props.table === 'ESG评价分析') { + api.post("/admin/company/esg_rating", { cid: props.cid, update_time: props.updateTime }).then(res => { + setValue(res) + for (let i = 0; i < 3; i++) { + // initRing("ring" + i, res['实质性议题得分情况'][issueScore[i].name], i) + } + }) + } + }, [props.cid,props.updateTime,props.table]) + + function initRing(id, param, i) { + const myChart = echarts.init(document.getElementById(id)) + myChart.setOption({ + tooltip: { + show: true, + trigger: "item", + // formatter: function (params) { + // return params.data.value; + // }, + }, + title: { + show: true, + text: issueScore[i].name, + x: "center", + left: "49%", + top: "center", + textAlign: "center", + textStyle: { + color: issueScore[i].color[0], + }, + }, + color: issueScore[i].color, + legend: { + orient: 'vertical', + x: "center", + y: "bottom", + itemHeight: 10, + itemGap: 8, + background: "#fff", + }, + series: Object.keys(param).map((key, index) => { + return { + name: param[key].name, + type: "pie", + radius: issueScore[i].radius[index], + label: { + show: false, + position: "center", + }, + labelLine: { + normal: { + show: false, + }, + }, + emphasis: { + label: { + show: true, + fontSize: "20", + fontWeight: "bold", + }, + }, + data: [ + { + value: param[key].value, + name: param[key].name, + }, + ], + }; + }), + }) + + window.onresize = function () { + myChart.resize() + } + } + + return ( + <> + {/* + {value['评价ID']} + {value['ESG评级']['ESG评级']} + {value['ESG评级']['ESG综合得分']} + {value['ESG评级']['行业']} + +

实质性议题

+ +

实质性议题得分情况

+ + { + issueScore.map((item, index) => { + return
+ }) + } + +
+

维度得分情况

+ */} + + + ) +} + +export default EsgAnalysis \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/evaluationRecords.js b/src/pages/home/branch/manage/company/companyDetails/evaluationRecords.js new file mode 100644 index 0000000..d905d51 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/evaluationRecords.js @@ -0,0 +1,26 @@ +import React, { useState, useEffect } from 'react' +import { } from 'antd' +import api from "@/api/request" +import FeTable from "@/components/table" +import "./index.css" +import { getColumn } from "@/utils/utils" + +function EvaluationRecords(props) { + const [value, setValue] = useState([]) + + useEffect(() => { + if (props.table === '评价记录') { + api.get("/admin/company/rating_records", { cid: props.cid }).then(res => { + setValue(res['评价记录']) + }) + } + }, [props.cid,props.table]) + + return ( + <> + + + ) +} + +export default EvaluationRecords \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js b/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js new file mode 100644 index 0000000..b599855 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/financialAnalysis.js @@ -0,0 +1,167 @@ +import React, { useState, useEffect } from 'react' +import "./index.css" +import { Row, Col, Descriptions } from 'antd' +import * as echarts from 'echarts/lib/echarts' +import "echarts/lib/chart/line"; +import "echarts/lib/chart/pie"; +import 'echarts/lib/component/grid' +import "echarts/lib/component/tooltip" +import api from "@/api/request" +import FeTable from "@/components/table" +import { getColumn } from "@/utils/utils" + +function FinancialAnalysis(props) { + const [value, setValue] = useState({}) + + useEffect(() => { + if (props.table === '财务分析') { + api.post("/admin/company/financial_analysis", { cid: props.cid, update_time: props.updateTime }).then(res => { + setValue(res) + if (Object.keys(res).length !== 0) { + initLine("line-1", res["财务得分去年比较"]) + initLine("line-2", res["财务得分同行比较"]) + initPie("pie-1", res["财务得分较去年变化"]) + initPie("pie-2", res["财务得分较同行差异"]) + } + }) + } + }, [props.cid, props.updateTime, props.table]) + + + function initLine(id, param) { + const myChart = echarts.init(document.getElementById(id)) + myChart.setOption({ + tooltip: { + show: true, + trigger: "item", + showContent: true, + borderColor: "#fff", + }, + grid: { + top: '20px', + left: '50px', + right: '50px', + bottom: '20px', + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: Object.keys(param[Object.keys(param)[0]]).map(key => { + return key + }), + axisLine: { + show: true + }, + axisTick: { + show: false + }, + }, + yAxis: { + type: 'value', + axisLine: { + show: false + }, + axisTick: { + show: false + }, + splitLine: { + show: true + } + }, + series: Object.keys(param).map(key => { + return { + name: key, + type: 'line', + data: Object.keys(param[key]).map(k => { + return param[key][k] + }) + } + }), + + }) + + window.onresize = function () { + myChart.resize() + } + } + + function initPie(id, param) { + const myChart = echarts.init(document.getElementById(id)) + myChart.setOption({ + tooltip: { + show: true, + trigger: "item", + showContent: true, + borderColor: "#fff", + }, + grid: { + top: '20px', + left: '50px', + right: '50px', + bottom: '20px', + width: '100%', + height: '100%' + }, + label: { + show: false + }, + series: [ + { + name: 'Data', + type: 'pie', + radius: ['50%', '70%'], + avoidLabelOverlap: false, + labelLine: { + show: false + }, + itemStyle: { + borderWidth: 5, + borderColor: '#fff', + }, + data: Object.keys(param).map(key => { + return { + name: key, + value: param[key].substring(0, param[key].length - 1) + } + }), + } + ] + }) + + window.onresize = function () { + myChart.resize() + } + } + + return ( + <> + + {value['评价ID']} + {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 new file mode 100644 index 0000000..32b118f --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/financialData.js @@ -0,0 +1,25 @@ +import React, { useState, useEffect } from 'react' +import { } from 'antd' +import api from "@/api/request" +import "./index.css" +import { getColumn } from "@/utils/utils" + +function FinancialData(props) { + const [value, setValue] = useState({}) + + useEffect(() => { + if (props.table === '财务数据' && props.updateTime) { + api.post("/admin/company/financial_data", { cid: props.cid, report_date: props.updateTime }).then(res => { + setValue(res) + }) + } + }, [props.cid, props.updateTime, props.table]) + + return ( + <> + + + ) +} + +export default FinancialData \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/index.css b/src/pages/home/branch/manage/company/companyDetails/index.css new file mode 100644 index 0000000..d31f2d0 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/index.css @@ -0,0 +1,13 @@ + +.sider-box{ + border-left:1px solid #f0f0f0; +} + +.title_h{ + margin: 0 0 20px 0; +} + +.table-span{ + margin: 5px 0; + display: block; +} \ 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 new file mode 100644 index 0000000..7bfd265 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/index.js @@ -0,0 +1,94 @@ +import React, { useState, useEffect } from 'react' +import { Card, Tabs, Row, Layout, Descriptions } from 'antd' +import api from "@/api/request" +import BusinessInformation from './businessInformation'; +import FinancialData from "./financialData" +import OperationalRisk from "./operationalRisk" +import FinancialAnalysis from "./financialAnalysis" +import CreditAnalysis from "./creditAnalysis" +import EsgAnalysis from "./esgAnalysis" +import EvaluationRecords from "./evaluationRecords" +import "./index.css" + +const { TabPane } = Tabs; + +const { Sider, Content } = Layout; + +const tab = [ + { title: "工商信息", key: "0", content: function (cid, updateTime,tabPane) { return } }, + { title: "财务数据", key: "1", content: function (cid, updateTime,tabPane) { return } }, + { title: "经营风险", key: "2", content: function (cid, updateTime,tabPane) { return } }, + { title: "财务分析", key: "3", content: function (cid, updateTime,tabPane) { return } }, + { title: "综合信用分析", key: "4", content: function (cid, updateTime,tabPane) { return } }, + { title: "ESG评价分析", key: "5", content: function (cid, updateTime,tabPane) { return } }, + { title: "评价记录", key: "6", content: function (cid, updateTime,tabPane) { return } }, +] + +function CompanyDetails(props) { + const [value, setValue] = useState({}) + const [tabPane, setTabPane] = useState(tab[0].title) + const [updateTime, setUpdateTime] = useState([]) + const [targetUpdateTime, setTargetUpdateTime] = useState([]) + + useEffect(() => { + api.get("/admin/company/head_info", { cid: props.cid }).then(res => { + setValue(res) + }) + }, [props.cid]) + + useEffect(() => { + api.post("/admin/company/update_time", { cid: props.cid, table: tabPane }).then(res => { + if (res.update_time) { + setUpdateTime(res.update_time) + setTargetUpdate(res.update_time[0]) + } else { + setUpdateTime([]) + } + }) + }, [props.cid, tabPane]) + + function callback(key) { + setTabPane(tab[key].title) + } + + function setTargetUpdate(param) { + setTargetUpdateTime(param) + } + + return ( + +

{value['企业名称']}

+ + + {props.cid} + + + {value['账户邮箱']} + + + {value['所属行业']} + + + + {tab.map(item => { + return + + {item.content(props.cid, targetUpdateTime,tabPane)} + +

更新日期

+ { + updateTime.map(item => { + return

{item}

+ }) + } + 返回条数

{updateTime.length}

+
+
+
+ })} +
+
+ ) +} + +export default CompanyDetails \ No newline at end of file diff --git a/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js b/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js new file mode 100644 index 0000000..b97f8f4 --- /dev/null +++ b/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js @@ -0,0 +1,45 @@ +import React, { useState, useEffect } from 'react' +import { Descriptions, Row, Col } from 'antd' +import FeTable from "@/components/table" +import api from "@/api/request" +import { getColumn } from "@/utils/utils" +import "./index.css" + +function OperationalRisk(props) { + const [value, setValue] = useState({}) + + useEffect(() => { + if (props.table === '经营风险') { + api.post("/admin/company/operating_risk", { cid: props.cid, update_time: props.updateTime }).then(res => { + setValue(res) + }) + } + }, [props.cid, props.updateTime, props.table]) + + return ( + <> + + {value['评价ID']} + {value['风险级别']} + {value['风险分数']} + {value['列入失信名单']} + + + +

合规风险

+ +

经营风险

+ +

变更记录

+ + + +

周边风险

+ + +
+ + ) +} + +export default OperationalRisk \ No newline at end of file diff --git a/src/pages/home/content.js b/src/pages/home/content.js index ba3551c..d7345a0 100644 --- a/src/pages/home/content.js +++ b/src/pages/home/content.js @@ -4,7 +4,7 @@ import { operationAction } from "@/action/index" import Dashboard from './branch/dashboard/dashboard' import TestCompany from "./branch/test/company" import ManageCompany from './branch/manage/company/company' -import CompanyDetails from "./branch/manage/company/companyDetails" +import CompanyDetails from "./branch/manage/company/companyDetails/index" import ManageRate from './branch/manage/rate/rate' import RateTabs from './branch/manage/rate/branch/index'; import ManageIndustry from "./branch/manage/industry" diff --git a/src/utils/utils.js b/src/utils/utils.js new file mode 100644 index 0000000..dac5b08 --- /dev/null +++ b/src/utils/utils.js @@ -0,0 +1,15 @@ +export function getColumn(params) { + return Array.isArray(params) && params.length !== 0 ? Object.keys(params[0]).map((key, index) => { + return { + title: key, + dataIndex: key, + key: index, + align: 'center', + render: record => { + return Array.isArray(record) ? record.map(item => { + return {item} + }) : {record} + } + } + }) : [] +} \ No newline at end of file