import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as QadCostcentreApi from '@/api/wms/qadCostcentre' import { QadCostcentre } from '../qadCostcentre/qadCostcentre.data' import * as QadProjectApi from '@/api/wms/qadProject' import { QadProject } from '../qadProject/qadProject.data' // 表单校验 export const SubjectAccountRules = reactive({ code: [required], usageDescription: [required], costecentreId: [required], costecentreCode: [required], costecentreType: [required], projectId: [required], projectCode: [required], available: [required], concurrencyStamp: [required], }) export const SubjectAccount = useCrudSchemas(reactive([ { label: 'id', field: 'id', sort: 'custom', isForm: false, isTable:false, }, { label: '代码', field: 'code', sort: 'custom', isSearch: true, }, { label: '领用描述', field: 'usageDescription', sort: 'custom', isSearch: true, }, { label: '成本中心ID', field: 'costecentreId', sort: 'custom', isSearch: false, isTable:false, form:{ componentProps:{ disabled:true } } }, { label: '成本中心代码', field: 'costecentreCode', sort: 'custom', isSearch: false, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'costcentreCode', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类 searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '成本中心类型', field: 'costecentreType', sort: 'custom', isSearch: false, form:{ componentProps:{ disabled:true } } }, { label: '项目ID', field: 'projectId', sort: 'custom', isSearch: false, isTable:false, disabled:true, form:{ componentProps:{ disabled:true } } }, { label: '项目代码', field: 'projectCode', sort: 'custom', isSearch: false, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'projectCode', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: QadProject.allSchemas, // 查询弹窗所需类 searchPage: QadProjectApi.getQadProjectPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, table: { width: 120 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, }, { label: '备注', field: 'remark', sort: 'custom', }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, 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' } } ]))