const columns = [
  {
    type: "index",
    fixed: "left",
    label: "序号",
    width: "50"
  },
  {
    label: '业务编号',
    prop: 'invoiceCode',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '类型',
    prop: 'type',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label:'订单来源',
    prop: 'source',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '销售方公司纳税识别号',
    prop: 'seller_code',
    minWidth: '160px',
    defaultData: '',
    required: true
  },
  {
    label: '销售方公司',
    prop: 'seller_name',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '订单编号',
    prop: 'orderCode',
    minWidth: '120px',
    defaultData: '',
    required: true
  },
  {
    label: '订单主单号',
    prop: 'cxCode',
    minWidth: '120px',
    defaultData: '',
    required: true
  },
  {
    label: '商品编号',
    prop: 'goodNo',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '商品名称',
    prop: 'goodName',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '单位',
    prop: 'unit',
    minWidth: '80px',
    defaultData: '',
    required: true
  },
  {
    label: '商品数量',
    prop: 'num',
    minWidth: '110px',
    defaultData: '',
    required: true
  },
  {
    label:'商品单价',
    prop: 'goodPrice',
    minWidth: '110px',
    defaultData: '',
    required: true
  },
  {
    label: '订单总金额',
    prop: 'totalPrice',
    minWidth: '110px',
    defaultData: '',
    required: true
  },
  {
    label: '税目',
    prop: 'cat_code',
    minWidth: '80px',
    defaultData: '',
    required: true
  },
  {
    label: '税目名称',
    prop: 'cat_name',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '税率',
    prop: 'tax',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '关联金额',
    prop: 'inv_fee',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '购买方公司名称',
    prop: 'inv_buyer_name',
    minWidth: '130px',
    defaultData: '',
    required: true
  },
  {
    label: '购买方公司纳税识别号',
    prop: 'inv_buyer_code',
    minWidth: '170px',
    defaultData: '',
    required: true
  },
  {
    label: '发票号码',
    prop: 'inv_number',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '发票类型',
    prop: 'inv_type',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '发票销售方公司',
    prop: 'inv_seller_name',
    minWidth: '130px',
    defaultData: '',
    required: true
  },
  {
    label: '发票销售方公司纳税号',
    prop: 'inv_seller_code',
    minWidth: '170px',
    defaultData: '',
    required: true
  },
  {
    label: '发票明细ID',
    prop: 'inv_item_id',
    minWidth: '110px',
    defaultData: '',
    required: true
  },
  {
    label: '货物或应税劳务、服务名称',
    prop: 'inv_good_name',
    minWidth: '200px',
    defaultData: '',
    required: true
  },
  {
    label: '类目编号',
    prop: 'inv_cat_code',
    minWidth: '90px',
    defaultData: '',
    required: true
  },
  {
    label: '规格型号',
    prop: 'inv_spec',
    minWidth: '110px',
    defaultData: '',
    required: true
  },
  {
    label: '发票商品单位',
    prop: 'inv_unit',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '发票商品数量',
    prop: 'inv_num',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '税前单价',
    prop: 'inv_subprice',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '税前总价',
    prop: 'inv_subtotal',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '发票税率',
    prop: 'inv_tax',
    minWidth: '80px',
    defaultData: '',
    required: true
  },
  {
    label: '税后单价',
    prop: 'inv_price',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '税后总额',
    prop: 'inv_total',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '类目编号状态',
    prop: 'TODO34',
    minWidth: '100px',
    defaultData: '',
    required: false
  },
  {
    label: '税率状态',
    prop: 'TODO35',
    minWidth: '100px',
    defaultData: '',
    required: false
  },
  {
    label: '备注',
    prop: 'remark',
    minWidth: '80px',
    defaultData: '',
    required: true
  },
  {
    label: '关联商品ID',
    prop: 'relaGoodNo',
    minWidth: '120px',
    defaultData: '',
    required: true
  },
  {
    label: '操作数量',
    prop: 'relaGoodNum',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '子商品编号',
    prop: 'childCode',
    minWidth: '100px',
    defaultData: '',
    required: true
  },
  {
    label: '子商品操作数量',
    prop: 'childNum',
    minWidth: '120px',
    defaultData: '',
    required: true
  }
]

const notOrderTemplate = [columns.slice(1).reduce((prev, current) => ({ ...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, notOrderTemplate };
