import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter2 } from '@/utils/formatTime' import { SparePart } from '@/views/eam/sparePart/sparePart.data' import * as ItemApi from '@/api/eam/sparePart' import { validateHanset, validateEmail } from '@/utils/validator' const { t } = useI18n() // 国际化 /** * @returns {Array} 备件申请主表 */ export const ItemOrderMain = useCrudSchemas(reactive([ { label: '采购订单编号', field: 'number', sort: 'custom', isForm: false, isSearch: true, table: { width: 150, fixed: 'left' }, }, { label: '电话', field: 'phone', sort: 'custom', }, { label: '传真', field: 'fax', sort: 'custom', }, { label: '采购员', field: 'purchaser', sort: 'custom', }, { label: '供应商编号', field: 'supplierNumber', sort: 'custom', }, { label: '供应商名称', field: 'supplierName', sort: 'custom', }, { label: '供应商地址', field: 'supplierAddress', sort: 'custom', }, { label: '发货至', field: 'shipTo', sort: 'custom', }, { label: '开票至', field: 'invoiceTo', sort: 'custom', }, { label: '联系人', field: 'contacts', sort: 'custom', }, { label: '联系电话', field: 'contactsPhone', sort: 'custom', }, { label: '付款方式', field: 'paymentType', sort: 'custom', form: { component: 'Select' }, }, { label: '注册地', field: 'registLocation', sort: 'custom', }, { label: '开户行', field: 'bank', sort: 'custom', }, { label: '账号', field: 'account', sort: 'custom', }, { label: '税号', field: 'dutyParagraph', sort: 'custom', }, // { // 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: 'FALSE', // componentProps: { // inactiveValue: 'FALSE', // activeValue: 'TRUE' // } // } // }, { label: '状态', field: 'status', sort: 'custom', dictType: DICT_TYPE.IS_COMPLETE, dictClass: 'string', isTable: true, isForm: true, tableForm: { type: 'Select' }, form: { value: 'INCOMPLETE', componentProps: { disabled: true, } } }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 200, fixed: 'right' } } ])) //表单校验 export const ItemOrderMainRules = reactive({ available: [ { required: true, message: '请选择是否关闭', trigger: 'change' } ], }) /** * @returns {Array} 备件申请子表 */ export const ItemOrderDetail = useCrudSchemas(reactive([ { label: '备件编号', field: 'itemNumber', sort: 'custom', isSearch: true, tableForm: { isInpuFocusShow: true, searchListPlaceholder: '请选择备件编号', searchField: 'number', searchTitle: '备件信息', searchAllSchemas: SparePart.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false } ] }, }, { label: '备件名称', field: 'itemName', sort: 'custom', isSearch: true, table: { width: 110, }, tableForm: { disabled: true } }, { label: '单位', field: 'uom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select', disabled: true } }, { label: '单价', field: 'singlePrice', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, isTable: true, table: { width: 150 }, tableForm: { type: 'Select', disabled: true } }, { label: '是否以旧换新', field: 'isRadeIn', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, isTable: true, table: { width: 150 }, tableForm: { type: 'Select', disabled: true } }, { label: '库存数量', field: 'qty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 } }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '备注', field: 'remark', table: { width: 150 }, }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 150, fixed: 'right' }, isTableForm: false, } ])) //表单校验 export const ItemOrderDetailRules = reactive({ singlePrice: [ { required: true, message: '请输入备件单价', trigger: 'blur' }, ], })