import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import { selectAllSysStationAreaList } from '#/api/system/infoEntry/stationInfo/stationInfo';
// import { queryGasStationList } from '#/api/schedule/index';
import { queryrclassesApilist } from '#/api/schedule/work/classes';
import { useUserStore } from '@vben/stores';
const userStore = useUserStore();
const getstationId = userStore.userInfo?.stations?.[0]?.id;

export const querySchema: FormSchemaGetter = () => {
  return [
    {
      component: 'ApiSelect',
      componentProps: {
        api: selectAllSysStationAreaList,
        labelField: 'stationName',
        valueField: 'id',
        placeholder: '请选择油站',
        clearable: true,
      },
      fieldName: 'stationName',
      defaultValue: getstationId,
      label: '油站',
    },
    {
      component: 'ApiSelect',
      componentProps: {
        api: queryrclassesApilist,
        labelField: 'shiftName',
        valueField: 'shiftName',
        placeholder: '请选择班次名称',
        clearable: true,
        resultField: 'rows',
      },
      fieldName: 'shiftName',
      label: '班次名称',
    },
    {
      component: 'DatePicker',
      componentProps: {
        type: 'datetime',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        placeholder: '选择时间',
      },
      fieldName: 'startTime',
      label: '上班时间',
    },
  ];
};

export const columns: VxeGridProps['columns'] = [
  {
    field: 'action',
    fixed: 'left',
    slots: { default: 'action' },
    resizable: false,
    title: '操作',
    width: 180,
  },
  {
    title: '上班日期',
    field: 'workDate',
    minWidth: 130,
  },
  {
    title: '班次',
    field: 'shiftName',
    minWidth: 130,
  },
  {
    title: '油站',
    field: 'stationName',
    minWidth: 130,
  },
  {
    title: '开班人员',
    field: 'userName',
    minWidth: 130,
  },
  {
    title: '上班人数',
    field: 'workNum',
    minWidth: 130,
  },
  {
    title: '最后操作人员',
    field: 'userName',
    minWidth: 130,
  },
  {
    title: '最后操作时间',
    field: 'updateTime',
    minWidth: 130,
  },
];
