export const defaultProps = {
  children: 'children',
  label: 'aircraftTypeName'
}
export const mockTableData = [
  {
    aircraftTypeName: '常规航材',
    parentTypeName: '',
    parentTypeId: '',
    id: '1',
    numbering: '01',
    sequence: '1',
    status: 1,
    children: [
      {
        aircraftTypeName: '灯泡',
        parentTypeName: '作战飞机',
        parentTypeId: '1',
        id: '1.1',
        numbering: '01.1',
        sequence: '1.1',
        status: 0
      },
      {
        aircraftTypeName: '滤芯',
        parentTypeName: '作战飞机',
        parentTypeId: '1',
        id: '1.2',
        numbering: '01.2',
        sequence: '1.2',
        status: 0
      }
    ]
  },
  {
    aircraftTypeName: '消耗品',
    parentTypeName: '',
    parentTypeId: '',
    id: '2',
    numbering: '02',
    sequence: '2',
    status: 1,
    children: [
      {
        aircraftTypeName: '密封胶',
        parentTypeName: '消耗品',
        parentTypeId: '2',
        id: '2.1',
        numbering: '02.1',
        sequence: '2.1',
        status: 0
      },
      {
        aircraftTypeName: '燃料',
        parentTypeName: '消耗品',
        parentTypeId: '2',
        id: '2.2',
        numbering: '02.2',
        sequence: '2.2',
        status: 0
      }
    ]
  },
  {
    aircraftTypeName: '修理航材',
    parentTypeName: '',
    parentTypeId: '',
    id: '3',
    numbering: '03',
    sequence: '3',
    status: 1,
    children: [
      {
        aircraftTypeName: '发动机',
        parentTypeName: '消耗品',
        parentTypeId: '3',
        id: '3.1',
        numbering: '03.1',
        sequence: '3.1',
        status: 0
      },
      {
        aircraftTypeName: '航电系统',
        parentTypeName: '消耗品',
        parentTypeId: '3',
        id: '3.2',
        numbering: '03.2',
        sequence: '3.2',
        status: 0
      }
    ]
  }
]

export const columns = (_this) => [
  {
    prop: 'sparePartsName',
    label: '航材名称'
  },
  {
    prop: 'spareNumber',
    label: '航材编号'
  },
  {
    prop: 'classification',
    label: '所属分类'
  },
  {
    prop: 'carryQuantity',
    label: '携带数量',
    edit: true,
    editStatus: false,
    onClick: (row, index, scope) => {
      _this.updateRow(row, index, scope)
    }
  },
  {
    prop: 'unitPrice',
    label: '单价'
  },
  {
    prop: 'carryingAmount',
    label: '携带金额'
  },
  {
    prop: 'autoGeneration',
    label: '自动生成',
    render: (h, params) => {
      if (params.row.autoGeneration == 1) {
        return h('span', { style: 'color: #008000' }, '是')
      } else {
        return h('span', { style: 'color: #ff0010' }, '否')
      }
    }
  },
  {
    prop: 'isModified',
    label: '是否修改',
    render: (h, params) => {
      if (params.row.isModified == 1) {
        return h('span', { style: 'color: #008000' }, '是')
      } else {
        return h('span', { style: 'color: #ff0010' }, '否')
      }
    }
  },
  {
    button: true,
    label: '操作',
    width: '240px',
    group: [
      {
        name: '删除',
        type: 'text',
        round: false,
        plain: false,
        onClick: (row, index, scope) => {
          _this.remove('删除', row)
        }
      }
    ]
  }
]
export const tableData = [
  {
    sparePartsName: '后轮',
    sparePartsCoding: 'F2013',
    classification: '轮胎',
    carryQuantity: '5',
    unitPrice: '2000',
    carryingAmount: '16000',
    applicationQuantity: '2',
    outNumber: '3',
    usageQuantity: '4',
    amountUse: '5',
    original: true,
    hcfl: '军械'
  },
  {
    sparePartsName: '前轮',
    sparePartsCoding: 'F2013',
    classification: '轮胎',
    carryQuantity: '5',
    unitPrice: '2000',
    carryingAmount: '16000',
    applicationQuantity: '2',
    outNumber: '3',
    usageQuantity: '4',
    amountUse: '5',
    original: true,
    hcfl: '军械'
  },
  {
    sparePartsName: '侧轮',
    sparePartsCoding: 'F2013',
    classification: '轮胎',
    carryQuantity: '5',
    unitPrice: '2000',
    carryingAmount: '16000',
    applicationQuantity: '2',
    outNumber: '3',
    usageQuantity: '4',
    amountUse: '5',
    original: true,
    hcfl: '军械'
  }
]
export const options = {
  stripe: true, // 斑马纹
  mutiSelect: true, // 多选框
  index: false, // 显示序号， 多选则 mutiSelect
  loading: false, // 表格动画
  initTable: true, // 是否一挂载就加载数据
  border: true,
  height: 'calc(100vh - 300px)'
}

