Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈智峰
jinfa-platform
Commits
4724a25a
Commit
4724a25a
authored
Sep 03, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改仓位部分bug
parent
9d35ac2d
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
245 additions
and
41 deletions
+245
-41
package.json
package.json
+1
-0
CustomSlider.tsx
src/components/NiceForm/components/CustomSlider.tsx
+15
-3
index.less
src/components/NiceForm/index.less
+1
-0
adjustRepository.tsx
src/pages/repositories/adjustRepository.tsx
+47
-20
PositionSetting.tsx
src/pages/repositories/components/PositionSetting.tsx
+1
-1
index.tsx
src/pages/repositories/index.tsx
+1
-1
index.tsx
src/pages/repositories/schema/index.tsx
+1
-1
index.ts
...transaction/purchaseOrder/readyAddOrder/constant/index.ts
+22
-0
detail.tsx
src/pages/transaction/purchaseOrder/readyAddOrder/detail.tsx
+39
-6
index.ts
.../transaction/purchaseOrder/readyAddOrder/effects/index.ts
+14
-0
useDetailOrder.tsx
...tion/purchaseOrder/readyAddOrder/model/useDetailOrder.tsx
+66
-4
useModalTable.ts
...action/purchaseOrder/readyAddOrder/model/useModalTable.ts
+11
-0
index.ts
...s/transaction/purchaseOrder/readyAddOrder/schema/index.ts
+26
-5
No files found.
package.json
View file @
4724a25a
...
...
@@ -12,6 +12,7 @@
"build:yxc"
:
"yarn api && yarn scripts:build-yxc && umi build"
,
"build:analyze"
:
"ANALYZE=1 umi build"
,
"build:dev"
:
"pm2 start scripts/devServer.js"
,
"build:clean"
:
"umi build"
,
"postinstall"
:
"umi generate tmp"
,
"prettier"
:
"prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'"
,
"test"
:
"umi-test"
,
...
...
src/components/NiceForm/components/CustomSlider.tsx
View file @
4724a25a
...
...
@@ -4,19 +4,31 @@ import { Slider, Input, Space, InputNumber } from 'antd'
const
CustomSlider
=
(
props
)
=>
{
const
value
=
props
.
value
||
0
const
componentProps
=
props
.
props
[
'x-component-props'
]
||
{}
const
{
max
=
0
,
width
=
'100%'
,
layout
=
{},
isNumber
=
false
}
=
componentProps
const
{
min
=
0
,
max
=
0
,
width
=
'100%'
,
layout
=
{},
isNumber
=
false
}
=
componentProps
const
handleChange
=
(
e
)
=>
{
const
fieldValue
=
e
.
target
?
(
e
.
target
.
value
||
0
)
:
e
let
nowValue
=
parseInt
(
fieldValue
).
toString
()
if
(
nowValue
<
min
)
{
return
;
}
else
if
(
nowValue
>
max
)
{
nowValue
=
max
}
props
.
mutators
.
change
(
nowValue
===
'0'
?
''
:
nowValue
)
}
return
(
<
div
style=
{
{
width
:
'100%'
,
...
layout
}
}
>
<
Slider
style=
{
{
width
}
}
disabled=
{
!
props
.
editable
}
value=
{
value
}
onChange=
{
e
=>
props
.
mutators
.
change
(
e
)
}
onChange=
{
handleChange
}
{
...
props
.
props
['
x
-
component
-
props
']}
/>
{
isNumber
?
<
div
>
<
Input
Number
className=
'underline_input'
min=
{
0
}
max=
{
max
||
0
}
value=
{
props
.
value
}
onChange=
{
fieldValue
=>
props
.
mutators
.
change
(
fieldValue
)
}
/>
<
Input
type=
'number'
className=
'underline_input'
value=
{
value
}
onChange=
{
handleChange
}
/>
</
div
>
:
<
Space
>
...
...
src/components/NiceForm/index.less
View file @
4724a25a
...
...
@@ -18,6 +18,7 @@
border-bottom: 1px solid #DFE1E6;
padding: 8px 19px;
display: block;
text-align: center;
input {
text-align: center;
}
...
...
src/pages/repositories/adjustRepository.tsx
View file @
4724a25a
...
...
@@ -51,10 +51,16 @@ const AddRepository:React.FC<{}> = (props) => {
useUnitPreview
(
initValue
,
addSchemaAction
)
useEffect
(()
=>
{
PublicApi
.
getWarehouseFreightSpaceAll
().
then
(({
data
})
=>
{
setReposits
(
data
)
})
},
[])
if
(
initValue
)
{
PublicApi
.
getWarehouseFreightSpaceListByProductid
({
productId
:
initValue
.
productId
}).
then
(({
data
,
code
})
=>
{
if
(
code
===
1000
)
{
setReposits
(
data
)
}
})
}
},
[
initValue
])
const
tableRecordColumns
:
any
[]
=
[
{
dataIndex
:
'id'
,
title
:
'ID'
,
align
:
'center'
},
...
...
@@ -95,13 +101,19 @@ const AddRepository:React.FC<{}> = (props) => {
params
[
key
]
=
value
}
})
const
{
data
}
=
await
foldFn
(
params
)
const
{
callInInventory
,
bringUpTheInventory
}
=
data
const
{
data
,
code
}
=
await
foldFn
(
params
)
if
(
code
===
1000
)
{
const
{
callInInventory
,
bringUpTheInventory
}
=
data
repositInAction
.
setFieldValue
(
'NO_SUBMIT2'
,
bringUpTheInventory
)
repositInAction
.
setFieldValue
(
'NO_SUBMIT1'
,
callInInventory
)
repositInAction
.
setFieldValue
(
'foldInventory'
,
''
)
tableRecordRef
.
current
.
reload
&&
tableRecordRef
.
current
.
reload
()
repositInAction
.
setFieldValue
(
'NO_SUBMIT2'
,
bringUpTheInventory
)
repositInAction
.
setFieldValue
(
'NO_SUBMIT1'
,
callInInventory
)
repositInAction
.
setFieldValue
(
'foldInventory'
,
0
,
false
)
repositInAction
.
setFieldState
(
'foldInventory'
,
state
=>
{
state
.
props
[
"x-component-props"
].
max
=
callInInventory
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
callInInventory
)
})
tableRecordRef
.
current
.
reload
&&
tableRecordRef
.
current
.
reload
()
}
}
// 库存调出表单提交
...
...
@@ -112,14 +124,20 @@ const AddRepository:React.FC<{}> = (props) => {
params
[
key
]
=
value
}
})
const
{
data
}
=
await
exportFn
(
params
)
const
{
data
,
code
}
=
await
exportFn
(
params
)
if
(
code
===
1000
)
{
const
{
callInInventory
,
bringUpTheInventory
}
=
data
const
{
callInInventory
,
bringUpTheInventory
}
=
data
repositOutAction
.
setFieldValue
(
'NO_SUBMIT1'
,
bringUpTheInventory
)
repositOutAction
.
setFieldValue
(
'NO_SUBMIT2'
,
callInInventory
)
repositOutAction
.
setFieldValue
(
'foldInventory'
,
0
)
tableRecordRef
.
current
.
reload
&&
tableRecordRef
.
current
.
reload
()
repositOutAction
.
setFieldValue
(
'NO_SUBMIT1'
,
bringUpTheInventory
)
repositOutAction
.
setFieldValue
(
'NO_SUBMIT2'
,
callInInventory
)
repositOutAction
.
setFieldValue
(
'foldInventory'
,
0
,
false
)
repositOutAction
.
setFieldState
(
'foldInventory'
,
state
=>
{
state
.
props
[
"x-component-props"
].
max
=
callInInventory
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
callInInventory
)
})
tableRecordRef
.
current
.
reload
&&
tableRecordRef
.
current
.
reload
()
}
}
const
transforInBtn
=
<
Row
justify=
'center'
>
...
...
@@ -250,6 +268,7 @@ const AddRepository:React.FC<{}> = (props) => {
// setIsEdit(true)
//
})
FormEffectHooks
.
onFormMount$
().
subscribe
(()
=>
{
console
.
log
(
'mount'
)
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
inventoryNumber
=
spyForm
.
getFieldValue
(
'inventory'
)
const
asyncEnums
=
reposits
.
map
(
v
=>
({
...
...
@@ -258,18 +277,26 @@ const AddRepository:React.FC<{}> = (props) => {
}))
utils
.
enum
(
'foldFreightSpaceId'
,
asyncEnums
)
$
(
'onFieldInputChange'
,
'foldFreightSpaceId'
).
subscribe
(
state
=>
{
const
numberValue
=
reposits
.
find
(
v
=>
v
.
id
===
state
.
value
).
inventory
||
0
const
repositValue
=
reposits
.
find
(
v
=>
v
.
id
===
state
.
value
)
const
numberValue
=
repositValue
.
inventory
||
0
utils
.
value
(
'NO_SUBMIT2'
,
numberValue
)
setFieldState
(
'NO_SUBMIT2'
,
state
=>
{
state
.
props
.
title
=
`当前仓位库存(${repositValue.unit})`
})
})
setFieldState
(
'foldInventory'
,
state
=>
{
state
.
props
[
"x-component-props"
].
max
=
in
ventoryNumber
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
in
ventoryNumber
)
state
.
props
[
"x-component-props"
].
max
=
in
itValue
.
inventory
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
in
itValue
.
inventory
)
})
// 调入仓位信息
utils
.
enum
(
'freightSpaceId'
,
[
{
label
:
name
,
value
:
id
}
])
utils
.
value
(
'freightSpaceId'
,
id
)
setFieldState
(
'NO_SUBMIT1'
,
state
=>
{
state
.
props
.
title
=
`当前仓位库存(${initValue.unit})`
})
utils
.
value
(
'NO_SUBMIT1'
,
inventoryNumber
)
})
}
}
...
...
src/pages/repositories/components/PositionSetting.tsx
View file @
4724a25a
...
...
@@ -254,7 +254,7 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
"x-component-props"
:
{
placeholder
:
'请选择品类'
,
className
:
'fixed-ant-selected-down'
,
// 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCategory
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectC
ustomerC
ategory
,
style
:
{
width
:
160
}
...
...
src/pages/repositories/index.tsx
View file @
4724a25a
...
...
@@ -187,7 +187,7 @@ const Repositories: React.FC<{}> = () => {
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'
search
'
,
'
name
'
,
FORM_FILTER_PATH
,
);
}
}
...
...
src/pages/repositories/schema/index.tsx
View file @
4724a25a
...
...
@@ -41,7 +41,7 @@ export const repositSchema: ISchema = padRequiredMessage({
children
:
"{{controllerBtns}}"
}
},
search
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-mega-props"
:
{
...
...
src/pages/transaction/purchaseOrder/readyAddOrder/constant/index.ts
View file @
4724a25a
...
...
@@ -53,4 +53,25 @@ export const orderTypeLabel = ['',
'渠道直采'
,
'渠道现货'
,
'渠道积分兑换'
]
export
const
memberColumns
:
any
[]
=
[
{
title
:
'会员ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'会员名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
'公司地址'
,
dataIndex
:
'address'
,
align
:
'center'
,
key
:
'address'
,
},
]
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/detail.tsx
View file @
4724a25a
...
...
@@ -10,23 +10,26 @@ import NiceForm from '@/components/NiceForm'
import
{
orderDetailSchema
}
from
'./schema'
import
{
useDetailOrder
}
from
'./model/useDetailOrder'
import
ModalTable
from
'@/components/ModalTable'
import
{
useModelTypeChange
}
from
'./effects'
import
{
OrderModalType
,
orderTypeLabel
}
from
'./constant'
import
{
useModelTypeChange
,
useEditHideField
}
from
'./effects'
import
{
OrderModalType
,
orderTypeLabel
,
memberColumns
}
from
'./constant'
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
export
interface
PurchaseOrderDetailProps
{}
const
addSchemaAction
=
createFormActions
()
// 采购订单详情页. 包含新增和编辑
const
PurchaseOrderDetail
:
React
.
FC
<
PurchaseOrderDetailProps
>
=
(
props
)
=>
{
const
{
orderModel
}
=
history
.
location
.
query
const
{
productColumns
,
setShowProBtn
,
showProBtn
}
=
useDetailOrder
({
orderModel
const
{
productColumns
,
setShowProBtn
,
showProBtn
,
visibleMember
,
setVisibleMember
}
=
useDetailOrder
({
addSchemaAction
})
// 页面进入时, 当前所处的下单模式
const
{
pageStatus
}
=
usePageStatus
()
const
handleOrderNo
=
()
=>
{}
const
handleOrderMember
=
()
=>
{}
// 选择会员弹窗
const
handleOrderMember
=
()
=>
{
setVisibleMember
(
true
)
}
const
orderNoPrice
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleOrderNo
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
const
orderMember
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleOrderMember
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
...
...
@@ -50,6 +53,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
schema=
{
orderDetailSchema
}
className=
'useConnectBtnWrapper'
effects=
{
(
$
,
ctx
)
=>
{
const
formUtils
=
useLinkageUtils
()
useModelTypeChange
(
state
=>
{
const
{
value
}
=
state
// 报价单的值 等同于是否填写过报价单
...
...
@@ -67,9 +71,15 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setShowProBtn
(
false
)
}
// if (value === OrderModalType.HAND_ORDER)
{
// formUtils.visible('supplyMembersName', true)
//
}
// 选择某种类型时, 需显示对应的订单类型
ctx
.
setFieldValue
(
'type'
,
orderTypeLabel
[
value
-
4
])
// -4 获得对应的数组下标, 由于id是固定的
})
useEditHideField
()
}
}
expressionScope=
{
{
orderNoPrice
,
...
...
@@ -83,6 +93,29 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
modalTitle=
'选择订单商品'
columns=
{
productColumns
}
/>
<
ModalTable
modalTitle=
'选择供应会员'
visible=
{
visibleMember
}
confirm=
{
()
=>
setVisibleMember
(
false
)
}
cancel=
{
()
=>
setVisibleMember
(
false
)
}
columns=
{
memberColumns
}
formilyProps=
{
{
ctx
:
{
schema
:
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-component-props"
:
{
placeholder
:
'请输入会员名称'
}
}
}
}
}
}
}
/>
</
PageHeaderWrapper
>
)
}
...
...
src/pages/transaction/purchaseOrder/readyAddOrder/effects/index.ts
View file @
4724a25a
import
{
ISchemaFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
export
const
useModelTypeChange
=
(
callback
)
=>
{
// 下单模式发生改变时
FormEffectHooks
.
onFieldValueChange$
(
'orderModel'
).
subscribe
(
state
=>
{
callback
(
state
)
})
}
export
const
useEditHideField
=
()
=>
{
const
{
pageStatus
}
=
usePageStatus
()
const
utils
=
useLinkageUtils
()
FormEffectHooks
.
onFormInit$
().
subscribe
(()
=>
{
if
(
pageStatus
===
PageStatus
.
ADD
)
{
utils
.
hide
(
'orderNo'
)
utils
.
hide
(
'createTime'
)
}
})
}
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/model/useDetailOrder.tsx
View file @
4724a25a
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
OrderModalType
}
from
'../constant'
import
{
PublicApi
}
from
'@/services/api'
import
{
useLocation
}
from
'umi'
import
{
ISchemaFormActions
}
from
'@formily/antd'
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
export
const
useDetailOrder
=
(
options
)
=>
{
interface
DetailOrderLocationState
{
// 进货单商品列表
productList
?:
any
[],
// 下单模式
modelType
?:
OrderModalType
}
interface
DetailOptionsProps
{
addSchemaAction
:
ISchemaFormActions
}
const
mockDefaultValue
:
DetailOrderLocationState
=
{
productList
:
[
{
id
:
1
,
name
:
'甲商品'
,
customerCategoryName
:
'假品类'
,
brandName
:
'假品牌'
}
],
modelType
:
5
}
export
const
useDetailOrder
=
(
options
:
DetailOptionsProps
)
=>
{
const
{
addSchemaAction
}
=
options
const
formilyUtils
=
useLinkageUtils
()
// const [productDataSource, setProductDataSource] = useState
const
[
showProBtn
,
setShowProBtn
]
=
useState
(
options
.
orderModel
)
const
locationState
=
useLocation
<
DetailOrderLocationState
>
().
state
||
{}
const
{
productList
,
modelType
}
=
locationState
// 是否显示选择商品按钮
const
[
showProBtn
,
setShowProBtn
]
=
useState
(
false
)
// 是否显示供应会员字段
const
[
showMemberType
,
setShowMemberType
]
=
useState
(
false
)
const
[
visibleMember
,
setVisibleMember
]
=
useState
(
false
)
// 商品列表, 如果路由state中 带有productList, 说明是进货单下单, 需要回显进货单商品数据
const
[
proList
,
setProList
]
=
useState
<
any
[]
>
(()
=>
productList
||
[])
// 回显数据写在这
useEffect
(()
=>
{
// 页面中有传入下单模式, 需要手动回显数据
if
(
modelType
)
{
addSchemaAction
.
setFieldValue
(
'orderModel'
,
modelType
)
}
// 在有传入商品列表时 需手动回显
if
(
proList
.
length
>
0
)
{
addSchemaAction
.
setFieldValue
(
'orderProductRequests'
,
proList
)
addSchemaAction
.
setFieldValue
(
'orderThe'
,
proList
[
0
].
name
)
}
},
[
modelType
,
productList
])
// 唤起新增订单
const
fetchAddOrder
=
async
(
params
)
=>
{
await
PublicApi
.
postOrderProcurementOrderAdd
(
params
)
}
const
productColumns
:
any
[]
=
[
{
title
:
'商品ID'
,
...
...
@@ -38,6 +94,11 @@ export const useDetailOrder = (options) => {
showProBtn
,
setShowProBtn
,
showMemberType
,
setShowMemberType
setShowMemberType
,
fetchAddOrder
,
proList
,
modelType
,
visibleMember
,
setVisibleMember
}
}
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/model/useModalTable.ts
0 → 100644
View file @
4724a25a
import
{
useState
}
from
'react'
export
const
useModalTable
=
()
=>
{
const
[
visible
,
setVisible
]
=
useState
(
false
)
return
{
visible
,
setVisible
}
}
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/schema/index.ts
View file @
4724a25a
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
{
OrderModalType
}
from
'../constant'
;
/**
* 除了订单必填字段, 默认
*/
export
const
tableListSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
...
...
@@ -75,12 +79,21 @@ const basicInfo: ISchema = {
properties
:
{
orderModel
:
{
type
:
'string'
,
required
:
true
,
enum
:
GlobalConfig
.
web
.
orderMode
.
map
(
v
=>
{
delete
v
.
platformType
;
return
v
}),
title
:
'下单模式'
title
:
'下单模式'
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
"target"
:
"supplyMembersName"
,
"condition"
:
`{{ $self.value ===
${
OrderModalType
.
HAND_ORDER
}
}}`
}
],
},
orderThe
:
{
type
:
'string'
,
title
:
'订单摘要'
,
required
:
true
,
"x-rules"
:
[
{
limitByte
:
true
,
...
...
@@ -95,6 +108,7 @@ const basicInfo: ISchema = {
disabled
:
true
,
addonAfter
:
"{{orderNoPrice}}"
},
visible
:
false
},
supplyMembersName
:
{
type
:
'string'
,
...
...
@@ -103,11 +117,15 @@ const basicInfo: ISchema = {
disabled
:
true
,
addonAfter
:
"{{orderMember}}"
},
required
:
true
,
visible
:
false
},
orderNo
:
{
type
:
'string'
,
title
:
'订单编号'
,
"x-component"
:
'text'
"x-component"
:
'text'
,
visible
:
false
},
type
:
{
type
:
'string'
,
...
...
@@ -116,15 +134,18 @@ const basicInfo: ISchema = {
},
createTime
:
{
type
:
'string'
,
title
:
'下单时间'
title
:
'下单时间'
,
visible
:
false
},
interiorState
:
{
type
:
'string'
,
title
:
'内部状态'
title
:
'内部状态'
,
visible
:
false
},
externalState
:
{
type
:
'string'
,
title
:
'外部状态'
title
:
'外部状态'
,
visible
:
false
},
}
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment