import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { handleTreeToComponentOptions } from '@/utils/tree' import * as DeptApi from '@/api/system/dept' const deptList = ref([]) // 树形结构 // 加载部门树(默认格式) deptList.value = handleTreeToComponentOptions(await DeptApi.getSimpleDeptList()) // 表单校验 export const SpotCheckItemRules = reactive({ content: [required], serialNumber: [required], concurrencyStamp: [required], type: [required], }) export const SpotCheckItem = useCrudSchemas(reactive([ { label: '序号', field: 'serialNumber', sort: 'custom', isSearch: true, fixed: 'left', form: { component:'InputNumber' }, }, { label: '点检内容', field: 'content', sort: 'custom', isSearch: true, form: { component: 'Input', componentProps: { type: 'textarea' } } }, { label: '点检部位', field: 'equipmentParts', sort: 'custom', isSearch: true }, { label: '来源于类型配置', field: 'type', sort: 'custom', dictType: DICT_TYPE.DEVICE_TYPE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { component: 'Select' } }, { label: '部门', field: 'departmentCode', sort: 'custom', isTable: false, isDetail: false, isSearch: false, isTableForm: false, form: { component: 'TreeSelect', componentProps: { // 假设deptList是部门数据列表 data: deptList, placeholder: "请选择部门", filterable: true, // multiple: true, } } }, { label: '是否启用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isTable: true, isDetail: false, isSearch: false, isTableForm: false, isForm: false, }, { label: '备注', field: 'remark', sort: 'custom', isSearch: true }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))