From 9abfbe0e27583a27790e24c8304d1497eb8aa2f6 Mon Sep 17 00:00:00 2001
From: Mr Ke <kelq@hugeinfo.com.cn>
Date: Mon, 06 Apr 2020 17:06:11 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/huge/frontEnd/hugeOA

---
 src/index.js                                    |   16 ++
 src/components/page/DocumentEditPage/index.jsx  |  177 +++++++++++++++++++++++++++++++++++
 src/pages/document/DocumentEdit.jsx             |   44 ++++++++
 src/components/page/DocumentEditPage/index.scss |   12 ++
 4 files changed, 246 insertions(+), 3 deletions(-)

diff --git a/src/components/page/DocumentEditPage/index.jsx b/src/components/page/DocumentEditPage/index.jsx
new file mode 100644
index 0000000..b75e628
--- /dev/null
+++ b/src/components/page/DocumentEditPage/index.jsx
@@ -0,0 +1,177 @@
+/* eslint-disable */
+/**liuwh
+ * 4/6/2020, 3:53:15 PM
+ * doc comment for the file goes here
+ */
+
+/** Happy Coding */
+import React, { ReactNode, ReactEventHandler, Component } from 'react';
+// import { Link } from 'react-router-dom';
+import { Card, Row, Col, Select, Button, Input, Upload, Icon, Spin } from 'antd';
+import './index.scss';
+const Option = Select.Option;
+
+import fetch from '../../../api/request';
+
+const param = [{ value: 'DT00002', name: '通知公告' }, { value: 'DT00001', name: '规章制度' }]
+export default class DocumentEditPage extends Component {
+  constructor(props) {
+    super(props);
+    this.config = {
+    };
+    this.state = {
+      loading: false,
+      savedate: {},
+      fileList: [],
+    };
+  }
+
+  componentWillMount() { }
+
+  componentDidMount() {
+    // this.loadData()
+  }
+
+  loadData = () => {
+    console.log('111')
+    let _this = this;
+    _this.setState({
+      loading: true
+    })
+    fetch({
+      url: 'api/document/getNewId',
+      params: {
+        id: 'new'
+      }
+    }).then(res => {
+      console.log(res)
+      _this.setState({
+        savedate: res.content,
+        loading: false,
+      });
+    });
+  }
+
+
+  saveInputChange = ({ target: { value, name } }) => {
+    this.setState(({ savedate }) => ({
+      savedate: {
+        ...savedate,
+        [name]: value
+      }
+    }))
+  }
+
+  submit = () => {
+    const { savedate } = this.state;
+    console.log(savedate)
+    // Fetch.savePatrolCom(savedate)
+    //   .then(res => {
+    //     if (res.code === 0) {
+    //       message.success("提交成功!");
+    //       this.props.history.push("/companyUpd")
+    //     } else {
+    //       message.error('保存失败,请联系管理员', 2)
+    //     }
+    //   });
+  }
+
+  cancle = () => {
+    this.props.history.push("/index/workbench");
+  }
+
+  render() {
+    const { savedate, fileList, loading } = this.state;
+    const props = {
+      action: `api/v1/attachment/materials?associateTypeId=1019&entityId=` + savedate.id,
+      onChange: ({ file, fileList }) => {
+        if (file.status !== 'uploading') {
+          console.log(file);
+          console.log(fileList);
+
+        }
+        this.setState({ fileList });
+      },
+      fileList: fileList,
+      // onDownload: (file) => {
+      //   console.log(file)
+      //   Fetch.attachmentDownload(file.uid)
+      //     .then(res => {
+      //       message.success("下载成功!");
+      //     });
+      // },
+      // onRemove: (file) => {
+      //   Fetch.deleteAttachment(file.uid)
+      //     .then(res => {
+      //       message.success("移除成功!");
+      //     });
+      //   this.setState(({ fileList }) => {
+      //     const index = fileList.indexOf(file);
+      //     const newFileList = fileList.slice();
+      //     newFileList.splice(index, 1);
+      //     return {
+      //       fileList: newFileList,
+      //     };
+      //   });
+      // }
+    };
+    return (
+      <div className="document-edit-page-main">
+        <Spin spinning={loading}>
+          <Card style={{ border: 20, margin: 20, padding: 20 }}>
+            <Row gutter={16}>
+              <Col className="gutter-row" >
+                文档类型:
+            </Col>
+            </Row>
+            <Row gutter={16}>
+              <Col className="gutter-row" style={{ margin: '12px 0' }} >
+                <Select style={{ width: "300px" }} onChange={(value) => this.saveInputChange({ target: { name: 'documentType', value } })} value={savedate.documentType || "DT00002"}>
+                  {
+                    param.map((data, key) => (
+                      <Option key={key} value={data.value}>{data.name}</Option>
+                    ))
+                  }
+                </Select>
+              </Col>
+            </Row>
+
+            <Row gutter={16} style={{ marginTop: '12px' }}>
+              <Col className="gutter-row" style={{ marginTop: '12px' }}>
+                规章制度标题:
+            </Col>
+            </Row>
+            <Row gutter={16}>
+              <Col className="gutter-row" style={{ margin: '12px 0' }} >
+                <Input style={{ width: '300px' }} name='documentItle' onChange={this.saveInputChange} value={savedate.documentItle || ""} />
+              </Col>
+            </Row>
+
+            <Row gutter={16} style={{ marginTop: '12px' }}>
+              <Col className="gutter-row" style={{ margin: '12px 0' }} >
+                规章制度源文件:
+            </Col>
+            </Row>
+            <Row gutter={16} >
+              <Col className="gutter-row" >
+                <Upload {...props}>
+                  <Button>
+                    <Icon type="upload" />上传文件</Button>
+                </Upload>
+              </Col>
+            </Row>
+            <Row gutter={16} style={{ marginTop: '12px' }}>
+              <Col className="gutter-row" >
+                支持扩展名:.pdf
+            </Col>
+            </Row>
+            <Row gutter={16} style={{ marginTop: '12px' }}>
+              <Col span={2} className="gutter-row" ><Button style={{ marginRight: '15px', width: '100px' }} type="primary" onClick={this.submit}>发布</Button></Col>
+              <Col span={2} className="gutter-row" ><Button style={{ marginLeft: '15px', width: '100px' }} onClick={this.cancle}>返回</Button></Col>
+            </Row>
+          </Card>
+        </Spin>
+      </div>
+    )
+  }
+}
diff --git a/src/components/page/DocumentEditPage/index.scss b/src/components/page/DocumentEditPage/index.scss
new file mode 100644
index 0000000..650689e
--- /dev/null
+++ b/src/components/page/DocumentEditPage/index.scss
@@ -0,0 +1,12 @@
+/* eslint-disable */
+/**liuwh
+ * 4/6/2020, 3:53:15 PM
+ * doc comment for the file goes here
+ */
+
+/** Happy Coding */
+.document-edit-page {
+  &-main {
+
+  }
+}
diff --git a/src/index.js b/src/index.js
index 0a36312..5d29e21 100644
--- a/src/index.js
+++ b/src/index.js
@@ -25,6 +25,11 @@
 import Announcement from './pages/index/Announcement'; //全部通知
 
 
