import dayjs from 'dayjs';
import { DescItem } from '/@/components/Description';
import { BasicColumn, FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '查房时间',
    dataIndex: 'patrolTime',
    width: 200,
    align: 'left',
  },
  {
    title: '查房内容',
    dataIndex: 'content',
    align: 'left',
  },
  {
    title: '记录人',
    dataIndex: 'updatorName',
    width: 120,
    align: 'left',
  },
];

// 表单列定义
export const searchFormSchema: FormSchema[] = [
  {
    label: 'updator_name',
    field: 'updatorName',
    component: 'Input',
    componentProps: {
      placeholder: '请输入updator_name',
    },
  },
];
// 表单新增编辑
export const dataFormSchema: FormSchema[] = [
  {
    label: '查房时间',
    field: 'patrolTime',
    required: true,
    component: 'DatePicker',
    componentProps: ({ formModel }) => {
      return {
        placeholder: '请输入查房时间',
        getPopupContainer: () => document.body,
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        showTime: true,
        disabledDate: current => {
          return current < dayjs(formModel.accessSetUpTime).subtract(1, 'day').endOf('day');
        },
      };
    },
  },
  {
    label: '记录',
    field: 'content',
    required: true,
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入查房内容',
    },
  },
];
// 表单详情查看
export const viewSchema: DescItem[] = [
  {
    label: '查房时间',
    field: 'patrolTime',
  },
  {
    label: '查房内容',
    field: 'content',
  },
  {
    label: '记录人',
    field: 'updatorName',
  },
];
