import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import * as ItemAccountsApi from '@/api/eam/itemAccounts' import { ItemAccounts } from '@/views/eam/itemAccounts/itemAccounts.data' import { EquipmentAccounts } from '@/views/eam/equipmentAccounts/equipmentAccounts.data' import * as EquipmentItemApi from '@/api/eam/equipmentAccounts' import { dateFormatter } from '@/utils/formatTime' export const SparePartsOutLocationRecordMain = useCrudSchemas( reactive([ { label: '申请编号', field: 'number', sort: 'custom', isSearch: true, isForm: false }, { label: '描述', field: 'description', sort: 'custom', isSearch: true }, { label: '申领备件总价', field: 'sumVal', sort: 'custom', isSearch: false, isTable: false, isForm: false }, { label: '流程状态', field: 'status', sort: 'custom', dictType: DICT_TYPE.SPAREPARTS_APPLY_STATUS_ENUM, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { component: 'Select' } }, { label: '申请人', field: 'applyer', sort: 'custom', isSearch: false, isTable: false, isForm: false }, { label: '审核人', field: 'approver', sort: 'custom', isSearch: false, isTable: false, isForm: false, form: { component: 'InputNumber', value: 0 } }, { label: '审核内容', field: 'approveContent', sort: 'custom', isSearch: true, isTable: false, isForm: false }, { label: '审核时间', field: 'approveTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: 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 }, { label: '自动通过', field: 'autoAgree', sort: 'custom', isSearch: false, isTable: false, isForm: false }, { label: '直接生成记录', field: 'directCreateRecord', sort: 'custom', isSearch: false, isTable: false, isForm: false }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, isTable: 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: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]) ) //表单校验 export const SparePartsOutLocationRecordMainRules = reactive({ description: [{ required: true, message: '描述不能为空', trigger: 'change' }] }) /** * @returns {Array} 备件申请子表 */ export const SparePartsOutLocationRecordDetail = useCrudSchemas( reactive([ { label: '备件编号', field: 'sparePartsCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择备件编号', // 输入框占位文本 searchField: 'itemNumber', // 查询弹窗赋值字段 searchTitle: '备件信息', // 查询弹窗标题 searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } }, tableForm: { isInpuFocusShow: true, searchListPlaceholder: '请选择备件编号', // 输入框占位文本 searchField: 'itemNumber', // 查询弹窗赋值字段 searchTitle: '备件信息', // 查询弹窗标题 searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } }, { label: '设备类别', field: 'type', dictType: DICT_TYPE.DEVICE_TYPE, dictClass: 'string', isTable: true, sort: 'custom', isSearch: false, table: { width: 150 }, tableForm: { type: 'Select' } }, { label: '设备工装编号', field: 'equipmentCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', 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 } ] } }, tableForm: { isInpuFocusShow: true, searchListPlaceholder: '请选择备件编号', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '备件信息', // 查询弹窗标题 searchAllSchemas: EquipmentAccounts.allSchemas, // 查询弹窗所需类 searchPage: EquipmentItemApi.getEquipmentAccountsPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'status', value: 'NORMAL', action: '==', isSearch: true, isMainValue: false } ] } }, { label: '库存数量', field: 'currentQty', sort: 'custom', isSearch: false, tableForm: { disabled: true } }, { label: '申领数量', field: 'applyQty', sort: 'custom', isSearch: false }, { label: '备注', field: 'remark', sort: 'custom', isSearch: false }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 150, fixed: 'right' }, isTableForm: false } ]) ) //表单校验 export const SparePartsOutLocationRecordDetailRules = reactive({ applyQty: [{ required: true, message: '请输入标包数量', trigger: 'blur' }] })