Commit 5c8e446c authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理仓位的一些校验

parent 0ec3e3c2
......@@ -9,7 +9,7 @@ const CustomSlider = (props) => {
const handleChange = (e) => {
const fieldValue = e.target ? (e.target.value || 0) : e
let nowValue = parseInt(fieldValue).toString()
let nowValue = Number(fieldValue).toString()
if (nowValue < min) {
return ;
} else if (nowValue > max) {
......@@ -25,11 +25,13 @@ const CustomSlider = (props) => {
disabled={!props.editable}
value={value}
onChange={handleChange}
{...props.props['x-component-props']}/>
{...props.props['x-component-props']}
/>
{
isNumber ?
<div>
<Input type='number' className='underline_input' value={value} onChange={handleChange}/>
{/* <Input type='number' className='underline_input' value={value} onChange={handleChange}/> */}
<InputNumber className='underline_input' value={value} onChange={handleChange} {...props.props['x-component-props']} />
</div>
:
<Space>
......
......@@ -76,7 +76,7 @@ registerValidationRules({
if (required) {
message += `${intl.formatMessage({id: 'common.bitian'})}`
}
return (required && !str) ? message : ''
return (required && str === null) ? message : ''
}
});
......
......@@ -101,6 +101,9 @@ export default {
'commodity.products.columns.upperMemberName':'Supply Member',
'commodity.products.columns.upperMemberName.1':'—',
'commodity.products.columns.type' : 'type of merchandise',
'commodity.products.columns.type.1' : 'Proprietary products',
'commodity.products.columns.type.2' : 'The upstream commodity',
'commodity.products.columns.type.3' : 'Consignment',
'commodity.products.columns.min':'Price',
'commodity.products.columns.currency':'¥',
'commodity.products.columns.applyTime':'Apply for review time',
......
......@@ -27,6 +27,7 @@ export default {
'repositories.controllerBtns.button.2': 'Batch New',
'repositories.controllerBtns.button.3': 'Batch modification',
'repositories.modalForm': 'Modify position inventory in batch',
'repositories.confirm.hint': 'Confirm to modify the selected position inventory in batches, and then update the original position inventory in batches!',
'repositories.addRepository.error': 'Please select a designated member',
'repositories.addRepository.back': 'Back',
......
......@@ -102,6 +102,9 @@ export default {
'commodity.products.columns.upperMemberName' : '공급원',
'commodity.products.columns.upperMemberName.1' : '—',
'commodity.products.columns.type' : '상품 유형',
'commodity.products.columns.type.1' : '자가경영 상품',
'commodity.products.columns.type.2' : '상위 상품',
'commodity.products.columns.type.3' : '상품을 대리 판매하다',
'commodity.products.columns.min' : '가격.',
'commodity.products.columns.currency' : '¥',
'commodity.products.columns.applyTime' : '신청 심사 시간',
......
......@@ -27,6 +27,7 @@ export default {
'repositories.controllerBtns.button.2' : '대량 새로 만들기',
'repositories.controllerBtns.button.3' : '대량 수정',
'repositories.modalForm' : '창고의 재고를 대량으로 수정하다.',
'repositories.confirm.hint': '대량수정 선택창고 재고량을 확인하는지 여부, 확인후 원창고 재고량을 갱신합니다!',
'repositories.addRepository.error' : '지정 회원을 선택하세요',
'repositories.addRepository.back' : '되돌아오다',
......
......@@ -102,6 +102,9 @@ export default {
'commodity.products.columns.upperMemberName' : '供应会员',
'commodity.products.columns.upperMemberName.1' : '—',
'commodity.products.columns.type' : '商品类型',
'commodity.products.columns.type.1' : '自营商品',
'commodity.products.columns.type.2' : '上游商品',
'commodity.products.columns.type.3' : '代销商品',
'commodity.products.columns.min' : '价格',
'commodity.products.columns.currency' : '¥',
'commodity.products.columns.applyTime' : '申请审核时间',
......
......@@ -27,6 +27,7 @@ export default {
'repositories.controllerBtns.button.2' : '批量新建',
'repositories.controllerBtns.button.3' : '批量修改',
'repositories.modalForm' : '批量修改仓位库存',
'repositories.confirm.hint': '是否确认批量修改选择的仓位库存,确认后将批量更新原仓位库存!',
'repositories.addRepository.error' : '请选择指定会员',
'repositories.addRepository.back' : '返回',
......
......@@ -132,6 +132,15 @@ const Products: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'commodity.products.columns.type' }),
dataIndex: 'type',
key: 'type',
render: t => {
if(t === 1) {
return intl.formatMessage({ id: 'commodity.products.columns.type.1' })
} else if(t === 2) {
return intl.formatMessage({ id: 'commodity.products.columns.type.2' })
} else if(t === 3) {
return intl.formatMessage({ id: 'commodity.products.columns.type.3' })
}
}
},
{
title: intl.formatMessage({ id: 'commodity.products.columns.min' }),
......
......@@ -54,7 +54,7 @@ const BatchAddRepository: React.FC<{}> = (props) => {
let res = await postProductFreightSpaceAddBatch(params)
if (res.code === 1000) {
setTimeout(() => {
history.goBack(-1)
history.goBack()
}, 1000)
}
}
......
......@@ -116,7 +116,6 @@ const BatchPositionSetting: React.FC<BatchPositionSettingProps> = (props) => {
return res.data
}
const fetchProductList = async (params) => {
const shopType = addSchemaAction.getFieldValue('shopType')
const res = await getProductCommodityCommonGetCommodityListByStock({
......
import React, { useRef } from 'react';
import { history, useIntl } from 'umi';
import { Button, Card, message, Space, Tooltip } from 'antd';
import { Button, Card, message, Modal, Space, Tooltip } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import StandardTable from '@/components/StandardTable';
......@@ -257,7 +257,15 @@ const Repositories: React.FC<{}> = () => {
}
const handleConfirm = () => {
Modal.confirm({
content: intl.formatMessage({ id: 'repositories.confirm.hint' }),
onOk() {
modalSchemaAction.submit()
},
onCancel() {
modalRef.current.setVisible(false)
}
});
}
const help = (text: string, desc: string) => (<>
......
......@@ -167,233 +167,6 @@ export const repositSchema: ISchema = padRequiredMessage({
}
})
export const repositMoreSchema: ISchema = padRequiredMessage({
type: 'object',
properties: {
REPOSIT_TABS: {
type: 'object',
"x-component": "tab",
"x-component-props": {
type: 'card'
},
properties: {
"tab-1": {
"type": "object",
"x-component": "tabpane",
"x-component-props": {
"tab": getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.tab.1' })
},
"properties": {
MEGA_LAYOUT1: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 4,
wrapperCol: 8,
labelAlign: 'left'
},
properties: {
name: {
type: 'string',
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.name.message' })
},
{
limitByte: true, // 自定义校验规则
maxByte: 60
}
],
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.name' }),
"x-component-props": {
placeholder: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.name.placeholder' })
}
},
shopType: {
type: 'string',
enum: SHOP_TYPES,
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.shopType' }),
required: true
},
productName: {
type: 'string',
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.productName' }),
"x-mega-props": {
full: true
},
"x-component-props": {
disabled: true,
addonAfter: "{{connectProduct}}"
},
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.productName.message' })
}
],
},
category: {
type: 'string',
display: false
},
brand: {
type: 'string',
display: false
},
unit: {
type: 'string',
display: false
},
productId: {
type: 'string',
display: false
},
warehouseId: {
type: 'string',
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.warehouseId' }),
enum: []
},
goodsName: {
type: 'string',
"x-component": 'Text',
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.goodsName' }),
default: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.goodsName.default' })
},
goodsId: {
type: 'string',
display: false
},
inventory: {
type: 'number',
"x-component": "CustomSlider",
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.inventory.message' })
}
],
"x-component-props": {
min: 0,
max: 200
},
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.inventory' }),
},
inventoryDeductWay: {
type: 'radio',
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.inventoryDeductWay' }),
required: true,
enum: [
{
label: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.inventoryDeductWay.1' }),
value: 1
},
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
},
upperMemberName: {
type: 'string',
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.upperMemberName' }),
"x-component": 'Text',
default: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.upperMemberName.default' })
},
upperStockCount: {
type: 'number',
title: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.upperStockCount' }),
"x-component": 'Text',
default: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.upperStockCount.default' })
},
}
}
}
},
"tab-2": {
"type": "object",
"x-component": "tabpane",
"x-component-props": {
"tab": getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.tab.2' })
},
"properties": {
MEGA_LAYOUT2: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 4,
labelAlign: 'left'
},
properties: {
"shopIds": {
"type": "array:number",
"x-component": 'CardCheckBox',
"x-component-props": {
dataSource: []
},
"title": getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.shopIds' }),
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.shopIds.message' })
}
],
}
}
}
}
},
"tab-3": {
type: 'object',
"x-component": 'tabpane',
"x-component-props": {
"tab": getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.tab.3' })
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 4,
labelAlign: 'left'
},
properties: {
"isAllMemberShare": {
"type": "radio",
enum: [
{ label: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.isAllMemberShare.1' }), value: 1 },
{ label: getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.isAllMemberShare.2' }), value: 0 },
],
"title": getIntl().formatMessage({ id: 'repositories.schema.repositMoreSchema.isAllMemberShare' }),
default: 1,
required: true,
"x-linkages": [
{
type: 'value:visible',
target: 'applyMember',
"condition": "{{!$value}}"
}
]
},
applyMember: {
type: 'array:number',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'memberId',
columns: "{{tableColumns}}",
prefix: "{{tableAddButton}}"
}
}
}
}
}
}
}
}
}
})
// 新增仓位
export const repositDetailSchema: ISchema = padRequiredMessage({
type: 'object',
......@@ -1168,6 +941,7 @@ export const repositInSchema: ISchema = padRequiredMessage({
isNumber: true,
max: 0,
min: 0,
step: 0.001,
layout: {
display: 'flex',
flexDirection: 'column',
......@@ -1258,6 +1032,7 @@ export const repositOutSchema: ISchema = padRequiredMessage({
isNumber: true,
max: 0,
min: 0,
step: 0.001,
layout: {
display: 'flex',
flexDirection: 'column',
......
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