import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import * as SupplierApi from '@/api/wms/supplier' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' import * as WarehouseApi from '@/api/wms/warehouse' import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data' import * as LocationApi from '@/api/wms/location' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import {validateYS} from '@/utils/validator' const { t } = useI18n() // 国际化 /** * @returns {Array} 供应商物料 */ export const Supplieritem = useCrudSchemas(reactive([ { label: '供应商代码', field: 'supplierCode', sort: 'custom', isSearch: true, table: { width: 150, fixed: 'left' }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择供应商代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '供应商信息', // 查询弹窗标题 searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 searchPage: SupplierApi.getSupplierPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '物料代码', field: 'itemCode', sort: 'custom', isSearch: true, table: { width: 180 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '物料基础信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '供应商物料代码', field: 'supplierItemCode', sort: 'custom', isSearch: false, table: { width: 180 } }, { label: '供应商计量单位', field: 'supplierUom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 } }, { label: '转换率', field: 'convertRate', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 0 } }, }, // { // label: '供应商包装单位', // field: 'packUnit', // dictType: DICT_TYPE.PACK_UNIT, // dictClass: 'string', // isTable: true, // sort: 'custom', // table: { // width: 150 // } // }, // { // label: '供应商包装量', // field: 'packQty', // sort: 'custom', // table: { // width: 150 // }, // form: { // component: 'InputNumber', // componentProps: { // min: 1, // precision: 6 // } // }, // }, // { // label: '默认收货仓库', // field: 'defaultWarehouseCode', // sort: 'custom', // table: { // width: 150 // }, // form: { // // labelMessage: '信息提示说明!!!', // componentProps: { // isSearchList: true, // 开启查询弹窗 // searchListPlaceholder: '请选择仓库代码', // 输入框占位文本 // searchField: 'code', // 查询弹窗赋值字段 // searchTitle: '仓库信息', // 查询弹窗标题 // searchAllSchemas: Warehouse.allSchemas, // 查询弹窗所需类 // searchPage: WarehouseApi.getWarehousePage, // 查询弹窗所需分页方法 // searchCondition: [{ // key: 'available', // value: 'TRUE', // isMainValue: false // }] // } // } // }, { label: '默认收货库位', field: 'defaultLocationCode', sort: 'custom', table: { width: 150 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { enterSearch:true, isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库位代码', // 输入框占位文本 searchField: 'code', // 查询弹窗赋值字段 searchTitle: '库位信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, // { // label: '结算方式', // field: 'settlementType', // dictType: DICT_TYPE.SETTLEMENT_TYPE, // dictClass: 'string', // isSearch: true, // isTable: true, // sort: 'custom', // table: { // width: 150 // } // }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 150 } }, { label: '生效时间', field: 'activeTime', formatter: dateFormatter, isTable: true, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '失效时间', field: 'expireTime', isTable: true, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '创建时间', field: 'createTime', isTable: true, isForm: false, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '创建者', field: 'creator', isTable: true, isForm: false, sort: 'custom', table: { width: 150 } }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 } }, { label: '操作', field: 'action', isDetail: false, isForm: false , table: { width: 150, fixed: 'right' } } ])) //表单校验 export const SupplieritemRules = reactive({ supplierCode: [ { required: true, message: '请输入供应商代码', trigger: 'change' } ], itemCode: [ { required: true, message: '请输入物料代码', trigger: 'change' } ], supplierItemCode: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' }, // { validator:validateYS, message: '请输入正确的代码', trigger: 'blur'} ], // packUnit: [ // { required: true, message: '请选择供应商包装单位', trigger: 'change' } // ], // packQty: [ // { required: true, message: '请输入供应商包装量', trigger: 'blur' } // ], available: [ { required: true, message: '请选择是否可用', trigger: 'change' } ], remark: [ { max: 50, message: '不得超过50个字符', trigger: 'blur' } ], })