This commit is contained in:
xuyucheng 2022-03-02 17:01:25 +08:00
parent b6f1359b7b
commit 0b53be6c52
6 changed files with 181 additions and 131 deletions

View File

@ -2,7 +2,7 @@ import axios from 'axios'
import { message } from 'antd'
axios.defaults.timeout = 50000;
axios.defaults.baseURL = 'http://139.9.249.34:51013'
axios.defaults.baseURL = 'https://api.fecribd.com'
axios.interceptors.request.use(config => {
const secret = "EZgo9ykxrYuBMYnYmmKIh"

View File

@ -1,20 +1,47 @@
import React, { Component } from 'react';
import api from "@/api/request"
import text_model from '@/utils/model'
import { Input, Button, Row, Col } from 'antd'
import { Input, Button, Row, Col, Tree } from 'antd'
import "@/assets/style/editReport.css"
class EditReport extends Component {
constructor(props) {
super(props)
this.state = {
text_model: text_model
data: [],
tree: []
}
}
// componentDidMount() {
componentDidMount() {
api.post("/admin/rating/get_report_text_model", { rid: this.props.id })
.then(res => {
this.setState({
data: res.result['text_model'],
tree: this.createTree(res.result['text_model'])
})
})
}
// }
createTree = (val) => {
const data = val.map((item, index) => {
return {
title: item['章节'], key: index.toString(), children: item["章节内容"].map((item_1, index_1) => {
return {
title: item_1['小节'], key: index.toString() + index_1.toString(), children: item_1["小节内容"].map((item_2, index_2) => {
console.log(item_2)
return { title: Object.keys(item_2)[0], key: index.toString() + index_1.toString() + index_2.toString() }
})
}
})
}
})
return data
}
onSelect = (value) =>{
console.log(value)
}
simulate = (value, i, j, m, n) => {
return value.map((item, index_first) => {
@ -31,7 +58,7 @@ class EditReport extends Component {
}
onSimulate = (a, b, c, d, e, f, g) => {
const data = this.state.text_model.filter((item, i) => {
const data = this.state.data.filter((item, i) => {
if (a === i) {
return item["章节内容"].filter((ele, j) => {
if (b === j) {
@ -58,19 +85,19 @@ class EditReport extends Component {
})
this.setState({
text_model: data
data: data
})
}
onFinish = () => {
api.post("/admin/rating/report_edit_save_delete", { rid: this.props.id, text_model: this.state.text_model })
api.post("/admin/rating/report_edit_save_delete", { rid: this.props.id, text_model: this.state.data })
.then(res => {
console.log(res)
})
}
onOutput = (a, b, c, d, e) => {
const data = this.state.text_model.filter((item, i) => {
const data = this.state.data.filter((item, i) => {
if (a === i) {
return item["章节内容"].filter((ele, j) => {
if (b === j) {
@ -97,7 +124,7 @@ class EditReport extends Component {
})
this.setState({
text_model: data
data: data
})
}
@ -106,8 +133,16 @@ class EditReport extends Component {
return (
<React.Fragment>
<Button onClick={this.onFinish}>输出</Button>
{this.state.text_model.map((item, i) => {
<Row>
<Col span={4}> <Tree
defaultExpandedKeys={['0-0-0', '0-0-1']}
defaultSelectedKeys={['0-0-0', '0-0-1']}
defaultCheckedKeys={['0-0-0', '0-0-1']}
treeData={this.state.tree}
onSelect={this.onSelect}
/></Col>
<Col span={20}><Button onClick={this.onFinish}>输出</Button>
{this.state.data.map((item, i) => {
return <React.Fragment><span className="paragraph_name">
{item["章节"]}
</span>
@ -132,7 +167,10 @@ class EditReport extends Component {
} </React.Fragment>
})}
</React.Fragment>
})}
})}</Col>
</Row>
</React.Fragment>
)
}

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { Descriptions,Card,Tag } from 'antd'
import { Descriptions, Tag, Divider } from 'antd'
import api from "@/api/request"
class RateResult extends Component {
@ -7,9 +7,6 @@ class RateResult extends Component {
super(props)
this.state = {
data: {},
managementScore: {},
financialScore: {},
riskScore: {}
}
}
@ -18,73 +15,81 @@ class RateResult extends Component {
.then(res => {
this.setState({
data: res.result[0],
managementScore: res.result[0]["经营评分"],
financialScore: res.result[0]["财务评分"],
riskScore: res.result[0]["风险评分"]
})
}).catch(err => {
console.log(err)
})
}
analysisObject(val) {
if (Object.keys(val).length !== 0) {
return Object.keys(val).map((key) => {
if (typeof val[key] !== 'object') {
return <p>{key}:{val[key]}</p>
} else {
return <React.Fragment><Tag color="#2db7f5">{key}</Tag><Descriptions bordered >{Object.keys(val[key]).map((child,n) => {
if (typeof val[key][child] !== 'object') {
return <Descriptions.Item label={child} key={n}>{val[key][child]}</Descriptions.Item >
} else {
return <Tag>{child}
{Object.keys(val[key][child]).map((ele, j) => {
return <span className="block">{ele}:{val[key][child][ele]}</span>
// return <Descriptions.Item label={ele} key={j}>{val[key][child][ele]}</Descriptions.Item>
})}
</Tag>
}
})}</Descriptions></React.Fragment>
}
})
} else {
return null
}
}
render() {
return (
<React.Fragment>
{(() => {
if (this.state.data === {}) {
return null;
} else {
return <React.Fragment><Descriptions title={this.state.data["企业名称"]} bordered extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>}>
<Descriptions title={this.state.data["企业名称"]} column={4} extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>} style={{ marginTop: 20 }}>
{Object.keys(this.state.data).map((key, i) => {
if (!['经营评分', '财务评分', '风险评分'].includes(key)) {
if (!['经营评分', '财务评分', '风险评分', "企业ID", "企业名称"].includes(key)) {
return <Descriptions.Item label={key} key={i}>{this.state.data[key]}</Descriptions.Item>
} else {
return null
}
})}
</Descriptions>
<Tag color="#108ee9">经营评分</Tag>
<Descriptions bordered>
{Object.keys(this.state.managementScore).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.managementScore[key]}</Descriptions.Item>
<Divider />
<Tag color="#108ee9" style={{ marginBottom: 20 }}>经营评分</Tag>
<Descriptions column={4}>
{this.state.data["经营评分"] && Object.keys(this.state.data["经营评分"]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["经营评分"][key]}</Descriptions.Item>
})}
</Descriptions>
<Tag color="#108ee9">财务评分</Tag>
<Card type="inner" style={{marginBottom:20}}>
{this.analysisObject(this.state.financialScore)}
</Card>
<Tag color="#108ee9">风险评分</Tag>
<Card type="inner">
{this.analysisObject(this.state.riskScore)}
</Card>
</React.Fragment>
}
})()}
<Divider />
<Tag color="#108ee9" style={{ marginBottom: 20 }}>财务评分</Tag>
<Descriptions column={4} title="盈利能力">
{this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["盈利能力"]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"]["盈利能力"][key]}</Descriptions.Item>
})}
</Descriptions>
<Descriptions column={4} title="债务风险">
{this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["债务风险"]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"]["债务风险"][key]}</Descriptions.Item>
})}
</Descriptions>
<Descriptions column={4} title="经营增长">
{this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["经营增长"]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"]["经营增长"][key]}</Descriptions.Item>
})}
</Descriptions>
<Descriptions column={4} title="资产质量">
{this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["资产质量"]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"]["资产质量"][key]}</Descriptions.Item>
})}
</Descriptions>
<Descriptions column={4} title="财务合计">
<Descriptions.Item label="合计">{this.state.data["财务评分"] && this.state.data["财务评分"]["合计"]}</Descriptions.Item>
</Descriptions>
<Divider />
<Tag color="#108ee9" style={{ marginBottom: 20 }}>风险评分</Tag>
<Descriptions column={4} title="合规风险">
<Descriptions.Item label="合规风险">{this.state.data["风险评分"] && this.state.data["风险评分"]["合规风险"]}</Descriptions.Item>
</Descriptions>
<Descriptions column={4} title="经营风险">
{this.state.data["风险评分"] && Object.keys(this.state.data["风险评分"]["经营风险"]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["风险评分"]["经营风险"][key]}</Descriptions.Item>
})}
</Descriptions>
<Divider />
{this.state.data["风险评分"] && this.state.data["风险评分"]["关联风险"] && this.state.data["风险评分"]["关联风险"]["变更记录"] && Object.keys(this.state.data["风险评分"]["关联风险"]["变更记录"]).map((key, i) => {
return <Descriptions column={4} title="关联风险 - 变更记录"><Descriptions.Item label={key} key={i}>{this.state.data["风险评分"]["关联风险"]["变更记录"][key]}</Descriptions.Item></Descriptions>
})}
{this.state.data["风险评分"] && this.state.data["风险评分"]["关联风险"] && this.state.data["风险评分"]["关联风险"]["周边风险"] && Object.keys(this.state.data["风险评分"]["关联风险"]["周边风险"]).map((key, i) => {
return <Descriptions column={4} title="关联风险 - 周边风险"><Descriptions.Item label={key} key={i}>{this.state.data["风险评分"]["关联风险"]["周边风险"][key]}</Descriptions.Item></Descriptions>
})}
<Descriptions column={4} title="关联风险 - 合计">
<Descriptions.Item label="合计">{this.state.data["风险评分"] && this.state.data["风险评分"]["关联风险"]["合计"]}</Descriptions.Item>
</Descriptions>
<Divider />
<Descriptions column={4} title="风险合计">
<Descriptions.Item label="合计">{this.state.data["风险评分"] && this.state.data["风险评分"]["合计"]}</Descriptions.Item>
</Descriptions>
</React.Fragment>
)
}

View File

@ -22,12 +22,10 @@ class RiskData extends Component {
}
analysisObject(val) {
console.log(val)
if (Object.keys(val).length !== 0) {
return Object.keys(val).map(key => {
if (typeof val[key] === "object") {
if (['合规风险', '经营风险'].includes(key)) {
return <React.Fragment><Tag color="#108ee9">{key}</Tag><Descriptions bordered>
return <React.Fragment><Tag color="#108ee9" style={{ marginBottom: 20 }}>{key}</Tag><Descriptions column={4}>
{Object.keys(val[key]).map((item, i) => {
return <Descriptions.Item label={item} key={i} >{val[key][item]}</Descriptions.Item>
})}
@ -35,7 +33,7 @@ class RiskData extends Component {
</React.Fragment>
} else {
return Object.keys(val[key]).map((item, i) => {
return <React.Fragment><Tag color="#108ee9">{item}</Tag><Descriptions bordered>
return <React.Fragment><Tag color="#108ee9" style={{ marginBottom: 20 }}>{item}</Tag><Descriptions column={4}>
{Object.keys(val[key][item]).map((ele, j) => {
return <Descriptions.Item label={ele} key={j}>{val[key][item][ele]}</Descriptions.Item>
})}
@ -46,9 +44,6 @@ class RiskData extends Component {
return null
}
})
} else {
return null
}
}
render() {

View File

@ -43,7 +43,6 @@ class Main extends Component {
}
}
}
}
onChange = activeKey => {

View File

@ -18,10 +18,22 @@ class Side extends Component {
{ title: '服务管理', path: '/service', icon: <GlobalOutlined />, category: 'Test' },
{ title: '用户', path: '/setting/user', icon: <UserOutlined />, category: 'Setting' },
{ title: '设置', path: '/service', icon: <SettingOutlined />, category: 'Setting' },
]
],
currentKey: '0'
}
}
componentDidUpdate(preProps, preState) {
console.log(preProps, preState)
if (preProps.activeKey !== preState.currentKey) {
// const title = preProps.panes.filter(item => {
// return item.key === preProps.activeKey ? item.title : null
// })
}
}
handleClick = e => {
this.props.parent.getMenuItem({
title: this.state.data[e.key].title,
@ -43,6 +55,7 @@ class Side extends Component {
<Menu
mode="inline"
defaultSelectedKeys={['0']}
selectedKeys={this.state.currentKey}
style={{ height: '100%', borderRight: 0, position: 'fixed', width: '220px' }}
theme="dark"
className='menu'