// @ts-ignore: 忽略
import type { FormSchemaGetter } from '#/adapter/form';
// @ts-ignore: 忽略
import type { VxeGridProps } from '#/adapter/vxe-table';

// 抽屉表单配置
export const drawerFormSchema: any | FormSchemaGetter = () => [
  {
    component: 'DatePicker',
    componentProps: {
      placeholder: '请选择调查开始时间',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      width: '100%',
    },
    fieldName: 'surveyStartTime',
    label: '调查开始时间',
    rules: 'required',
  },
  {
    component: 'DatePicker',
    componentProps: {
      placeholder: '请选择调查结束时间',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      width: '100%',
    },
    fieldName: 'surveyEndTime',
    label: '调查结束时间',
    rules: 'required',
  },
  {
    fieldName: 'entranceSurveyTable',
    label: '拐入率调查表格',
    // component: 'div',
    hideLabel: true,
    renderComponentContent: () => {
      return {
        default: () => [],
      };
    },
  },
];

// 默认表格列配置
export const defautTableColumns: VxeGridProps['columns'] = [
  {
    field: 'competitorName',
    title: '油站',
    width: 100,
    fixed: 'left',
    formatter: ({ row }) => {
      return row.competitorName || row.stationName || '-';
    },
  },
  {
    field: 'gasCar',
    title: '汽油车',
    width: 180,
    children: [
      {
        field: 'gasRoadFlow',
        title: '路面车流',
        editRender: { name: 'input' },
        width: 90,
      },
      {
        field: 'gasInFlow',
        title: '进站车流',
        editRender: { name: 'input' },
        width: 90,
      },
    ],
  },
  {
    field: 'dieselCar',
    title: '柴油车',
    width: 180,
    children: [
      {
        field: 'dieselRoadFlow',
        title: '路面车流',
        editRender: { name: 'input' },
        width: 90,
      },
      {
        field: 'dieselInFlow',
        title: '进站车流',
        editRender: { name: 'input' },
        width: 90,
      },
    ],
  },
  {
    field: 'motorcycle',
    title: '摩托车',
    width: 180,
    children: [
      {
        field: 'motorcycleRoadFlow',
        title: '路面车流',
        editRender: { name: 'input' },
        width: 90,
      },
      {
        field: 'motorcycleInFlow',
        title: '进站车流',
        editRender: { name: 'input' },
        width: 90,
      },
    ],
  },
];
