import { optionsFilter } from '@/quickComponents/utils'
import { parseTime } from '@/utils'
const compelOptions = [
  {
    label: '是',
    value: true
  },
  {
    label: '否',
    value: false
  },
]
const osOptions = [
  {
    label: '安卓',
    value: 'ANDROID'
  },
  {
    label: '苹果',
    value: 'IOS'
  },
]

export const tableFields = {
  'createDate': {
    label: '创建时间',
    filter: (time) => parseTime(time),
    props: {
      width: '180px'
    }
  },
  'title': '标题',
  'compel': {
    label: '强制更新',
    filter: (status) => optionsFilter(status, compelOptions)
  },
  'os': {
    label: '系统类型',
    filter: (status) => optionsFilter(status, osOptions)
  },
  'publish': {
    label: '是否发布',
    filter: (status) => optionsFilter(status, compelOptions)
  },
  'releaseNum': '版本号',
  'content': '内容描述',
}

export const createFields = {
  'title': '标题',
  'compel': {
    type: 'select',
    label: '强制更新',
    props: {
      options: compelOptions
    }
  },
  'os': {
    type: 'select',
    label: '系统类型',
    props: {
      options: osOptions
    }
  },
  'publish': {
    type: 'select',
    label: '是否发布',
    props: {
      options: compelOptions
    }
  },
  'releaseNum': '版本号',
  'content': {
    label: '内容描述',
    type: 'editor',
    // props: {
    //   type: 'textarea',
    //   rows: 5
    // }
  },
  'url': {
    type: 'file',
    label: '下载地址',
  },
}
