import { FormSchema } from '@/components/Form/index';
import { getAdSortAllList } from '@/api/content/adSort';
export const loadSelectData = async (res) => {
  //这里可以进行数据转换处理
  return (await getAdSortAllList({ ...res })).map((item, index) => {
    return {
      ...item,
      label: item.name,
      value: item.id,
      index,
    };
  });
};
export const schemas: FormSchema[] = [
  {
    field: 'title',
    component: 'NInput',
    label: '广告标题',
    componentProps: {
      placeholder: '请输广告标题',
    },
  },
  {
    field: 'status',
    component: 'NSelect',
    label: '广告状态',
    componentProps: {
      placeholder: '请选择广告状态',
      clearable: true,
      options: [
        {
          label: '在用',
          value: '1',
        },
        {
          label: '停用',
          value: '2',
        },
      ],
    },
  },
  {
    field: 'adSortId',
    component: 'BasicSelect',
    label: '广告位',
    componentProps: {
      placeholder: '请选择广告位',
      clearable: true,
      block: true,
      request: loadSelectData,
    },
  },
];
