import React from "react";
import { WeaFormItem, WeaInput, WeaSearchGroup } from "ecCom";
import { inject, observer } from "mobx-react";
import "./index.less";

@inject("archivesStore")
@observer
export default class BaseForm extends React.Component {
  componentWillMount() {
    const { archivesStore: { getBaseForm } } = this.props;
    getBaseForm(this.props.employeeId);
  }

  render() {
    const { archivesStore: { baseFormData }, record } = this.props;
    const { username, department, position, telephone, hiredate, dimissionDate } = baseFormData;
    const { paymentOrganizationName } = record;
    const baseItems = [
      { com: Input("姓名", username) },
      { com: Input("部门", department) },
      { com: Input("岗位", position) },
      { com: Input("手机号", telephone) },
      { com: Input("入职日期", hiredate) },
      // { com: Input("合同到期日期", dimissionDate) }
    ];
    const taxagentItems = [
      { com: Input("个税扣缴义务人", paymentOrganizationName) }
    ];
    return (
      <div className="socialFormWrapper">
        <WeaSearchGroup title="基本信息" items={baseItems} col={1} showGroup/>
        <WeaSearchGroup title="个税扣缴义务人" items={taxagentItems} col={1} showGroup/>
      </div>
    );
  }
}
const Input = (label, value) => {
  return (
    <WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
      <WeaInput value={value} viewAttr={1}/>
    </WeaFormItem>
  );
};
