import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Select',
    fieldName: 'link',
    label: '环节',
    componentProps: {
      placeholder: '请选择环节',
      options: [
        { label: '环节1', value: '环节1' },
        { label: '环节2', value: '环节2' },
        { label: '环节3', value: '环节3' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'taskName',
    label: '事项',
    componentProps: {
      placeholder: '请选择事项',
      options: [
        { label: '事项1', value: '事项1' },
        { label: '事项2', value: '事项2' },
        { label: '事项3', value: '事项3' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'personInCharge',
    label: '负责人',
    componentProps: {
      placeholder: '请选择负责人',
      options: [
        { label: '负责人1', value: '负责人1' },
        { label: '负责人2', value: '负责人2' },
        { label: '负责人3', value: '负责人3' },
      ],
    },
  },
  {
    component: 'Select',
    fieldName: 'supervisor',
    label: '监交人',
    componentProps: {
      placeholder: '请选择监交人',
      options: [
        { label: '监交人1', value: '监交人1' },
        { label: '监交人2', value: '监交人2' },
        { label: '监交人3', value: '监交人3' },
      ],
    },
  },
];

export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'taskName',
    title: '事项',
    minWidth: 150,
  },
  {
    field: 'guidance',
    title: '要求指引',
    minWidth: 200,
  },
  {
    field: 'link',
    title: '环节',
    minWidth: 120,
  },
  {
    field: 'personInCharge',
    title: '负责人',
    minWidth: 120,
  },
  {
    field: 'supervisor',
    title: '监交人',
    minWidth: 120,
  },
  {
    field: 'updateTime',
    title: '更新时间',
    minWidth: 180,
  },
  {
    field: 'operator',
    title: '操作人',
    minWidth: 120,
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 150,
  },
];

export const drawerFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
    fieldName: 'id',
  },
  {
    component: 'Select',
    fieldName: 'station',
    label: '交接油站',
    componentProps: {
      placeholder: '请选择交接油站',
      options: [
        { label: '油站1', value: '油站1' },
        { label: '油站2', value: '油站2' },
        { label: '油站3', value: '油站3' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'Select',
    fieldName: 'supervisor',
    label: '监交人',
    componentProps: {
      placeholder: '请选择监交人',
      options: [
        { label: '监交人1', value: '监交人1' },
        { label: '监交人2', value: '监交人2' },
        { label: '监交人3', value: '监交人3' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'DatePicker',
    fieldName: 'startDate',
    label: '交接开始日期',
    componentProps: {
      placeholder: '请选择交接开始日期',
      type: 'date',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'onlineDuration',
    label: '线上交接建议时长',
    componentProps: {
      placeholder: '请输入线上交接建议时长（天）',
      type: 'number',
      min: 0,
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'followUpDuration',
    label: '交接后续建议时长',
    componentProps: {
      placeholder: '请输入交接后续建议时长（天）',
      type: 'number',
      min: 0,
    },
    rules: 'required',
  },
  {
    component: 'Select',
    fieldName: 'link',
    label: '环节',
    componentProps: {
      placeholder: '请选择环节',
      options: [
        { label: '环节1', value: '环节1' },
        { label: '环节2', value: '环节2' },
        { label: '环节3', value: '环节3' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'Select',
    fieldName: 'personInCharge',
    label: '负责人',
    componentProps: {
      placeholder: '请选择负责人',
      options: [
        { label: '负责人1', value: '负责人1' },
        { label: '负责人2', value: '负责人2' },
        { label: '负责人3', value: '负责人3' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'RadioGroup',
    fieldName: 'needSupervisor',
    label: '是否需要监交人',
    componentProps: {
      options: [
        { label: '是', value: '是' },
        { label: '否', value: '否' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'Select',
    fieldName: 'taskName',
    label: '事项',
    componentProps: {
      placeholder: '请选择事项',
      options: [
        { label: '事项1', value: '事项1' },
        { label: '事项2', value: '事项2' },
        { label: '事项3', value: '事项3' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'RadioGroup',
    fieldName: 'needCompare',
    label: '是否比作',
    componentProps: {
      options: [
        { label: '是', value: '是' },
        { label: '否', value: '否' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'guidance',
    label: '要求指引',
    componentProps: {
      placeholder: '请输入要求指引',
      maxlength: 200,
      type: 'textarea',
      rows: 3,
    },
  },
  {
    component: 'RadioGroup',
    fieldName: 'needPhoto',
    label: '拍照',
    componentProps: {
      options: [
        { label: '是', value: '是' },
        { label: '否', value: '否' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'RadioGroup',
    fieldName: 'needAttachment',
    label: '附件',
    componentProps: {
      options: [
        { label: '是', value: '是' },
        { label: '否', value: '否' },
      ],
    },
    rules: 'required',
  },
];
