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

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Select',
    fieldName: 'stationName',
    label: '油站',
    componentProps: {
      placeholder: '请选择油站',
      options: [
        { label: '油站1', value: '油站1' },
        { label: '油站2', value: '油站2' },
        { label: '油站3', value: '油站3' },
      ],
    },
  },
  {
    component: 'DatePicker',
    fieldName: 'operationTime',
    label: '操作时间',
    componentProps: {
      placeholder: '请选择操作时间',
      type: 'daterange',
      rangeSeparator: '至',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
    },
  },
  {
    component: 'Input',
    fieldName: 'filterModel',
    label: '过滤器型号',
    componentProps: {
      placeholder: '请输入过滤器型号',
    },
  },
  {
    component: 'Input',
    fieldName: 'filterNo',
    label: '过滤器编号',
    componentProps: {
      placeholder: '请输入过滤器编号',
    },
  },
];


export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'stationName',
    title: '油站',
    minWidth: 150,
  },
  {
    field: 'filterNo',
    title: '过滤器编号',
    minWidth: 180,
  },
  {
    field: 'filterModel',
    title: '过滤器型号',
    minWidth: 150,
  },
  {
    field: 'dispenserModel',
    title: '油机型号',
    minWidth: 150,
  },
  {
    field: 'relatedGun',
    title: '关联油枪',
    minWidth: 120,
  },
  {
    field: 'relatedOil',
    title: '关联油品',
    minWidth: 120,
  },
  {
    field: 'totalFilteredLiters',
    title: '累计过滤升数',
    minWidth: 180,
  },
  {
    field: 'nextReplaceDate',
    title: '下次更换日期',
    minWidth: 150,
  },
  {
    field: 'operator',
    title: '操作人',
    minWidth: 120,
  },
  {
    field: 'operationTime',
    title: '操作时间',
    minWidth: 180,
  },
  {
    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: 'stationName',
    label: '油站',
    componentProps: {
      placeholder: '请选择油站',
      options: [
        { label: '油站1', value: '油站1' },
        { label: '油站2', value: '油站2' },
        { label: '油站3', value: '油站3' },
      ],
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'filterNo',
    label: '过滤器编号',
    componentProps: {
      placeholder: '请输入过滤器编号',
      maxlength: 100,
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'filterModel',
    label: '过滤器型号',
    componentProps: {
      placeholder: '请输入过滤器型号',
      maxlength: 100,
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'dispenserModel',
    label: '油机型号',
    componentProps: {
      placeholder: '请输入油机型号',
      maxlength: 100,
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'relatedGun',
    label: '关联油枪',
    componentProps: {
      placeholder: '请输入关联油枪',
      maxlength: 50,
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'relatedOil',
    label: '关联油品',
    componentProps: {
      placeholder: '请输入关联油品',
      maxlength: 50,
    },
    rules: 'required',
  },
  {
    component: 'InputNumber',
    fieldName: 'totalFilteredLiters',
    label: '累计过滤升数',
    componentProps: {
      placeholder: '请输入累计过滤升数',
      min: 0,
      step: 1,
    },
    rules: 'required',
  },
  {
    component: 'DatePicker',
    fieldName: 'nextReplaceDate',
    label: '下次更换日期',
    componentProps: {
      placeholder: '请选择下次更换日期',
      type: 'date',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    rules: 'required',
  },
];

