import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; import { getPopupContainer } from '@vben/utils'; import { getDictOptions } from '#/utils/dict'; import { DictEnum } from '@vben/constants'; export const querySchema: FormSchemaGetter = () => [ { component: 'Input', fieldName: 'deviceName', label: '设备名称', }, { component: 'Input', fieldName: 'deviceIp', label: '设备ip', }, { component: 'Input', fieldName: 'deviceType', label: '设备类型', }, { fieldName: 'deviceStatus', label: '在线状态', component: 'Select', componentProps: { getPopupContainer, options: getDictOptions(DictEnum.sis_device_status), }, }, ]; // 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新 // export const columns: () => VxeGridProps['columns'] = () => [ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60 }, { title: '设备名称', field: 'deviceName', }, { title: '厂商编号', field: 'factoryNo', }, { title: '设备类型', field: 'device_type', }, { title: '设备ip', field: 'deviceIp', }, { title: '设备端口', field: 'devicePort', }, { title: '设备mac', field: 'deviceMac', }, { title: '在线状态', field: 'deviceStatus', }, { field: 'action', fixed: 'right', slots: { default: 'action' }, title: '操作', width: 180, }, ]; export const modalSchema: FormSchemaGetter = () => [ { label: '主键id', fieldName: 'id', component: 'Input', dependencies: { show: () => false, triggerFields: [''], }, }, { label: '设备名称', fieldName: 'deviceName', component: 'Input', rules: 'required', }, { label: '设备厂商', fieldName: 'facrotyNo', component: 'Input', rules: 'required', }, { label: '设备类型', fieldName: 'deviceType', component: 'Input', rules: 'required', }, { label: '设备ip', fieldName: 'deviceIp', component: 'Input', rules: 'required', }, { label: '设备端口', fieldName: 'devicePort', component: 'Input', rules: 'required', }, { label: '设备账号', fieldName: 'deviceAccount', component: 'Input', rules: 'required', }, { label: '设备密码', fieldName: 'devicePwd', component: 'Input', rules: 'required', }, { label: '设备Mac', fieldName: 'deviceMac', component: 'Input', }, ];