This commit is contained in:
xuyucheng 2022-03-04 12:13:42 +08:00
parent f02f95fe57
commit 224912ef76
4 changed files with 47 additions and 42 deletions

View File

@ -1,3 +1,22 @@
.simulate-table{ .simulate-table {
text-align: center; text-align: center;
padding: 10px;
border-radius: 0px;
}
.backTop {
height: 40px;
width: 40px;
line-height: 40px;
border-radius: 4px;
background-color: #1088e9;
color: #fff;
text-align: center;
font-size: 14px;
}
.paragraph_name{
display: block;
margin: 20px 0;
font-size: 14px;
} }

View File

@ -73,7 +73,7 @@ body,
height: 90% !important; height: 90% !important;
} }
.ant-input{ .ant-input {
/* padding: 10px ; */ /* padding: 10px ; */
} }
@ -190,29 +190,16 @@ span {
margin-bottom: 20px; margin-bottom: 20px;
} }
.block{ .block {
display: block; display: block;
margin: 5px 0; margin: 5px 0;
} }
.ant-table-cell{ .ant-table-cell {
font-size: 12px; font-size: 12px;
} }
.paragraph_name{ .react-pdf__Page {
display: block;
margin: 20px 0;
font-weight: 800;
font-size: 14px;
}
.paragraph_content{
display: block;
margin: 20px 0;
}
.react-pdf__Page{
display: flex; display: flex;
justify-content: center; justify-content: center;
} }

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import api from "@/api/request" import api from "@/api/request"
import { Input, Button, Row, Col, Tree } from 'antd' import { Input, Button, Row, Col, Tree,BackTop } from 'antd'
import "@/assets/style/editReport.css" import "@/assets/style/editReport.css"
class EditReport extends Component { class EditReport extends Component {
@ -28,7 +28,6 @@ class EditReport extends Component {
title: item['章节'], key: index.toString(), children: item["章节内容"].map((item_1, index_1) => { title: item['章节'], key: index.toString(), children: item["章节内容"].map((item_1, index_1) => {
return { return {
title: item_1['小节'], key: index.toString() + index_1.toString(), children: item_1["小节内容"].map((item_2, index_2) => { 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 { title: Object.keys(item_2)[0], key: index.toString() + index_1.toString() + index_2.toString() }
}) })
} }
@ -39,18 +38,19 @@ class EditReport extends Component {
return data return data
} }
onSelect = (value) =>{ onSelect = (value) => {
console.log(value) const Dom = document.getElementById(value)
if (Dom) {
Dom.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
} }
simulate = (value, i, j, m, n) => { simulate = (value, i, j, m, n) => {
return value.map((item, index_first) => { return value.map((item, index_first) => {
return <Row className="simulate" justify="center"> return <Row className="simulate" justify="start" style={{flexWrap:'nowrap'}}>
{ {
item.map((ele, index_second) => { item.map((ele, index_second) => {
return <Col span={parseInt(24 / value[0].length)}> return <Input defaultValue={ele} className="simulate-table" onChange={this.onSimulate.bind(this, i, j, m, n, index_first, index_second)} />
<Input defaultValue={ele} className="simulate-table" onChange={this.onSimulate.bind(this, i, j, m, n, index_first, index_second)} />
</Col>
}) })
} }
</Row> </Row>
@ -133,32 +133,32 @@ class EditReport extends Component {
return ( return (
<React.Fragment> <React.Fragment>
<Row> <BackTop><div className='backTop'>UP</div></BackTop>
<Col span={4}> <Tree <Row style={{paddingRight: 20}}>
defaultExpandedKeys={['0-0-0', '0-0-1']} <Col span={3}><Tree
defaultSelectedKeys={['0-0-0', '0-0-1']} defaultExpandedKeys={['000', '001']}
defaultCheckedKeys={['0-0-0', '0-0-1']} defaultSelectedKeys={['000', '001']}
defaultCheckedKeys={['000', '001']}
treeData={this.state.tree} treeData={this.state.tree}
onSelect={this.onSelect} onSelect={this.onSelect}
/></Col> /></Col>
<Col span={20}><Button onClick={this.onFinish}>输出</Button> <Col span={21}><Button onClick={this.onFinish} type='primary' style={{float:'right'}}>输出</Button>
{this.state.data.map((item, i) => { {this.state.data.map((item, i) => {
return <React.Fragment><span className="paragraph_name"> return <React.Fragment><span className="paragraph_name" id={i.toString()} >
{item["章节"]} {item["章节"]}
</span> </span>
{item["章节内容"].map((item_child, j) => { {item["章节内容"].map((item_child, j) => {
return <React.Fragment><span className="paragraph_name" style={{ marginLeft: 20 }}>{item_child["小节"]}</span> return <React.Fragment><span className="paragraph_name" id={i.toString() + j.toString()}>{item_child["小节"]}</span>
{ {
item_child["小节内容"].map((item_child_child, m) => { item_child["小节内容"].map((item_child_child, m) => {
return Object.keys(item_child_child).map((key, n) => { return Object.keys(item_child_child).map((key, n) => {
return key === "表格" ? <React.Fragment> return key === "表格" ? <React.Fragment>
<span className="paragraph_name" style={{ marginLeft: 40 }}>{key}:</span> <span id={i.toString() + j.toString() + m.toString()} className="paragraph_name">{key}:</span>
{this.simulate(item_child_child[key], i, j, m, n)} {this.simulate(item_child_child[key], i, j, m, n)}
</React.Fragment> </React.Fragment>
: <React.Fragment> : <React.Fragment>
<span className="paragraph_name" style={{ marginLeft: 40 }}>{key}:</span> <span id={i.toString() + j.toString() + m.toString()} className="paragraph_name">{key}:</span>
<Input.TextArea <Input.TextArea
style={{ marginLeft: 60, width: "calc(100% - 80px)", }}
defaultValue={item_child_child[key]} defaultValue={item_child_child[key]}
onChange={this.onOutput.bind(this, i, j, m, n)} /> onChange={this.onOutput.bind(this, i, j, m, n)} />
</React.Fragment> </React.Fragment>
@ -167,7 +167,8 @@ class EditReport extends Component {
} </React.Fragment> } </React.Fragment>
})} })}
</React.Fragment> </React.Fragment>
})}</Col> })}
</Col>
</Row> </Row>

View File

@ -29,9 +29,7 @@ class Side extends Component {
// const title = preProps.panes.filter(item => { // const title = preProps.panes.filter(item => {
// return item.key === preProps.activeKey ? item.title : null // return item.key === preProps.activeKey ? item.title : null
// }) // })
} }
} }
handleClick = e => { handleClick = e => {