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.
 
 
 

999 lines
20 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import { validateHanset, validateEmail } from '@/utils/validator'
const { t } = useI18n() // 国际化
/**
* @returns {Array} 采购订单主表
*/
export const PurchaseMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
sortTableDefault: 1,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.PURCHASE_ORDER_STATUS,
dictClass: 'string',
isTable: true,
isForm: false,
isSearch: true,
sortSearchDefault: 1000,
sortTableDefault: 2,
sort: 'custom',
table: {
width: 150
},
form: {
value: '1',
componentProps: {
disabled: true
}
}
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
labelMessage: '影响明细中物料代码,需在供应商物料中维护',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
}
},
sortTableDefault: 3,
},
{
label: '供应商名称',
field: 'supplierName',
dictClass: 'string',
isTable: true,
isSearch: false,
isForm: false,
sort: 'custom',
sortTableDefault:4,
table: {
width: 150
},
},
{
label: '订单类型',
field: 'type',
dictType: DICT_TYPE.PURCHASE_ORDER_TYPE,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
sortTableDefault: 5,
table: {
width: 150
},
},
// {
// label: '行类型',
// field: 'poLineType',
// isTable: false,
// isSearch: true,
// sort: 'custom',
// table: {
// width: 150
// },
// },
{
label: '订单日期',
field: 'orderDate',
isTable: false,
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
sortTableDefault: 6,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
},
value: new Date().getTime()
},
},
{
label: '截止日期',
field: 'dueDate',
isTable: false,
isForm: false,
formatter: dateFormatter2,
detail:{
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
sortTableDefault: 7,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
},
{
label: '版本',
field: 'version',
sort: 'custom',
isTable: false,
table: {
width: 150
},
},
{
label: '税率',
field: 'taxRate',
sort: 'custom',
table: {
width: 150
},
isTable: false,
form: {
component: 'InputNumber',
componentProps: {
style: {width:'100%'},
min: 0,
max: 1,
precision: 6,
}
}
},
{
label: '支付周期',
field: 'paymentCycle',
sort: 'custom',
isTable: false,
isForm: false,
table: {
width: 150
},
},
{
label: '联系人姓名',
field: 'contactName',
sort: 'custom',
isTable: false,
table: {
width: 150
},
},
{
label: '联系人电话',
field: 'contactPhone',
sort: 'custom',
isTable: false,
table: {
width: 150
},
},
{
label: '联系人电子邮件',
field: 'contactEmail',
sort: 'custom',
isTable: false,
table: {
width: 150
},
},
{
label: '是否寄存订单',
field: 'isConsignment',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
sort: 'custom',
table: {
width: 150
},
isForm: false,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '订单备注',
field: 'poRmks',
sort: 'custom',
isTable: false,
isForm:false,
table: {
width: 150
},
},
{
label: '管理编号',
field: 'poContract',
sort: 'custom',
isTable:true,
isForm:false,
table: {
width: 150
},
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTable: false,
form: {
value: 'PurchaseReceipt',
componentProps: {
disabled: true
}
}
},
{
label: '数据来源区分',
field: 'dataSource',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTable: false,
form: {
}
},
// {
// label: '当前阶段',
// field: 'currentStage',
// sort: 'custom',
// table: {
// width: 150
// },
// form: {
// component: 'InputNumber',
// componentProps: {
// style: {width:'100%'},
// min: 0
// }
// },
// isTableForm: false,
// isForm: false,
// isTable:false,
// },
{
label: '创建者',
field: 'creator',
sort: 'custom',
isForm: false,
isTable: true,
table: {
width: 150
},
sortTableDefault: 1000,
},
{
label: '创建时间',
field: 'createTime',
isTable:true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
isForm: false,
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
sortTableDefault: 1000,
},
// {
// label: '备注',
// field: 'remark',
// isTable: false,
// table: {
// width: 150
// },
// },
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))
//表单校验
export const PurchaseMainRules = reactive({
supplierCode: [
{ required: true, message: '请输入供应商代码', trigger: 'change' }
],
type: [
{ required: true, message: '请选择订单类型', trigger: 'change' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
orderDate: [
{ required: true, message: '请输入订单日期', trigger: 'change' }
],
taxRate: [
{ required: true, message: '请输入税率', trigger: 'blur' }
],
version: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contactName: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contactPhone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
],
contactEmail: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateEmail, message: '请输入正确的邮箱格式', trigger: 'blur'}
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
})
/**
* @returns {Array} 采购订单子表
*/
export const PurchaseDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '行号',
field: 'lineNumber',
table: {
width: 150
},
tableForm:{
disabled:true,
isSearchList: true, // 开启查询弹窗
}
},
{
label: '品番',
field: 'itemCode',
isSearch: true,
table: {
width: 150
},
tableForm:{
disabled:true,
multiple:true,//多选
isInpuFocusShow: true,
searchListPlaceholder: '请选择供应商物料',
searchField: 'itemCode',
searchTitle: '供应商物料信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.selectItembasicTypeToSupplieritem,
searchCondition: [{
key:'supplierCode',
value:'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationPage: SupplieritemApi.getSupplierItemListByCodes, // tableForm下方输入框校验失去焦点之后是否正确的方法
isShowTableFormSearch: true, //tableForm下方是否出现输入框
isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据
// 失去焦点校验参数
verificationParams: [{
key: 'itemCode',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true,
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择供应商物料',
searchField: 'itemCode',
searchTitle: '供应商物料信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.selectItembasicTypeToSupplieritem,
searchCondition: [{
key:'supplierCode',
value:'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
// 失去焦点校验参数
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true,
}]
}
}
},
{
label: '行类型',
field: 'poLineType',
isTable: true,
isSearch: false,
sort: 'custom',
table: {
width: 150
},
},
{
label: '采购订单数量',
field: 'orderQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
disabled: false,
min: 1,
precision: 6
}
},
tableForm: {
disabled: false,
hidden: false,
type: 'InputNumber',
min: 1,
precision: 6
},
},
{
label: '采购标包数量',
field: 'purchaseStdQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
disabled: false,
min: 1,
precision: 6
}
},
hiddenInMain: true,
tableForm: {
disabled: false,
hidden: false,
type: 'InputNumber',
min: 1,
precision: 6
},
},
{
label: '采购计量单位',
field: 'purchaseStdUom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
isTableForm: true,
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true,
type: 'Select',
},
table: {
width: 150
},
},
{
label: '转换率',
field: 'convertRate',
form: {
component: 'InputNumber',
componentProps: {
min: 0
}
},
hiddenInMain: true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: t('ts.单价'),
field: 'singlePrice',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '金额',
field: 'amount',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '库存标包数量',
field: 'packQty',
hiddenInMain: true,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false,
},
{
label: '库存标包规格',
hiddenInMain: true,
field: 'packUnit',
// dictType: DICT_TYPE.PACK_UNIT,
// dictClass: 'string',
isTable: true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '库存计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
isTableForm: true,
hiddenInMain: true,
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true,
type: 'Select',
},
table: {
width: 150
},
},
{
label: '默认收货库区',
field: 'defaultAreaCode',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
hiddenInMain: true,
isTableForm: false,
isForm: false,
isTable: false,
},
// {
// label: 'ERP库位',
// field: 'erpLocationCode',
// dictType : DICT_TYPE.ERP_LOCATION,
// dictClass: 'string',
// table: {
// width: 150
// },
// hiddenInMain:true,
// isTableForm: false,
// isForm: false,
// isTable: false,
// },
{
label: t('ts.已计划数量'),
field: 'plannedPurchaseQty',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
},
value: 1
},
isTableForm: false,
isForm: false,
},
{
label: t('ts.已发货数量'),
field: 'shippedPurchaseQty',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
},
value: 1
},
isTableForm: false,
isForm: false,
},
{
label: t('ts.已收货数量'),
field: 'receivedPurchaseQty',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: t('ts.已退货数量'),
field: 'returnedPurchaseQty',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: t('ts.已上架数量'),
field: 'putawayPurchaseQty',
table: {
width: 150
},
hiddenInMain: true,
form: {
component: 'InputNumber',
value: 1,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '库区描述',
field: 'areaDescription',
table: {
width: 150
},
hiddenInMain: true,
form: {
componentProps: {
disabled: true
}
},
isTableForm: false,
isForm: false,
isTable: false,
},
{
label: '项目代码',
field: 'projectCode',
table: {
width: 150
},
hiddenInMain: true,
isTableForm: false,
isForm: false,
isTable: false,
},
{
label: '供应商计量数量',
field: 'supplierQty',
hiddenInMain:true,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false,
isTable: false,
},
{
label: '供应商计量单位',
field: 'supplierUom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: false,
hiddenInMain:true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '超收百分比',
field: 'overReceivingPercent',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
componentProps: {
min: 0
}
},
isTable:false,
isTableForm:false,
tableForm: {
type: 'InputNumber',
min: 0
}
},
// {
// label: '创建时间',
// field: 'createTime',
// isTable: true,
// isTableForm: false,
// formatter: dateFormatter,
// detail: {
// dateFormat: 'YYYY-MM-DD HH:mm:ss'
// },
// table: {
// width: 180
// },
// hiddenInMain:false,
// isForm: false,
// form: {
// component: 'DatePicker',
// componentProps: {
// style: {width:'100%'},
// type: 'datetime',
// dateFormat: 'YYYY-MM-DD HH:mm:ss',
// valueFormat: 'x',
// }
// }
// },
// {
// label: '创建者',
// field: 'creator',
// isTableForm: false,
// table: {
// width: 150
// },
// hiddenInMain:false,
// isForm: false,
// },
{
label: '备注',
hiddenInMain:true,
field: 'remark',
table: {
width: 150
},
isTable: false,
},
{
label: '操作',
hiddenInMain:true,
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
},
isTableForm:false,
}
]))
//表单校验
export const PurchaseDetailRules = reactive({
lineNumber: [
{ required: true, message: '请输入行号', trigger: 'blur' },
// { max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
packQty: [
{ required: true, message: '请输入包装数量', trigger: 'blur' }
],
packUnit: [
{ required: true, message: '请选择包装规格', trigger: 'change' }
],
convertRate: [
{ required: true, message: '请输入转换率', trigger: 'blur' }
],
taxRate: [
{ required: true, message: '请输入税率', trigger: 'blur' }
],
shippedQty: [
{ required: true, message: '请输入已发货数量', trigger: 'blur' }
],
receivedQty: [
{ required: true, message: '请输入已收货数量', trigger: 'blur' }
],
returnedQty: [
{ required: true, message: '请输入已退货数量', trigger: 'blur' }
],
putawayQty: [
{ required: true, message: '请输入已上架数量', trigger: 'blur' }
],
overReceivingPercent: [
{ required: true, message: '请输入超收百分比', trigger: 'blur' }
],
orderQty: [
{ required: true, message: '请输入订单数量', trigger: 'blur' }
],
// uom: [
// { required: true, message: '请选择计量单位', trigger: 'change' }
// ],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
nuumber: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})