import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as UserApi from '@/api/system/user' export interface User { id: number, nickname: string } // 表单校验 export const ToolChangedRecordRules = reactive({ code: [required], name: [required], concurrencyStamp: [required] }) const userList = ref([]) userList.value = await UserApi.getSimpleUserList() export const ToolChangedRecord = useCrudSchemas(reactive([ { label: '工装编号', field: 'code', sort: 'custom', isSearch: true, fixed: 'left' }, { label: '工装名称', field: 'name', sort: 'custom', isSearch: true }, { label: '变更前状态', field: 'statusBefore', sort: 'custom', isSearch: true, dictType: DICT_TYPE.DEVICE_STATUS, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { component: 'Select' } }, { label: '变更后状态', field: 'statusAfter', sort: 'custom', isSearch: true, dictType: DICT_TYPE.DEVICE_STATUS, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { component: 'Select', } }, { label: '操作人', field: 'operator', sort: 'custom', isSearch: true, search: { component: 'Select', componentProps: { options: userList.value, optionsAlias: { valueField: 'id', labelField: 'nickname' }, filterable: true, clearable: true } }, }, { label: '操作时间', field: 'operateTime', 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '备注', field: 'remark', sort: 'custom', isSearch: true }, // { // label: '操作', // field: 'action', // isForm: false, // table: { // width: 150, // fixed: 'right' // } // } ]))