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.

813 lines
16 KiB

import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const PurchaseMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 150,
fixed: 'left'
},
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPage // 查询弹窗所需分页方法
}
}
},
{
label: '订单类型',
field: 'type',
dictType: DICT_TYPE.PURCHASE_ORDER_TYPE,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.PURCHASE_ORDER_STATUS,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
form: {
value: '1',
componentProps: {
disabled: true
}
}
},
{
label: '订单日期',
field: 'orderDate',
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',
},
value: new Date().getTime()
},
},
{
label: '税率',
field: 'taxRate',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
style: {width:'100%'},
min: 0
}
}
},
{
label: '截止日期',
field: 'dueDate',
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: 'version',
sort: 'custom',
table: {
width: 150
},
},
{
label: '联系人姓名',
field: 'contactName',
sort: 'custom',
table: {
width: 150
},
},
{
label: '联系人电话',
field: 'contactPhone',
sort: 'custom',
table: {
width: 150
},
},
{
label: '联系人电子邮件',
field: 'contactEmail',
sort: 'custom',
table: {
width: 150
},
},
{
label: '当前阶段',
field: 'currentStage',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
style: {width:'100%'},
min: 0
}
}
},
{
label: '备注',
field: 'remark',
table: {
width: 150
},
},
{
label: '是否寄存订单',
field: 'isConsignment',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
isForm: false,
form: {
value: 'PurchaseReceipt',
componentProps: {
disabled: true
}
}
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
isForm: false,
table: {
width: 150
},
},
{
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',
}
},
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
isForm: false,
table: {
width: 150
},
},
{
label: '最后更新时间',
field: 'updateTime',
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',
}
},
},
{
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' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
businessType: [
{ required: true, message: '请输入业务类型', trigger: 'blur' }
],
})
/**
* @returns {Array}
*/
export const PurchaseDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '行号',
field: 'lineNumber',
table: {
width: 150
},
tableForm:{
isSearchList: true, // 开启查询弹窗
}
},
{
label: 'ERP库位',
field: 'erpLocationCode',
dictType : DICT_TYPE.ERP_LOCATION,
dictClass: 'string',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '项目代码',
field: 'projectCode',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '标包数量',
field: 'stdPackQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false,
},
{
label: '标包单位',
field: 'stdPackUnit',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '供应商计量数量',
field: 'supplierQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false,
},
{
label: '供应商计量单位',
field: 'supplierUom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '转换率',
field: 'convertRate',
form: {
component: 'InputNumber',
componentProps: {
min: 0
}
},
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '已发货数量',
field: 'shippedQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
},
value: 1
},
isTableForm: false,
isForm: false,
},
{
label: '已收货数量',
field: 'receivedQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
value: 0,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '已退货数量',
field: 'returnedQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
value: 0,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '已上架数量',
field: 'putawayQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
value: 1,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '超收百分比',
field: 'overReceivingPercent',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0
}
},
tableForm: {
type: 'InputNumber',
min: 0
}
},
{
label: '单价',
field: 'singlePrice',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '金额',
field: 'amount',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '订单数量',
field: 'orderQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '单据号',
field: 'nuumber',
isTableForm: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物品代码',
field: 'itemCode',
table: {
width: 150
},
tableForm:{
isInpuFocusShow: true,
searchListPlaceholder: '请选择物品代码',
searchField: 'code',
searchTitle: '物品基础信息',
searchAllSchemas: Itembasic.allSchemas,
searchPage: ItembasicApi.getItembasicPage
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择物品代码',
searchField: 'code',
searchTitle: '物品基础信息',
searchAllSchemas: Itembasic.allSchemas,
searchPage: ItembasicApi.getItembasicPage
}
}
},
{
label: '明细状态',
field: 'status',
dictType: DICT_TYPE.WORK_ORDER_DETAIL_STATUS,
dictClass: 'string',
isSearch: true,
isTable: true,
isForm: false,
isTableForm: false,
table: {
width: 150
},
form: {
componentProps: {
disabled: true
},
value: 'OPEN'
},
tableForm:{
type: 'Select'
}
},
{
label: '备注',
field: 'remark',
table: {
width: 150
},
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 150
},
tableForm:{
type:'Select'
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '创建者',
field: 'creator',
isTableForm: false,
table: {
width: 150
},
isForm: false,
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
isTableForm: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
isForm: false,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isTableForm: false,
table: {
width: 150
},
isForm: false,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新时间',
field: 'updateTime',
isTableForm: false,
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 150
},
isForm: false,
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
},
isTableForm:false,
}
]))
//表单校验
export const PurchaseDetailRules = reactive({
lineNumber: [
{ required: true, message: '请输入行号', trigger: 'blur' }
],
stdPackQty: [
{ required: true, message: '请输入标包数量', trigger: 'blur' }
],
stdPackUnit: [
{ 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' }
],
})