const mapFields = {
    name:"name",
    primaryClassification:'primaryClassification', // 一级分类
    secondaryClassification:'secondaryClassification',  // 二级分类
    threeLevelClassification:'cat_name', // 三级分类
    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,
    '三级服务分类': mapFields.threeLevelClassification,
    '单价': mapFields.price,
    '单位': mapFields.unit,
    '数量': mapFields.num,
    '非税报价': mapFields.nonTaxQuotes,
    '税率': mapFields.taxRate,
    '税额': mapFields.tax,
    '含税报价': mapFields.taxIncludedQuote,
  }
  
  export const columns = [
    {
        type: 'index',
        label: '序号',
        width: '70px'
    },
    {
      prop: mapFields.primaryClassification,
      label: '一级服务分类',
      minWidth: '120px',
      _slot_:'one',
      required: true,
    },
    {
      prop: mapFields.secondaryClassification,
      label: '二级服务分类',
      minWidth: '120px',
      required: true,
      _slot_:'two'

    },
    {
      prop: mapFields.threeLevelClassification,
      label: '三级服务分类',
      minWidth: '120px',
      required: true,
      _slot_:'three'
    },
    {
      prop: mapFields.price,
      label: '单价',
      minWidth: '120px',
      required: true
    },
    {
      prop: mapFields.unit,
      label: '单位',
      minWidth: '120px',
      required: true
    },
    {
      prop:mapFields.num,
      label:'数量',
      minWidth:'100px',
      required:true
    },
    {
      prop: mapFields.nonTaxQuotes,
      label: '非税报价',
      width: '126px',
      required: true
    },
    {
      prop: mapFields.taxRate,
      label: '税率',
      minWidth: '126px',
      required: true
    },
    {
      prop: mapFields.tax,
      label: '税额',
      width: '126px',
      required: true
    },
    {
      prop: mapFields.taxIncludedQuote,
      label: '含税报价',
      width: '120px',
      required: true
    },
    {
      prop: mapFields.remark,
      label: '备注',
      width: '120px',
      required: true
    }
  ]
  
  export const getTableProperty = (key) => mapTemplateToTable[key]
  export const getColumn = (key) => columns.find(column => key === column.prop) 
  
  export const template = Array(1).fill(1).map(() => Object.keys(mapTemplateToTable).reduce((prev, property) => {
    prev[property] = ''
    return prev
  }, {}))
  
  
  export const requiredFields = [
    mapFields.name,
    mapFields.threeLevelClassification,
    mapFields.price,
    mapFields.unit,
    mapFields.num,
    mapFields.taxRate,
    mapFields.nonTaxQuotes,
    mapFields.taxIncludedQuote
  ]
  
  export const requsetFields = [
    mapFields.name,
    mapFields.threeLevelClassification,
    mapFields.price,
    mapFields.unit,
    mapFields.num,
    mapFields.taxRate,
    // mapFields.tax,
    // mapFields.nonTaxQuotes,
    // mapFields.taxIncludedQuote
  ]
  

  export const ModalTypes = {
    create:'create',
    update:'update',
    copy: 'copy'
  }
  