Commit 247e07d0 authored by Bill's avatar Bill

fix: 修改物料上传校验,部分字段校验

parent ffb5919d
......@@ -26,7 +26,7 @@ import ProcurementRoute from './procurementRoute'; // todo wuting
// import contracRoute from './contracRoute';
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
const isDev = process.env.NODE_ENV === "development";
const isDev = false;
const homeRoute = {
path: `/memberCenter/home`,
name: 'home',
......
......@@ -34,6 +34,7 @@ interface PickUploadProps extends Pick<UploadProps, PickProps> {
* 自定义渲染child
*/
renderUploadChild?: (fileList: any[]) => React.ReactNode,
multiple?: boolean,
}
const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
......@@ -55,6 +56,7 @@ const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
showFiles,
renderUploadChild,
maxCount,
multiple,
} = props;
const hasFileListProps = "fileList" in props;
const hasMaxCount = typeof maxCount !== 'undefined' ? { maxCount } : {};
......@@ -82,6 +84,7 @@ const UploadFiles: React.FC<PickUploadProps> = (props: PickUploadProps) => {
data: {
fileType: UPLOAD_TYPE
},
multiple: multiple,
// disabled: loading || disabled,
showUploadList: false,
onChange(info: UploadChangeParam) {
......@@ -220,7 +223,8 @@ UploadFiles.defaultProps = {
mode: 'default',
buttonText: intl.formatMessage({id: 'components.shangchuanwenjian'}),
fileContainerClassName: '',
showFiles: true
showFiles: true,
multiple: false,
// fileList: []
};
......
......@@ -48,7 +48,12 @@ const SelectMaterial: React.FC<Iprops> & { isFieldComponent: boolean} = (props:
},
{
title: '物料组',
dataIndex: 'materialGroup'
dataIndex: 'materialGroup',
render: (text, record) => {
return (
<div>{record.materialGroup?.name}</div>
)
}
},
{
title: '规格型号',
......
......@@ -23,7 +23,7 @@ export const schema: ISchema = {
},
{
limitByte: true,
maxByte: 24,
maxByte: 12,
}
]
},
......@@ -33,7 +33,7 @@ export const schema: ISchema = {
'x-rules': [
{
required: true,
message: '请输入物料组代码'
message: '请输入物料组名称'
},
{
limitByte: true,
......
......@@ -88,7 +88,7 @@ const MaterialQuery = () => {
const supplierColumns = [
{
title: '供应商',
dataIndex: 'id',
dataIndex: 'memberName',
},
{
title: '物料名称',
......@@ -250,7 +250,7 @@ const MaterialQuery = () => {
modalType='Drawer'
visible={visible}
onClose={() => setVisible(false)}
title={"选择供应商"}
title={"选择供应商物料"}
columns={supplierColumns}
schema={purchaseSchema}
onOk={handleOnOk}
......
import { ISchema, Schema } from '@formily/antd'
import { message, Upload } from 'antd';
/**
* 新增物料
......@@ -155,7 +156,24 @@ export const getSchema = (schema: ISchema): ISchema => {
flexDirection: 'row',
alignItems: 'center',
flexWrap: 'wrap',
}
},
multiple: true,
beforeUpload: (file) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/jpg' || file.type === 'image/png';
console.log(file, isJpgOrPng);
if (!isJpgOrPng) {
message.error("仅支持JPG/PNG/JPEG格式")
return Upload.LIST_IGNORE;
// message.error(intl.formatMessage({ id: 'commodity.products.addProductsItem.productDescFormDefault.error.1' }));
}
const isLessThan = file.size / 1024 < 600;
if (!isLessThan) {
message.error('Image must smaller than 600KB!');
return Upload.LIST_IGNORE
}
return true;
},
}
},
tips: {
......
......@@ -14,7 +14,7 @@ export const purchaseSchema: ISchema = {
'x-component-props': {
placeholder: '供应商',
align: 'flex-left',
advanced: false
// advanced: false
},
},
[FORM_FILTER_PATH]: {
......@@ -57,6 +57,13 @@ export const purchaseSchema: ISchema = {
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
type: {
type: 'string',
'x-component-props': {
placeholder: '规格型号',
allowClear: true,
}
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
......
......@@ -88,7 +88,7 @@ const MaterialQuery = () => {
)
}
<Menu.Item>
<Link to={`/memberCenter/commodityAbility/priceManage/priceStrategy?code=${record.code}`}>
<Link to={`/memberCenter/commodityAbility/priceManage/priceLibrary?code=${record.code}`}>
价格库
</Link>
</Menu.Item>
......
......@@ -54,6 +54,16 @@ export const schema: ISchema = {
title: '供应商物料编号',
type: 'string',
editable: false,
"x-rules": [
{
limitByte: true,
maxByte: '最长20个字符'
},
{
pattern: /(?=.*[0-9])(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/])(?=.*[a-zA-Z])/,
message: '编号由英文(不分大小写)、数字、特殊字符组成'
}
]
},
userName: {
title: '联系人',
......@@ -61,8 +71,8 @@ export const schema: ISchema = {
editable: false,
"x-rules": [
{
limitByte: 24,
message: '最长24个字符'
limitByte: true,
maxByte: 24,
}
]
},
......@@ -73,7 +83,7 @@ export const schema: ISchema = {
"x-rules": [
{
limitByte: 40,
message: '最长40个字符'
maxByte: '最长40个字符'
}
]
},
......@@ -84,7 +94,7 @@ export const schema: ISchema = {
"x-rules": [
{
limitByte: 40,
message: '最长40个字符'
maxByte: '最长40个字符'
}
]
},
......@@ -95,7 +105,7 @@ export const schema: ISchema = {
"x-rules": [
{
limitByte: 24,
message: '最长24个字符'
maxByte: '最长24个字符'
}
]
},
......@@ -106,7 +116,7 @@ export const schema: ISchema = {
"x-rules": [
{
limitByte: 40,
message: '最长40个字符'
maxByte: '最长40个字符'
}
]
},
......@@ -117,7 +127,7 @@ export const schema: ISchema = {
"x-rules": [
{
limitByte: 40,
message: '最长40个字符'
maxByte: '最长40个字符'
}
]
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment