const columns = [
  {
    type: "index",
    fixed: "left",
    label: "序号",
    width: "50"
  },
  {
    label: '业务编号',
    prop: 'invoiceCode',
    minWidth: '100px',
    required: true,
    defaultData: [
      'INV2410240908118985',
      'INV2410281054597892'
    ]
  },
  {
    label: '类型',
    prop: 'type',
    minWidth: '100px',
    required: true,
    defaultData: [
      '入库',
      '入库红冲'
    ]
  },
  {
    label: '订单来源',
    prop: 'source',
    minWidth: '100px',
    required: true,
    defaultData: [
      '采销结算',
      '非采销结算'
    ],
  },
  {
    label: '订单购买方纳税号',
    prop: 'buyer_code',
    minWidth: '130px',
    required: true,
    defaultData: [
      '91110118MACEA1R94G',
      '91110118MACEA1R94G',
    ]
  },
  {
    label: '订单购买方公司名称',
    prop: 'buyer_name',
    minWidth: '150px',
    required: true,
    defaultData: [
      '北京锦兴弘昌科技有限公司',
      '北京锦兴弘昌科技有限公司'
    ],
  },
  {
    label: '订单销售方纳税号',
    prop: 'seller_code',
    minWidth: '160px',
    required: true,
    defaultData: [
      '91110113MA004JNJ28',
      '91110113MA004JNJ28'
    ],
  },
  {
    label: '订单销售方公司名称',
    prop: 'seller_name',
    minWidth: '160px',
    required: true,
    defaultData: [
      '北京万宇恒通国际科贸有限公司',
      '北京万宇恒通国际科贸有限公司'
    ]
  },
  {
    label: '订单编号',
    prop: 'orderCode',
    minWidth: '120px',
    required: true,
    defaultData: [
      'FQR2408091410078906',
      'FQR2408091408089205'
    ]
  },
  {
    label: '订单主单号',
    prop: 'cxCode',
    minWidth: '120px',
    defaultData: [
      'QR2408091409232833',
      'QR2408091407526489'
    ]
  },
  {
    label: '商品类型',
    prop: 'goodType',
    minWidth: '120px',
    required: true,
    defaultData: [
      '库存商品',
      '咨询商品'
    ],
  },
  {
    label: '商品编号',
    prop: 'goodNo',
    minWidth: '100px',
    required: true,
    defaultData: [
      'SKU2402041456190398',
      'SKU2403201007265803'
    ]
  },
  {
    label: '商品名称',
    prop: 'goodName',
    minWidth: '100px',
    required: true,
    defaultData: [
      '户外便携 幸福有约运动套装',
      '泰康开泰说系列-盛世泰康文件册'
    ],
  },
  {
    label: '订单单位',
    prop: 'unit',
    minWidth: '80px',
    required: true,
    defaultData: [
      '套',
      '个'
    ],
  },
  {
    label: '商品数量',
    prop: 'num',
    minWidth: '110px',
    required: true,
    defaultData: [
      '6',
      '6'
    ],
  },
  {
    label: '商品单价',
    prop: 'goodPrice',
    minWidth: '110px',
    required: true,
    defaultData: [
      '91.15',
      '91.15'
    ],
  },
  {
    label: '订单总金额',
    prop: 'totalPrice',
    minWidth: '110px',
    required: true,
    defaultData: [
      '273.45',
      '273.45',
    ]
  },
  {
    label: '税目',
    prop: 'cat_code',
    minWidth: '80px',
    required: true,
    defaultData: [
      '1060502040000000000',
      '1060105040000000000',
    ],
  },
  {
    label: '税目名称',
    prop: 'cat_name',
    minWidth: '100px',
    required: true,
    defaultData: [
      '工艺品',
      '纸制品'
    ],
  },
  {
    label: '订单税率',
    prop: 'tax',
    minWidth: '100px',
    required: true,
    defaultData: [
      '13',
      '13'
    ]
  },
  {
    label: '关联金额',
    prop: 'inv_fee',
    minWidth: '100px',
    required: true,
    defaultData: [
      '273',
      '2038.4'
    ],
  },
  {
    label: '购买方纳税号',
    prop: 'inv_buyer_code',
    minWidth: '130px',
    required: true,
    defaultData: [
      '91110118MACEA1R94G',
      '91110118MACEA1R94G'
    ],
  },
  {
    label: '购买方名称',
    prop: 'inv_buyer_name',
    minWidth: '170px',
    required: true,
    defaultData: [
      '北京锦兴弘昌科技有限公司',
      '北京锦兴弘昌科技有限公司'
    ],
  },
  {
    label: '发票号码',
    prop: 'inv_number',
    minWidth: '100px',
    required: true,
    defaultData: [
      '24112000000154116434',
      '24112000000154116434'
    ],
  },
  {
    label: '开票日期',
    prop: 'inv_open_date',
    minWidth: '100px',
    required: true,
    defaultData: [
      '2024-10-16',
      '2024-11-18'
    ],
  },
  {
    label: '发票类型',
    prop: 'inv_type',
    minWidth: '100px',
    required: true,
    defaultData: [
      '增值税专用发票',
      '增值税普通发票'
    ],
  },
  {
    label: '销售方公司纳税号',
    mapLabel: '发票销售方公司纳税号',
    prop: 'inv_seller_code',
    minWidth: '170px',
    required: true,
    defaultData: [
      '91110113MA004JNJ28',
      '91110113MA004JNJ28'
    ]
  },
  {
    label: '销售方公司',
    prop: 'inv_seller_name',
    minWidth: '130px',
    required: true,
    defaultData: [
      '北京万宇恒通国际科贸有限公司',
      '北京万宇恒通国际科贸有限公司'
    ]
  },
  {
    label: '发票明细ID',
    prop: 'inv_item_id',
    minWidth: '110px',
    defaultData: [
      '1280',
      '1281'
    ]
  },
  {
    label: '货物或应税劳务、服务名称',
    prop: 'inv_good_name',
    minWidth: '200px',
    required: true,
    defaultData: [
      '*印刷品*JXHC 品牌文创2024年简装本（橙色）',
      '*纸制品*JXHC泰康家族办公室手册'
    ]
  },
  {
    label: '类目编号',
    prop: 'inv_cat_code',
    minWidth: '90px',
    required: true,
    defaultData: [
      '1060408990000000000',
      '1060408990000000000'
    ]
  },
  {
    label: '规格型号',
    prop: 'inv_spec',
    minWidth: '110px',
    defaultData: [
      '',
      ''
    ],
  },
  {
    label: '单位',
    mapLabel: '发票商品单位',
    prop: 'inv_unit',
    minWidth: '100px',
    defaultData: [
      '套',
      '个'
    ],
  },
  {
    label: '数量',
    prop: 'inv_num',
    minWidth: '100px',
    defaultData: [
      '6',
      '6'
    ],
  },
  {
    label: '税前单价',
    prop: 'inv_subprice',
    minWidth: '100px',
    // required: true,
    defaultData: [
      '91.150442477876',
      '11.858407079646'
    ],
  },
  {
    label: '税前总价',
    prop: 'inv_subtotal',
    minWidth: '100px',
    required: true,
    defaultData: [
      '273.45',
      '273.45'
    ],
  },
  {
    label: '税率',
    prop: 'inv_tax',
    minWidth: '80px',
    required: true,
    defaultData: [
      '273.45',
      '273.45'
    ],
  },
  {
    label: '税额',
    prop: 'inv_tax_total',
    minWidth: '80px',
    required: true,
    defaultData: [
      '13%',
      '13%'
    ]
  },
  {
    label: '税后单价',
    prop: 'inv_price',
    minWidth: '100px',
    // required: true,
    defaultData: [
      '103',
      '103'
    ],
  },
  {
    label: '税后总额',
    prop: 'inv_total',
    minWidth: '100px',
    required: true,
    defaultData: [
      '309',
      '309'
    ],
  },
  {
    label: '类目编号状态',
    prop: 'cat_diff',
    minWidth: '100px',
    required: true,
    defaultData: [
      '一致',
      '不一致'
    ],
  },
  {
    label: '税率状态',
    prop: 'tax_diff',
    minWidth: '100px',
    required: true,
    defaultData: [
      '一致',
      '不一致'
    ],
  },
  {
    label: '备注',
    prop: 'remark',
    minWidth: '80px',
    defaultData: [
      '',
      '同意'
    ]
  },
  {
    label: '入账月份',
    prop: 'fz_date',
    minWidth: '80px',
    required: true,
    defaultData: [
      '2024-11',
      '2024-11'
    ]
  },
  {
    label: '关联商品ID',
    prop: 'relaGoodNo',
    minWidth: '120px',
    required: true,
    defaultData: [
      '10',
      '11'
    ]
  },
  {
    label: '操作数量',
    prop: 'relaGoodNum',
    minWidth: '100px',
    required: true,
    defaultData: [
      '6',
      '6'
    ]
  }
]

const notOrderTemplate = new Array(3).fill(1).map((_, index) => (columns.slice(1).reduce((prev, current) => {
  const isRequired = index === 0
  let defaultValue = ''

  if (isRequired) {
    defaultValue = current.required ? '必填' : ''
  } else {
    defaultValue = current.defaultData[index - 1]
  }

  return { ...prev, [current.label]: defaultValue }
}, {})))

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 };
