import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import { EquipmentAccounts } from '@/views/eam/equipmentAccounts/equipmentAccounts.data' import * as EquipmentItemApi from '@/api/eam/equipmentAccounts' import { BasicMaintenanceOption } from '@/views/eam/basicMaintenanceOption/basicMaintenanceOption.data' import * as MaintenanceOptionApi from '@/api/eam/basicMaintenanceOption' import { BasicEamWorkshop } from '@/views/eam/basicEamWorkshop/basicEamWorkshop.data' import * as WorkshopApi from '@/api/eam/basicEamWorkshop' // 表单校验 export const MaintenanceRules = reactive({ name: [required], type: [required], equipmentCode: [required], optionCode: [required], cycle: [required], startTime: [required], endTime: [required], workshopCode: [required] }) export const Maintenance = useCrudSchemas( reactive([ { label: 'id', field: 'id', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '计划编号', field: 'number', sort: 'custom', isSearch: true, isForm: false, isDetail: true }, { label: '计划名称1', field: 'name', sort: 'custom', isSearch: true }, { label: '设备类别', field: 'type', dictType: DICT_TYPE.DEVICE_TYPE, dictClass: 'string', sort: 'custom', isSearch: false }, { label: '设备工装编号', field: 'equipmentCode', sort: 'custom', isSearch: true, isForm: true, form: { componentProps: { isSearchList: true, // 开启查询弹窗 searchTitle: '设备信息', // 查询弹窗标题 searchListPlaceholder: '请选择 设备编号', // 输入框占位文本 searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类 searchField: 'code', // 查询弹窗赋值字段 searchPage: EquipmentItemApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法 multiple: true, searchCondition: [ { key: 'status', value: 'NORMAL', action: '==', isSearch: true, isMainValue: false } ] } } }, { label: '方案编号', field: 'optionCode', sort: 'custom', isSearch: true, isForm: true, form: { componentProps: { isSearchList: true, // 开启查询弹窗 searchTitle: '保养方案信息', // 查询弹窗标题 searchListPlaceholder: '请选择保养方案', // 输入框占位文本 searchAllSchemas: BasicMaintenanceOption.allSchemas, // 查询弹窗所需类 searchField: 'code', // 查询弹窗赋值字段 searchPage: MaintenanceOptionApi.getBasicMaintenanceOptionPage, // 查询弹窗所需分页方法 multiple: true, searchCondition: [ { key: 'available', value: 'TRUE', action: '==', isSearch: true, isMainValue: false } ] } } }, { label: '周期', field: 'cycle', dictType: DICT_TYPE.MAINTENANCE_CYCLE, dictClass: 'string', sort: 'custom', isSearch: true }, { label: '计划开始时间', field: 'startTime', 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '计划结束时间', field: 'endTime', 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '状态', field: 'status', sort: 'custom', isSearch: true, dictType: DICT_TYPE.EAM_PLAN_STATUS, dictClass: 'string' }, { label: '审核人', field: 'approver', sort: 'custom', isSearch: false, isForm: false }, { label: '审核内容', field: 'approveContent', sort: 'custom', isSearch: false, isForm: false }, { label: '审核时间', field: 'approveTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isForm: 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '自动审核', field: 'autoExamine', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '自动通过', field: 'autoAgree', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '直接生成记录', field: 'directCreateRecord', sort: 'custom', isSearch: false }, { label: '所属厂区编号', field: 'factoryAreaCode', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '车间代码', field: 'workshopCode', sort: 'custom', isSearch: false, required: true, form: { componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '车间', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '车间信息', // 查询弹窗标题 searchAllSchemas: BasicEamWorkshop.allSchemas, // 查询弹窗所需类 searchPage: WorkshopApi.getBasicEamWorkshopPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '创建时间', field: 'createTime', 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: '部门id', field: 'departmentCode', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false }, { label: '地点ID', field: 'siteId', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isTable: true, isDetail: false, isSearch: true, isTableForm: false, isForm: false }, { label: '删除时间', field: 'deletionTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm: false, isDetail: 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '删除人id', field: 'deleterId', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false, form: { component: 'InputNumber', value: 0 } }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]) ) // 表单校验 export const RelationMaintenancePlanItemRules = reactive({ planNumber: [required], itemCode: [required], itemName: [required] }) export const RelationMaintenancePlanItem = useCrudSchemas( reactive([ { label: 'id', field: 'id', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '计划编号', field: 'planNumber', sort: 'custom', isSearch: true }, { label: '项编号', field: 'itemCode', sort: 'custom', isSearch: true }, { label: '保养名称', field: 'itemName', sort: 'custom', isSearch: true }, { label: '是否必选', field: 'isSelectd', sort: 'custom', isSearch: true, dictType: DICT_TYPE.FALSE_OR_TRUE, dictClass: 'string' }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm: false, isDetail: 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: '部门id', field: 'departmentCode', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '地点ID', field: 'siteId', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '是否可用默认TRUE', field: 'available', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '删除时间', field: 'deletionTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: false, isForm: false, isDetail: 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '删除人id', field: 'deleterId', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isSearch: false, isTable: false, isForm: false, isDetail: false, form: { component: 'InputNumber', value: 0 } }, { label: '操作', field: 'action', isSearch: false, isTable: false, isForm: false, isDetail: false, table: { width: 150, fixed: 'right' } } ]) )