This commit is contained in:
xuyucheng 2022-05-05 16:39:41 +08:00
parent 23a0ba164a
commit ac5ad75f0b
9 changed files with 193 additions and 154 deletions

View File

@ -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 (
<React.Fragment>
<Table bordered style={{ marginBottom: 20 }} dataSource={this.state.data} columns={this.state.columns} scroll={{y:this.state.minHeight}} onRow={record => {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']}}/>
<div style={{ height: this.state.minHeight }}>
<Table bordered style={{ marginBottom: 20 }} dataSource={this.state.data} columns={this.state.columns} scroll={{ y: this.state.minHeight }} onRow={record => {
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']
}} />
</div>
</React.Fragment>
)
}

View File

@ -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) {
<h1 className='title_h'>工商信息</h1>
<Descriptions>
{value['工商信息'] && Object.keys(value['工商信息']).map((key, index) => {
return key !== "经营范围" ? <Descriptions.Item label={key}>{value['工商信息'][key]}</Descriptions.Item> : null
return key !== "经营范围" ? <Descriptions.Item><Tag color="#108ee9">{key}</Tag>{value[''][key]}</Descriptions.Item> : null
})}
{value['工商信息'] && <Descriptions.Item label="经营范围">{value['工商信息']['经营范围']}</Descriptions.Item>}
{value['工商信息'] && <Descriptions.Item><Tag color="#108ee9">经营范围</Tag>{value['']['']}</Descriptions.Item>}
</Descriptions>
<h1 className='title_h'>股东信息</h1>
{value['股东信息'] && <FeTable data={getPageData(value['股东信息'], stockholderPage.current, stockholderPage.pageSize)} columns={getColumn(value['股东信息'])} current={stockholderPage.current} pageChange={stockPageChange} onShowSizeChange={onStockShowSizeChange} total={value['股东信息'].length}/>}
{value['股东信息'] && <FeTable data={getPageData(value['股东信息'], stockholderPage.current, stockholderPage.pageSize)} columns={getColumn(value['股东信息'])} current={stockholderPage.current} pageChange={stockPageChange} onShowSizeChange={onStockShowSizeChange} total={value['股东信息'].length} />}
<h1 className='title_h'>主要成员</h1>
{value['主要成员'] && <FeTable data={getPageData(value['主要成员'], memberPage.current, memberPage.pageSize)} columns={getColumn(value['主要成员'])} current={memberPage.current} pageChange={pageChange} onShowSizeChange={onShowSizeChange} total={value['主要成员'].length} />}
</>

View File

@ -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 (
<>
<Descriptions>
<Descriptions.Item label="评价ID">{value['评价ID']}</Descriptions.Item>
<Descriptions.Item label='企业名称'>{value['企业名称']}</Descriptions.Item>
</Descriptions>
<Row justify='space-between'>
<Col span={11}>
<div id="radar" style={{ height: 500 }}></div>
</Col>
<Col span={11}>
<Descriptions bordered column={1}>
{value["信用分析"] && Object.keys(value['信用分析']).map(key => {
return <Descriptions.Item label={key}>{value['信用分析'][key]}</Descriptions.Item>
})}
{
Object.keys(value).length !== 0 ? <>
<Descriptions>
<Descriptions.Item><Tag color="#108ee9">评价ID{value['评价ID']}</Tag></Descriptions.Item>
<Descriptions.Item style={{float:'right'}}><Tag color="#108ee9">企业名称{value['企业名称']}</Tag></Descriptions.Item>
</Descriptions>
</Col>
</Row>
<Row justify='space-between'>
{
value['指标表格'] && Object.keys(value['指标表格']).map(key => {
return <Col span={7}>
<Descriptions bordered column={2} title={key}>
{value['指标表格'] && Object.keys(value['指标表格'][key]).map(k => {
return <Descriptions.Item label={k}>{value['指标表格'][key][k]}</Descriptions.Item>
<Row justify='space-between'>
<Col span={11}>
<div id="radar" style={{ height: 500 }}></div>
</Col>
<Col span={11}>
<Descriptions bordered column={1}>
{value["信用分析"] && Object.keys(value['信用分析']).map((key,index) => {
return <Descriptions.Item label={key} key={index}>{value['信用分析'][key]}</Descriptions.Item>
})}
</Descriptions>
</Col>
})
}
</Row>
<p style={{ fontWeight: 800 }}>历史级别</p>
<FeTable data={value['历史级别']} columns={getColumn(value['历史级别'])} />
</Row>
<Row justify='space-between'>
{
value['指标表格'] && Object.keys(value['指标表格']).map((key,index) => {
return <Col span={7}>
<Descriptions bordered column={2} title={key} key={index}>
{value['指标表格'] && Object.keys(value['指标表格'][key]).map((k,i) => {
return <Descriptions.Item label={k} key={i}>{value['指标表格'][key][k]}</Descriptions.Item>
})}
</Descriptions>
</Col>
})
}
</Row>
<p style={{ fontWeight: 800 }}>历史级别</p>
<FeTable data={value['历史级别']} columns={getColumn(value['历史级别'])} />
</>
: <Empty />
}
</>
)
}

View File

@ -153,7 +153,7 @@ function EsgAnalysis(props) {
<div id='ring'></div>
<p style={{ fontWeight: 800 }}>维度得分情况</p>
<FeTable data={value['维度得分情况']} columns={getColumn(value['维度得分情况'])} /> */}
<Empty></Empty>
<Empty/>
</>
)
}

View File

@ -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 (
<>
<Descriptions>
<Descriptions.Item label="评价ID">{value['评价ID']}</Descriptions.Item>
<Descriptions.Item label='财报期'>{value['财报期']}</Descriptions.Item>
</Descriptions>
<Row style={{ marginBottom: 40 }}>
<Col span={10}>
<p style={{ fontWeight: 800 }}>财务得分去年比较</p>
<div id='bar-1' style={{ height: 250 }}></div>
</Col>
<Col span={10} offset={2}>
<p style={{ fontWeight: 800 }}>财务得分同行比较</p>
<div id='bar-2' style={{ height: 250 }}></div>
</Col>
</Row>
<Row style={{ marginBottom: 40 }}>
<Col span={10}>
<p style={{ fontWeight: 800 }}>财务得分较去年变化</p>
<div id='bar-3' style={{ height: 250 }}></div>
</Col>
<Col span={10} offset={2}>
<p style={{ fontWeight: 800 }}>财务得分较同行差异</p>
<div id='bar-4' style={{ height: 250 }}></div>
</Col>
</Row>
{value['指标详情'] && <FeTable data={getPageData(value['指标详情'], page, size)} columns={getColumn(value['指标详情'])} current={page} pageChange={pageChange} onShowSizeChange={onShowSizeChange} total={value['指标详情'].length} />}
</>
)
return (
<>
{
Object.keys(value).length !== 0 ? <>
<Descriptions>
<Descriptions.Item><Tag color="#108ee9">评价ID{value['评价ID']}</Tag></Descriptions.Item>
<Descriptions.Item style={{float:'right'}}><Tag color="#108ee9">财报期{value['财报期']}</Tag></Descriptions.Item>
</Descriptions>
<Row style={{ marginBottom: 40 }}>
<Col span={10}>
<p style={{ fontWeight: 800 }}>财务得分去年比较</p>
<div id='bar-1' style={{ height: 250 }}></div>
</Col>
<Col span={10} offset={2}>
<p style={{ fontWeight: 800 }}>财务得分同行比较</p>
<div id='bar-2' style={{ height: 250 }}></div>
</Col>
</Row>
<Row style={{ marginBottom: 40 }}>
<Col span={10}>
<p style={{ fontWeight: 800 }}>财务得分较去年变化</p>
<div id='bar-3' style={{ height: 250 }}></div>
</Col>
<Col span={10} offset={2}>
<p style={{ fontWeight: 800 }}>财务得分较同行差异</p>
<div id='bar-4' style={{ height: 250 }}></div>
</Col>
</Row>
{value['指标详情'] && <FeTable data={getPageData(value['指标详情'], page, size)} columns={getColumn(value['指标详情'])} current={page} pageChange={pageChange} onShowSizeChange={onShowSizeChange} total={value['指标详情'].length} />}
</>
: <Empty />
}
</>
)
}
export default FinancialAnalysis

