forked from huge/frontEnd/hugeOA

Mr Ke
2020-04-06 756cb18003a3a5602dba0ac6761e9c57289a8bac
Merge branch 'master' of http://120.79.193.119:9090/r/huge/frontEnd/hugeOA
4 files modified
172 ■■■■ changed files
src/components/page/DocumentEditPage/index.jsx 153 ●●●● patch | view | raw | blame | history
src/components/page/index/rulesList/index.jsx 11 ●●●● patch | view | raw | blame | history
src/index.js 4 ●●●● patch | view | raw | blame | history
src/pages/index/System.jsx 4 ●●●● patch | view | raw | blame | history
src/components/page/DocumentEditPage/index.jsx
@@ -7,11 +7,13 @@
/** 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 { Card, Row, Col, Select, Button, Input, Upload, Icon, Spin, message } from 'antd';
import './index.scss';
const Option = Select.Option;
const { TextArea } = Input;
import fetch from '../../../api/request';
import { BASE_URL } from '../../../api/httpurl'
const param = [{ value: 'DT00002', name: '通知公告' }, { value: 'DT00001', name: '规章制度' }]
export default class DocumentEditPage extends Component {
@@ -21,32 +23,39 @@
    };
    this.state = {
      loading: false,
      iconLoading: false,
      savedate: {},
      fileList: [],
      disabled: false,
    };
  }
  componentWillMount() { }
  componentDidMount() {
    // this.loadData()
    this.loadData()
  }
  loadData = () => {
    console.log('111')
    const { id } = this.props;
    console.log(id)
    let _this = this;
    _this.setState({
      loading: true
      loading: true,
      disabled: id ? true : false
    })
    fetch({
      url: 'api/document/getNewId',
      url: 'api/document/findDetail',
      params: {
        id: 'new'
        id: id || 'new'
      }
    }).then(res => {
      console.log(res)
      _this.setState({
        savedate: res.content,
        savedate: {
          ...res,
          documentType: res.documentType || 'DT00002'
        },
        loading: false,
      });
    });
@@ -65,6 +74,31 @@
  submit = () => {
    const { savedate } = this.state;
    console.log(savedate)
    if (savedate.documentType == 'DT00001') {
      if (!savedate.documentItle) {
        return message.warning('规章制度标题不能为空')
      }
    } else {
      if (!savedate.documentItle) {
        return message.warning('通知标题不能为空')
      } else if (!savedate.documentContent) {
        return message.warning('通知内容不能为空')
      }
    }
    let _this = this;
    _this.setState({
      iconLoading: true
    })
    fetch({
      url: 'api/document/saveOrUpdateNotice',
      method: 'POST',
      data: savedate
    }).then(res => {
      console.log(res)
      _this.setState({
        iconLoading: false,
      });
    });
    // Fetch.savePatrolCom(savedate)
    //   .then(res => {
    //     if (res.code === 0) {
@@ -81,9 +115,9 @@
  }
  render() {
    const { savedate, fileList, loading } = this.state;
    const { savedate, fileList, loading, disabled } = this.state;
    const props = {
      action: `api/v1/attachment/materials?associateTypeId=1019&entityId=` + savedate.id,
      action: BASE_URL + `api/attachment/materials?associateId=${savedate.documentType == 'DT00002' ? 1001 : 1002}&entityId=` + savedate.id,
      onChange: ({ file, fileList }) => {
        if (file.status !== 'uploading') {
          console.log(file);
@@ -118,6 +152,7 @@
    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" >
@@ -126,7 +161,7 @@
            </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"}>
                <Select disabled={disabled} style={{ width: "300px" }} onChange={(value) => this.saveInputChange({ target: { name: 'documentType', value } })} value={savedate.documentType}>
                  {
                    param.map((data, key) => (
                      <Option key={key} value={data.value}>{data.name}</Option>
@@ -136,37 +171,87 @@
              </Col>
            </Row>
            <Row gutter={16} style={{ marginTop: '12px' }}>
              <Col className="gutter-row" style={{ marginTop: '12px' }}>
                规章制度标题:
            </Col>
            </Row>
            {
              savedate.documentType == 'DT00002' &&
              <Row gutter={16} style={{ marginTop: '12px' }}>
                <Col className="gutter-row" style={{ marginTop: '12px' }}>
                  通知标题:
                </Col>
              </Row>
            }
            {
              savedate.documentType == 'DT00001' &&
              <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 || ""} />
                <Input disabled={disabled} 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' }} >
                规章制度源文件:
            {
              savedate.documentType == 'DT00002' &&
              <Row gutter={16}>
                <Col className="gutter-row" >
                  通知内容:
            </Col>
            </Row>
            <Row gutter={16} >
              <Col className="gutter-row" >
                <Upload {...props}>
                  <Button>
                    <Icon type="upload" />上传文件</Button>
                </Upload>
              </Col>
            </Row>
              </Row>
            }
            {
              savedate.documentType == 'DT00002' &&
              <Row gutter={16}>
                <Col className="gutter-row" style={{ margin: '12px 0' }} >
                  <TextArea disabled={disabled} style={{ width: '500px' }} name='documentContent' onChange={this.saveInputChange} value={savedate.documentContent || ""} />
                </Col>
              </Row>
            }
            {
              savedate.documentType == 'DT00001' &&
              <Row gutter={16} style={{ marginTop: '12px' }}>
                <Col className="gutter-row" style={{ margin: '12px 0' }} >
                  规章制度源文件:
                </Col>
              </Row>
            }
            {savedate.documentType == 'DT00001' &&
              <Row gutter={16} >
                <Col className="gutter-row" >
                  <Upload disabled={disabled} {...props}>
                    <Button>
                      <Icon type="upload" />上传文件</Button>
                  </Upload>
                </Col>
              </Row>
            }
            {
              savedate.documentType == 'DT00001' &&
              <Row gutter={16} style={{ marginTop: '12px' }}>
                <Col className="gutter-row" >
                  通知范围:
                </Col>
              </Row>
            }
            {
              savedate.documentType == 'DT00002' &&
              <Row gutter={16} style={{ marginTop: '12px' }}>
                <Col className="gutter-row" style={{ margin: '12px 0' }} >
                  通知范围:
                </Col>
              </Row>
            }
            {savedate.documentType == 'DT00002' &&
              <Row gutter={16} >
                <Col className="gutter-row" >
                  目前仅支持全员通知
                </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 disabled={disabled} style={{ marginRight: '15px', width: '100px' }} type="primary" loading={this.state.iconLoading} onClick={this.submit}>发布</Button></Col>
              <Col span={2} className="gutter-row" ><Button style={{ marginLeft: '15px', width: '100px' }} onClick={this.cancle}>返回</Button></Col>
            </Row>
          </Card>
src/components/page/index/rulesList/index.jsx
@@ -33,12 +33,19 @@
  componentDidMount() { }
  cancle = (id) => {
    console.log(id)
  //   // this.props.history.push("/document/create?id=" + id);
  this.props.history.push({ pathname: "/document/create" });
  }
  renderColumns = () => {
    return [
      { title: '通知标题', dataIndex: 'documentItle;' },
      { title: '通知标题', dataIndex: 'documentTitle' },
      { title: '通知内容', dataIndex: 'documentContent' },
      { title: '接受情况', dataIndex: 'groupType', render: (cur, item) => <span>{item.readNumber || 0}/{item.noticeNumber || 0}</span> },
      { title: '通知时间', dataIndex: 'createTime', render: (cur, item) => cur !== "" && cur != null ? moment(cur).format("YYYY-MM-DD HH:mm") : "" },
      { title: '操作', render: (text, record) => <a href="" onClick={() => this.cancle(record.id)}>查看</a> }
    ];
  }
@@ -68,7 +75,7 @@
          formData={formData}
          setFormData={this.setFormData}
          data={[
            { type: 'input', name: '标题', label: '标题', key: 'title' },
            { type: 'input', name: '标题', label: '标题', key: 'documentTitle' },
            {
              type: 'rangePicker',
              label: '发布时间',
src/index.js
@@ -55,10 +55,10 @@
              <Route path="/index/workbench/announcement" component={Announcement} />
              {/* 规章制度 */}
              <Route path="/index/rules" component={System} />
              {/* 首页 */}
              <Route path="/index" component={Workbench} />
              <Route path="/login" component={Login} />
              <Route path="/" component={Workbench} />
src/pages/index/System.jsx
@@ -28,9 +28,9 @@
  render() {
    return (
      <div className="System-main">
        <BreadcrumbView data={[{ name: '工作制度' }]} />
        <BreadcrumbView data={[{ name: '规章制度' }]} />
        {/* <SystemPage /> */}
        <RulesList {...this.prosp} />
        <RulesList {...this.props} />
      </div>
    )
  }