import React, { useState, useEffect } from 'react';
import { Modal, Form, Input, Button, Select, Switch, InputNumber } from 'antd';
import {
  getbompage,
  getBomInfo,
} from '../service';
const AddBom = (props) => {
  const { Option, OptGroup } = Select;
  const [options, setOptions] = useState();
  // const [propovalue,setPropovalue] = useState();
  console.log('值',props.values);
  // if(props.values!=null){props.setvalues.name
  //   setPropovalue(props.values);
  // }
  return (
    <Modal
      title={props.setvalues.name+'配方选择'}
      width={640}
      visible={props.createModalVisible}
      bodyStyle={{ padding: '32px 40px 48px' }}
      footer={null}
      onCancel={() => {
        props.onCancel();
      }}
      destroyOnClose
    >
      <Form
        layout="vertical"
        preserve={false}
        initialValues={props.values}
        onFinish={props.onFinish}
      >
        {/* <Form.Item
          name="bomId"
          label="配方名称"
          rules={[{ required: true, message: '请选择配方名称' }]}
        >
          <Select
            style={{ width: '100%' }}
            placeholder="请选择配方名称">
              {options}</Select>
        </Form.Item> */}
         <Form.Item
          name="bomId"
          label="配方名称"
          rules={[{ required: true, message: '请选择配方名称' }]}
        >
          <Select placeholder="请选择配方名称">
            {props.getGoodsBoms.map((item, index) => {
              return (
                <Select.Option index={index} value={item.id} key={item.id}>
                  {item.name}
                </Select.Option>
              );
            })}
          </Select>
        </Form.Item>
        <Form.Item name="status" label="状态" rules={[{ required: true }]} >
          <Select placeholder="请选择状态">
            <Select.Option value={0}>启用</Select.Option>
            <Select.Option value={1}>禁用</Select.Option>
          </Select>
        </Form.Item>
        <Form.Item>
          <Button type="primary" htmlType="submit">
            保存
          </Button>
        </Form.Item>
      </Form>
    </Modal>
  );
};

export default AddBom;
