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

fix: 更新新增投标交付地址传参,仓位添加批量新增仓位库存

parent 3d6be0b3
......@@ -295,6 +295,14 @@ const CommodityRoute: RouterChild = {
icon: 'smile',
component: './repositories',
},
// 仓位-批量新增
{
path: '/memberCenter/commodityAbility/repositories/batchAdd',
name: 'batchAddRepository',
icon: 'smile',
component: './repositories/batchAddRepository',
hideInMenu: true,
},
// 仓位-新增
{
path: '/memberCenter/commodityAbility/repositories/add',
......
......@@ -136,7 +136,9 @@ const AddNewBid:React.FC<AddNewBidProps> = (props) => {
}
addSchemaAction.getFieldState('deliverAddressId', state => {
params['deliverAddress'] = state.props.enum.filter(item => item['value'] === params['deliverAddressId'])[0]['label']
if(params?.deliverAddressId) {
params['deliverAddress'] = state.props.enum.filter(item => item['value'] === params['deliverAddressId'])[0]['label']
}
})
let res = await PublicApi.postPurchaseInviteTenderSaveOrUpdateInviteTender(params)
if(res.code === 1000) {
......
import React from 'react'
import { history } from 'umi'
import { Button, Card, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import './index.less'
import { batchRepositDetailSchema } from './schema'
import { createFormActions } from '@formily/antd'
import { omit } from '@/utils'
import { PublicApi } from '@/services/api'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import BatchPositionSetting from './components/BatchPositionSetting'
const addSchemaAction = createFormActions()
const BatchAddRepository:React.FC<{}> = (props) => {
const {
id,
preview,
pageStatus
} = usePageStatus()
// 整体表单提交
const formSubmit = async (values) => {
const params = {...values}
console.log(params, 'params')
if (params['applyMember']) {
params['applyMember'] = params['applyMember']
}
if (params['commodityList']) {
params['commodityList'] = params['commodityList'].map(item =>({
productId: item.id,
productName: item.name,
category: item.customerCategoryName,
brand: item.brandName,
unit: item.unitName,
goodsId: item?.goodsId || null,
itemNo: item?.goodsCode || null,
goodsName: item?.goodsName || null,
}))
}
if(!params['isAllMemberShare'] && !params['applyMember']?.length) {
message.error('请选择指定会员')
} else {
addSchemaAction.getFieldState('warehouseId', prevState => {
if(prevState.value) {
params['warehouseName'] = prevState.props.enum.filter((item: any) => item.value === prevState.value)[0]['label']
}
})
addSchemaAction.getFieldState('shopIds', state => {
params['shopIds'] = state.value.map(item => state.props['x-component-props'].dataSource.filter(_ => _.id === item)[0])
})
let res = await PublicApi.postProductFreightSpaceAddBatch(params)
if(res.code === 1000) {
setTimeout(() => {
history.goBack(-1)
}, 1000)
}
}
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
className='addRepository'
title={pageStatus === PageStatus.PREVIEW ? '查看仓位' : '批量新增仓位'}
extra={(
pageStatus !== PageStatus.PREVIEW
? (
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
保存
</Button>
)
: null
)}
>
<Card className=''>
{/* <WrapperLayout> */}
<BatchPositionSetting addSchemaAction={addSchemaAction} schema={batchRepositDetailSchema} formSubmit={formSubmit}/>
{/* </WrapperLayout> */}
</Card>
</PageHeaderWrapper>
)
}
export default BatchAddRepository
This diff is collapsed.
......@@ -18,7 +18,6 @@ import { treeReduction } from '@/utils';
const formActions = createFormActions();
// 模拟请求
const fetchData = async (params: any) => {
if(params?.category) {
formActions.getFieldState('category', state => {
......@@ -140,6 +139,10 @@ const Repositories: React.FC<{}> = () => {
history.push(`/memberCenter/commodityAbility/repositories/add`);
};
const handleBatchAdd = () => {
history.push(`/memberCenter/commodityAbility/repositories/batchAdd`);
}
const controllerBtns = <Space>
<Button
type="primary"
......@@ -148,6 +151,8 @@ const Repositories: React.FC<{}> = () => {
>
新建
</Button>
<Button onClick={handleBatchAdd}>批量新建</Button>
<Button>批量修改</Button>
</Space>
return (
......
......@@ -289,10 +289,10 @@ export const repositMoreSchema: ISchema = padRequiredMessage({
label: '按仓位随机扣减',
value: 1
},
{
label: '按仓库位置远近扣除',
value: 2
}
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
}
......@@ -521,10 +521,170 @@ export const repositDetailSchema: ISchema = padRequiredMessage({
label: '按仓位随机扣减',
value: 1
},
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
}
}
}
}
},
"tab-2": {
"type": "object",
"x-component": "tabpane",
"x-component-props": {
"tab": "适用商城"
},
"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": "适用商城",
required: true,
}
}
}
}
},
"tab-3": {
type: 'object',
"x-component": 'tabpane',
"x-component-props": {
"tab": "适用会员"
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 4,
labelAlign: 'left'
},
properties: {
"isAllMemberShare": {
"type": "radio",
enum: [
{ label: '所有会员共享(默认)', value: 1 },
{ label: '指定会员', value: 0 },
],
"title": "选择会员",
default: 1,
required: true,
"x-linkages": [
{
label: '按仓库位置远近扣除',
value: 2
type: 'value:visible',
target: 'applyMember',
"condition": "{{!$value}}"
}
]
},
applyMember: {
type: 'array:number',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'memberId',
columns: "{{tableColumns}}",
prefix: "{{tableAddButton}}",
pagination: {
"onChange": "{{paginationChange}}",
"total": "{{membersLength}}"
}
}
}
}
}
}
}
}
}
}
})
// 批量新增仓位
export const batchRepositDetailSchema: 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": "基本信息"
},
"properties": {
MEGA_LAYOUT1: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 4,
wrapperCol: 8,
labelAlign: 'left'
},
properties: {
shopType: {
type: 'string',
enum: getShopTypeMap,
title: '商城类型',
required: true
},
warehouseId: {
type: 'string',
title: '仓库名称',
enum: []
},
inventory: {
type: 'number',
"x-mega-props": {
full: true
},
required: true,
title: '分配仓位库存',
"x-rules": [
{
validator: value => {
return value > Number.MAX_SAFE_INTEGER
},
message:'仓位库存数值已超出最大限度',
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '仓位库存数值仅限三位小数',
},
]
},
inventoryDeductWay: {
type: 'radio',
title: '库存扣减方式',
required: true,
enum: [
{
label: '按仓位随机扣减',
value: 1
},
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
}
......@@ -533,6 +693,38 @@ export const repositDetailSchema: ISchema = padRequiredMessage({
}
},
"tab-2": {
type: 'object',
"x-component": 'tabpane',
"x-component-props": {
"tab": "适用商品"
},
properties: {
MEGA_LAYOUT3: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelCol: 4,
labelAlign: 'left'
},
properties: {
commodityList: {
type: 'array:number',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'id',
columns: "{{tableProductColumns}}",
prefix: "{{tableAddProductButton}}",
// pagination: {
// "onChange": "{{paginationChange}}",
// "total": "{{membersLength}}"
// }
}
}
}
}
}
},
"tab-3": {
"type": "object",
"x-component": "tabpane",
"x-component-props": {
......@@ -560,7 +752,7 @@ export const repositDetailSchema: ISchema = padRequiredMessage({
}
}
},
"tab-3": {
"tab-4": {
type: 'object',
"x-component": 'tabpane',
"x-component-props": {
......@@ -727,10 +919,10 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
label: '按仓位随机扣减',
value: 1
},
{
label: '按仓库位置远近扣除',
value: 2
}
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
}
......
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