View File

@ -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 <React.Fragment><FeTable data={data} columns={transTitle}></FeTable></React.Fragment>
}
return (
<>
<p>资产负债表</p>
{profits.length !== 0 && analysisArray(profits)}
<p>利润表</p>
{assets.length !== 0 && analysisArray(assets)}
<p>财务指标</p>
{financial.length !== 0 && analysisArray(financial)}
<p>补充数据表</p>
{supplement.length !== 0 && analysisArray(supplement)}
{
Array.isArray(props.updateTime) && props.updateTime[0] !== undefined ? <>
<p>资产负债表</p>
{profits.length !== 0 && analysisArray(profits)}
<p>利润表</p>
{assets.length !== 0 && analysisArray(assets)}
<p>财务指标</p>
{financial.length !== 0 && analysisArray(financial)}
<p>补充数据表</p>
{supplement.length !== 0 && analysisArray(supplement)}
</> : <Empty></Empty>
}
</>
)
}

View File

@ -14,4 +14,11 @@
.ant-checkbox-wrapper{
margin: 5px 0;
}
.spin-box{
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}

View File

@ -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) {
<Card>
<p style={{ fontWeight: 800 }} >{value['企业名称']}</p>
<Descriptions>
<Descriptions.Item label="企业ID">
{props.cid}
<Descriptions.Item>
<Tag color="#108ee9">企业ID{props.cid}</Tag>
</Descriptions.Item>
<Descriptions.Item label="邮箱">
{value['账户邮箱']}
<Descriptions.Item>
<Tag color="#108ee9">账户邮箱{value['账户邮箱']}</Tag>
</Descriptions.Item>
<Descriptions.Item label="行业">
{value['所属行业']}
<Descriptions.Item>
<Tag color="#108ee9">所属行业{value['所属行业']}</Tag>
</Descriptions.Item>
</Descriptions>
<Tabs defaultActiveKey="0" onChange={callback}>
{tab.map(item => {
return <TabPane tab={item.title} key={item.key}>
<Layout style={{ background: '#fff' }}>
<Content style={{ background: '#fff', margin: "0 0 40px 0", padding: "20px 20px 20px 0" }}>{tabPane === '财务数据' ? item.content(props.cid, updateTimeArray, tabPane) : item.content(props.cid, targetUpdateTime, tabPane)}</Content>
<Layout style={{ background: '#fff',minHeight:500 }}>
<Content style={{ background: '#fff', margin: "0 0 40px 0", padding: "20px 20px 20px 0",height:'100%' }}>{tabPane === '财务数据' ? item.content(props.cid, updateTimeArray, tabPane) : item.content(props.cid, targetUpdateTime, tabPane)}</Content>
<Sider style={{ background: '#fff', padding: 20 }} className='sider-box'>
<p>更新日期</p>
<p>{

View File

@ -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 (
<>
<Descriptions column={4}>
<Descriptions.Item label="评价ID">{value['评价ID']}</Descriptions.Item>
<Descriptions.Item label="风险级别">{value['风险级别']}</Descriptions.Item>
<Descriptions.Item label="风险分数">{value['风险分数']}</Descriptions.Item>
<Descriptions.Item label="列入失信名单">{value['列入失信名单']}</Descriptions.Item>
</Descriptions>
<Row justify='space-between'>
<Col span={12} style={{ paddingRight: 20 }}>
<p>合规风险</p>
{value['合规风险统计'] && <FeTable data={getPageData(value['合规风险统计'], compliancePage.current, compliancePage.pageSize)} columns={getColumn(value['合规风险统计'])} minHeight={300} current={compliancePage.current} pageChange={compliancePageChange} onShowSizeChange={onComplianceShowSizeChange} total={value['合规风险统计'].length} />}
{value['合规风险统计'] && <div style={{height:64}}></div>}
<p>变更记录</p>
{value['变更记录统计'] && <FeTable data={getPageData(value['变更记录统计'], alterationPage.current, alterationPage.pageSize)} columns={getColumn(value['变更记录统计'])} minHeight={300} current={alterationPage.current} pageChange={alterationPageChange} onShowSizeChange={onAlterationShowSizeChange} total={value['变更记录统计'].length} />}
{value['变更记录统计'] && <div style={{height:64}}></div>}
</Col>
<Col span={12} style={{ paddingLeft: 20 }}>
<p>经营风险</p>
{value['经营风险统计'] && <FeTable data={getPageData(value['经营风险统计'], businessPage.current, businessPage.pageSize)} columns={getColumn(value['经营风险统计'])} minHeight={300} current={businessPage.current} pageChange={businessPageChange} onShowSizeChange={onBusinessShowSizeChange} total={value['经营风险统计'].length} />}
{value['经营风险统计'] && <div style={{height:64}}></div>}
<p>周边风险</p>
{value['周边风险统计'] && <FeTable data={getPageData(value['周边风险统计'], rimPage.current, rimPage.pageSize)} columns={getColumn(value['周边风险统计'], slot())} minHeight={300} current={rimPage.current} pageChange={rimPageChange} onShowSizeChange={onRimShowSizeChange} total={value['周边风险统计'].length} callback={callback} />}
{value['周边风险统计'] && <div style={{height:64}}></div>}
</Col>
</Row>
{
Object.keys(value).length !== 0 ? <>
<Descriptions column={4}>
<Descriptions.Item><Tag color="#108ee9">评价ID{value['评价ID']}</Tag></Descriptions.Item>
<Descriptions.Item><Tag color="#108ee9">风险级别{value['风险级别']}</Tag></Descriptions.Item>
<Descriptions.Item><Tag color="#108ee9">风险分数{value['风险分数']}</Tag></Descriptions.Item>
<Descriptions.Item><Tag color="#108ee9">列入失信名单{value['列入失信名单']}</Tag></Descriptions.Item>
</Descriptions>
<Row justify='space-between'>
<Col span={12} style={{ paddingRight: 20 }}>
<p>合规风险</p>
{value['合规风险统计'] && <FeTable data={getPageData(value['合规风险统计'], compliancePage.current, compliancePage.pageSize)} columns={getColumn(value['合规风险统计'])} minHeight={300} current={compliancePage.current} pageChange={compliancePageChange} onShowSizeChange={onComplianceShowSizeChange} total={value['合规风险统计'].length} />}
{value['合规风险统计'] && <div style={{ height: 64 }}></div>}
<p>变更记录</p>
{value['变更记录统计'] && <FeTable data={getPageData(value['变更记录统计'], alterationPage.current, alterationPage.pageSize)} columns={getColumn(value['变更记录统计'])} minHeight={300} current={alterationPage.current} pageChange={alterationPageChange} onShowSizeChange={onAlterationShowSizeChange} total={value['变更记录统计'].length} />}
{value['变更记录统计'] && <div style={{ height: 64 }}></div>}
</Col>
<Col span={12} style={{ paddingLeft: 20 }}>
<p>经营风险</p>
{value['经营风险统计'] && <FeTable data={getPageData(value['经营风险统计'], businessPage.current, businessPage.pageSize)} columns={getColumn(value['经营风险统计'])} minHeight={300} current={businessPage.current} pageChange={businessPageChange} onShowSizeChange={onBusinessShowSizeChange} total={value['经营风险统计'].length} />}
{value['经营风险统计'] && <div style={{ height: 64 }}></div>}
<p>周边风险</p>
{value['周边风险统计'] && <FeTable data={getPageData(value['周边风险统计'], rimPage.current, rimPage.pageSize)} columns={getColumn(value['周边风险统计'], slot())} minHeight={300} current={rimPage.current} pageChange={rimPageChange} onShowSizeChange={onRimShowSizeChange} total={value['周边风险统计'].length} callback={callback} />}
{value['周边风险统计'] && <div style={{ height: 64 }}></div>}
</Col>
</Row>
</>
: <Empty />
}
</>
)
}