import { BasicColumn, FormSchema } from '/@/components/Table';
import { listDictModel } from '@/api/common';
import { getSailings } from '/@/api/biz/management/working';

// export const BasicWeek = [
//   {
//     field: 'monday',
//     label: '星期一',
//   },
//   {
//     field: 'tuesday',
//     label: '星期二',
//   },
//   {
//     field: 'wednesday',
//     label: '星期三',
//   },
//   {
//     field: 'thursday',
//     label: '星期四',
//   },
//   {
//     field: 'friday',
//     label: '星期五',
//   },
//   {
//     field: 'saturday',
//     label: '星期六',
//   },
//   {
//     field: 'sunday',
//     label: '星期日',
//   },
// ];
export enum BasicWeekEnum {
  monday = '星期一',
  monday_field = 'monday',
  tuesday = '星期二',
  tuesday_field = 'tuesday',
  wednesday = '星期三',
  wednesday_field = 'wednesday',
  thursday = '星期四',
  thursday_field = 'thursday',
  friday = '星期五',
  friday_field = 'friday',
  saturday = '星期六',
  saturday_field = 'saturday',
  sunday = '星期日',
  sunday_field = 'sunday',
}

export const BasicTab = [
  {
    key: '0',
    label: '全部',
    value: 0,
    hasValue: true,
    hasBracket: true,
  },
  {
    key: '1',
    label: '新患者',
    value: 12,
    hasValue: true,
    prefixColor: '#1BC1B3',
    // valueColor: 'red',
    hasBracket: true,
  },
  {
    key: '2',
    label: '无排班患者',
    value: 0,
    hasValue: true,
    prefixColor: '#F7B500',
    hasBracket: true,
  },
];
export const BasicTabActive = BasicTab[0].key;

export const columns: BasicColumn[] = [
  {
    title: '编号',
    dataIndex: 'patientUniqueNo',
    align: 'left',
    width: 160,
  },
  {
    title: '姓名',
    dataIndex: 'patientName',
    align: 'left',
    width: 150,
  },
  {
    title: '性别',
    dataIndex: 'patientGender',
    align: 'left',
    width: 80,
  },
  {
    title: '年龄',
    dataIndex: 'age',
    align: 'left',
    width: 80,
  },
  {
    title: '建档时间',
    dataIndex: 'archivesCreateTime',
    align: 'left',
    width: 200,
  },
  {
    title: '类型',
    dataIndex: 'patientType',
    align: 'left',
    width: 100,
  },
  {
    title: '透析机器',
    dataIndex: 'machine',
    align: 'left',
    width: 130,
  },
  {
    title: '透析频率',
    dataIndex: 'frequency',
    align: 'left',
    width: 120,
  },
  {
    title: '特殊时间需求',
    dataIndex: 'specialNeed',
    align: 'left',
    // width: 300,
    // ellipsis: false,
  },
];

// 表单新增编辑
export const dataFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'patientUniqueNo',
    component: 'PlainText',
  },
  {
    label: '建档时间',
    field: 'archivesCreateTime',
    component: 'PlainText',
  },
  {
    label: '类型',
    field: 'patientType',
    // component: 'ApiSelect',
    // componentProps: {
    //   api: listDictModel,
    //   params: {
    //     dictCode: 'pb_type',
    //   },
    //   disabled: true,
    // },
    component: 'ApiRadioGroup',
    componentProps: {
      api: listDictModel,
      params: {
        dictCode: 'pb_type',
      },
      disabled: true,
    },
  },
  {
    label: '透析机器',
    field: 'machine',
    component: 'ApiCheckboxGroup',
    componentProps: {
      api: listDictModel,
      params: {
        dictCode: 'bm_pump',
      },
    },
  },
  {
    field: 'frequency',
    label: '透析频次(次/周)',
    component: 'ApiInputDict',
    componentProps: ({ formModel }) => {
      return {
        api: listDictModel,
        params: {
          dictCode: 'sp_week',
          dictSort: true,
        },
        isInputNum: true,
        onChange: e => {
          console.log('🚀 ~ file: data.ts:81 ~ e:', e);
          return (formModel['frequency'] = e);
        },
      };
    },
  },
  {
    label: '特殊时间需求',
    field: 'special',
    component: 'RadioGroup',
    componentProps: {
      options: [
        { label: '无', value: 0 },
        { label: '有', value: 1 },
      ],
    },
  },
  {
    label: '期望周次',
    field: 'specialNeedWeek',
    component: 'CheckboxGroup',
    componentProps: {
      options: [],
      // api: getSailings,
      // resultField: 'infos',
      // valueField: 'sort',
      // labelField: 'name',
      // options: [
      //   {
      //     label: '第一班',
      //     value: '1',
      //   },
      //   {
      //     label: '第二班',
      //     value: '2',
      //   },
      //   {
      //     label: '第三班',
      //     value: '3',
      //   },
      // ],
    },
    show: ({ values }) => {
      return values.special == 1;
    },
    colProps: {
      span: 24,
    },
  },
  {
    label: '期望班次',
    field: 'sailingSorts',
    component: 'ApiCheckboxGroup',
    componentProps: {
      api: getSailings,
      resultField: 'infos',
      valueField: 'sort',
      labelField: 'name',
      // options: [
      //   {
      //     label: '第一班',
      //     value: '1',
      //   },
      //   {
      //     label: '第二班',
      //     value: '2',
      //   },
      //   {
      //     label: '第三班',
      //     value: '3',
      //   },
      // ],
    },
    show: ({ values }) => {
      return values.special == 1;
    },
    colProps: {
      span: 24,
    },
  },
];
