import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { queryDeviceList } from './performance.api'; import { defHttp } from '/@/utils/http/axios'; import { TreeItem } from '/@/components/Tree/index'; //tree export const treeData: TreeItem[] = [ { title: 'parent 1', key: '0-0', icon: 'home|svg', children: [ { title: 'leaf', key: '0-0-0' }, { title: 'leaf', key: '0-0-1', children: [ { title: 'leaf', key: '0-0-0-0' }, { title: 'leaf', key: '0-0-0-1' }, ], }, ], }, { title: 'parent 2', key: '1-1', icon: 'home|svg', children: [ { title: 'leaf', key: '1-1-0' }, { title: 'leaf', key: '1-1-1' }, ], }, { title: 'parent 3', key: '2-2', icon: 'home|svg', children: [ { title: 'leaf', key: '2-2-0' }, { title: 'leaf', key: '2-2-1' }, ], }, ]; export const columns: BasicColumn[] = [ { title: '设备类型', dataIndex: 'devicekind_dictText', width: 120, }, // { // title: '设备类型code', // dataIndex: 'devicekind', // width: 120, // }, // { // title: 'plc地址', // dataIndex: 'plcaddr', // width: 100, // }, // { // title: 'plc读写位数', // dataIndex: 'floatnum', // width: 100, // // customRender: render.renderAvatar, // }, // { // title: '读写类型', // dataIndex: 'datakind_dictText', // width: 80, // // sorter: true, // // customRender: ({ text }) => { // // return render.renderDict(text, 'sex'); // // }, // }, { title: '值名称', dataIndex: 'valuename', width: 100, }, { title: '值code', dataIndex: 'valuecode', width: 100, }, // { // title: '值类型', // width: 150, // dataIndex: 'valuetype_dictText', // }, // { // title: '最小值', // width: 100, // dataIndex: 'fmin', // }, // { // 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: 'devicekind', component: 'MTreeSelect', colProps: { span: 6 }, }, { label: '值名称', field: 'valuename', component: 'Input', colProps: { span: 6 }, }, { label: '值code', field: 'valuecode', component: 'Input', 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', componentProps: { api: (params) => defHttp.get({ url: `/sys/dict/getDictItems/${e + 'kind'}` }, params), resultField: 'result', labelField: 'title', valueField: 'value', }, }); }, }; }, }, { label: '点表类型', field: 'devicetype', component: 'ApiSelect', componentProps: ({ formModel, formActionType }) => { // debugger; return { // options: provincesOptions, componentProps: {}, api: (params) => defHttp.get({ url: `/sys/dict/getDictItems/${formModel.devicekind + 'kind'}` }, params), resultField: 'result', labelField: 'title', valueField: 'value', }; }, }, { 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: 'plc地址', field: 'plcaddr', component: 'Input', }, { label: '数据类型', field: 'datakind', component: 'JDictSelectTag', componentProps: { dictCode: 'datakind', placeholder: '请选择数据类型', stringToNumber: true, }, }, { label: '字节数', field: 'len', 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: '是否保存', }, }, { label: '是否报警', field: 'bwarning', component: 'JDictSelectTag', componentProps: { dictCode: 'booltype', placeholder: '是否报警', }, }, { label: '是否计算平均值', field: 'avgflag', component: 'JDictSelectTag', componentProps: { dictCode: 'booltype', placeholder: '是否计算平均值', }, }, { label: '小数位数', field: 'floatnum', component: 'InputNumber', }, { label: '备注', field: 'strremark', component: 'InputTextArea', }, ];