diff --git a/src/api/request.js b/src/api/request.js index c505def..2dee04a 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -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" diff --git a/src/pages/home/branch/manage/rate/branch/editReport.js b/src/pages/home/branch/manage/rate/branch/editReport.js index 977d848..0138481 100644 --- a/src/pages/home/branch/manage/rate/branch/editReport.js +++ b/src/pages/home/branch/manage/rate/branch/editReport.js @@ -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,33 +133,44 @@ class EditReport extends Component { return ( - - {this.state.text_model.map((item, i) => { - return - {item["章节"]} - - {item["章节内容"].map((item_child, j) => { - return {item_child["小节"]} - { - item_child["小节内容"].map((item_child_child, m) => { - return Object.keys(item_child_child).map((key, n) => { - return key === "表格" ? - {key}: - {this.simulate(item_child_child[key], i, j, m, n)} - - : - {key}: - - - }) - }) - } - })} - - })} + + + + {this.state.data.map((item, i) => { + return + {item["章节"]} + + {item["章节内容"].map((item_child, j) => { + return {item_child["小节"]} + { + item_child["小节内容"].map((item_child_child, m) => { + return Object.keys(item_child_child).map((key, n) => { + return key === "表格" ? + {key}: + {this.simulate(item_child_child[key], i, j, m, n)} + + : + {key}: + + + }) + }) + } + })} + + })} + + + ) } diff --git a/src/pages/home/branch/manage/rate/branch/rateResult.js b/src/pages/home/branch/manage/rate/branch/rateResult.js index 83c0a4e..49cc748 100644 --- a/src/pages/home/branch/manage/rate/branch/rateResult.js +++ b/src/pages/home/branch/manage/rate/branch/rateResult.js @@ -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

{key}:{val[key]}

