import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' const { t } = useI18n() // 国际化 /** * @returns {Array} 供应商 */ export const Supplier = useCrudSchemas(reactive([ { label: '代码', field: 'code', sort: 'custom', isSearch: true, table: { width: 150, fixed: 'left' } }, { label: '名称', field: 'name', sort: 'custom', table: { width: 150 } }, { label: '简称', field: 'shortName', sort: 'custom', table: { width: 150 } }, { label: '地址', field: 'address', sort: 'custom', table: { width: 150 } }, { label: '国家', field: 'country', sort: 'custom', table: { width: 150 } }, { label: '城市', field: 'city', sort: 'custom', table: { width: 150 } }, { label: '电话', field: 'phone', sort: 'custom', table: { width: 150 } }, { label: '传真', field: 'fax', sort: 'custom', table: { width: 150 } }, { label: '邮编', field: 'postId', sort: 'custom', table: { width: 150 } }, { label: '联系人', field: 'contacts', sort: 'custom', table: { width: 150 } }, { label:'银行', field: 'bank', sort: 'custom', table: { width: 150 } }, { label: '币种', field: 'currency', sort: 'custom', dictType: DICT_TYPE.CURRENCY, dictClass: 'string', isSearch: true, isTable: true, table: { width: 150 } }, { label: '税率', field: 'taxRate', sort: 'custom', form: { component: 'InputNumber', componentProps: { min: 0 } }, table: { width: 150 } }, { label: '类型', field: 'type', sort: 'custom', dictType: DICT_TYPE.SUPPLIER_TYPE, dictClass: 'string', isSearch: true, isTable: true, table: { width: 150 } }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, isTable: true, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 150 } }, { label: '生效时间', field: 'activeTime', sort: 'custom', isTable: true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, table: { width: 180 } }, { label: '失效时间', field: 'expireTime', sort: 'custom', isTable: true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, table: { width: 180 } }, { label: '备注', field: 'remark', sort: 'custom', isTable: false, isForm: false, }, { label: '创建时间', field: 'createTime', sort: 'custom', isTable: false, isForm: false, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, table: { width: 180 } }, { label: '创建者', field: 'creator', sort: 'custom', isTable: false, isForm: false, }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' } } ])) //表单校验 export const SupplierRules = reactive({ code: [ { required: true, message: '请输入代码', trigger: 'blur' } ], shortName: [ { required: true, message: '请输入简称', trigger: 'blur' } ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], })