// @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: 'salesSurveyTable',
    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: 'gasolineCar',
    title: '汽油车',
    width: 180,
    children: [
      {
        field: 'gasolineVehicleCount',
        title: '进站次数',
        editRender: { name: 'input' },
        width: 90,
      },
      {
        field: 'gasolineVolumeDiff',
        title: '加油升差数',
        editRender: { name: 'input' },
        width: 90,
      },
    ],
  },
  {
    field: 'dieselCar',
    title: '柴油车',
    width: 180,
    children: [
      {
        field: 'dieselVehicleCount',
        title: '进站次数',
        width: 90,
        editRender: { name: 'input' },
      },
      {
        field: 'dieselVolumeDiff',
        title: '加油升差数',
        width: 90,
        editRender: { name: 'input' },
      },
    ],
  },
  {
    field: 'motorcycle',
    title: '摩托车',
    width: 180,
    children: [
      {
        field: 'motorcycleCount',
        title: '进站次数',
        width: 90,
        editRender: { name: 'input' },
      },
      {
        field: 'motorcycleVolumeDiff',
        title: '加油升差数',
        width: 90,
        editRender: { name: 'input' },
      },
    ],
  },
  {
    field: 'gasCar',
    title: '气车',
    width: 180,
    children: [
      {
        field: 'gasVehicleCount',
        title: '进站次数',
        width: 90,
        editRender: { name: 'input' },
      },
      {
        field: 'gasVolumeDiff',
        title: '加油升差数',
        width: 90,
        editRender: { name: 'input' },
      },
    ],
  },
  {
    field: 'periodForecastDiff',
    title: '时段预测销量差（升）',
    width: 150,
    editRender: { name: 'input' },
  },
  {
    field: 'dailyForecastDiff',
    title: '全天预测销量差（升）',
    editRender: { name: 'input' },
    width: 150,
  },
  {
    field: 'surveySales',
    title: '调查销量（升）',
    width: 180,
    children: [
      {
        field: 'gasolineSurveyVolume',
        title: '汽油',
        width: 90,
        editRender: { name: 'input' },
      },
      {
        field: 'dieselSurveyVolume',
        title: '柴油',
        width: 90,
        editRender: { name: 'input' },
      },
    ],
  },
];