- } else { - return {key}{Object.keys(val[key]).map((child,n) => { - if (typeof val[key][child] !== 'object') { - return {val[key][child]} - } else { - return {child} - {Object.keys(val[key][child]).map((ele, j) => { - return {ele}:{val[key][child][ele]} - // return {val[key][child][ele]} - })} - - } - })} - } - }) - } else { - return null - } - } render() { return ( - {(() => { - if (this.state.data === {}) { - return null; - } else { - return 企业ID:{this.state.data["企业ID"]}}> - {Object.keys(this.state.data).map((key, i) => { - if (!['经营评分', '财务评分', '风险评分'].includes(key)) { - return {this.state.data[key]} - } else { - return null - } - })} - - 经营评分 - - {Object.keys(this.state.managementScore).map((key, i) => { - return {this.state.managementScore[key]} - })} - - 财务评分 - - {this.analysisObject(this.state.financialScore)} - - 风险评分 - - {this.analysisObject(this.state.riskScore)} - - - } - })()} + 企业ID:{this.state.data["企业ID"]}} style={{ marginTop: 20 }}> + {Object.keys(this.state.data).map((key, i) => { + if (!['经营评分', '财务评分', '风险评分', "企业ID", "企业名称"].includes(key)) { + return {this.state.data[key]} + } else { + return null + } + })} + + + 经营评分 + + {this.state.data["经营评分"] && Object.keys(this.state.data["经营评分"]).map((key, i) => { + return {this.state.data["经营评分"][key]} + })} + + + 财务评分 + + {this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["盈利能力"]).map((key, i) => { + return {this.state.data["财务评分"]["盈利能力"][key]} + })} + + + {this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["债务风险"]).map((key, i) => { + return {this.state.data["财务评分"]["债务风险"][key]} + })} + + + {this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["经营增长"]).map((key, i) => { + return {this.state.data["财务评分"]["经营增长"][key]} + })} + + + {this.state.data["财务评分"] && Object.keys(this.state.data["财务评分"]["资产质量"]).map((key, i) => { + return {this.state.data["财务评分"]["资产质量"][key]} + })} + + + {this.state.data["财务评分"] && this.state.data["财务评分"]["合计"]} + + + 风险评分 + + {this.state.data["风险评分"] && this.state.data["风险评分"]["合规风险"]} + + + {this.state.data["风险评分"] && Object.keys(this.state.data["风险评分"]["经营风险"]).map((key, i) => { + return {this.state.data["风险评分"]["经营风险"][key]} + })} + + + {this.state.data["风险评分"] && this.state.data["风险评分"]["关联风险"] && this.state.data["风险评分"]["关联风险"]["变更记录"] && Object.keys(this.state.data["风险评分"]["关联风险"]["变更记录"]).map((key, i) => { + return {this.state.data["风险评分"]["关联风险"]["变更记录"][key]} + })} + {this.state.data["风险评分"] && this.state.data["风险评分"]["关联风险"] && this.state.data["风险评分"]["关联风险"]["周边风险"] && Object.keys(this.state.data["风险评分"]["关联风险"]["周边风险"]).map((key, i) => { + return {this.state.data["风险评分"]["关联风险"]["周边风险"][key]} + })} + + {this.state.data["风险评分"] && this.state.data["风险评分"]["关联风险"]["合计"]} + + + + {this.state.data["风险评分"] && this.state.data["风险评分"]["合计"]} + ) } diff --git a/src/pages/home/branch/manage/rate/branch/riskData.js b/src/pages/home/branch/manage/rate/branch/riskData.js index 93803c9..9c0f1e9 100644 --- a/src/pages/home/branch/manage/rate/branch/riskData.js +++ b/src/pages/home/branch/manage/rate/branch/riskData.js @@ -1,6 +1,6 @@ import React, { Component } from 'react' import api from "@/api/request" -import { Descriptions,Tag } from 'antd' +import { Descriptions, Tag } from 'antd' class RiskData extends Component { constructor(props) { @@ -14,7 +14,7 @@ class RiskData extends Component { api.post("/admin/rating/risk", { rid: this.props.id }) .then(res => { this.setState({ - data: res.result.length!==0?res.result[0]:[] + data: res.result.length !== 0 ? res.result[0] : [] }) }).catch(err => { console.log(err) @@ -22,33 +22,28 @@ 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 {key} - {Object.keys(val[key]).map((item, i) => { - return {val[key][item]} + return Object.keys(val).map(key => { + if (typeof val[key] === "object") { + if (['合规风险', '经营风险'].includes(key)) { + return {key} + {Object.keys(val[key]).map((item, i) => { + return {val[key][item]} + })} + + + } else { + return Object.keys(val[key]).map((item, i) => { + return {item} + {Object.keys(val[key][item]).map((ele, j) => { + return {val[key][item][ele]} })} - - - } else { - return Object.keys(val[key]).map((item, i) => { - return {item} - {Object.keys(val[key][item]).map((ele, j) => { - return {val[key][item][ele]} - })} - - }) - } - }else{ - return null + + }) } - }) - } else { - return null - } + } else { + return null + } + }) } render() { diff --git a/src/pages/home/content.js b/src/pages/home/content.js index 439f03b..ca68414 100644 --- a/src/pages/home/content.js +++ b/src/pages/home/content.js @@ -43,7 +43,6 @@ class Main extends Component { } } } - } onChange = activeKey => { @@ -111,13 +110,13 @@ class Main extends Component { case "/manage/industry": return case "/manage/industry/analysis": - return + return case "/test/company": return case "/setting/user": return default: - return + return } } diff --git a/src/pages/home/side.js b/src/pages/home/side.js index 64728c8..0aa6679 100644 --- a/src/pages/home/side.js +++ b/src/pages/home/side.js @@ -18,10 +18,22 @@ class Side extends Component { { title: '服务管理', path: '/service', icon: , category: 'Test' }, { title: '用户', path: '/setting/user', icon: , category: 'Setting' }, { title: '设置', path: '/service', icon: , 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, @@ -30,7 +42,7 @@ class Side extends Component { } 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) => { return {this.state.data.map((ele, index) => { @@ -43,6 +55,7 @@ class Side extends Component {