/*
 * Author: 黎永顺
 * name: 数据采集-导入选项
 * Description:
 * Date: 2023/2/20
 */
import React, { Component } from "react";
import { WeaSearchGroup } from "ecCom";
import { DataCollectionDatePicker, DataCollectionSelect } from "../index";

class ImportFormCom extends Component {
  screenChange = ({ key, value }) => {
    const { onChangeImportForm } = this.props;
    onChangeImportForm(key, value);
  };

  render() {
    const { taxAgentOption = [], declareMonth, taxAgentId } = this.props;
    const items = [
      {
        com: DataCollectionDatePicker({
          label: "税款所属期",
          value: declareMonth,
          onChange: this.screenChange,
          key: "declareMonth",
          screen: false
        })
      },
      {
        com: DataCollectionSelect({
          label: "个税扣缴义务人",
          value: taxAgentId || "",
          onChange: this.screenChange,
          options: [{ key: "", showname: "全部" }, ...taxAgentOption],
          key: "taxAgentId", viewAttr: 3
        })
      }
    ];
    !declareMonth && items.shift();
    _.isNil(taxAgentId) && items.pop();
    return (
      <WeaSearchGroup className="screenWrapper" showGroup needTigger={false} items={items}
                      col={2}/>
    );
  }
}

export default ImportFormCom;
