import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { rules } from '/@/utils/helper/validator'; import { render } from '/@/utils/common/renderUtils'; export const columns: BasicColumn[] = [ { title: '名称', dataIndex: 'strname', width: 120, }, { title: '安装位置', dataIndex: 'strinstallpos', width: 100, }, { title: '读取数据方式', dataIndex: 'strtype', width: 100, }, { title: '分站IP地址', dataIndex: 'strip', width: 100, }, { title: '链接状态', dataIndex: 'linkstatus', width: 100, }, { title: '备注', width: 150, dataIndex: 'strremark', }, ]; export const recycleColumns: BasicColumn[] = [ { title: '名称', dataIndex: 'strname', width: 100, }, { title: '安装位置', dataIndex: 'strinstallpos', width: 100, }, { title: '链接状态', dataIndex: 'linkstatus', width: 80, customRender: render.renderAvatar, }, ]; export const searchFormSchema: FormSchema[] = [ { label: '监测类型', field: 'monitorparam', component: 'MTreeSelect', componentProps: { virtual: false, }, colProps: { span: 6 }, }, { label: '安装位置', field: 'strinstallpos', component: 'Input', colProps: { span: 6 }, }, { label: '链接状态', field: 'linkstatus', component: 'JDictSelectTag', componentProps: { dictCode: 'user_status', placeholder: '请选择读写类型', stringToNumber: true, }, colProps: { span: 6 }, }, ]; export const formSchema: FormSchema[] = [ { label: '', field: 'id', component: 'Input', show: false, }, { label: '名称', field: 'strname', component: 'Input', required: true, }, { label: '安装位置', field: 'strinstallpos', component: 'Input', required: true, }, { label: '读取数据方式', field: 'strtype', component: 'JDictSelectTag', required: true, componentProps: { dictCode: 'getdatatype', placeholder: '请选择读取数据方式', }, }, { label: '监测类型', field: 'monitorparam', component: 'MTreeSelect', componentProps: { virtual: false, }, }, { label: '分站IP或请求地址', field: 'strip', component: 'Input', required: true, }, { label: '分站端口', field: 'nport', component: 'Input', }, { label: 'PLC类型', field: 'plcType', component: 'JDictSelectTag', ifShow: ({ values }) => values.strtype === 'plc', componentProps: { dictCode: 'plcType', placeholder: '请选择PLC类型', }, }, { label: '分站站号', field: 'code', component: 'InputNumber', ifShow: ({ values }) => ['modbus', 'modbusRtu'].includes(values.strtype), }, { label: '节点码', field: 'code', component: 'Input', ifShow: ({ values }) => values.strtype === 'opc_ua', }, { label: '是否从0开始', field: 'isZeroStart', component: 'RadioGroup', defaultValue: 1, ifShow: ({ values }) => ['modbus', 'modbusRtu'].includes(values.strtype), componentProps: () => { return { options: [ { label: '是', value: 1, key: '1' }, { label: '否', value: 0, key: '2' }, ], }; }, }, { label: '分站类型', field: 'reqparam', component: 'Input', ifShow: ({ values }) => ['modbus', 'modbusRtu'].includes(values.strtype), componentProps: { placeholder: '请填写158/130/235', }, }, { label: '请求方式', field: 'reqtype', component: 'JDictSelectTag', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), componentProps: { dictCode: 'reqtype', placeholder: '请选择请求方式', }, }, { label: 'reqHeader请求头', field: 'reqHeader', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || !['plc', 'modbus', 'modbusRtu', 'opc_ua', 'txt'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '请求参数', field: 'reqparam', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), }, { label: '读取文件名', field: 'reqparam', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('txt'), }, { label: '请求参数或读取文件名', field: 'reqparam', component: 'Input', ifShow: ({ values }) => values.strtype && !['plc', 'modbus', 'modbusRtu', 'opc_ua', 'txt', 'http'].some((type) => values.strtype && values.strtype.startsWith(type)) && !values.strtype?.startsWith('http') && !values.strtype?.startsWith('txt'), }, { label: '返回数据解析', field: 'dataproperty', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt')), }, { label: 'ID字段', field: 'idcode', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt') || !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '名称code', field: 'namecode', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt') || !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '连接用户名', field: 'remoteUser', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype === 'opc_ua' || !['plc', 'modbus', 'modbusRtu', 'txt'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '连接密码', field: 'remotePass', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype === 'opc_ua' || !['plc', 'modbus', 'modbusRtu', 'txt'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '数据格式化', field: 'dataformat', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt') || !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '字符串分隔符', field: 'splitchar', component: 'Input', ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt') || !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))), }, { label: '控制请求地址', field: 'controlStrip', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), }, { label: '控制请求类型', field: 'controlReqtype', component: 'JDictSelectTag', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), componentProps: { dictCode: 'reqtype', placeholder: '请选择控制请求方式', }, }, { label: '控制请求Header', field: 'controlHeader', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), }, { label: '控制请求参数', field: 'controlReqparam', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), }, { label: '登录地址', field: 'loginUrl', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), }, { label: '登录结果解析', field: 'loginResult', component: 'Input', ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'), }, { label: '是否自动同步设备', field: 'isAutoSyn', component: 'RadioGroup', defaultValue: 0, ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt')), componentProps: () => { return { options: [ { label: '否', value: 0, key: '0' }, { label: '是', value: 1, key: '1' }, ], }; }, }, { label: '备注', field: 'strremark', component: 'InputTextArea', }, ]; export const historyColumns: BasicColumn[] = [ { title: '名称', dataIndex: 'devicename', key: 'devicename', width: 120, align: 'center', }, { title: '安装位置', dataIndex: 'stationname', key: 'stationname', width: 120, align: 'center', }, { title: '开始报警时间', dataIndex: 'starttime', key: 'starttime', width: 120, align: 'center', }, { title: '结束报警时间', dataIndex: 'endtime', key: 'endtime', width: 120, align: 'center', }, { title: '报警状态', dataIndex: 'nwartype_dictText', key: 'nwartype_dictText', width: 120, align: 'center', }, ];