import { taskStatus } from '@/utils/status'

export const columns = (_this) => [
  {
    prop: 'taskName',
    label: '任务名称',
    align: 'left',
    width: '200px'
  },
  {
    prop: 'taskCode',
    label: '任务代号'
  },
  {
    prop: 'taskTime',
    label: '任务时间',
    width: '200px'
  },
  {
    prop: 'taskDuration',
    label: '任务时长/小时'
  },
  {
    prop: 'flyingSession',
    label: '飞行场次'
  },
  {
    prop: 'env',
    label: '飞行环境'
  },
  {
    prop: 'transferLabel',
    label: '转场形式'
  },

  {
    prop: 'teamLeader',
    label: '带队领导'
  },

  {
    prop: 'taskAircraftNum',
    label: '任务要求飞机数量'
  },
  {
    prop: 'carryingAvmatNumber',
    label: '携带航材数量'
  },
  {
    prop: 'taskType',
    label: '任务类型'
  },

  {
    prop: 'taskSite',
    label: '任务地点'
  },

  {
    prop: 'status',
    label: '状态',
    width: '100px',
    render: (h, params) => taskStatus(h, params.row.status)
  },

  {
    prop: 'updateTime',
    label: '更新时间'
  },
  {
    button: true,
    label: '操作',
    width: '180px',
    align: 'left',
    group: [
      {
        name: '查看',
        type: 'text',
        round: false,
        plain: false,
        onClick: (row, index, scope) => {
          _this.look(row)
        }
      },
      {
        name: '编修',
        type: 'text',
        round: false,
        plain: false,
        statusKey: 'status',
        unDisableKey: [2, 3],
        showType: '1', //0:父级；1：子级
        onClick: (row, index, scope) => {
          _this.toCompile(row)
        }
      },
      {
        name: '确认完成',
        type: 'text',
        round: false,
        plain: false,
        statusKey: 'status',
        unDisableKey: '3',
        showType: '0', //0:父级；1：子级
        onClick: (row, index, scope) => {
          _this.confirm(row)
        }
      }
    ]
  }
]

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