@jdlinker/linker
Version:
jdLinker 系统模块
107 lines (106 loc) • 2.17 kB
text/typescript
import { BasicColumn } from '@jdlinker/ui';
import { FormSchema } from '@jdlinker/ui';
import { h } from '@vue/runtime-core';
import { Tag } from 'ant-design-vue';
//列表数据
export const columns: BasicColumn[] = [
{
title: '名称',
align: 'center',
dataIndex: 'name',
},
{
title: '点位ID',
align: 'center',
dataIndex: 'code',
},
{
title: '数据类型',
align: 'center',
dataIndex: 'dataType',
},
{
title: '当前数据',
align: 'center',
dataIndex: 'dataValue',
},
{
title: '采集状态',
align: 'center',
dataIndex: 'dataState',
customRender: ({ record }) => {
const status = record.dataState;
const enable = status === '1';
const color = enable ? 'green' : 'red';
const text = enable ? '采集中' : '已停止';
return h(Tag, { color: color }, () => text);
},
},
{
title: '状态',
align: 'center',
dataIndex: 'state',
customRender: ({ record }) => {
const status = record.state;
const enable = status === '1';
const color = enable ? 'green' : 'red';
const text = enable ? '正常' : '禁用';
return h(Tag, { color: color }, () => text);
},
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '名称',
field: 'name',
component: 'Input',
},
{
label: '采集状态',
field: 'dataState',
component: 'Input',
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: 'opc_id',
field: 'opcId',
component: 'Input',
dynamicDisabled: true,
},
{
label: 'opc_name',
field: 'opcName',
component: 'Input',
dynamicDisabled: true,
},
{
label: '名称',
field: 'name',
component: 'Input',
},
{
label: '点位ID',
field: 'code',
component: 'Input',
},
{
label: '数据类型',
field: 'dataType',
component: 'Input',
},
{
label: '描述',
field: 'description',
component: 'InputTextArea',
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];