/* eslint-disable array-callback-return,no-undef */
import React, { Component } from 'react';
import { Form } from '@ant-design/compatible';
// import '@ant-design/compatible/assets/index.css';
import { Layout, Tabs, Spin, Avatar } from 'antd-v4';
import styles from '../../index.less';
import Toolbar from '../Common/ToolBar/ToolBarNew';
import * as commonFunc from '../Common/commonFunc';
import CommonBase from '../Common/CommonBase';
import CommonElementEvent from '../Common/CommonElementEvent';
import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
import CommonView from '../Common/CommonView';
import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */

const { Header, Content } = Layout;
const { TabPane } = Tabs;

class CheckModelInfoComponent extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
    this.form = {}; /*   表单对象   */
  }
  render() {
    const { pageLoading } = this.props;
    return (
      <div>
        <Spin spinning={pageLoading}>
          <div>
            <CheckModelComponent
              {...this.props}
              {...this.state}
            />
          </div>
        </Spin>
      </div>
    );
  }
}
const CheckModelComponent = Form.create({
  mapPropsToFields(props) {
    const { masterData } = props;
    const obj = commonFunc.mapPropsToFields(masterData, Form);
    return obj;
  },
})((props) => {
  const {
    form, onReturnForm, AutoTableHeight, app,
  } = props;
  /*   回带表单   */
  onReturnForm(form);
  const checkPerson = commonFunc.showMessage(app.commonConst, 'checkPerson');/* 审核人 */
  return (
    <Form>
      <Layout>
        <Header className={styles.header}>
          <Toolbar {...props} />
        </Header>
        <Layout className={styles.clayout}>
          <Content className={styles.content}>
            <div className="bill-search-group">
              <CommonView {...props} />
            </div>
            <div id="slaveTabs" className={styles.bShow}>
              <div>
                <Avatar src={props.imgSrc} />
              </div>
              <Tabs className={styles.slaveTabs} tabBarStyle={{ marginLeft: 10 }} style={{ height: AutoTableHeight }}>
                <TabPane tab={checkPerson} key={2} className="xly-bill-list">
                  <StaticEditTable {...commonBusiness.getTableTypes('sischeckphaselogininfo', props)} setOpterationColumn="Y" footer="hidden" />
                </TabPane>
              </Tabs>
            </div>
          </Content>
        </Layout>
      </Layout>
    </Form>
  );
});

export default CommonBase(CommonElementEvent(CheckModelInfoComponent));

