admin-vben5/apps/web-antd/src/views/property/accessControl/device/data.ts
dev_ljl a107323e36
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m27s
1、资产管理
2025-06-24 14:52:45 +08:00

186 lines
3.5 KiB
TypeScript

import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from '#/utils/dict';
import {renderDict} from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'accessCode',
label: '设备编码',
},
{
component: 'Input',
fieldName: 'accessName',
label: '设备名称',
},
{
component: 'Select',
fieldName: 'controlType',
componentProps: {
options: getDictOptions('wy_kzklx'),
},
label: '控制卡类型',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{type: 'checkbox', width: 60},
{
title: '序号',
field: 'id',
slots: {
default: ({rowIndex}) => {
return rowIndex + 1;
},
},
},
{
title: '设备编码',
field: 'accessCode',
},
{
title: '设备名称',
field: 'accessName',
},
{
title: '园区编码',
field: 'communityCode',
},
{
title: '建筑编码',
field: 'buildingCode',
},
{
title: '设备IP',
field: 'accessIp',
},
{
title: '端口',
field: 'accessPort',
},
{
title: '设备类型',
field: 'accessType',
},
{
title: '工厂编码',
field: 'factoryCode',
},
{
title: '控制卡类型',
field: 'controlType',
slots: {
default: ({row}) => {
return renderDict(row.controlType, 'wy_kzklx');
},
},
},
{
title: '控制卡类型编码',
field: 'controlCode',
},
{
title: '外部编码',
field: 'outCode',
},
{
title: '组织编码',
field: 'orgCode',
},
{
field: 'action',
fixed: 'right',
slots: {default: 'action'},
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '设备编码',
fieldName: 'accessCode',
component: 'Input',
rules: 'required',
},
{
label: '设备名称',
fieldName: 'accessName',
component: 'Input',
rules: 'required',
},
{
label: '园区编码',
fieldName: 'communityCode',
component: 'Input',
rules: 'required',
},
{
label: '建筑编码',
fieldName: 'buildingCode',
component: 'Input',
rules: 'required',
},
{
label: '设备IP',
fieldName: 'accessIp',
component: 'Input',
},
{
label: '端口',
fieldName: 'accessPort',
component: 'Input',
},
{
label: '设备类型',
fieldName: 'accessType',
component: 'Input',
rules: 'required',
},
{
label: '工厂编码',
fieldName: 'factoryCode',
component: 'Input',
rules: 'required',
},
{
label: '控制卡类型',
fieldName: 'controlType',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_KZKLX 便于维护
options: getDictOptions('wy_kzklx'),
},
rules: 'selectRequired',
},
{
label: '控制卡类型编码',
fieldName: 'controlCode',
component: 'Input',
},
{
label: '外部编码',
fieldName: 'outCode',
component: 'Input',
},
{
label: '组织编码',
fieldName: 'orgCode',
component: 'Input',
rules: 'required',
},
];