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' import { message } from 'antd'
axios.defaults.timeout = 50000; 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 => { axios.interceptors.request.use(config => {
const secret = "EZgo9ykxrYuBMYnYmmKIh" const secret = "EZgo9ykxrYuBMYnYmmKIh"

View File

@ -1,20 +1,47 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import api from "@/api/request" import api from "@/api/request"
import text_model from '@/utils/model' import { Input, Button, Row, Col, Tree } from 'antd'
import { Input, Button, Row, Col } from 'antd'
import "@/assets/style/editReport.css" import "@/assets/style/editReport.css"
class EditReport extends Component { class EditReport extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { 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) => { simulate = (value, i, j, m, n) => {
return value.map((item, index_first) => { return value.map((item, index_first) => {
@ -31,7 +58,7 @@ class EditReport extends Component {
} }
onSimulate = (a, b, c, d, e, f, g) => { 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) { if (a === i) {
return item["章节内容"].filter((ele, j) => { return item["章节内容"].filter((ele, j) => {
if (b === j) { if (b === j) {
@ -58,19 +85,19 @@ class EditReport extends Component {
}) })
this.setState({ this.setState({
text_model: data data: data
}) })
} }
onFinish = () => { 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 => { .then(res => {
console.log(res) console.log(res)
}) })
} }
onOutput = (a, b, c, d, e) => { 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) { if (a === i) {
return item["章节内容"].filter((ele, j) => { return item["章节内容"].filter((ele, j) => {
if (b === j) { if (b === j) {
@ -97,7 +124,7 @@ class EditReport extends Component {
}) })
this.setState({ this.setState({
text_model: data data: data
}) })
} }
@ -106,33 +133,44 @@ class EditReport extends Component {
return ( return (
<React.Fragment> <React.Fragment>
<Button onClick={this.onFinish}>输出</Button> <Row>
{this.state.text_model.map((item, i) => { <Col span={4}> <Tree
return <React.Fragment><span className="paragraph_name"> defaultExpandedKeys={['0-0-0', '0-0-1']}
{item["章节"]} defaultSelectedKeys={['0-0-0', '0-0-1']}
</span> defaultCheckedKeys={['0-0-0', '0-0-1']}
{item["章节内容"].map((item_child, j) => { treeData={this.state.tree}
return <React.Fragment><span className="paragraph_name" style={{ marginLeft: 20 }}>{item_child["小节"]}</span> onSelect={this.onSelect}
{ /></Col>
item_child["小节内容"].map((item_child_child, m) => { <Col span={20}><Button onClick={this.onFinish}>输出</Button>
return Object.keys(item_child_child).map((key, n) => { {this.state.data.map((item, i) => {
return key === "表格" ? <React.Fragment> return <React.Fragment><span className="paragraph_name">
<span className="paragraph_name" style={{ marginLeft: 40 }}>{key}:</span> {item["章节"]}
{this.simulate(item_child_child[key], i, j, m, n)} </span>
</React.Fragment> {item["章节内容"].map((item_child, j) => {
: <React.Fragment> return <React.Fragment><span className="paragraph_name" style={{ marginLeft: 20 }}>{item_child["小节"]}</span>
<span className="paragraph_name" style={{ marginLeft: 40 }}>{key}:</span> {
<Input.TextArea item_child["小节内容"].map((item_child_child, m) => {
style={{ marginLeft: 60, width: "calc(100% - 80px)", }} return Object.keys(item_child_child).map((key, n) => {
defaultValue={item_child_child[key]} return key === "表格" ? <React.Fragment>
onChange={this.onOutput.bind(this, i, j, m, n)} /> <span className="paragraph_name" style={{ marginLeft: 40 }}>{key}:</span>
</React.Fragment> {this.simulate(item_child_child[key], i, j, m, n)}
}) </React.Fragment>
}) : <React.Fragment>
} </React.Fragment> <span className="paragraph_name" style={{ marginLeft: 40 }}>{key}:</span>
})} <Input.TextArea
</React.Fragment> style={{ marginLeft: 60, width: "calc(100% - 80px)", }}
})} defaultValue={item_child_child[key]}
onChange={this.onOutput.bind(this, i, j, m, n)} />
</React.Fragment>
})
})
} </React.Fragment>
})}
</React.Fragment>
})}</Col>
</Row>
</React.Fragment> </React.Fragment>
) )
} }

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Descriptions,Card,Tag } from 'antd' import { Descriptions, Tag, Divider } from 'antd'
import api from "@/api/request" import api from "@/api/request"
class RateResult extends Component { class RateResult extends Component {
@ -7,9 +7,6 @@ class RateResult extends Component {
super(props) super(props)
this.state = { this.state = {
data: {}, data: {},
managementScore: {},
financialScore: {},
riskScore: {}
} }
} }
@ -18,73 +15,81 @@ class RateResult extends Component {
.then(res => { .then(res => {
this.setState({ this.setState({
data: res.result[0], data: res.result[0],
managementScore: res.result[0]["经营评分"],
financialScore: res.result[0]["财务评分"],
riskScore: res.result[0]["风险评分"]
}) })
}).catch(err => { }).catch(err => {
console.log(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() { render() {
return ( return (
<React.Fragment> <React.Fragment>
{(() => { <Descriptions title={this.state.data["企业名称"]} column={4} extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>} style={{ marginTop: 20 }}>
if (this.state.data === {}) { {Object.keys(this.state.data).map((key, i) => {
return null; if (!['经营评分', '财务评分', '风险评分', "企业ID", "企业名称"].includes(key)) {
} else { return <Descriptions.Item label={key} key={i}>{this.state.data[key]}</Descriptions.Item>
return <React.Fragment><Descriptions title={this.state.data["企业名称"]} bordered extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>}> } else {
{Object.keys(this.state.data).map((key, i) => { return null
if (!['经营评分', '财务评分', '风险评分'].includes(key)) { }
return <Descriptions.Item label={key} key={i}>{this.state.data[key]}</Descriptions.Item> })}
} else { </Descriptions>
return null <Divider />
} <Tag color="#108ee9" style={{ marginBottom: 20 }}>经营评分</Tag>
})} <Descriptions column={4}>
</Descriptions> {this.state.data["经营评分"] && Object.keys(this.state.data["经营评分"]).map((key, i) => {
<Tag color="#108ee9">经营评分</Tag> return <Descriptions.Item label={key} key={i}>{this.state.data["经营评分"][key]}</Descriptions.Item>
<Descriptions bordered> })}
{Object.keys(this.state.managementScore).map((key, i) => { </Descriptions>
return <Descriptions.Item label={key} key={i}>{this.state.managementScore[key]}</Descriptions.Item> <Divider />
})} <Tag color="#108ee9" style={{ marginBottom: 20 }}>财务评分</Tag>
</Descriptions> <Descriptions column={4} title="盈利能力">
<Tag color="#108ee9">财务评分</Tag> {this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["盈利能力"]).map((key, i) => {
<Card type="inner" style={{marginBottom:20}}> return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"]["盈利能力"][key]}</Descriptions.Item>
{this.analysisObject(this.state.financialScore)} })}
</Card> </Descriptions>
<Tag color="#108ee9">风险评分</Tag> <Descriptions column={4} title="债务风险">
<Card type="inner"> {this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["债务风险"]).map((key, i) => {
{this.analysisObject(this.state.riskScore)} return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"]["债务风险"][key]}</Descriptions.Item>
</Card> })}
</React.Fragment> </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> </React.Fragment>
) )
} }

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import api from "@/api/request" import api from "@/api/request"
import { Descriptions,Tag } from 'antd' import { Descriptions, Tag } from 'antd'
class RiskData extends Component { class RiskData extends Component {
constructor(props) { constructor(props) {
@ -14,7 +14,7 @@ class RiskData extends Component {
api.post("/admin/rating/risk", { rid: this.props.id }) api.post("/admin/rating/risk", { rid: this.props.id })
.then(res => { .then(res => {
this.setState({ this.setState({
data: res.result.length!==0?res.result[0]:[] data: res.result.length !== 0 ? res.result[0] : []
}) })
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
@ -22,33 +22,28 @@ class RiskData extends Component {
} }
analysisObject(val) { analysisObject(val) {
console.log(val) return Object.keys(val).map(key => {
if (Object.keys(val).length !== 0) { if (typeof val[key] === "object") {
return Object.keys(val).map(key => { if (['合规风险', '经营风险'].includes(key)) {
if (typeof val[key] === "object") { return <React.Fragment><Tag color="#108ee9" style={{ marginBottom: 20 }}>{key}</Tag><Descriptions column={4}>
if (['合规风险', '经营风险'].includes(key)) { {Object.keys(val[key]).map((item, i) => {
return <React.Fragment><Tag color="#108ee9">{key}</Tag><Descriptions bordered> return <Descriptions.Item label={item} key={i} >{val[key][item]}</Descriptions.Item>
{Object.keys(val[key]).map((item, i) => { })}
return <Descriptions.Item label={item} key={i} >{val[key][item]}</Descriptions.Item> </Descriptions>
</React.Fragment>
} else {
return Object.keys(val[key]).map((item, i) => {
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>
})} })}
</Descriptions> </Descriptions></React.Fragment>
</React.Fragment> })
} else {
return Object.keys(val[key]).map((item, i) => {
return <React.Fragment><Tag color="#108ee9">{item}</Tag><Descriptions bordered>
{Object.keys(val[key][item]).map((ele, j) => {
return <Descriptions.Item label={ele} key={j}>{val[key][item][ele]}</Descriptions.Item>
})}
</Descriptions></React.Fragment>
})
}
}else{
return null
} }
}) } else {
} else { return null
return null }
} })
} }
render() { render() {

View File

@ -43,7 +43,6 @@ class Main extends Component {
} }
} }
} }
} }
onChange = activeKey => { onChange = activeKey => {
@ -111,13 +110,13 @@ class Main extends Component {
case "/manage/industry": case "/manage/industry":
return <ManageIndustry /> return <ManageIndustry />
case "/manage/industry/analysis": case "/manage/industry/analysis":
return <AnalysisDetails value={name}/> return <AnalysisDetails value={name} />
case "/test/company": case "/test/company":
return <TestCompany /> return <TestCompany />
case "/setting/user": case "/setting/user":
return <UserSet /> return <UserSet />
default: default:
return <EmptyContent/> return <EmptyContent />
} }
} }

View File

@ -18,10 +18,22 @@ class Side extends Component {
{ title: '服务管理', path: '/service', icon: <GlobalOutlined />, category: 'Test' }, { title: '服务管理', path: '/service', icon: <GlobalOutlined />, category: 'Test' },
{ title: '用户', path: '/setting/user', icon: <UserOutlined />, category: 'Setting' }, { title: '用户', path: '/setting/user', icon: <UserOutlined />, category: 'Setting' },
{ title: '设置', path: '/service', icon: <SettingOutlined />, 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 => { handleClick = e => {
this.props.parent.getMenuItem({ this.props.parent.getMenuItem({
title: this.state.data[e.key].title, title: this.state.data[e.key].title,
@ -30,7 +42,7 @@ class Side extends Component {
} }
render() { render() {
const menus = localStorage.getItem("menus").split(',') || ['Board', 'Manage','Model','Test','Setting'] const menus = localStorage.getItem("menus").split(',') || ['Board', 'Manage', 'Model', 'Test', 'Setting']
const menuItem = menus.map((item, i) => { const menuItem = menus.map((item, i) => {
return <Menu.ItemGroup title={item} key={i}> return <Menu.ItemGroup title={item} key={i}>
{this.state.data.map((ele, index) => { {this.state.data.map((ele, index) => {
@ -43,6 +55,7 @@ class Side extends Component {
<Menu <Menu
mode="inline" mode="inline"
defaultSelectedKeys={['0']} defaultSelectedKeys={['0']}
selectedKeys={this.state.currentKey}
style={{ height: '100%', borderRight: 0, position: 'fixed', width: '220px' }} style={{ height: '100%', borderRight: 0, position: 'fixed', width: '220px' }}
theme="dark" theme="dark"
className='menu' className='menu'