import {convertToPinyin} from '../pinYin/PinYin'
// import { genCargoowner, genSupplier } from "./search-model";

export const basicData = function (self) {
  return [
    {
      type: 'input',
      name: 'cargoOwnerId',
      label: '',
      value: '',
      hidden: true
    },
    {
      type: 'input',
      name: 'cargoOwnerName',
      label: '',
      value: '',
      hidden: true
    },
    {
      type: 'input',
      name: 'itemCode',
      label: '商品编码',
      value: '',
      required: true,
      maxLength: 30,
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'input',
      name: 'itemName',
      label: '商品中文名称',
      value: '',
      required: true,
      maxLength: 60,
      labelCol: {span: 8},
      span: 6,
      on: {
        blur(evt) {
          self.$refs.detail.$refs.main[0].form.setFieldsValue({
            itemAssistantCode: convertToPinyin(evt.target.value)
          })
        }
      }
    },
    {
      type: 'input',
      name: 'itemShortName',
      label: '商品简称',
      value: '',
      maxLength: 10,
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'input',
      name: 'itemNameEn',
      label: '商品英文名称',
      value: '',
      maxLength: 50,
      labelCol: {span: 8},
      span: 6
    },
    // { hidden: true, type: "input", name: "itemCategoryId", label: "商品分类ID", value: "", },
    // { hidden: true, type: "input", name: "itemCategoryCode", label: "商品分类编号", value: "", },
    // {
    //     type: "input", name: "itemCategoryName", label: "商品分类", value: "",
    //     labelCol: { span: 8 }, span: 6,
    //     on: {
    //         // 临时使用
    //         blur(evt) {
    //             self.$refs.detail.$refs.main[0].form.setFieldsValue({
    //                 itemCategoryId: convertToPinyin(evt.target.value),
    //                 itemCategoryCode: convertToPinyin(evt.target.value),
    //                 itemCategoryName: evt.target.value
    //             })
    //         }
    //     }
    // },
    {
      type: 'input',
      name: 'manufacturerId',
      label: '生产商',
      value: '',
      /*required: true,*/ maxLength: 32,
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'input',
      name: 'countryOriginId',
      label: '产地',
      value: '',
      maxLength: 32,
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'input',
      name: 'itemAssistantCode',
      label: '助记码',
      value: '',
      labelCol: {span: 8},
      span: 6
    },
    {hidden: true, type: 'input', name: 'pieceUom', label: '最小单位', value: ''},
    {hidden: true, type: 'input', name: 'pieceConversionRate', label: '最小单位规格', value: ''},
    {
      hidden: true,
      type: 'input',
      name: 'pieceBarcode',
      label: '商品条码',
      value: '',
      disabled: true,
      placeholder: '',
      labelCol: {span: 8},
      span: 6
    },
    {hidden: true, type: 'input', name: 'caseUom', label: '最大单位', value: ''},
    {hidden: true, type: 'input', name: 'caseConversionRate', label: '最大单位箱规', value: ''},
    {
      type: 'input',
      name: 'specification',
      label: '商品规格',
      value: '',
      labelCol: {span: 8},
      span: 6
    },

    {
      hidden: true,
      type: 'input',
      name: 'caseBarcode',
      label: '外箱条码',
      value: '',
      disabled: true,
      placeholder: '',
      labelCol: {span: 8},
      span: 6
    },
    {
      hidden: true,
      type: 'input',
      name: 'status',
      label: '状态',
      value: '',
      disabled: true,
      placeholder: '',
      labelCol: {span: 8},
      span: 6
    },

    {
      type: 'input',
      name: 'itemCategoryName',
      label: '首营类型',
      value: '',
      maxLength: 32,
      labelCol: {span: 8},
      span: 6
    },

    {
      type: 'select',
      name: 'segment1',
      label: '是否机械臂拣选',
      value: undefined,
      options: [
        {label: '是', value: 1},
        {label: '否', value: 0}
      ],
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'date',
      name: 'gmtCreate',
      label: '创建日期',
      format: 'YYYY-MM-DD',
      value: '',
      maxLength: 32,
      labelCol: {span: 8},
      span: 6
    },

    {
      type: 'date',
      name: 'gmtModified',
      label: '修改日期',
      format: 'YYYY-MM-DD',
      value: '',
      maxLength: 32,
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'SwitchValue',
      name: 'isEnable',
      label: '启用标识',
      value: 1,
      labelCol: {span: 8},
      span: 6
    },
    {
      type: 'number',
      name: 'identifyNum',
      label: '视觉识别数量',
      value: '',
      labelCol: {span: 8},
      span: 6
    },
    // {
    //     type: 'number',
    //     name: 'segment3',
    //     label: '视觉复核最大数',
    //     value: '',
    //     labelCol: {span: 8},
    //     span: 6
    //   },

    {
      type: 'textarea',
      name: 'itemDesc',
      label: '备注',
      value: '',
      maxLength: 240,
      labelCol: {span: 2},
      span: 24,
      rows: 2
    }
  ]
}
