export const mapFields = {
    name: "name",
    // primaryClassification: 'primaryClassification', // 一级分类
    // secondaryClassification: 'secondaryClassification',  // 二级分类
    threeLevelClassification: 'service_cat', // 三级分类
    price: 'price', // 单价
    unit: 'unit', // 单位
    nonTaxQuotes: 'pay_fee', // 非税报价
    taxRate: 'tax', // 税率
    tax: 'tax_fee', // 税额
    taxIncludedQuote: 'total_fee',
    num: 'num',
    remark:'remark'
  }
  
  const mapTemplateToTable = {
    '三级服务分类名称': mapFields.name,
    // '一级服务分类': mapFields.primaryClassification,
    // '二级服务分类': mapFields.secondaryClassification,
    '三级服务分类ID': mapFields.threeLevelClassification,
    '单价': mapFields.price,
    '单位': mapFields.unit,
    '数量': mapFields.num,
    '非税报价': mapFields.nonTaxQuotes,
    '税率': mapFields.taxRate,
    '税额': mapFields.tax,
    '含税报价': mapFields.taxIncludedQuote,
    '备注':mapFields.remark
  }
  
  export const columns = [
    {
        type: 'index',
        label: '序号',
        width: '70px'
    },
     {
       prop: mapFields.name,
       label: '三级服务分类名称',
       width: '130px',
       required: true,
       data:'舞美制作、设备搭建及撤场'
     },
    // {
    //   prop: mapFields.primaryClassification,
    //   label: '一级服务分类',
    //   width: '120px',
    //   required: false
    // },
    // {
    //   prop: mapFields.secondaryClassification,
    //   label: '二级服务分类',
    //   width: '120px',
    //   required: false
    // },
    {
      prop: mapFields.threeLevelClassification,
      label: '三级服务分类ID',
      minWidth: '120px',
      required: true,
      data:38
    },
    {
      prop: mapFields.price,
      label: '单价',
      minWidth: '120px',
      required: true,
      data:16
    },
    {
      prop: mapFields.unit,
      label: '单位',
      minWidth: '120px',
      required: true,
      data:'个'
    },
    {
      prop:mapFields.num,
      label:'数量',
      minWidth:'100px',
      required:true,
      data:10
    },
    {
      prop: mapFields.nonTaxQuotes,
      label: '非税报价',
      width: '126px',
      required: true,
      data:100
    },
    {
      prop: mapFields.taxRate,
      label: '税率',
      minWidth: '126px',
      required: true,
      data:6
    },
    {
      prop: mapFields.tax,
      label: '税额',
      width: '126px',
      required: true,
      data:60
    },
    {
      prop: mapFields.taxIncludedQuote,
      label: '含税报价',
      width: '120px',
      required: true,
      data:160
    },
    {
      prop: mapFields.remark,
      label: '备注',
      width: '120px',
      required: true,
      data:'remark'
    }
  ]
  
  export const getTableProperty = (key) => mapTemplateToTable[key]
  export const getColumn = (key) => columns.find(column => key === column.prop) 
  
  export const template = Array(1).fill(1).map(() => columns.slice(1).reduce((prev, {label,data}) => {
    prev[label] = data
    return prev
  }, {}))
  
  
  export const requiredFields = [
    mapFields.name,
    mapFields.threeLevelClassification,
    mapFields.price,
    mapFields.unit,
    mapFields.num,
    mapFields.taxRate,
    mapFields.nonTaxQuotes,
    mapFields.taxIncludedQuote,
    mapFields.remark,
    mapFields.tax
  ]

  export const numberFields = [
    mapFields.price,
    mapFields.taxIncludedQuote,
    mapFields.nonTaxQuotes,
    mapFields.tax
  ]

  export const intergeFields = [
    mapFields.threeLevelClassification,
    mapFields.num,
    mapFields.taxRate,
  ]
  
  export const requsetFields = [
    mapFields.name,
    mapFields.threeLevelClassification,
    mapFields.price,
    mapFields.unit,
    mapFields.num,
    mapFields.taxRate,
    mapFields.remark,
    mapFields.taxIncludedQuote,
    mapFields.nonTaxQuotes,
    mapFields.tax
  ]
  

  export const mapLetterToType = {
    budget:1,
    activity:2,
    project:3
  }
