mode
This commit is contained in:
parent
074963d86f
commit
dcf8f39144
|
@ -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 (
|
||||
<React.Fragment>
|
||||
{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>
|
||||
<Tag color="#108ee9" style={{ marginBottom: 20 }}>经营问卷</Tag>
|
||||
<p>{this.state.visible.map((item, index) => {
|
||||
return <Tag color={!item.disabled ? '#f50' : '#909399'} style={{ marginBottom: 20,cursor:'pointer' }} onClick={this.onChangeDisabled.bind(this, index)}>{item.name}</Tag>
|
||||
})}</p>
|
||||
{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 <p>
|
||||
{item.children.map((child, j) => {
|
||||
return <>
|
||||
<p><span>{child.label}</span></p>
|
||||
<p>
|
||||
<span style={{ marginRight: 20 }}>答案:</span>
|
||||
<span style={{ color: '#108ee9' }}>{child.type !== '多选题' ? this.state.data['经营问卷'][i === 0 ? j : sum + j] : null}</span>
|
||||
{child.type === '单选题' ? child.option.map(e => {
|
||||
return e.index === this.state.data['经营问卷'][i === 0 ? j : sum + j] ? <span style={{ color: '#108ee9', marginLeft: 5 }}>.{e.label}</span> : 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 ? <span style={{ color: '#108ee9', marginLeft: 5 }}>{e.index}.{e.label}</span> : null
|
||||
}) : null
|
||||
}) : <span style={{ color: '#108ee9', marginLeft: 5 }}>{child.unit}</span>}
|
||||
</p>
|
||||
</>
|
||||
})}
|
||||
</p>
|
||||
}else{
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
{this.state.data['财务填报'] && this.analysisObject(this.state.data['财务填报'])}
|
||||
</>
|
||||
: this.state.data && this.state.type === 1 ?
|
||||
|
|
|
@ -24,7 +24,6 @@ class RateResult extends Component {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
|
|
@ -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 (
|
||||
<>
|
||||
<Modal
|
||||
visible={this.state.visible}
|
||||
title="新增"
|
||||
okText="确 认"
|
||||
cancelText="取 消"
|
||||
onCancel={this.onCancel}
|
||||
onOk={this.onSubmit}
|
||||
width={1020}
|
||||
>
|
||||
<Form name="dynamic_form_nest_item" ref={this.form} layout="vertical" autoComplete="off">
|
||||
<Tag color="#108ee9">行业</Tag>
|
||||
<Form.Item name="行业">
|
||||
<Input/>
|
||||
</Form.Item>
|
||||
<Tag color="#108ee9">评价类型</Tag>
|
||||
<Form.Item name="评价类型">
|
||||
<Select>
|
||||
<Option value="综合信用评价">综合信用评价</Option>
|
||||
<Option value="ESG评价">ESG评价</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Tag color="#108ee9">问卷内容</Tag>
|
||||
<Form.List name="问卷内容">
|
||||
{(fields, { add, remove }) => {
|
||||
return (
|
||||
<>
|
||||
{fields.map((field) => (
|
||||
<>
|
||||
<Form.Item label="类别" name={[field.name, 'label']}><Input /></Form.Item>
|
||||
<Form.List name={[field.name, 'children']}>
|
||||
{(fields, { add, remove }) => {
|
||||
return (
|
||||
<>
|
||||
{fields.map((field) => (
|
||||
<>
|
||||
<Card>
|
||||
<Form.Item label="标签" {...field} name={[field.name, 'label']}><Input /></Form.Item>
|
||||
<Form.Item label="类型" {...field} name={[field.name, 'type']}>
|
||||
<Select>
|
||||
<Option value="选择题">选择题</Option>
|
||||
<Option value="多选题">多选题</Option>
|
||||
<Option value="填空题">填空题</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<p>选项</p>
|
||||
<Form.List {...field} name={[field.name, 'option']}>
|
||||
{(field, { add, remove }) => {
|
||||
return (
|
||||
<>
|
||||
{field.map(field => {
|
||||
return (
|
||||
<Card>
|
||||
<Row gutter={24} align="middle">
|
||||
<Col span={6}><Tag color="#87d068">选项</Tag>
|
||||
<Form.Item {...field} name={[field.name, 'index']}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={24}>
|
||||
<Tag color="#87d068">描述</Tag>
|
||||
<Form.Item {...field} name={[field.name, 'label']}>
|
||||
<TextArea></TextArea>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row justify='center'><Button type="dashed" onClick={() => remove(field.name)}>delete</Button></Row>
|
||||
</Card>
|
||||
)
|
||||
})}
|
||||
<Form.Item>
|
||||
<Button type="dashed" onClick={() => add()} icon={<PlusOutlined />}>
|
||||
添加选项
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}}
|
||||
</Form.List>
|
||||
<Form.Item label="单位" {...field} name={[field.name, 'unit']}>
|
||||
<Input placeholder='类型为填空题时填入' />
|
||||
</Form.Item>
|
||||
<Button type="danger" onClick={() => remove(field.name)}>删除内容</Button>
|
||||
</Card>
|
||||
</>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button type="primary" onClick={() => add()} icon={<PlusOutlined />} >
|
||||
添加内容
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}}
|
||||
</Form.List>
|
||||
<Row justify='center'><Button type="danger" onClick={() => remove(field.name)} block icon={<MinusOutlined />}>删除类别</Button></Row>
|
||||
</>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button type="primary" onClick={() => add()} block icon={<PlusOutlined />} style={{ marginTop: 20 }}>
|
||||
添加类别
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</>
|
||||
)
|
||||
}}
|
||||
</Form.List>
|
||||
</Form>
|
||||
</Modal>
|
||||
<Row justify='space-between'>
|
||||
<Search placeholder="检索问卷" onSearch={this.onSearch} enterButton style={{ width: 300, marginBottom: 20 }} />
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={this.setVisible}
|
||||
>
|
||||
新增问卷
|
||||
</Button>
|
||||
</Row>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default withRouter(Threshold)
|
||||
|
|
@ -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 <ManageIndustry />
|
||||
case "/manage/industry/analysis":
|
||||
return <AnalysisDetails value={name} />
|
||||
case "/modal/threshold":
|
||||
return <Threshold/>
|
||||
case "/test/company":
|
||||
return <TestCompany />
|
||||
case "/setting/user":
|
||||
|
|
|
@ -12,7 +12,7 @@ class Side extends Component {
|
|||
{ title: '企业', path: '/manage/company', icon: <FundProjectionScreenOutlined />, category: 'Manage' },
|
||||
{ title: '服务', path: '/manage/rate', icon: <GlobalOutlined />, category: 'Manage' },
|
||||
{ title: '行业宏观', path: '/manage/industry', icon: <BookOutlined />, category: 'Manage' },
|
||||
{ title: '阈值', path: '/service', icon: <BranchesOutlined />, category: 'Model' },
|
||||
{ title: '阈值', path: '/modal/threshold', icon: <BranchesOutlined />, category: 'Model' },
|
||||
{ title: '行业分类', path: '/service', icon: <ApartmentOutlined />, category: 'Model' },
|
||||
{ title: '企业管理', path: '/test/company', icon: <FundProjectionScreenOutlined />, category: 'Test' },
|
||||
{ title: '服务管理', path: '/service', icon: <GlobalOutlined />, category: 'Test' },
|
||||
|
|
Loading…
Reference in New Issue