+
+import DocumentEdit from './pages/document/DocumentEdit'; //新建文档
+
+
+
 const { Content } = Layout;
 const history = createHashHistory();
 
@@ -43,14 +48,19 @@
           </Switch>
           <Content>
             <Switch>
-              
+              {/* 新建文档 */}
+              <Route path="/document/create" component={DocumentEdit} />
+
+
               {/* 全部通知 */}
               <Route path="/index/workbench/announcement" component={Announcement} />
-              <Route path="/index/rules" component={System} />
               
               {/* 首页 */}
               <Route path="/index" component={Workbench} />
-              
+             
+              {/* 规章制度 */}
+              <Route path="/index/rules" component={System} />
+
               <Route path="/login" component={Login} />
               {/* 路由的页面重定向 */}
               <Redirect to="/" component={Workbench} />
diff --git a/src/pages/document/DocumentEdit.jsx b/src/pages/document/DocumentEdit.jsx
new file mode 100644
index 0000000..a9b9407
--- /dev/null
+++ b/src/pages/document/DocumentEdit.jsx
@@ -0,0 +1,44 @@
+/* eslint-disable */
+/**liuwh
+ * 4/6/2020, 3:51:13 PM
+ * doc comment for the file goes here
+ */
+
+/** Happy Coding */
+import React, { ReactNode, ReactEventHandler, Component } from 'react';
+// import { Link } from 'react-router-dom';
+// import { Icon } from 'antd';
+import BreadcrumbView from '../../components/common/BreadcrumbView';
+import DocumentEditPage from '../../components/page/DocumentEditPage'
+
+export default class DocumentEdit extends Component {
+  constructor(props) {
+    super(props);
+    this.config = {
+    };
+    this.state = {
+    };
+  }
+
+  componentWillMount() { }
+
+  componentDidMount() { }
+
+  componentDidShow() { }
+
+  render() {
+    return (
+      <div className="document-edit-main">
+        <BreadcrumbView data={[{ name: '新建文档' }]} />
+        <DocumentEditPage history={this.props.history}/>
+      </div>
+    )
+  }
+}
+//export default function DocumentEdit({  }) {
+//    return (
+//     <div className="document-edit-main">
+//
+//      </div>
+//    )
+//}

--
Gitblit v1.8.0