drgyen-iot-ui/apps/web-antd/src/views/application/appDevice/data.ts

100 lines
1.9 KiB
TypeScript

import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
componentProps: {
allowClear: true,
filterOption: true,
placeholder: '请选择所属平台',
showSearch: true,
},
fieldName: 'applicationCode',
label: '所属平台',
},
{
component: 'Input',
fieldName: 'deviceKey',
label: '设备码',
},
{
component: 'Input',
fieldName: 'deviceName',
label: '设备名称',
},
{
component: 'Select',
fieldName: 'productKey',
label: '所属产品',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
// {
// title: '编号',
// field: 'id',
// },
{
title: '所属平台',
field: 'applicationName',
},
{
title: '设备码',
field: 'deviceKey',
},
{
title: '设备名称',
field: 'deviceName',
},
{
title: '所属产品',
field: 'productKey',
slots: { default: 'productKey' },
},
{
title: '分配时间',
field: 'allotTime',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const drawerSchema: FormSchemaGetter = () => [
{
label: '编号',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '设备唯一码',
fieldName: 'deviceKey',
component: 'Input',
rules: 'required',
},
{
label: '产品码',
fieldName: 'productKey',
component: 'Input',
rules: 'required',
},
{
label: '所属平台码',
fieldName: 'applicationCode',
component: 'Input',
rules: 'required',
},
];