import { DescItem } from '/@/components/Description';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { infraStorageconfigQueryPage } from '/@/api/infra/infraStorageConfigApi';
export const columns: BasicColumn[] = [
  {
    title: '文件名称',
    dataIndex: 'realName',
  },
  {
    title: '绝对路径',
    dataIndex: 'absolutePath',
  },
  {
    title: '存储配置',
    dataIndex: 'configName',
  },
  {
    title: '文件大小',
    dataIndex: 'size',
  },
  {
    title: '文件后缀',
    dataIndex: 'suffix',
  },
];

// 表单列定义
export const searchFormSchema: FormSchema[] = [
  {
    label: '文件名称',
    field: 'realName',
    component: 'Input',
    componentProps: {
      placeholder: '请输入文件名称',
    },
  },
];
// 表单新增编辑
export const dataFormSchema: FormSchema[] = [
  {
    label: '文件名称',
    field: 'name',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入文件名称',
    },
  },
  {
    label: '绝对路径',
    field: 'absolutePath',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入绝对路径',
    },
  },
  {
    label: '存储配置',
    field: 'configId',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: infraStorageconfigQueryPage,
      params: {
        pageNum: 1,
        pageSize: 999,
      },
      mode: 'single',
      labelField: 'name',
      valueField: 'id',
      resultField: 'data',
      placeholder: '请输入存储配置',
    },
  },
  {
    label: '文件大小',
    field: 'size',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入文件大小',
    },
  },
  {
    label: '文件后缀',
    field: 'suffix',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入文件后缀',
    },
  },
];
// 表单详情查看
export const viewSchema: DescItem[] = [
  {
    label: '文件名称',
    field: 'realName',
  },
  {
    label: '绝对路径',
    field: 'absolutePath',
  },
  {
    label: '存储配置',
    field: 'configName',
  },
  {
    label: '文件大小',
    field: 'size',
  },
  {
    label: '文件后缀',
    field: 'suffix',
  },
];
