This commit is contained in:
xuyucheng 2022-04-27 16:59:26 +08:00
parent ad9c64ce2e
commit 23a0ba164a
5 changed files with 79 additions and 80 deletions

View File

@ -18,7 +18,6 @@ function CreditAnalysis(props) {
if(Object.keys(res).length !== 0){
initRadar("radar", res['指标雷达'])
}
})
}
}, [props.cid,props.updateTime,props.table])
@ -44,7 +43,7 @@ function CreditAnalysis(props) {
max: param['最大分数'][key]
}
})
},
},
series: [
{
name: 'Budget vs spending',

View File

@ -12,8 +12,8 @@ import { getColumn } from "@/utils/utils"
function FinancialAnalysis(props) {
const [value, setValue] = useState({})
const [page,setPage] = useState(1)
const [size,setSize] = useState(10)
const [page, setPage] = useState(1)
const [size, setSize] = useState(10)
useEffect(() => {
if (props.table === '财务分析') {
@ -21,7 +21,7 @@ function FinancialAnalysis(props) {
setValue(res)
if (Object.keys(res).length !== 0) {
var data = {}
res["财务得分年度比较"].forEach(item=>{
res["财务得分年度比较"].forEach(item => {
data[Object.keys(item)[0]] = item[Object.keys(item)[0]]
})
initDoubleBar("bar-1", data)
@ -45,8 +45,8 @@ function FinancialAnalysis(props) {
return `<span>${params.name} ${params.data}%</span>`
}
},
legend:{
show:true,
legend: {
show: true,
x: "right",
y: "top",
itemHeight: 10,
@ -87,10 +87,10 @@ function FinancialAnalysis(props) {
return {
type: 'bar',
barWidth: "20%",
name:key,
name: key,
data: Object.keys(param[key]).map(k => {
return param[key][k]
})
}),
}
})
})
@ -147,58 +147,65 @@ function FinancialAnalysis(props) {
barWidth: "20%",
data: Object.keys(param).map(key => {
return param[key]
})
}),
itemStyle: {
normal: {
color: function (params) {
return params.data < 0 ? "#f50" : '#5970CA'
}
}
}
}]
})
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 (
<>
<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} />}
</>
)
}
export default FinancialAnalysis

View File

@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
import api from "@/api/request"
import "./index.css"
import FeTable from "@/components/table"
import { Empty } from 'antd'
function FinancialData(props) {
const [profits, setProfits] = useState([])
@ -35,7 +34,9 @@ function FinancialData(props) {
function getFinancial(callback, params) {
api.post("/admin/company/financial_data", params).then(res => {
callback(res)
if (Object.keys(res).length !== 0) {
callback(res)
}
})
}
@ -44,9 +45,13 @@ function FinancialData(props) {
const matrixData = params.map((row) => {
var arr = [];
for (var i in row) {
columns.push(i)
arr.push(row[i]);
if (i !== '报告期') {
columns.push(i)
arr.push(row[i]);
}
}
columns.unshift('报告期')
arr.unshift(row['报告期']);
return arr;
});
@ -63,8 +68,7 @@ function FinancialData(props) {
return {
title: item, dataIndex: item, align: 'center', key: i
}
}
);
});
const data = transData.map((item, i) => {
var obj = {}
@ -86,29 +90,13 @@ function FinancialData(props) {
return (
<>
<p>资产负债表</p>
{profits.length !== 0 ? analysisArray(profits) : <Empty description={
<span>
请选择时间
</span>
} style={{height:300}}/>}
{profits.length !== 0 && analysisArray(profits)}
<p>利润表</p>
{assets.length !== 0 ? analysisArray(assets): <Empty description={
<span>
请选择时间
</span>
} style={{height:300}}/>}
{assets.length !== 0 && analysisArray(assets)}
<p>财务指标</p>
{financial.length !== 0 ? analysisArray(financial): <Empty description={
<span>
请选择时间
</span>
} style={{height:300}}/>}
{financial.length !== 0 && analysisArray(financial)}
<p>补充数据表</p>
{supplement.length !== 0 ? analysisArray(supplement): <Empty description={
<span>
请选择时间
</span>
} style={{height:300}}/>}
{supplement.length !== 0 && analysisArray(supplement)}
</>
)
}

View File

@ -45,6 +45,7 @@ function CompanyDetails(props) {
})
setUpdateTime(data)
setTargetUpdateTime(res.update_time[0])
setUpdateTimeArray([res.update_time[0]])
} else {
setUpdateTime([])
}
@ -85,7 +86,7 @@ function CompanyDetails(props) {
<Sider style={{ background: '#fff', padding: 20 }} className='sider-box'>
<p>更新日期</p>
<p>{
tabPane === '财务数据' ? <Checkbox.Group options={updateTime} onChange={setTargetUpdateArray} /> : <Radio.Group onChange={setTargetUpdate} value={targetUpdateTime}>{updateTime.map(item => {
tabPane === '财务数据' ? <Checkbox.Group options={updateTime} onChange={setTargetUpdateArray} value={updateTimeArray}/> : <Radio.Group onChange={setTargetUpdate} value={targetUpdateTime}>{updateTime.map(item => {
return <Radio value={item.value}>{item.label}</Radio>
})}</Radio.Group>
}</p>

View File

@ -136,14 +136,18 @@ function OperationalRisk(props) {
<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>
</>