export const modalMenuTreeData = [
  {
    aircraftTypeName: '全部',
    parentTypeName: '',
    parentTypeId: '',
    id: '1',
    numbering: '01',
    sequence: '1',
    status: 1,
    children: [
      {
        id: '1.1',
        aircraftTypeName: '飞发'
      },
      {
        id: '1.1',
        aircraftTypeName: '特设'
      },
      {
        id: '1.1',
        aircraftTypeName: '无线电'
      },
      {
        id: '1.1',
        aircraftTypeName: '军械'
      }
    ]
  }
]

export const modalTreeObj = {
  title: '所属分类',
  activityheight: '500px',
  searchIcon: false,
  configure: defaultProps
}

export const treeObj = {
  title: '所属分类',
  activityheight: '275px',
  searchIcon: false,
  configure: defaultProps
}

export const modalColumns = (_this) => [
  {
    prop: 'sparePartsName',
    label: '航材名称'
  },
  {
    prop: 'sparePartsCoding',
    label: '航材编号'
  },
  {
    prop: 'hcfl',
    label: '航材分类'
  },
  {
    button: true,
    label: '操作',
    width: '240px',
    group: [
      {
        name: '选择',
        type: 'text',
        round: false,
        plain: false,
        onClick: (row, index, scope) => {
          _this.select(row)
        }
      }
    ]
  }
]

export const modalTableData = [
  {
    sparePartsName: '后轮',
    sparePartsCoding: 'F2013',
    classification: '轮胎',
    carryQuantity: '',
    unitPrice: '5000',
    carryingAmount: '17000',
    applicationQuantity: '',
    outNumber: '',
    usageQuantity: '',
    amountUse: '85',
    hcfl: '军械'
  },
  {
    sparePartsName: '前轮',
    sparePartsCoding: 'F223',
    classification: '轮胎',
    carryQuantity: '',
    unitPrice: '4000',
    carryingAmount: '6000',
    applicationQuantity: '',
    outNumber: '',
    usageQuantity: '',
    amountUse: '2',
    hcfl: '无线电'
  },
  {
    sparePartsName: '侧轮',
    sparePartsCoding: 'F2012',
    classification: '轮胎',
    carryQuantity: '',
    unitPrice: '2400',
    carryingAmount: '61000',
    applicationQuantity: '',
    outNumber: '',
    usageQuantity: '',
    amountUse: '5',
    hcfl: '无线电'
  },
  {
    sparePartsName: '上轮',
    sparePartsCoding: 'F2H13',
    classification: '轮胎',
    carryQuantity: '',
    unitPrice: '400',
    carryingAmount: '17000',
    applicationQuantity: '',
    outNumber: '',
    usageQuantity: '',
    amountUse: '30',
    hcfl: '军械'
  }
]

export const modalOptions = {
  stripe: true, // 斑马纹
  mutiSelect: false, // 多选框
  index: false, // 显示序号， 多选则 mutiSelect
  loading: false, // 表格动画
  initTable: true, // 是否一挂载就加载数据
  border: true,
  height: 'calc(100vh - 380px)'
}
