/* eslint-disable react/jsx-indent */

import React, { Component } from 'react';
import { SearchOutlined, SettingOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
// import '@ant-design/compatible/assets/index.css';
import {
  message,
  Layout,
  Switch,
  DatePicker,
  Radio,
  Input,
  Button,
  Select,
  Row,
  Col,
} from 'antd-v4';
import moment from 'moment';
import * as thisUtils from './ProductionPlanUtils';/* 单据业务功能 */
import styles1 from './index.less';
import CommonBase from '../Common/CommonBase';/* 获取配置及数据 */
import * as commonUtils from '../../utils/utils';/* 通用方法 */
import * as commonFunc from '../Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
import AntdDraggableModal from '../Common/AntdDraggableModal';

const {
  Header, Content, Footer, Sider,
} = Layout;
const { RangePicker } = DatePicker;
const RadioGroup = Radio.Group;
const { Option } = Select;
const InputGroup = Input.Group;
const FormItem = Form.Item;


// const printItem = (
//   <Menu onClick={this.handlePrintChange}>
//     <Menu.Item key="1">印刷排程</Menu.Item>
//     <Menu.Item key="2">印后排程</Menu.Item>
//   </Menu>
// )
class ProductionPlan extends Component {
  constructor(props) {
    super(props);
    this.state = {
      enabled: true,
      planTop: styles1.top,
      radiovalue: 0,
      sSqlCondition: '',
      inputCondition: '1',
      inputText: '',
      searchText: '',
      dataFrom: moment().startOf('day').subtract(100, 'days'),
      dataTo: moment().endOf('day'),
      processTableVisable: false,
      processTableLoding: false,
      curProductName: '',
      // selectedRowKeys: [], // Check here to configure the default column
      // selectedMachineRowKeys: [], // Check here to configure the default column
      changeMachine: true,
      sChangeTeamId: '',
      sChangeMachineId: '',
      loading: false,
      filterListData: [{
        key: '1',
        value: '工单号',
      }, {
        key: '2',
        value: '订单号',
      }, {
        key: '3',
        value: '客户名称',
      }, {
        key: '4',
        value: '印件名称',
      }],
      teamData: [],
      DropDownlistMachineData: [],
      // ArrangeColumns: [{
      //   title: '工单号',
      //   dataIndex: 'sOrderNo',
      //   width: 300,
      //   ...this.getColumnSearchProps('sOrderNo'),
      //   render: (text, record) =>
      //     <button onClick={() => this.queryBillProcess(record.key, record.sProductName)}>{text}</button>,
      // }, {
      //   title: '工序名称',
      //   dataIndex: 'sProcessName',
      //   width: 150,
      //   ...this.getColumnSearchProps('sProcessName'),
      // }, {
      //   title: '客户',
      //   dataIndex: 'sCustomerName',
      //   width: 200,
      // }, {
      //   title: '印件',
      //   dataIndex: 'sProductName',
      //   width: 200,
      // }, {
      //   title: '数量',
      //   dataIndex: 'dProductQty',
      //   width: 200,
      // }, {
      //   title: '班组',
      //   dataIndex: 'sTeamName',
      //   width: 200,
      // }],
      // ArrangeData: [],
    };
    this.dscrollY = 'calc(100vh - 423px - 35px)';
    this.form = {};
    this.handleList(0, 0, '', '1 = 1'); // 工作中心
    // this.handleList(1, 0, '', '1 = 1'); // 排程数据
  }
  componentWillReceiveProps(nextProps) {
    let {
      workCenterColumn,
      machineColumn,
      arrangeColumn,
      constFind,
      constReset,
      constScheduling,
      constOutProcessing,
      constRelease,
      constSuspend,
      constCancelSuspend,
      constReturn,
      constChangeTeam,
      constChangeMachine,
      constConfirm,
      constSave,
      constPrint,
      constOutExcel,
      constCloseDrag,
      constOpenDrag,
      constRdoStatus,
      constCondition,
      constKeyWord,
    } = nextProps;
    const { formData } = nextProps;
    if (commonUtils.isEmptyArr(workCenterColumn) && formData.length > 0) {
      const workCenterConfig = formData.filter(item => item.sTbName.toUpperCase() === 'sisworkcenter'.toUpperCase())[0];
      workCenterColumn = commonFunc.getHeaderConfig(workCenterConfig, workCenterColumn);
      const tableConfig = workCenterConfig.gdsconfigformslave;
      const column = [];
      for (const child of tableConfig) {
        if (child.bVisible && child.sControlName !== '') {
          let sDropDown = [];
          if (child.sChineseDropDown !== '' && child.sChineseDropDown.indexOf(',') > 0) {
            sDropDown = child.sChineseDropDown.split(',');
          }
          column.push({
            sControlName: child.sControlName,
            sChinese: child.sChinese,
            sChineseDropDown: sDropDown,
          });
        }
      }
      constFind = commonFunc.getControlConfig('BtnFind', column);
      constReset = commonFunc.getControlConfig('BtnReset', column);
      constScheduling = commonFunc.getControlConfig('BtnScheduling', column);
      constOutProcessing = commonFunc.getControlConfig('BtnOutProcessing', column);
      constRelease = commonFunc.getControlConfig('BtnRelease', column);
      constSuspend = commonFunc.getControlConfig('BtnSuspend', column);
      constCancelSuspend = commonFunc.getControlConfig('BtnCancelSuspend', column);
      constReturn = commonFunc.getControlConfig('BtnReturn', column);
      constChangeTeam = commonFunc.getControlConfig('EdtChangeTeam', column);
      constChangeMachine = commonFunc.getControlConfig('EdtChangeMachine', column);
      constConfirm = commonFunc.getControlConfig('BtnConfirm', column);
      constSave = commonFunc.getControlConfig('BtnSave', column);
      constPrint = commonFunc.getControlConfig('BtnPrint', column);
      constOutExcel = commonFunc.getControlConfig('BtnOutExcel', column);
      constCloseDrag = commonFunc.getControlConfig('bCloseDrag', column);
      constOpenDrag = commonFunc.getControlConfig('bOpenDrag', column);
      constRdoStatus = commonFunc.getControlConfig('RdoStatus', column);
      constCondition = commonFunc.getControlConfig('LstCondition', column);
      constKeyWord = commonFunc.getControlConfig('EdtKeyWord', column);
      // constFind = column.
      // constFind: '查找',
      //   constReset: '重置',
      //   constScheduling: '生产排程',
      //   constOutProcessing: '发外加工',
      //   constRelease: '下达',
      //   constSuspend: '暂停',
      //   constCancelSuspend: '取消下达',
      //   constReturn: '返回重排',
      //   constChangeTeam: '换班组',
      //   constChangeMachine: '换机台',
      //   constConfirm: '确认更换',
      //   constSave: '保存',
      //   constPrint: '打印',
      //   constOutExcel: '导出',
      //   constDrag: '是否拖动',
      //   constRdoStatus: '未排程,已排程,已下达,正在生产,已暂停,冻结,已完工,全部',
      //   constCondition: '工单号,订单号,客户名称,印件名称',
      //   constKeyWord: '关键字',

      const machineConfig = formData.filter(item => item.sTbName.toUpperCase() === 'elemachine'.toUpperCase())[0];
      machineColumn = commonFunc.getHeaderConfig(machineConfig, machineColumn);
      const arrangeConfig = formData.filter(item => item.sTbName.toUpperCase() === 'mftproductionplanslave'.toUpperCase())[0];
      arrangeColumn = commonFunc.getHeaderConfig(arrangeConfig, arrangeColumn);
      this.props.onSaveState({
        workCenterConfig,
        workCenterColumn,
        machineConfig,
        machineColumn,
        arrangeConfig,
        arrangeColumn,
        constFind,
        constReset,
        constScheduling,
        constOutProcessing,
        constRelease,
        constSuspend,
        constCancelSuspend,
        constReturn,
        constChangeTeam,
        constChangeMachine,
        constConfirm,
        constSave,
        constPrint,
        constOutExcel,
        constCloseDrag,
        constOpenDrag,
        constRdoStatus,
        constCondition,
        constKeyWord,
      });
    }
  }
  componentWillUpdate() {
  }

  getColumnSearchProps = dataIndex => ({
    filterDropdown: ({
      setSelectedKeys, selectedKeys, confirm, clearFilters,
    }) => (

      <div style={{ padding: 8, background: '#fff', borderRadius: 4 }}>
        <Input
          ref={(node) => { this.searchInput = node; }}
          placeholder={` ${dataIndex}`}
          value={selectedKeys[0]}
          onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
          onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
          style={{ width: 188, marginBottom: 8, display: 'block' }}
        />
        <Button
          type="primary"
          onClick={() => this.handleSearch(selectedKeys, confirm)}
          icon={<SearchOutlined />}
          size="small"
          style={{ width: 90, marginRight: 8 }}
        >
          查找
        </Button>
        <Button
          onClick={() => this.handleReset(clearFilters)}
          size="small"
          style={{ width: 90 }}
        >
          重置
        </Button>
      </div>
    ),
    filterIcon: filtered => <SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} />,
    onFilter: (value, record) => record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()),
    onFilterDropdownVisibleChange: (visible) => {
      if (visible) {
        setTimeout(() => this.searchInput.select());
      }
    },
    render: text => (text),
  })

  getInputSqlCondition = (i) => {
    switch (i) {
      case '1':
        return 'M.sWorkOrderId like ';
      case '2':
        return 'M.sOrderNo like ';
      case '3':
        return 'EM.sCustomerName like ';
      default:
        return 'ET.sProductName like ';
    }
  }
  handleSelectMachineChange = (name, selectedMachineRowKeys) => {
    if (this.state.radiovalue > 0) {
      this.handleList(1, -1, selectedMachineRowKeys[0], `M.sMachineId =''${selectedMachineRowKeys[0]}''`); // 排程数据
    }
    this.props.onSaveState({
      [`${name}SelectedRowKeys`]: selectedMachineRowKeys,
      sChangeTeamId: '',
      teamData: [],
    });
  }
  handleSelectChange = (name, selectedRowKeys) => {
    const selectedData = this.props.arrangeData.filter(item => selectedRowKeys.indexOf(item.key) > -1);
    this.props.onSaveState({
      [`${name}SelectedRowKeys`]: selectedRowKeys,
    });
    this.setState({
      changeMachine: true,
      sChangeMachineId: '',
      DropDownlistMachineData: [],
    });
    // 去重复
    const res = new Map();
    if (selectedData.filter(a => !res.has(a.sProcessName) && res.set(a.sProcessName, 1)).length > 1) {
      this.setState({ changeMachine: false });
    }
  }
  handleTeamChange =(value) => {
    this.setState({
      sChangeTeamId: value,
    });
  }
  handleMachineChange =(value) => {
    this.setState({
      sChangeMachineId: value,
    });
  }
  handleRangePickerChange=(date) => {
    this.setState({
      dataFrom: date[0],
      dataTo: date[1],
    });
  }

  handleListConditionChange= (value) => {
    this.setState({
      inputCondition: value,
    });
  }
  handleInputChange = (e) => {
    this.setState({
      inputText: e.target.value,
    });
  }

  handlePrintChange = () => {
  }
  queryBillProcess = (key, value) => {
    this.setState({
      processTableVisable: true,
      curProductName: value,
      processTableLoding: true,
    });
    this.handleList(0, -1, '', '1 = 1'); // 工作中心
  }

  handleUserSet = () => {
  }
  handleSearch = (selectedKeys, confirm) => {
    confirm();
    this.setState({ searchText: selectedKeys[0] });
  }

  handleRadioChange =(e) => {
    this.setState({
      radiovalue: e.target.value,
    });
    const radioValue = e.target.value;
    if (radioValue < 6) {
      this.handleList(0, radioValue, '', '1 = 1'); // 工作中心 无条件查
      // this.handleList(1, radioValue, '', '1 = 1'); // 排程数据 无条件查
    } else {
      this.handleList(0, radioValue, '', ''); // 工作中心 根据条件查
      // this.handleList(1, radioValue, '', ''); // 排程数据 根据条件查
    }
  }
  handleReset = (clearFilters) => {
    clearFilters();
    this.setState({ searchText: '' });
  }

  async handleList(iOperType, radioValue, sWorkCenterId, sSqlCondition, sIds, sMachineIds, sTeamId) {
    const { app } = this.props;
    const params = {
      token: app.token,
      value: {
        sProName: 'Sp_Manufacture_ProducttionPlan_List',
        paramsMap: {
          iStates: radioValue >= 0 ? radioValue + 1 : this.state.radiovalue + 1,
          iOperType,
          sWorkCenterId,
          sIds: sIds === undefined ? [''] : sIds.toString(),
          sMachineId: sMachineIds === undefined ? [''] : sMachineIds.toString(),
          sTeamId: sTeamId === undefined ? '' : sTeamId,
          sSqlCondition: sSqlCondition !== '' ? sSqlCondition : `M.tStartDate >= "${this.state.dataFrom.format('YYYY-MM-DD')
          }" and M.tStartDate <= "${this.state.dataTo.format('YYYY-MM-DD')}" and  ${this.getInputSqlCondition(this.state.inputCondition)
          }"%${this.state.inputText}%"`,
        },
      },
    };
    const returnData = await thisUtils.handleGetDataSetByName(params);
    const { proData, msgs } = returnData;
    if (returnData !== undefined) {
      if (iOperType === 0) {
        this.props.onSaveState({
          workCenterData: proData,
          machineData: [],
          arrangeData: [],
          machineSelectedRowKeys: [],
          arrangeSelectedRowKeys: [],
          DropDownlistMachineData: [],
          teamData: [],
          processTableLoding: false,
        });
        // if (proData.length > 0) {
        //   this.handleList(2, -1, proData[0].sId);
        // }
      } else if (iOperType === 2) {
        this.props.onSaveState({
          machineData: proData,
          selectedRowKeys: [],
          DropDownlistMachineData: [],
          teamData: [],
        });
      } else if (iOperType === 100) { // 换班组时,取班组;
        this.setState({ teamData: proData });
      } else if (iOperType === 101) { // 取机台时，取机台;
        this.setState({ DropDownlistMachineData: proData });
      } else {
        this.props.onSaveState({ arrangeData: proData, selectedRowKeys: [] });
      }
    } else {
      message.error(msgs);
    }
  }
  handleSubmit = async (e) => {
    e.preventDefault();
    this.form.validateFields(async (err) => {
      if (!err) {
        this.handleList(1, -1, '', '');
      }
    });
  };
  handleForm = (form) => {
    this.form = form;
  };
  handleWorkCenterClick = (record) => {
    const newKey = record.key;
    this.handleList(1, -1, newKey, `M.sWorkCenterId =''${newKey}''`); // 排程数据
    this.handleList(2, -1, newKey, '1 = 1'); // 机器数据
    this.props.onSaveState({
      machineSelectedRowKeys: [],
    });
  };
  // start = () => {
  //   this.setState({ loading: true });
  //   // ajax request after empty completing
  //   setTimeout(() => {
  //     this.setState({
  //       selectedRowKeys: [],
  //       loading: false,
  //     });
  //   }, 1000);
  // }

  processTableOk = () => {
    this.setState({
      processTableVisable: false,
    });
  }

  processTableCancel = () => {
    this.setState({
      processTableVisable: false,
    });
  }

  handleTeamDropdown = (e) => {
    if (e && this.props.machineSelectedRowKeys.length > 0) {
      this.handleList(100, -1, '', '', '', this.props.machineSelectedRowKeys);
    }
  }
  handleMachineDropdown = (e) => {
    if (e && this.props.arrangeSelectedRowKeys.length > 0) {
      this.handleList(101, -1, '', '', this.props.arrangeSelectedRowKeys[0], '');
    }
  }

  handleButtonClick = (e) => {
    if (this.props.arrangeSelectedRowKeys.length < 1) {
      message.info('排程数据不为空');
      return;
    }
    if (e === 3 && this.props.machineSelectedRowKeys.length < 1) { // 生产排单
      message.info('请选择机台');
      return;
    }
    if (e === 11) { // 更换机台 + 班组
      if (this.state.sChangeMachineId !== '' && this.state.sChangeTeamId !== '') {
        this.handleList(20, 0, '', '', this.props.arrangeSelectedRowKeys, this.state.sChangeMachineId, this.state.sChangeTeamId);
      } else if (this.state.sChangeMachineId !== '') {
        this.handleList(21, 0, '', '', this.props.arrangeSelectedRowKeys, this.state.sChangeMachineId, '');
      } else if (this.state.sChangeTeamId !== '') {
        this.handleList(22, 0, '', '', this.props.arrangeSelectedRowKeys, '', this.state.sChangeTeamId);
      }
    } else {
      this.handleList(e, 0, '', '', this.props.arrangeSelectedRowKeys, this.props.machineSelectedRowKeys);
    }
  }

  render() {
    const { workCenterColumn } = this.props;
    return (
      <div>
        {commonUtils.isNotEmptyArr(workCenterColumn) ?
          <ProductionPlanComponent
            {...this.props}
            {...this.state}
            onSelectChange={this.handleSelectChange}
            onSelectMachineChange={this.handleSelectMachineChange}
            dscrollY={this.dscrollY}
            printItem={this.printItem}
            onRadioChange={this.handleRadioChange}
            onTeamChange={this.handleTeamChange}
            onRangePickerChange={this.handleRangePickerChange}
            onListConditionChange={this.handleListConditionChange}
            onInputChange={this.handleInputChange}
            onUserSet={this.handleUserSet}
            onColResize={this.handleResize}
            onSubmit={this.handleSubmit}
            onReturnForm={this.handleForm}
            onWorkCenterClick={this.handleWorkCenterClick}
            onProcessTableCancel={this.processTableCancel}
            onProcessTableOk={this.processTableOk}
            onButtonClick={this.handleButtonClick}
            onTeamDropdown={this.handleTeamDropdown}
            onMachineChange={this.handleMachineChange}
            onMachineDropdown={this.handleMachineDropdown}
          />
          : ''}
      </div>
    );
  }
}

