import React from 'react';
import { connect } from 'dva';
import { Button, Row, Col, Form, Input,Select,Upload,Icon,Transfer,Spin,message } from 'antd';
import {
  extend,
  extendRule,
  initFilter,
  initQueryFilter,
  getOnlyPropertyData,
  extendInclude, guid
} from "../../../utils/common";
import DropDownPagination from '../../common/DropDownPaginationEx';
import EditComponent from "../../../baseComponents/EditComponent";
import config from "../../../config";

const FormItem = Form.Item;
const Option = Select.Option;
const { TextArea } = Input;
class QcMangerAdd extends EditComponent {
  constructor(props) {
    super(props);
    this.state = {
      data: {
      
      },
    };
  };
  
 
  onGetEntityData(allColumns, navFields){
    //super.onGetEntityData(allColumns, navFields);
    let { id: ID, copySrcId, login,data } = this.props
    if (!copySrcId) {
      copySrcId = this.copySrcId;
      this.copySrcId = null;
    }
    if(!ID){
      ID=data.id;
    }
    this.setState({
      data:{
        ID,
        ORG_ID:this.props.login.OrgId
      }
    })
  }

  onAfterHeadDropDownSelect(params){
    super.onAfterHeadDropDownSelect(params);
    console.log(record);
    const { value, record, colConfig, thisRef } = params ? params : {};
    if(record&&colConfig.field==='SN'){
      const detail={
        ID:guid(),
        SEND_ORDER_ID:this.state.data.ID,
        ORG_ID:this.state.data.ORG_ID,
        SN_ID:this.state.data.SN_ID,
        Nav_SN:{...this.state.data.Nav_SN}
      }
      const data=[detail];
      this.setEditTableData({ editCode: 'detail', data, isAppend: true });
    }
  } 
}


export default connect(({ login, loading,custom,app }) => ({ login, loading,custom,app}))(Form.create()(QcMangerAdd));
