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.
 
 
 
 

397 lines
8.0 KiB

import { setComponentProps } from '@/components/Form/src/helper'
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const ItemRules = reactive({
number: [
{ required: true, message: '请输入备件编号', trigger: 'blur' },
{ max: 20, message: '不得超过20个字符', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入备件名称', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
uom: [
{ required: true, message: '请选择备件单位', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
classification: [{ required: true, message: '请选择备件分类', trigger: 'blur' }],
describes: [{ max: 600, message: '不得超过600个字符', trigger: 'blur' }]
})
export const Item = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '备件编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: true,
table: {
width: 180,
fixed: 'left'
}
},
{
label: '备件名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {
width: 110
}
},
{
label: '规格',
field: 'specifications',
sort: 'custom'
},
{
label: '是否常储',
field: 'isConstant',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 110
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '科目',
field: 'subject',
sort: 'custom',
dictType: DICT_TYPE.ITEM_SUBJECT,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '科目代码',
field: 'subjectCode',
sort: 'custom',
isTable: true
},
{
label: '单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '类别',
field: 'category',
sort: 'custom',
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '备件分类',
field: 'classification',
sort: 'custom',
dictType: DICT_TYPE.CLASSIFICATION,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '区域',
field: 'region',
sort: 'custom',
dictType: DICT_TYPE.ITEM_REGION,
dictClass: 'string',
isSearch: false,
isTable: true,
tableForm: {
type: 'Select'
}
},
// {
// label: '采购方式',
// field: 'purchaseWay',
// sort: 'custom',
// dictType: DICT_TYPE.PURCHASE_WAY,
// dictClass: 'string',
// isSearch: false,
// isTable: true,
// tableForm: {
// type: 'Select'
// }
// },
{
label: '物料类型',
field: 'itemType',
sort: 'custom',
isSearch: true,
table: {
width: 110
}
},
{
label: '单价',
field: 'singlePrice',
sort: 'custom'
},
{
label: '重采购点',
field: 'reprocurement',
sort: 'custom',
table: {
width: 110
},
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '安全库存',
field: 'safetyStock',
sort: 'custom',
isSearch: false,
isForm: true,
table: {
width: 110
},
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '成本中心',
field: 'cost',
sort: 'custom',
table: {
width: 110
}
},
{
label: '采购员',
field: 'purchaser',
sort: 'custom',
table: {
width: 100
}
},
{
label: '财务',
field: 'financer',
sort: 'custom'
},
{
label: '是否以旧换新',
field: 'isRadeIn',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 140
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '是否框架协议',
field: 'isFramework',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
isTable: true,
sort: 'custom',
table: {
width: 140
},
tableForm: {
type: 'Select',
inactiveValue: 'FALSE',
disabled: true
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
// {
// label: '是否可用',
// field: 'available',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string',
// isSearch: false,
// isTable: true,
// sort: 'custom',
// table: {
// width: 150
// },
// tableForm: {
// type: 'Select',
// inactiveValue: 'FALSE',
// disabled: true
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// }
// },
{
label: '描述',
field: 'describes',
sort: 'custom',
form: {
component: 'Input',
componentProps: {
type: 'textarea'
},
colProps: {
span: 24
}
}
},
{
label: '创建者',
field: 'creator',
hiddenSearchHigh: true,
sort: 'custom',
isSearch: false,
isForm: false,
table: {
width: 150
}
},
{
label: '创建时间',
field: 'createTime',
hiddenSearchHigh: true,
sort: 'custom',
formatter: dateFormatter,
isForm: false,
table: {
width: 170
}
},
// {
// label: '图片',
// field: 'upload',
// isTable: true,
// },
// {
// label: '文件',
// field: 'filePathListView',
// sort: 'custom',
// isTable: false,
// table: {
// },
// form: {
// component: 'UploadFile',
// componentProps: {
// }
// }
// },
{
label: '文件',
field: 'attachmentFileList',
sort: 'custom',
isTable: false,
isForm: true,
table: {},
form: {
component: 'UploadImgs',
colProps: {
span: 24
}
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
])
)
export const ItemSearchTable = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '备件编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
fixed: 'left'
}
},
{
label: '备件名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {}
},
{
label: '数量',
field: 'qty',
sort: 'custom',
hiddenSearchHigh: true,
}
])
)