diff --git a/src/pages/home/branch/manage/rate/branch/fillDetails.js b/src/pages/home/branch/manage/rate/branch/fillDetails.js index 7f22cbc..13bc896 100644 --- a/src/pages/home/branch/manage/rate/branch/fillDetails.js +++ b/src/pages/home/branch/manage/rate/branch/fillDetails.js @@ -9,7 +9,13 @@ class FillDetails extends Component { this.state = { data: {}, financialFill: {}, - type: 0 + type: 0, + questionnaire: [], + visible: [ + { name: '环境', disabled: false }, + { name: '社会', disabled: true }, + { name: '治理', disabled: true } + ] } } @@ -20,12 +26,28 @@ class FillDetails extends Component { this.setState({ data: res.result.length !== 0 ? res.result[0] : {}, type: this.props.value.types === "综合评价流程" ? 0 : 1 + }, () => { + this.getQuestionnaire() }) }).catch(err => { console.log(err) }) } + + getQuestionnaire() { + const form = { + type: this.props.value.types === "综合评价流程" ? '综合信用评价' : 'ESG评价', + industry: this.state.data["行业选择"][0] + } + api.post("/admin/model/questionnaire/get_questionnaire", form) + .then(res => { + this.setState({ + questionnaire: res.data ? res.data['问卷内容'] : [] + }) + }) + } + analysisQuestion(val) { if ("经营问卷" in this.state.data) { return val.map((key, i) => { @@ -130,16 +152,58 @@ class FillDetails extends Component { } + onChangeDisabled = e => { + const data = [ + { name: '环境', disabled: true }, + { name: '社会', disabled: true }, + { name: '治理', disabled: true } + ] + data[e].disabled = false + this.setState({ + visible: data + }) + } + render() { + var sum = 0 + return ( {this.state.data && this.state.type === 0 ? <> 企业ID:{this.state.data["企业ID"]}}>

评价年度:{this.state.data["评价年度"]}{(() => { if ("行业选择" in this.state.data && this.state.data["行业选择"] !== null) { return this.state.data["行业选择"].join("/") } else { return null } })()}

- 经营问卷 - - {this.analysisQuestion(this.state.data["经营问卷"])} - + 经营问卷 +

{this.state.visible.map((item, index) => { + return {item.name} + })}

+ {this.state.questionnaire.map((item, i) => { + if (i !== 0) { + sum = sum + this.state.questionnaire[i - 1].children.length; + } + if (!this.state.visible[i].disabled) { + return

+ {item.children.map((child, j) => { + return <> +

{child.label}

+

+ 答案: + {child.type !== '多选题' ? this.state.data['经营问卷'][i === 0 ? j : sum + j] : null} + {child.type === '单选题' ? child.option.map(e => { + return e.index === this.state.data['经营问卷'][i === 0 ? j : sum + j] ? .{e.label} : null + }) : child.type === '多选题' ? child.option.map((e) => { + return Array.isArray(this.state.data['经营问卷'][i === 0 ? j : sum + j]) ? this.state.data['经营问卷'][i === 0 ? j : sum + j].map((k) => { + return e.index === k ? {e.index}.{e.label} : null + }) : null + }) : {child.unit}} +

+ + })} +

+ }else{ + return null + } + }) + } {this.state.data['财务填报'] && this.analysisObject(this.state.data['财务填报'])} : this.state.data && this.state.type === 1 ? diff --git a/src/pages/home/branch/manage/rate/branch/rateResult.js b/src/pages/home/branch/manage/rate/branch/rateResult.js index 3b802d2..ad72078 100644 --- a/src/pages/home/branch/manage/rate/branch/rateResult.js +++ b/src/pages/home/branch/manage/rate/branch/rateResult.js @@ -24,7 +24,6 @@ class RateResult extends Component { }) } - render() { return ( diff --git a/src/pages/home/branch/modal/threshold.js b/src/pages/home/branch/modal/threshold.js new file mode 100644 index 0000000..5c16428 --- /dev/null +++ b/src/pages/home/branch/modal/threshold.js @@ -0,0 +1,186 @@ +import React, { Component } from 'react'; +import { withRouter } from "react-router-dom"; +import { Row, Input, Button, Form, Tag, Modal, Select, Card, Col, message } from 'antd'; +import { PlusOutlined,MinusOutlined } from '@ant-design/icons'; +import api from "@/api/request" + +const { Search, TextArea } = Input + +const { Option } = Select + +class Threshold extends Component { + constructor(props) { + super(props) + this.state = { + visible: true, + data: { + 行业: "", + 评价类型: "", + 问卷内容: [ + { label: "", children: [{ label: "", type: "", option: [{ index: "", label: "" }, { index: "", label: "" }] }] }, + ] + } + } + } + + form = React.createRef() + + addContent = () => { + const data = this.state.data['问卷内容'] + data.push({ label: "", children: [{ label: "", type: "", option: [{ index: "", label: "" }, { index: "", label: "" }] }] }) + this.setState({ + 问卷内容: data + }) + } + + onSearch = e => { + + } + + setVisible = () => { + this.setState({ + visible: true + }) + } + + onCancel = () => { + this.setState({ + visible: false + }) + } + + onSubmit = () => { + const form = this.form.current.getFieldsValue() + api.post("/admin/model/questionnaire/insert_new_questionnaire", { questionnaire: form }) + .then(res => { + message.success(res.info) + }) + } + + render() { + return ( + <> + +
+ 行业 + + + + 评价类型 + + + + 问卷内容 + + {(fields, { add, remove }) => { + return ( + <> + {fields.map((field) => ( + <> + + + {(fields, { add, remove }) => { + return ( + <> + {fields.map((field) => ( + <> + + + + + +

选项

+ + {(field, { add, remove }) => { + return ( + <> + {field.map(field => { + return ( + + + 选项 + + + + + + 描述 + + + + + + + + ) + })} + + + + + ) + }} + + + + + +
+ + ))} + + + + + ) + }} +
+ + + ))} + + + + + ) + }} +
+
+
+ + + + + + ) + } +} + +export default withRouter(Threshold) + diff --git a/src/pages/home/content.js b/src/pages/home/content.js index e691afb..7d84835 100644 --- a/src/pages/home/content.js +++ b/src/pages/home/content.js @@ -11,6 +11,7 @@ import ManageIndustry from "./branch/manage/industry" import AnalysisDetails from './branch/manage/industry/branch/analysisDetails' import UserSet from './branch/setting/user' import EmptyContent from "./empty" +import Threshold from './branch/modal/threshold' import { connect } from 'react-redux'; import { CloseOutlined } from '@ant-design/icons'; import { Button } from 'antd'; @@ -107,6 +108,8 @@ class Main extends Component { return case "/manage/industry/analysis": return + case "/modal/threshold": + return case "/test/company": return case "/setting/user": diff --git a/src/pages/home/side.js b/src/pages/home/side.js index 1ac484d..47a20f6 100644 --- a/src/pages/home/side.js +++ b/src/pages/home/side.js @@ -12,7 +12,7 @@ class Side extends Component { { title: '企业', path: '/manage/company', icon: , category: 'Manage' }, { title: '服务', path: '/manage/rate', icon: , category: 'Manage' }, { title: '行业宏观', path: '/manage/industry', icon: , category: 'Manage' }, - { title: '阈值', path: '/service', icon: , category: 'Model' }, + { title: '阈值', path: '/modal/threshold', icon: , category: 'Model' }, { title: '行业分类', path: '/service', icon: , category: 'Model' }, { title: '企业管理', path: '/test/company', icon: , category: 'Test' }, { title: '服务管理', path: '/service', icon: , category: 'Test' },