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.
 
 
 
 

105 lines
2.2 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import {validateHanset,validateFax,validatePostCode,validateYS} from '@/utils/validator'
// 表单校验
export const SupplierRules = reactive({
number: [
{ required: true, message: '请输入供应商编号', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入供应商名称', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
phone: [
{ max: 11, message: '不得超过11个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
],
})
export const Supplier = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '供应商编号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: true,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '供应商名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '简称',
field: 'shortName',
sort: 'custom',
isSearch: false,
},
{
label: '联系人',
field: 'contacts',
sort: 'custom',
},
{
label: '联系电话',
field: 'phone',
sort: 'custom',
isSearch: false,
},
{
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: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
table: {
width: 170
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))