/*
 * Author: 黎永顺
 * Description: 编号设置预览
 * Date: 2022-05-18 10:21:09
 * LastEditTime: 2022-06-08 16:37:01
 */
import React, { Component } from "react";

class Preview extends Component {
  render() {
    const { dataSource } = this.props;
    return (
      <div className="preview">
        <span className="label">预览</span>
        <div className="content">
          {_.map(
            _.map(dataSource, (item) => {
              const { numField, numFieldName } = item;
              if (
                numField === "year" ||
                numField === "month" ||
                numField === "day" ||
                numField === "subcompany" ||
                numField === "department" ||
                numField === "jobtitles"
              ) {
                return {
                  ...item,
                  value: numFieldName,
                };
              }
              return { ...item };
            }),
            (it, idx) => {
              const { numFieldName, value } = it;
              return (
                <div className="item" key={idx}>
                  <div title={numFieldName}>{numFieldName}</div>
                  <div>{value}</div>
                </div>
              );
            }
          )}
        </div>
      </div>
    );
  }
}

export default Preview;
