From 6a86d7a3e4d030c7886e193bdb73e8e9759f9f9c Mon Sep 17 00:00:00 2001
From: xuyucheng
Date: Tue, 17 May 2022 16:57:22 +0800
Subject: [PATCH] mode
---
.../company/companyDetails/operationalRisk.js | 1 -
.../branch/manage/rate/branch/editReport.js | 14 +--
.../branch/manage/rate/branch/fillDetails.js | 20 +---
.../branch/manage/rate/branch/rateProcess.js | 11 +-
.../branch/manage/rate/branch/rateResult.js | 35 +-----
.../branch/manage/rate/branch/riskData.js | 5 +-
src/pages/home/branch/manage/rate/rate.js | 106 +++++++++++++++---
src/pages/home/branch/test/company.js | 14 +--
8 files changed, 122 insertions(+), 84 deletions(-)
diff --git a/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js b/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js
index 89cb238..77a0d26 100644
--- a/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js
+++ b/src/pages/home/branch/manage/company/companyDetails/operationalRisk.js
@@ -30,7 +30,6 @@ function OperationalRisk(props) {
if (props.table === '经营风险' && props.updateTime) {
api.post("/admin/company/operating_risk", { cid: props.cid, update_time: props.updateTime }).then(res => {
setValue(res)
-
})
}
}, [props.cid, props.updateTime, props.table])
diff --git a/src/pages/home/branch/manage/rate/branch/editReport.js b/src/pages/home/branch/manage/rate/branch/editReport.js
index 61779b4..b0bb570 100644
--- a/src/pages/home/branch/manage/rate/branch/editReport.js
+++ b/src/pages/home/branch/manage/rate/branch/editReport.js
@@ -14,12 +14,11 @@ class EditReport extends Component {
}
componentDidMount() {
- const url = this.props.value.types === "综合评价流程" ? "/admin/rating/get_report_text_model" : "/admin/rating/get_esg_report_text"
- api.post(url, { rid: this.props.value.rid })
+ api.post("/admin/rating/report_data", { 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['报告内容'] ? res.result['报告内容'] : [],
+ tree: res.result['报告内容'] ? this.createTree(res.result) : [],
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
})
@@ -27,7 +26,7 @@ class EditReport extends Component {
createTree = (val) => {
if (this.props.value.types === "综合评价流程") {
- const data = val['text_model'].map((item, index) => {
+ const data = val['报告内容'].map((item, index) => {
return {
title: item['章节'], key: index.toString(), children: item["章节内容"].map((item_1, index_1) => {
return {
@@ -40,7 +39,7 @@ class EditReport extends Component {
})
return data
} else {
- const data = val['text_model'].map((item, index) => {
+ const data = val['报告内容'].map((item, index) => {
return {
title: item['章节'], key: index.toString(), children: item["章节内容"].map((_, index_1) => {
return {
@@ -105,13 +104,12 @@ class EditReport extends Component {
}
onFinish = () => {
- 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)
+ api.post("/admin/rating/report_revise", form)
.then(res => {
message.info(res.info)
})
diff --git a/src/pages/home/branch/manage/rate/branch/fillDetails.js b/src/pages/home/branch/manage/rate/branch/fillDetails.js
index 885ed72..606d16f 100644
--- a/src/pages/home/branch/manage/rate/branch/fillDetails.js
+++ b/src/pages/home/branch/manage/rate/branch/fillDetails.js
@@ -20,11 +20,10 @@ class FillDetails extends Component {
}
componentDidMount() {
- const url = this.props.value.types === "综合评价流程" ? "/admin/rating/details" : "/admin/rating/esg_details"
- api.post(url, { rid: this.props.value.rid })
+ api.post("/admin/rating/details", { rid: this.props.value.rid })
.then(res => {
this.setState({
- data: res.result.length !== 0 ? res.result[0] : {},
+ data: res.result,
type: this.props.value.types === "综合评价流程" ? 0 : 1
}, () => {
this.getQuestionnaire()
@@ -34,11 +33,10 @@ class FillDetails extends Component {
})
}
-
getQuestionnaire() {
const form = {
type: this.props.value.types === "综合评价流程" ? '综合信用评价' : 'ESG评价',
- industry: this.state.data["行业选择"][0]
+ industry: this.props.value.types === "综合评价流程" ? this.state.data["行业选择"][0]:undefined
}
api.post("/admin/model/questionnaire/get_questionnaire", form)
.then(res => {
@@ -98,7 +96,6 @@ class FillDetails extends Component {
}
analysisArray = (params) => {
-
var columns = []
const matrixData = params.map((row) => {
var arr = [];
@@ -122,8 +119,7 @@ class FillDetails extends Component {
return {
title: item, dataIndex: item, align: 'center', key: i
}
- }
- );
+ });
const data = transData.map((item, i) => {
var obj = {}
@@ -135,11 +131,8 @@ class FillDetails extends Component {
})
return obj
})
-
data.shift()
-
return 近三年企业数据
-
}
onChangeDisabled = e => {
@@ -156,7 +149,6 @@ class FillDetails extends Component {
render() {
var sum = 0
-
return (
{this.state.data && this.state.type === 0 ? <>
@@ -164,7 +156,7 @@ class FillDetails extends Component {
评价年度:{this.state.data["评价年度"]}{(() => { if ("行业选择" in this.state.data && this.state.data["行业选择"] !== null) { return this.state.data["行业选择"].join("/") } else { return null } })()}
经营问卷
{this.state.visible.map((item, index) => {
- return {item.name}
+ return {item.name}
})}
{this.state.questionnaire.map((item, i) => {
if (i !== 0) {
@@ -189,7 +181,7 @@ class FillDetails extends Component {
>
})}
- }else{
+ } else {
return null
}
})
diff --git a/src/pages/home/branch/manage/rate/branch/rateProcess.js b/src/pages/home/branch/manage/rate/branch/rateProcess.js
index 8ab1544..d40bb95 100644
--- a/src/pages/home/branch/manage/rate/branch/rateProcess.js
+++ b/src/pages/home/branch/manage/rate/branch/rateProcess.js
@@ -136,14 +136,16 @@ function RateProcess1(props) {
"animated": true
},
]
- res.info.forEach((item, index) => {
- Object.keys(item).forEach((key, i) => {
+ console.log(res.info['评价流程'])
+ Object.keys(res.info['评价流程']).forEach((item, index) => {
+ console.log(item,index)
+ Object.keys(res.info['评价流程'][item]).forEach((key, i) => {
nodes.push({
id: count.toString(),
data: { label: key },
type: index === 0 ? "input" : index === res.info.length - 1 ? "output" : "default",
position: { x: (i + 1) * 200, y: (index + 1) * 100 },
- style: item[key] === 1 ? {
+ style: res.info['评价流程'][item][key] === 1 ? {
background: '#87d068',
color: '#fff',
border: '1px solid #87d068',
@@ -158,7 +160,8 @@ function RateProcess1(props) {
count++
})
})
- setNodes(nodes)
+ console.log(nodes)
+ // setNodes(nodes)
if (props.value.type === "ESG评价流程") {
setEdges(edges_2)
} else {
diff --git a/src/pages/home/branch/manage/rate/branch/rateResult.js b/src/pages/home/branch/manage/rate/branch/rateResult.js
index ad72078..9fa36e0 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, Tag, Divider, Empty } from 'antd'
+import { Descriptions, Tag, Divider, Empty, } from 'antd'
import api from "@/api/request"
class RateResult extends Component {
@@ -7,16 +7,15 @@ class RateResult extends Component {
super(props)
this.state = {
data: {},
- type: 0,
+ risk: {},
}
}
componentDidMount() {
- const url = this.props.value.types === "综合评价流程" ? "/admin/rating/rating_result" : "/admin/rating/esg_rating_result"
- api.post(url, { rid: this.props.value.rid })
+ api.post("/admin/rating/rating_result", { rid: this.props.value.rid })
.then(res => {
this.setState({
- data: res.result[0],
+ data: res.result,
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
}).catch(err => {
@@ -46,37 +45,15 @@ class RateResult extends Component {
财务评分
- {['盈利能力', '债务风险', '经营增长', '资产质量', '财务合计'].map(item => {
+ {['盈利能力', '债务风险', '经营增长', '资产质量'].map(item => {
return
{this.state.data["财务评分"] && this.state.data["财务评分"][item] && Object.keys(this.state.data["财务评分"][item]).map((key, i) => {
return {this.state.data["财务评分"][item][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["风险评分"]["合计"]}
-
>
: this.state.data && this.state.type === 1 ?
<>
diff --git a/src/pages/home/branch/manage/rate/branch/riskData.js b/src/pages/home/branch/manage/rate/branch/riskData.js
index 31427ad..72b4f97 100644
--- a/src/pages/home/branch/manage/rate/branch/riskData.js
+++ b/src/pages/home/branch/manage/rate/branch/riskData.js
@@ -12,11 +12,10 @@ class RiskData extends Component {
}
componentDidMount() {
- const url = this.props.value.types === "综合评价流程" ? "/admin/rating/risk" : "/admin/rating/esg_risk"
- api.post(url, { rid: this.props.value.rid })
+ api.post("/admin/rating/risk" , { rid: this.props.value.rid })
.then(res => {
this.setState({
- data: res.result.length !== 0 ? res.result[0] : {},
+ data: res.result,
type: this.props.value.types === "综合评价流程" ? 0 : 1
})
}).catch(err => {
diff --git a/src/pages/home/branch/manage/rate/rate.js b/src/pages/home/branch/manage/rate/rate.js
index 90cd85d..c6f64ab 100644
--- a/src/pages/home/branch/manage/rate/rate.js
+++ b/src/pages/home/branch/manage/rate/rate.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
-import { Input } from 'antd'
+import { Input, Form, Button } from 'antd'
import Pdf from "@/components/pdf"
import FeTable from '@/components/table'
import api from "@/api/request"
@@ -7,8 +7,10 @@ import { connect } from 'react-redux';
import store from "@/store/index"
import { operationAction } from "@/action/index"
-
-const { Search } = Input
+var status = {
+ name: '',
+ sort: ''
+}
class ManageRate extends Component {
constructor(props) {
@@ -17,25 +19,32 @@ class ManageRate extends Component {
data: [],
columns: [],
file: "",
- visible: false
+ visible: false,
+ total: 0,
+ form: {
+ search: {},
+ sort: {},
+ page_no: 1,
+ page_size: 10
+ }
}
}
componentDidMount() {
- this.onSearch("")
+ this.init()
}
- onSearch = (value) => {
- api.post("/admin/rating/search", { query: value, skip: 0, limit: 10 }).then(res => {
- const col = Object.keys(res.result[0]).map((key, i) => {
+ init = () => {
+ api.post("/admin/rating/search", this.state.form).then(res => {
+ const col = Object.keys(res.result.records[0]).map((key, i) => {
return key === "证书fid" || key === "报告fid" ? {
title: key,
dataIndex: key,
key: i,
align: 'center',
- render: (record) => 预 览
+ render: (record) => 预 览
} : {
- title: key, dataIndex: key, align: 'center', key: i
+ title: key, dataIndex: key, align: 'center', key: i, sorter: key !== 'uid' ? (a, b, c) => { this.sort(c, key) } : null, defaultSortOrder: 'descend',
}
})
col.push({
@@ -43,17 +52,50 @@ class ManageRate extends Component {
dataIndex: '详 情',
key: col.length,
align: 'center',
- render: () => 详 情,
+ render: () => 详 情,
})
this.setState({
- data: res.result,
- columns: col
+ columns: col,
+ data: res.result.records,
+ total: res.result.total
})
}).catch(err => {
console.log(err)
})
}
+ onSearch = (value) => {
+ const search = { search: {}, page_no: 1 }
+ value && Object.keys(value).forEach(key => {
+ if (value[key] && value[key].length !== 0) {
+ search.search[key] = value[key]
+ }
+ })
+ this.setState({
+ form: Object.assign(this.state.form, search)
+ }, () => {
+ this.init()
+ })
+ }
+
+ sort = (c, item, search) => {
+ if (status.name === item && status.sort === c) {
+ return false
+ } else {
+ status = {
+ name: item,
+ sort: c
+ }
+ this.setState({
+ form: Object.assign(this.state.form, {
+ sort: { [item]: c === 'ascend' ? 'asc' : 'desc' }
+ })
+ }, () => {
+ this.onSearch()
+ })
+ }
+ }
+
isJump = false
handleClick(value) {
@@ -77,7 +119,7 @@ class ManageRate extends Component {
return item.title === value["评价项目"] + '(' + value["评价ID"] + ')' ? false : true
})
if (state) {
- newPanes.push({ title: value["评价项目"] + '(' + value["评价ID"] + ')', content: "/manage/rate/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString(),value:{cid:value["企业ID"],rid:value["评价ID"],types:value['评价项目'] === 'ESG评价'?'ESG评价流程':'综合评价流程'} });
+ newPanes.push({ title: value["评价项目"] + '(' + value["评价ID"] + ')', content: "/manage/rate/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString(), value: { cid: value["企业ID"], rid: value["评价ID"], types: value['评价项目'] === 'ESG评价' ? 'ESG评价流程' : '综合评价流程' } });
store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key)))
} else {
return null
@@ -93,12 +135,44 @@ class ManageRate extends Component {
})
}
+ pageChange = (current, pageSize) => {
+ this.setState({
+ form: Object.assign(this.state.form, {
+ page_no: current,
+ page_size: pageSize
+ })
+ }, () => {
+ this.init()
+ })
+ }
+
+ onShowSizeChange = (current, pageSize) => {
+ this.setState({
+ form: Object.assign(this.state.form, {
+ page_no: current,
+ page_size: pageSize
+ })
+ }, () => {
+ this.init()
+ })
+ }
+
render() {
return (
-
-
+
+
+
+
+
+
+
+
+
)
}
diff --git a/src/pages/home/branch/test/company.js b/src/pages/home/branch/test/company.js
index 2ccca11..b3d8c25 100644
--- a/src/pages/home/branch/test/company.js
+++ b/src/pages/home/branch/test/company.js
@@ -13,11 +13,11 @@ class TestCompany extends Component {
super(props)
this.state = {
data: [
- // { title: "企业认证", desc: "根据企业名称、统一社会信用代码、法人姓名进行企业认证", obj: { company: "", code: "", legal_person: "", cid: "" }, label: ["企业名称", "统一社会信用代码", "法人姓名", "企业ID"], url: "/admin/test/enterprise_certification", method: 'post' },
- // { title: "级联删除企业ID", desc: "根据cid,删除与其有关的所有记录", obj: { cid: "", data: [] }, label: ["企业ID", "企业数据"], url: "/admin/test/delete_cid_cascade", method: 'post' },
- // { title: "级联删除评价ID", desc: "根据rid,删除与其有关的所有记录", obj: { rid: "", record: "", data: [] }, label: ["评价ID", "评价类型", "评价记录"], url: "/admin/test/delete_rid_cascade", method: 'post' },
- // { title: "企业认证状态修改", desc: "修改企业认证状态,只能修改为未认证,如需认证则通过认证接口", obj: { cid: "" }, label: ["企业ID"], url: "/admin/test/change_verified", method: 'get' },
- // { title: "级联生成企业主页", desc: "根据rid,生成企业主页信息", obj: { rid: "", types: "" }, label: ["评价ID", "评价类型"], url: "/admin/test/generate_rid_information", method: 'post' },
+ { title: "企业认证", desc: "根据企业名称、统一社会信用代码、法人姓名进行企业认证", obj: { company: "", code: "", legal_person: "", cid: "" }, label: ["企业名称", "统一社会信用代码", "法人姓名", "企业ID"], url: "/admin/test/enterprise_certification", method: 'post' },
+ { title: "级联删除企业ID", desc: "如需重新打分,可根据此接口传入cid,删除与其有关的所有记录。", obj: { cid: "", data: [] }, label: ["企业ID", "企业数据"], url: "/admin/test/delete_cid_cascade", method: 'post' },
+ { title: "级联删除评价ID", desc: "如需重新打分,可根据此接口传入rid,删除与其有关的所有记录,并将进行状态改为进行。", obj: { rid: "", record: "", data: [] }, label: ["评价ID", "评价类型", "评价记录"], url: "/admin/test/delete_rid_cascade", method: 'post' },
+ { title: "企业认证状态修改", desc: "修改企业认证状态,只能修改为未认证,并将应用端-企业用户对应认证信息置为None,如需认证则通过认证接口。", obj: { cid: "" }, label: ["企业ID"], url: "/admin/test/change_verified", method: 'get' },
+ { title: "rid生成企业主页信息", desc: "通过此接口传入rid可以重新完成模型打分、报告生成、证书生成、主页数据生成等一系列流程。", obj: { rid: ""}, label: ["评价ID", "评价类型"], url: "/admin/test/generate_rid_information", method: 'post' },
{ title: "新增测试企业", desc: "新增一家测试测试", obj: { email: "", company: "", code: "", legal_person: "" }, label: ["邮箱", "企业", "统一社会信用代码", "法人"], url: "/admin/test/new_company", method: 'post' },
],
setIsModalVisible: false,
@@ -34,10 +34,6 @@ class TestCompany extends Component {
}
}
- componentDidMount() {
-
- }
-
form = React.createRef()
showModal = (val) => {