import { selectObj } from '@/utils/select'
import { D7CHECK_COLLECTION_RESULT_ENUM, D7CheckSearchType, ID7CheckParams } from './types'
import { statusObj, statusStorageObj } from '@/utils/tableData'
import { Radio } from 'antd'

export const DEFAULT_D7CHECK_PARAMS: ID7CheckParams = {
  pageNum: 1,
  pageSize: 10,
  num: '',
  userType: '',
  deptName: '',
  userName: '',
  status: ''
}

export const D7CHECK_PARAM_ROWS: D7CheckSearchType[] = [
  { name: '盘点日期范围', key: 'date2', type: '日期选择' },
  { name: '盘点单编号', key: 'num', type: '输入框' },
  { name: '发起部门', key: 'deptName', type: '输入框' },
  { name: '发起人', key: 'userName', type: '输入框' },
  { name: '发起日期范围', key: 'date', type: '日期选择' },
  { name: '申请状态', key: 'status', type: '下拉框', data: selectObj['申请状态'] },
  { name: '选择角色', key: 'userType', type: '下拉框', data: selectObj['角色'] }
]

export const D7CHECK_TABLE_COLUMNS = [
  ['dateRes', '盘点日期', 'date'],
  ['txt', '盘点单编号', 'num'],
  ['txt', '分库缩写', 'sonNum'],
  ['txt', '发起部门', 'deptName'],
  ['txt', '发起人', 'creatorName'],
  ['txt', '发起日期', 'createTime'],
  ['txtChange', '申请状态', 'status', statusObj]
]

export const D7CHECK_COLUMNS = [
  ['img', '封面图', 'thumb'],
  ['txt', '编号类型', 'numName'],
  ['txt', '藏品编号', 'goodsNum'],
  ['txt', '藏品名称', 'goodsName'],
  ['ping', '数量', 'pcs', 'pcsUnit'],
  ['txtChange', '库存状态', 'statusStorage', statusStorageObj],
  [
    'input',
    '放置位置',
    'address',
    {
      maxLength: 20,
      placeholder: '请填写内容，不超过20字'
    }
  ],
  ['datePicker', '借出日期 *', 'startDate'],
  ['datePicker', '预计归还日期 *', 'endDate']
]

export const D7CEHCK_COLLECTION_RESULT_OPTIONS = [
  {
    label: '待盘点',
    value: D7CHECK_COLLECTION_RESULT_ENUM.PENDING
  },
  {
    label: '在库',
    value: D7CHECK_COLLECTION_RESULT_ENUM.IN
  },
  {
    label: '不在库',
    value: D7CHECK_COLLECTION_RESULT_ENUM.OUT
  }
]

export const D7CEHCK_COLLECTION_RESULT_OBJ = {
  [D7CHECK_COLLECTION_RESULT_ENUM.PENDING]: '待盘点',
  [D7CHECK_COLLECTION_RESULT_ENUM.IN]: '在库',
  [D7CHECK_COLLECTION_RESULT_ENUM.OUT]: '不在库'
}

export const D7CHECK_COLLECTION_COLUMNS = [
  ['txt', '登记号类型', 'numName'],
  ['txt', '编号', 'num'],
  ['txt', '藏品分库号', 'siteNum'],
  ['txt', '名称', 'name'],
  ['txtC', '年代', 'dictAge'],
  ['txtC', '质地', 'dictTexture3'],
  ['ping', '计件数量', 'pcs', 'pcsUnit'],
  ['txt', '级别', 'dictLevel'],
  ['txtC', '文物现状', 'dictTorn'],
  [
    'input',
    '* 盘点人',
    'checker',
    {
      maxLength: 20,
      placeholder: '请填写'
    }
  ],
  [
    'custom',
    '盘点结果',
    'statusCheck',
    {
      render(readOnly?: boolean) {
        return (
          <Radio.Group
            optionType='button'
            size='small'
            disabled={readOnly}
            options={D7CEHCK_COLLECTION_RESULT_OPTIONS}
          />
        )
      }
    }
  ],
  [
    'input',
    '备注',
    'remark',
    {
      maxLength: 20,
      placeholder: '请填写'
    }
  ]
]
