import { taskStatus } from '@/utils/status'
export const tableData = [
  {
    taskName: '第一次训练',
    taskTime: '2023-05-04/2023-05-14',
    taskLength: '10',
    taskEnvironment: '沙漠',
    taskType: '越野5公里',
    state: '2',
    completionRate: '30%',
    term: '80%',
    piece: '60%',
    amount: '70%',
    nonmissionTerm: '60%',
    nonmissionPiece: '60%',
    nonmissionAmount: '90%',
    rwdh: 'F0-54'
  },
  {
    taskName: '第二次训练',
    taskTime: '2023-04-04/2023-05-06',
    taskLength: '33',
    taskEnvironment: '跑道',
    taskType: '负重30公里',
    state: '2',
    completionRate: '30%',
    term: '80%',
    piece: '60%',
    amount: '70%',
    nonmissionTerm: '60%',
    nonmissionPiece: '60%',
    nonmissionAmount: '90%',
    rwdh: 'F0-52'
  },
  {
    taskName: '第三次训练',
    taskTime: '2023-05-04/2023-05-06',
    taskLength: '2',
    taskEnvironment: '山上',
    taskType: '急行100公里',
    state: '3',
    completionRate: '30%',
    term: '80%',
    piece: '60%',
    amount: '70%',
    nonmissionTerm: '60%',
    nonmissionPiece: '60%',
    nonmissionAmount: '90%',
    rwdh: 'F0-53'
  },
  {
    taskName: '第四次训练',
    taskTime: '2023-07-01/2023-07-02',
    taskLength: '1',
    taskEnvironment: '海边',
    taskType: '越野20公里',
    state: '2',
    completionRate: '30%',
    term: '80%',
    piece: '60%',
    amount: '70%',
    nonmissionTerm: '60%',
    nonmissionPiece: '60%',
    nonmissionAmount: '90%',
    rwdh: 'F0-56'
  },
  {
    taskName: '第五次训练',
    taskTime: '2023-09-01/2023-09-04',
    taskLength: '3',
    taskEnvironment: '沙滩',
    taskType: '急行20公里',
    state: '2',
    completionRate: '30%',
    term: '80%',
    piece: '60%',
    amount: '70%',
    nonmissionTerm: '60%',
    nonmissionPiece: '60%',
    nonmissionAmount: '90%',
    rwdh: 'F0-57'
  }
]
export const dictionaries = {
  1: {
    text: '待提交',
    class: 'other-state'
  },
  2: {
    text: '机务编制中',
    class: 'receive-state'
  },
  3: {
    text: '机务确认中',
    class: 'theme-state'
  },
  4: {
    text: '机务待审核',
    class: 'warning-state'
  },
  5: {
    text: '航材编制中',
    class: 'other-state'
  },
  6: {
    text: '航材确认中',
    class: 'info-state'
  },
  7: {
    text: '执行情况登记中',
    class: 'receive-state'
  },
  8: {
    text: '执行情况待确认',
    class: 'theme-state'
  },
  9: {
    text: '携行使用登记中',
    class: 'danger-state'
  },
  10: {
    text: '已完成',
    class: 'success-state'
  }
}

export const columns = (_this) => [
  {
    prop: 'taskName',
    label: '任务名称',
    align: 'left',
    width: '200px'
  },
  {
    prop: 'taskCode',
    label: '任务代号'
  },
  {
    prop: 'taskTime',
    label: '任务时间'
  },
  {
    prop: 'taskDuration',
    label: '任务时长'
  },
  {
    prop: 'env',
    label: '飞行环境'
  },
  {
    prop: 'taskType',
    label: '任务类型'
  },
  {
    prop: 'status',
    label: '状态',
    render: (h, params) => taskStatus(h, params.row.status)
  },
  {
    prop: 'aircraftIntactRatio',
    label: '装备完好率',
    render: (h, params) => {
      return h('span', {}, params.row.aircraftIntactRatio + '%')
    }
  },
  {
    label: '任务携行航材利用率',
    children: [
      { prop: 'assignmentUseRatio.item', label: '项' },
      { prop: 'assignmentUseRatio.piece', label: '件' },
      { prop: 'assignmentUseRatio.piece', label: '金额' }
    ]
  },
  {
    label: '非任务携行航材利用率',
    children: [
      { prop: 'noAssignmentUseRatio.item', label: '项' },
      { prop: 'noAssignmentUseRatio.piece', label: '件' },
      { prop: 'noAssignmentUseRatio.piece', label: '金额' }
    ]
  },
  {
    button: true,
    label: '操作',
    width: '240px',
    group: [
      {
        name: '登记',
        type: 'text',
        round: false,
        plain: false,
        statusKey: 'status',
        unDisableKey: [9],
        showType: '1', //0:父级；1：子级
        onClick: (row, index, scope) => {
          _this.toRegistering(row)
        }
      }
    ]
  }
]

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