import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { TableColumn } from '@/types/table' import * as PszcCommonApi from '@/api/pszc/pszccommon' // 数据点 const sjdList = await PszcCommonApi.selectHr108Pros({flag: '5' , type: '1'}) // 仪器仪表 const yqbList = await PszcCommonApi.selectHr108Pros({flag: '5' , type: '2'}) // 表单校验 export const HrSizingmilldata108Rules = reactive({ }) export const HrSizingmilldata108 = useCrudSchemas(reactive([ { label: '数据点编号', field: 'icode', sort: 'custom', isSearch: false, }, { label: '数据点名称', field: 'icode', isTable: true, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { return sjdList.find((obj) => obj.code === cellValue)?.label }, search: { show: true, component: 'Select', api: () => sjdList, componentProps: { optionsAlias: { labelField: 'label', valueField: 'code' } } }, form: { component: 'Select', api: () => sjdList, componentProps: { optionsAlias: { labelField: 'label', valueField: 'code' } } } }, { label: '采集值', field: 'ivalue', sort: 'custom', isSearch: false, }, { label: '仪表的编号', field: 'mcode', sort: 'custom', isSearch: false, }, { label: '仪表的名称', field: 'mcode', isTable: true, formatter: (_: Recordable, __: TableColumn, cellValue: number) => { return yqbList.find((obj) => obj.code === cellValue)?.label }, search: { show: true, component: 'Select', api: () => yqbList, componentProps: { optionsAlias: { labelField: 'label', valueField: 'code' } } }, form: { component: 'Select', api: () => yqbList, componentProps: { optionsAlias: { labelField: 'label', valueField: 'code' } } } }, { label: '开始时间', field: 'updateTime', sort: 'custom', formatter: dateFormatter, isSearch: false, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, isForm: false, }, { label: '结束时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, isForm: false, } // , // { // label: '操作', // field: 'action', // isForm: false, // table: { // width: 150, // fixed: 'right' // } // } ]))