import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { queryDeviceList } from './point.api'; import { defHttp } from '/@/utils/http/axios'; export const columns: BasicColumn[] = [ // { // title: 'id', // dataIndex: 'id', // width: 120, // ifShow: true, // }, { title: '设备类型', dataIndex: 'devicekind_dictText', width: 120, }, { title: '点表类型', dataIndex: 'devicetype', width: 120, }, { title: '值名称', dataIndex: 'valuename', width: 100, }, { title: '值code', dataIndex: 'valuecode', width: 100, }, { title: '点位地址', width: 150, dataIndex: 'plcaddr', }, { title: '数据类型', width: 100, dataIndex: 'datakind_dictText', }, // { // title: '最大值', // dataIndex: 'fmax', // width: 100, // }, // { // title: '模拟最小值', // dataIndex: 'testlow', // width: 100, // }, // { // title: '模拟最大值', // width: 100, // dataIndex: 'testup', // }, // { // title: '小数位数', // width: 100, // dataIndex: 'floatnum', // }, // { // title: '是否保存', // dataIndex: 'saveflag_dictText', // width: 80, // }, ]; export const searchFormSchema: FormSchema[] = [ { label: '设备类型', field: 'devicetype', component: 'MTreeSelect', colProps: { span: 6 }, }, ]; export const formSchema: FormSchema[] = [ { label: '', field: 'id', component: 'Input', show: false, }, { label: '设备分类', field: 'devicekind', component: 'ApiSelect', // componentProps: { // dictCode: 'devicekind', // placeholder: '请选择设备分类', // }, componentProps: ({ formModel, formActionType }) => { return { // options: provincesOptions, placeholder: '请选择设备分类', api: queryDeviceList, resultField: 'result', // use name as label labelField: 'itemText', // use id as value valueField: 'itemValue', onChange: (e: any) => { // formModel.devicetype = ''; const { updateSchema } = formActionType; updateSchema({ field: 'devicetype', component: 'ApiSelect', componentProps: { api: (params) => defHttp.get({ url: `/sys/dict/getDictItems/${e + 'kind'}` }, params), resultField: 'result', labelField: 'title', valueField: 'value', }, }); }, resetFields: () => {}, }; }, }, { label: '点表类型', field: 'devicetype', component: 'ApiSelect', componentProps: ({ formModel }) => { return { defaultValue: formModel['devicetype'], componentProps: {}, api: (params) => defHttp.get({ url: `/sys/dict/getDictItems/${formModel.devicekind + 'kind'}` }, params), resultField: 'result', labelField: 'title', valueField: 'value', }; }, }, { label: '功能码', field: 'fanctionCode', component: 'Input', }, { label: '值名称', field: 'valuename', component: 'Input', }, { label: '值code', field: 'valuecode', component: 'Input', }, { label: '值类型', field: 'valuetype', component: 'JDictSelectTag', componentProps: { dictCode: 'valuetype', placeholder: '请选择设备类型', stringToNumber: true, }, }, { label: '指令默认写入值', field: 'value', component: 'Input', }, { label: '点位地址', field: 'plcaddr', component: 'Input', }, { label: '数据类型', field: 'datakind', component: 'JDictSelectTag', componentProps: { dictCode: 'datakind', placeholder: '请选择数据类型', stringToNumber: true, }, }, { label: '字节数', field: 'len', component: 'Input', }, { label: '功能码', field: 'fanctionCode', component: 'Input', }, { label: '数值解析', field: 'dictset', component: 'Input', }, { label: '最小值', field: 'fmin', component: 'InputNumber', }, { label: '最大值', field: 'fmax', component: 'InputNumber', }, { label: '模拟最小值', field: 'testlow', component: 'InputNumber', }, { label: '模拟最大值', field: 'testup', component: 'InputNumber', }, { label: '开始指令', field: 'startcommand ', component: 'InputTextArea', }, { label: '结束指令', field: 'endcommand', component: 'InputTextArea', }, { label: '控制指令设置模拟数据', field: 'setTestdata', component: 'InputTextArea', }, { label: '是否保存', field: 'saveflag', component: 'JDictSelectTag', componentProps: { dictCode: 'booltype', placeholder: '是否保存', stringToNumber: true, }, }, { label: '是否报警', field: 'bwarning', component: 'JDictSelectTag', componentProps: { dictCode: 'booltype', placeholder: '是否报警', stringToNumber: true, }, }, { label: '是否计算平均值', field: 'avgflag', component: 'JDictSelectTag', componentProps: { dictCode: 'booltype', placeholder: '是否计算平均值', stringToNumber: true, }, }, { label: '小数位数', field: 'floatnum', component: 'InputNumber', }, { label: '备注', field: 'strremark', component: 'InputTextArea', }, ];