const ProductionPlanComponent = Form.create({
})((props) => {
  const {
    form,
    planTop,
    radiovalue,
    dataFrom,
    dataTo,
    teamData,
    DropDownlistMachineData,
    onRadioChange,
    onTeamChange,
    onMachineChange,
    onRangePickerChange,
    onListConditionChange,
    onInputChange,
    onUserSet,
    filterListData,
    dscrollY,
    onSubmit,
    onReturnForm,
    onWorkCenterClick,
    onSelectChange,
    onSelectMachineChange,
    processTableVisable,
    processTableLoding,
    curProductName,
    // processTableOk,
    onProcessTableCancel,
    onProcessTableOk,
    onButtonClick,
    changeMachine,
    onTeamDropdown,
    onMachineDropdown,
    constFind,
    // constReset,
    constScheduling,
    constOutProcessing,
    constRelease,
    constSuspend,
    constCancelSuspend,
    constReturn,
    constChangeTeam,
    constChangeMachine,
    constConfirm,
    constSave,
    constPrint,
    constOutExcel,
    constCloseDrag,
    constOpenDrag,
    constRdoStatus,
    constCondition,
    constKeyWord,
  } = props;
  // const dscrollRight = 'calc(100vh - 193px - 35px)';
  const { getFieldDecorator } = form;
  /*   回带表单   */
  onReturnForm(form);
  const left1props = {
    ...commonBusiness.getTableTypes('workCenter', props),
    tableProps: {
      rowSelection: null,
      bordered: false,
      loading: processTableLoding,
      className: styles1.border,
      scroll: { x: 270, y: 201 },
      onRow: (record) => { return { onClick: () => { onWorkCenterClick(record); } }; },
    },
  };

  const left2props = {
    ...commonBusiness.getTableTypes('machine', props),
    rowSelectionType: 'radio',
    onSelectRowChange: onSelectMachineChange,
    tableProps: {
      bordered: false,
      className: styles1.border,
      scroll: { x: 270, y: dscrollY },
    },
  };
  const rightprops = {
    ...commonBusiness.getTableTypes('arrange', props),
    rowSelectionType: 'checkbox',
    onSelectRowChange: onSelectChange,
    tableProps: {
      bordered: true,
      className: styles1.border,
      // scroll: { x: 3000, y: dscrollRight },
    },
  };

  return (
    <Form onSubmit={onSubmit}>
      <Layout>
        <Header className={styles1.header}>
          <div className={planTop}>
            <Row>
              <Col span={12} >
                <FormItem>
                  {getFieldDecorator('productionProcess', {
                    initialValue: radiovalue,
                  })(<RadioGroup onChange={onRadioChange}>
                    { constRdoStatus.sChineseDropDown.map((o, i) =>
                      <Radio value={i}>{o}</Radio>)
                      }
                     </RadioGroup>)}
                </FormItem>
              </Col>
              <Col span={5}>
                <FormItem>
                  {getFieldDecorator('productionTime', {
                    initialValue: [dataFrom, dataTo],
                  })(<RangePicker onChange={onRangePickerChange} />)}
                </FormItem>
              </Col>
              <Col span={5}>
                <InputGroup compact>
                  <FormItem>
                    {getFieldDecorator('productionSQl', {
                    })(<Select placeholder={constCondition.sChinese} onChange={onListConditionChange} style={{ width: 100 }}>
                      { filterListData.map(child =>
                        <Option value={child.key}>{child.value}</Option>)
                      }
                       </Select>)}
                  </FormItem>
                  <FormItem>
                    {getFieldDecorator('productionSQlKey', {
                    })(<Input style={{ width: 170 }} onChange={onInputChange} placeholder={constKeyWord.sChinese} />)}
                  </FormItem>
                </InputGroup>
              </Col>
              <Col span={2}>
                <Button type="primary" htmlType="submit" style={{ margin: 2 }}>{constFind.sChinese}</Button>
                <div className={styles1.affixMenu}>
                  <SettingOutlined onClick={onUserSet} />
                </div>
              </Col>
            </Row>
          </div>
        </Header>
        <div>
          {
            processTableVisable ?
              <AntdDraggableModal
                title={`${curProductName}`}
                visible={processTableVisable}
                onOk={onProcessTableOk}
                onCancel={onProcessTableCancel}
              >
                <StaticEditTable {...left1props} />
              </AntdDraggableModal>
              : ''
          }
        </div>
        <Layout>
          <Content className={styles1.content}>
            <Layout>
              <Sider className={styles1.left}>
                <div className={styles1.left1}>
                  <StaticEditTable {...left1props} />
                </div>
                <div className={styles1.left2}>
                  <StaticEditTable {...left2props} />
                </div>
              </Sider>
              <Content className={styles1.right}>
                <StaticEditTable {...rightprops} />
              </Content>
            </Layout>
          </Content>
          <Footer className={planTop} style={{ marginTop: 0 }}>
            <Row>
              <Col span={4} >
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 3)} disabled={radiovalue !== 0}style={{ margin: 2 }}>{constScheduling.sChinese}</Button>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 4)} disabled={radiovalue !== 0} style={{ margin: 2 }}>{constOutProcessing.sChinese}</Button>
              </Col>
              <Col span={14}>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 5)} disabled={(radiovalue === 0 || radiovalue >= 3)} style={{ margin: 2, display: radiovalue !== 2 ? 'inline-block' : 'none' }}>{constRelease.sChinese}</Button>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 6)} disabled={(radiovalue === 0 || radiovalue >= 3)} style={{ margin: 2, display: radiovalue === 2 ? 'inline-block' : 'none' }}>{constCancelSuspend.sChinese}</Button>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 7)} disabled={(radiovalue === 0 || radiovalue >= 4)} style={{ margin: 2, display: radiovalue !== 4 ? 'inline-block' : 'none' }}>{constSuspend.sChinese}</Button>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 8)} disabled={radiovalue === 0} style={{ margin: 2, display: radiovalue === 5 ? 'inline-block' : 'none' }}>恢复生产</Button>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 9)} disabled={(radiovalue === 0 || radiovalue >= 3)} style={{ margin: 2 }}>{constReturn.sChinese}</Button>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 10)} disabled={(radiovalue === 0 || radiovalue >= 4)} style={{ margin: 2 }}>加工完成</Button>
                <Select defaultValue={constChangeTeam.sChinese} style={{ width: 100 }} onDropdownVisibleChange={onTeamDropdown} onChange={onTeamChange}>
                  { teamData.map(child =>
                    <Option key={child.key}>{child.sTeamName}</Option>)
                  }
                </Select>
                <Select defaultValue={constChangeMachine.sChinese} style={{ width: 140 }} onDropdownVisibleChange={onMachineDropdown} onChange={onMachineChange}>
                  { DropDownlistMachineData.map(child =>
                    <Option key={child.key}>{child.sMachineName}</Option>)
                  }
                </Select>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 11)} disabled={(radiovalue === 0 || !changeMachine || radiovalue >= 3)} style={{ margin: 4 }}>{constConfirm.sChinese}</Button>
              </Col>
              <Col span={4}>
                <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 12)} style={{ margin: 2 }}>{constSave.sChinese}</Button>
                {/* <Dropdown overlay={printItem}> */}
                {/* <Button> */}
                {/* Actions <Icon type="down" /> */}
                {/* </Button> */}
                {/* </Dropdown> */}
                <Button type="primary" htmlType="button" style={{ margin: 2 }}>{constPrint.sChinese}</Button>
                <Button type="primary" htmlType="button" style={{ margin: 2 }}>{constOutExcel.sChinese}</Button>
              </Col>
              <Col span={2}>
                <Switch checkedChildren={constCloseDrag.sChinese} unCheckedChildren={constOpenDrag.sChinese} defaultChecked={false} />
              </Col>
            </Row>
          </Footer>
        </Layout>
      </Layout>
    </Form>
  );
});
export default CommonBase(ProductionPlan);
