config.data.ts 2.3 KB
import { BasicColumn, FormSchema } from '/@/components/Table';
import { getOrganizationList } from '/@/api/system/system';
import { copyTransFun } from '/@/utils/fnUtils';

// 表格列数据
export const columns: BasicColumn[] = [
  {
    title: '封面',
    dataIndex: 'avatar',
    width: 80,
    slots: { customRender: 'img' },
  },
  {
    title: '名字',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '厂家',
    dataIndex: 'brand',
    width: 120,
  },
  {
    title: '摄像头编号',
    dataIndex: 'sn',
    width: 120,
  },
  {
    title: '视频流',
    dataIndex: 'videoUrl',
    width: 120,
  },
  {
    title: '所属组织',
    dataIndex: 'organizationDTO.name',
    width: 160,
  },
  {
    title: '添加时间',
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    width: 180,
  },
];

// 查询字段
export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '摄像头名字',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      maxLength: 36,
      placeholder: '请输入摄像头名字',
    },
  },
];

// 弹框配置项
export const formSchema: FormSchema[] = [
  {
    field: 'avatar',
    label: '视频封面',
    slot: 'iconSelect',
    component: 'Input',
  },
  {
    field: 'name',
    label: '视频名字',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入视频名字',
      maxLength: 30,
    },
  },
  {
    field: 'organizationId',
    label: '所属组织',
    required: true,
    component: 'ApiTreeSelect',
    componentProps: {
      api: async () => {
        const data = await getOrganizationList();
        copyTransFun(data as any as any[]);
        return data;
      },
    },
  },
  {
    field: 'brand',
    label: '视频厂家',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入视频厂家',
    },
  },
  {
    field: 'sn',
    label: '摄像头编号',
    component: 'Input',
    required: true,
    componentProps: {
      placeholder: '请输入摄像头编号',
    },
  },
  {
    field: 'videoUrl',
    label: '视频流',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入视频流',
      maxLength: 255,
    },
  },
];