You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

445 lines
8.2 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter2 } from '@/utils/formatTime'
import { validateHanset, validateEmail } from '@/utils/validator'
import { dateFormatter } from '@/utils/formatTime'
import { validateTwoNum, validateSixNum } from '@/utils/validator'
const { t } = useI18n() // 国际化
/**
* @returns {Array} 检验任务主表
*/
export const InspectionRecordMain = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '记录编码',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 200,
fixed: 'left'
}
},
{
label: '状态',
field: 'isPublished',
dictType: DICT_TYPE.PUBLISHE_STATUS,
sort: 'custom',
isSearch: false,
table: {
width: 150
},
},
{
label: '物料编码',
field: 'itemCode',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 200
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '检验批次',
field: 'inspectionBatch',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
}
},
{
label: '检验方案编码',
field: 'inspectionSchemeCode',
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 200
}
},
{
label: '检验人',
field: 'creator',
table: {
width: 130
},
isForm: false,
isTable: true
},
{
label: '检验时间',
field: 'inspectionTime',
sort: 'custom',
isDetail: true,
isForm: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
table: {
width: 200,
fixed: 'right'
}
}
])
)
//表单校验
export const InspectionRecordMainRules = reactive({
useDecision: [required],
})
/**
* @returns {Array} 检验任务子表
*/
export const InspectionRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isSearch: false,
isForm: false,
},
{
label: '记录编码',
field: 'recordCode',
sort: 'custom',
isSearch: false,
},
{
label: '工序编码',
field: 'processCode',
sort: 'custom',
isSearch: false,
},
{
label: '工序描述',
field: 'processDescribe',
sort: 'custom',
isSearch: false,
},
{
label: '顺序号',
field: 'sequenceCode',
sort: 'custom',
isSearch: false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '是否破坏性检验',
field: 'isDestroyInspection',
sort: 'custom',
isSearch: false,
form: {
component: 'Radio'
},
},
{
label: '检验开始时间',
field: 'inspectionStartTime',
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: 'inspectionEndTime',
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: 'inspectionOperator',
sort: 'custom',
isSearch: false,
},
{
label: '检验特性编码',
field: 'inspectionFeaturesCode',
sort: 'custom',
isSearch: false,
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// isSearch: 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: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isTableForm: false,
}
]))
//表单校验
export const InspectionRecordDetailRules = reactive({
recordCode: [required],
processCode: [required],
sequenceCode: [required],
isDestroyInspection: [required],
available: [required],
})
/**
* @returns {Array} 检验记录包装
*/
export const InspectionRecordPackage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
field: 'number',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:200
},
table:{
width:150
}
},
{
label: '包装号',
field: 'packageCode',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:160
},
table:{
width:150
}
},
{
label: '包装规格',
field: 'packageSpecificationCode',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:150
},
table:{
width:150
}
},
{
label: '数量',
field: 'amount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
tableForm:{
disabled:true,
width:120
},
table:{
width:150
}
},
{
label: '计量单位',
field: 'measuringUnit',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:120
},
table:{
width:150
}
},
{
label: '采样数量',
field: 'sampleAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '合格数量',
field: 'qualifiedAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '不合格数量',
field: 'noQualifiedAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '破坏数量',
field: 'destroyAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
},
{
label: '冻结数量',
field: 'frozenAmount',
sort: 'custom',
isSearch: true,
tableForm:{
disabled:true,
width:100
},
table:{
width:150
}
}
]))
//表单校验
export const InspectionRecordPackageRules = reactive({
qualifiedAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
frozenAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
destroyAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
noQualifiedAmount: [
required,
{ validator:validateSixNum, message: '小数点后最多6位', trigger: 'blur'}
],
})