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

import { DictEnum } from '@vben/constants';

import { getDictOptions } from '#/utils/dict';

export const queryFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'areaName',
    label: '片区',
    componentProps: {
      placeholder: '请输入片区名称',
    },
  },
];

export const tableColumns: VxeGridProps['columns'] = [
  {
    type: 'checkbox',
    width: 80,
  },
  {
    field: 'areaName',
    title: '片区名称',
    minWidth: 150,
  },
  // {
  //   field: 'address',
  //   title: '详细地址',
  //   minWidth: 200,
  // },
  {
    field: 'manager',
    title: '片区经理',
    minWidth: 120,
  },
  {
    field: 'gasStations',
    title: '关联油站',
    minWidth: 120,
  },
  {
    field: 'status',
    title: '状态',
    minWidth: 100,
    slots: { default: 'status' },
  },
  {
    field: 'updateTime',
    title: '修改时间',
    minWidth: 150,
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 150,
  },
];

export const drawerFormSchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
    fieldName: 'id',
  },
  {
    component: 'Input',
    fieldName: 'areaName',
    label: '片区名称',
    componentProps: {
      placeholder: '请输入片区名称',
      maxlength: 100,
    },
    rules: 'required',
  },
  // {
  //   component: 'Input',
  //   fieldName: 'address',
  //   label: '详细地址',
  //   componentProps: {
  //     placeholder: '请输入详细地址',
  //     maxlength: 200,
  //   },
  //   rules: 'required',
  // },
  {
    component: 'RadioGroup',
    componentProps: {
      options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
      isButton: true,
    },
    fieldName: 'status',
    defaultValue: '0',
    label: '状态',
    required: false,
  },
];
