UNPKG

@jdlinker/linker

Version:

jdLinker 系统模块

124 lines (123 loc) 2.42 kB
import { BasicColumn, 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: '功能码', align: 'center', dataIndex: 'code', }, { title: '从站ID', align: 'center', dataIndex: 'unitId', }, { title: '寄存器数量', align: 'center', dataIndex: 'quantity', }, { title: '地址', align: 'center', dataIndex: 'address', }, { title: '当前数据', align: 'center', dataIndex: 'dataValue', }, { title: '采集状态', align: 'center', dataIndex: 'collectState', customRender: ({ record }) => { const status = record.state; 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: 'collectState', component: 'Input', }, ]; //表单数据 export const formSchema: FormSchema[] = [ { label: 'modbus_id', field: 'masterId', component: 'Input', }, { label: 'modbus_id', field: 'masterName', component: 'Input', }, { label: '名称', field: 'name', component: 'Input', }, { label: '功能码', field: 'code', component: 'Input', }, { label: '从站ID', field: 'unitId', component: 'Input', }, { label: '寄存器数量', field: 'quantity', component: 'Input', }, { label: '地址', field: 'address', component: 'Input', }, { label: '描述', field: 'description', component: 'InputTextArea', }, // TODO 主键隐藏字段,目前写死为ID { label: '', field: 'id', component: 'Input', show: false, }, ];