const columns = [
  {
    label: '商品ID',
    prop: 'product_id',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '购买方公司纳税号',
    prop: 'buyer_code',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '购买方公司名称',
    prop: 'buyer_name',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '盘点类型',
    prop: 'check_type',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '盘点数量',
    prop: 'check_num',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '库存数量',
    prop: 'balance_num',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '调整单入账月份',
    prop: 'fz_date',
    minWidth: '160px',
    defaultData: '',
    required: true
  }
]

const orderTemplate = [columns.reduce((prev, current) => {
  return { ...prev, [current.label]: current.defaultData ? current.defaultData : '' }
}, {})]


export const mapLabelToProp = columns.reduce((prev, current) => ({
  ...prev,
  [current.label]: current.prop
}), {})


export const mapPropertyToLabel = columns.reduce((prev, current) => ({
  ...prev,
  [current.prop]: current.label
}), {})

export const requiredProps = columns.filter(column => !!column.required).map(item => item.prop)

export { columns, orderTemplate };
