This commit is contained in:
xuyucheng 2022-03-18 15:49:54 +08:00
parent 6fd919b17b
commit 074963d86f
8 changed files with 248 additions and 74 deletions

View File

@ -70,7 +70,6 @@ class CompanyDetails extends Component {
}
handleClick(value) {
console.log(value)
this.isJump = true
this.setState({
visible: true,

View File

@ -71,7 +71,6 @@ class IndustryAnalysis extends Component {
onSubmit = () => {
const form = this.form.current
console.log(form.getFieldsValue())
const data = {
"行业": form.getFieldsValue()['行业'],
"行业简介": form.getFieldsValue()['行业简介'],

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import api from "@/api/request"
import { Input, Button, Row, Col, Tree, BackTop, Tag, Empty } from 'antd'
import { Input, Button, Row, Col, Tree, BackTop, Tag, Empty, message } from 'antd'
import "@/assets/style/editReport.css"
class EditReport extends Component {
@ -8,7 +8,8 @@ class EditReport extends Component {
super(props)
this.state = {
data: [],
tree: []
tree: [],
type: 0
}
}
@ -17,13 +18,15 @@ class EditReport extends Component {
api.post(url, { rid: this.props.value.rid })
.then(res => {
this.setState({
data: res.result['text_model']?res.result['text_model']:[],
tree: res.result['text_model']?this.createTree(res.result):[]
data: res.result['text_model'] ? res.result['text_model'] : [],
tree: res.result['text_model'] ? this.createTree(res.result) : [],
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
})
}
createTree = (val) => {
if (this.props.value.types === "综合评价流程") {
const data = val['text_model'].map((item, index) => {
return {
title: item['章节'], key: index.toString(), children: item["章节内容"].map((item_1, index_1) => {
@ -36,6 +39,18 @@ class EditReport extends Component {
}
})
return data
} else {
const data = val['text_model'].map((item, index) => {
return {
title: item['章节'], key: index.toString(), children: item["章节内容"].map((_, index_1) => {
return {
title: "段落", key: index.toString() + index_1.toString()
}
})
}
})
return data
}
}
onSelect = (value) => {
@ -90,13 +105,20 @@ class EditReport extends Component {
}
onFinish = () => {
api.post("/admin/rating/report_edit_save_delete", { rid: this.props.id, text_model: this.state.data })
const url = this.state.type === 0 ? "/admin/rating/report_edit_save_delete" : "/admin/rating/esg_report_edit_save_delete"
const form = {
cid: this.props.value.cid,
rid: this.props.value.rid,
text_model: this.state.data
}
api.post(url, form)
.then(res => {
console.log(res)
message.info(res.info)
})
}
onOutput = (a, b, c, d, e) => {
if (this.state.type === 0) {
const data = this.state.data.filter((item, i) => {
if (a === i) {
return item["章节内容"].filter((ele, j) => {
@ -126,15 +148,46 @@ class EditReport extends Component {
this.setState({
data: data
})
} else {
if (typeof b !== 'number') {
const data = this.state.data.filter((item, i) => {
if (a === i) {
return item['章节'] = b.target.value
} else {
return item
}
})
this.setState({
data
})
} else {
const data = this.state.data.filter((item, i) => {
if (a === i) {
return item['章节内容'].filter((ele, j) => {
if (b === j) {
return ele['段落'] = c.target.value
} else {
return ele
}
})
} else {
return item
}
})
this.setState({
data
})
}
}
}
render() {
return (
<React.Fragment>
{this.state.data.length !== 0 ? <>
<BackTop><div className='backTop'>UP</div></BackTop>
{this.state.data.length !== 0 && this.state.type === 0 ? <><BackTop><div className='backTop'>UP</div></BackTop>
<Row style={{ paddingRight: 20 }}>
<Col span={3}><Tree
defaultExpandedKeys={['000', '001']}
@ -171,7 +224,43 @@ class EditReport extends Component {
})}
</Col>
</Row>
</> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
</> : this.state.data.length !== 0 && this.state.type === 1 ?
<>
<BackTop><div className='backTop'>UP</div></BackTop>
<Row style={{ paddingRight: 20 }}>
<Col span={3}><Tree
defaultExpandedKeys={['00', '01']}
defaultSelectedKeys={['00', '01']}
defaultCheckedKeys={['00', '01']}
treeData={this.state.tree}
onSelect={this.onSelect}
/></Col>
<Col span={21}><Button onClick={this.onFinish} type='primary' style={{ position: 'absolute', right: 0 }}>输出</Button>
{this.state.data.map((item, i) => {
return <React.Fragment>
<p><Tag color="#3b5999" id={i.toString()}>章节</Tag></p>
<p>
<Input.TextArea
defaultValue={item['章节']}
onChange={this.onOutput.bind(this, i)} />
</p>
<p><Tag color="#55acee">章节内容</Tag></p>
{item["章节内容"].map((item_child, j) => {
return <>
<p><Tag color="#87d068" id={i.toString() + j.toString()}>段落</Tag></p>
<p>
<Input.TextArea
defaultValue={item_child['段落']}
onChange={this.onOutput.bind(this, i, j)} />
</p>
</>
})}
</React.Fragment>
})}
</Col>
</Row>
</>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
</React.Fragment>
)
}

View File

@ -7,8 +7,9 @@ class FillDetails extends Component {
constructor(props) {
super(props)
this.state = {
data: [],
financialFill: {}
data: {},
financialFill: {},
type: 0
}
}
@ -17,8 +18,8 @@ class FillDetails extends Component {
api.post(url, { rid: this.props.value.rid })
.then(res => {
this.setState({
data: res.result.length !== 0 ? res.result[0] : [],
financialFill: res.result.length !== 0 ? res.result[0]['财务填报'] : []
data: res.result.length !== 0 ? res.result[0] : {},
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
}).catch(err => {
console.log(err)
@ -84,18 +85,89 @@ class FillDetails extends Component {
}
}
analysisArray = (params) => {
var columns = []
const matrixData = params.map((row) => {
var arr = [];
for (var i in row) {
columns.push(i)
arr.push(row[i]);
}
return arr;
});
const transData = matrixData[0].map((col, i) => {
return [
columns[i],
...matrixData.map((row) => {
return row[i];
}),
];
});
const transTitle = transData[0].map((item, i) => {
return {
title: item, dataIndex: item, align: 'center', key: i
}
}
);
const data = transData.map((item, i) => {
var obj = {}
item.forEach((child, j) => {
Object.assign(obj, {
[transTitle[j].title]: child,
key: j
})
})
return obj
})
data.shift()
return <React.Fragment><Tag color="#2db7f5">近三年企业数据</Tag><FeTable data={data} columns={transTitle}></FeTable></React.Fragment>
}
render() {
return (
<React.Fragment>
{this.state.data.length!==0 ? <>
{this.state.data && this.state.type === 0 ? <>
<Descriptions title={this.state.data["企业名称"]} bordered extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>}></Descriptions>
<p><Tag color="#87d068">评价年度{this.state.data["评价年度"]}</Tag><Tag color="#87d068" style={{ float: 'right' }}>{(() => { if ("行业选择" in this.state.data && this.state.data["行业选择"] !== null) { return this.state.data["行业选择"].join("/") } else { return null } })()}</Tag></p>
<Tag color="#108ee9">经营问卷</Tag>
<Descriptions bordered>
{this.analysisQuestion(this.state.data["经营问卷"])}
</Descriptions>
{this.analysisObject(this.state.financialFill)}
</> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
{this.state.data['财务填报'] && this.analysisObject(this.state.data['财务填报'])}
</>
: this.state.data && this.state.type === 1 ?
<>
<Descriptions title={this.state.data["企业名称"]} bordered extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>}></Descriptions>
<p><Tag color="#87d068">评价年度{this.state.data["评价年度"]}</Tag><Tag color="#87d068" style={{ float: 'right' }}>{(() => { if ("所属行业" in this.state.data && this.state.data["所属行业"] !== null) { return this.state.data["所属行业"].join("/") } else { return null } })()}</Tag></p>
<Tag color="#108ee9" style={{ marginBottom: 20 }}>公司当年收入万元</Tag>
<Descriptions column={4} bordered>
{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>
{
['环境问卷', '社会问卷', '治理问卷'].map(item => {
return <><Tag color="#108ee9" style={{ marginBottom: 20 }}>{item}</Tag>
<div><Tag color="#2db7f5">其他类型问卷</Tag></div>
<Descriptions bordered >
{this.state.data[item]['其他类型问卷'].map((key, i) => {
return <Descriptions.Item label={i + 1 + "题"} key={i} span={0.5}>{key}</Descriptions.Item>
})}
</Descriptions>
{this.state.data[item] && this.state.data[item]['近三年公司数据'] && this.analysisArray(this.state.data[item]['近三年公司数据'])}
</>
})
}
</>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
</React.Fragment>
)

View File

@ -13,15 +13,12 @@ class RateProcess extends Component {
}
componentDidMount() {
console.log(this.props)
api.post("/admin/rating/get_company_process", this.state.form)
.then(res => {
this.setState({
data: res.info
}, () => {
console.log(this.state.data)
})
console.log(res)
})
}

View File

@ -7,6 +7,7 @@ class RateResult extends Component {
super(props)
this.state = {
data: {},
type: 0,
}
}
@ -16,6 +17,7 @@ class RateResult extends Component {
.then(res => {
this.setState({
data: res.result[0],
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
}).catch(err => {
console.log(err)
@ -26,7 +28,7 @@ class RateResult extends Component {
render() {
return (
<React.Fragment>
{this.state.data ? <>
{this.state.data && this.state.type === 0 ? <>
<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 (!['经营评分', '财务评分', '风险评分', "企业ID", "企业名称"].includes(key)) {
@ -45,29 +47,13 @@ class RateResult extends Component {
</Descriptions>
<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>
{['盈利能力', '债务风险', '经营增长', '资产质量', '财务合计'].map(item => {
return <Descriptions column={4} title={item}>
{this.state.data["财务评分"] && this.state.data["财务评分"][item] && Object.keys(this.state.data["财务评分"][item]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data["财务评分"][item][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="合规风险">
@ -92,7 +78,30 @@ class RateResult extends Component {
<Descriptions column={4} title="风险合计">
<Descriptions.Item label="合计">{this.state.data["风险评分"] && this.state.data["风险评分"]["合计"]}</Descriptions.Item>
</Descriptions>
</> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
</>
: this.state.data && this.state.type === 1 ?
<>
<Descriptions title={this.state.data["企业名称"]} column={3} extra={<Tag color="#108ee9">企业ID{this.state.data["企业ID"]}</Tag>} style={{ marginTop: 20 }}>
{Object.keys(this.state.data).map((key, i) => {
if (!['公司治理得分', '环境得分', '社会得分'].includes(key)) {
return <Descriptions.Item label={key} key={i}>{this.state.data[key]}</Descriptions.Item>
} else {
return null
}
})}
</Descriptions>
{['公司治理得分', '环境得分', '社会得分'].map(item => {
return <>
<Tag color="#108ee9" style={{ marginBottom: 20 }}>{item}</Tag>
<Descriptions column={3} >
{this.state.data[item] && Object.keys(this.state.data[item]).map((key, i) => {
return <Descriptions.Item label={key} key={i}>{this.state.data[item][key]}</Descriptions.Item>
})}
</Descriptions>
</>
})}
</>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
</React.Fragment>
)
}

View File

@ -6,7 +6,8 @@ class RiskData extends Component {
constructor(props) {
super(props)
this.state = {
data: []
data: {},
type: 0
}
}
@ -15,7 +16,8 @@ class RiskData extends Component {
api.post(url, { rid: this.props.value.rid })
.then(res => {
this.setState({
data: res.result.length !== 0 ? res.result[0] : []
data: res.result.length !== 0 ? res.result[0] : {},
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
}).catch(err => {
console.log(err)
@ -50,7 +52,15 @@ class RiskData extends Component {
render() {
return (
<React.Fragment>
{this.state.data.length !== 0 ? this.analysisObject(this.state.data) : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
{this.state.data && this.state.type === 0 ? this.analysisObject(this.state.data) : this.state.data && this.state.type === 1 ?
<>
<Descriptions title="风险数据" extra={<Tag color="#108ee9">更新日期{this.state.data["更新日期"]}</Tag>}>
{Object.keys(this.state.data).map((key, i) => {
return ["更新日期","企业ID","评价ID"].includes(key) ? null : <Descriptions.Item label={key} key={i} span={0.5}>{this.state.data[key]}</Descriptions.Item>
})}
</Descriptions>
</>
: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />}
</React.Fragment>
)
}

View File

@ -92,7 +92,6 @@ class Main extends Component {
}
getBranch = (props, name, params) => {
console.log(params)
switch (props) {
case '/dashboard':
return <Dashboard />