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
shenshaokai
jinfa-platform
Commits
5ce1c294
Commit
5ce1c294
authored
Apr 08, 2022
by
前端-彭佳文
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-0418-xxx' into 'v2-220418'
新曾字段,修改bug See merge request linkseeks-design/pro-platform!166
parents
cd3f8d67
04c5a8f2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
210 additions
and
46 deletions
+210
-46
index.ts
...ion/purchaseRequisition/increaseRequisition/apis/index.ts
+1
-0
index.tsx
...creaseRequisition/components/materialModalTable/index.tsx
+51
-35
useGetTableSearchData.tsx
...n/components/materialModalTable/useGetTableSearchData.tsx
+38
-0
index.less
...action/purchaseRequisition/increaseRequisition/index.less
+15
-0
index.tsx
...saction/purchaseRequisition/increaseRequisition/index.tsx
+84
-11
index.ts
...n/purchaseRequisition/increaseRequisition/schema/index.ts
+10
-0
modal.ts
...n/purchaseRequisition/increaseRequisition/schema/modal.ts
+11
-0
No files found.
src/pages/transaction/purchaseRequisition/increaseRequisition/apis/index.ts
View file @
5ce1c294
...
...
@@ -16,6 +16,7 @@ export const fetchOrderApi = {
/** 请购单物料 获取商品货品列表 */
async
getPurchaseRequesitionMaterielList
(
params
)
{
params
.
materialGroupId
=
params
.
materialGroupId
?
params
.
materialGroupId
?.
pop
()
:
''
const
{
data
}
=
await
getProductGoodsGetGoodsList
(
params
)
return
data
},
...
...
src/pages/transaction/purchaseRequisition/increaseRequisition/components/materialModalTable/index.tsx
View file @
5ce1c294
...
...
@@ -8,13 +8,16 @@ import Search from '@/components/NiceForm/components/Search'
import
Submit
from
'@/components/NiceForm/components/Submit'
;
import
Children
from
'@/components/NiceForm/components/Children'
;
import
{
addRequesitionMaterialSchema
}
from
'../../schema/modal'
import
{
Tooltip
}
from
'antd'
import
{
Cascader
,
Tooltip
}
from
'antd'
import
{
QuestionCircleOutlined
}
from
'@ant-design/icons'
import
{
clearModalParams
}
from
'@/utils'
import
CustomCategorySearch
from
'@/components/NiceForm/components/CustomCategorySearch'
import
CustomInputSearch
from
'@/components/NiceForm/components/CustomInputSearch'
import
{
searchBrandOptionEffect
,
searchCustomerCategoryOptionEffect
}
from
'../../effects'
import
{
useIntl
,
getIntl
}
from
'umi'
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
import
{
getProductMaterialGroupTree
}
from
'@/services/ProductV2Api'
import
{
fetchTreeData
,
useAsyncCascader
}
from
'./useGetTableSearchData'
export
interface
MaterialModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
...
...
@@ -46,6 +49,17 @@ export const materialColumns: any[] = [
key
:
'name'
,
},
{
title
:
"物料组"
,
dataIndex
:
'materialGroup'
,
align
:
'center'
,
key
:
'materialGroup'
,
render
:
(
text
,
record
)
=>
{
return
(
<
div
>
{
record
.
name
}
</
div
>
)
}
},
{
title
:
getIntl
().
formatMessage
({
id
:
'purchaseRequisition.guigexinghao'
,
defaultMessage
:
'规格型号'
}),
dataIndex
:
'type'
,
align
:
'center'
,
...
...
@@ -71,7 +85,7 @@ export const materialColumns: any[] = [
},
]
const
MaterialModalTable
:
React
.
FC
<
MaterialModalTableProps
>
=
(
props
)
=>
{
const
MaterialModalTable
:
React
.
FC
<
MaterialModalTableProps
>
=
(
props
)
=>
{
const
intl
=
useIntl
()
const
{
type
=
'checkbox'
,
schemaAction
,
confirmModal
,
currentRef
,
sectionProps
,
...
restProps
}
=
props
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
sectionProps
...
...
@@ -89,11 +103,11 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
const
addMaterialProcessField
=
(
value
,
origin
)
=>
{
let
tempOriginData
=
[...
origin
]
// 对选中值去重
const
_value
=
Object
.
values
(
value
.
reduce
((
item
,
next
)
=>
{
const
_value
=
Object
.
values
(
value
.
reduce
((
item
,
next
)
=>
{
item
[
next
.
id
]
=
next
return
item
},{}))
if
(
Array
.
isArray
(
_value
))
{
},
{}))
if
(
Array
.
isArray
(
_value
))
{
let
processData
=
_value
.
map
(
v
=>
{
let
temp
:
any
=
{};
temp
.
id
=
v
.
id
;
...
...
@@ -108,7 +122,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
})
let
originIds
=
tempOriginData
.
map
(
item
=>
item
.
id
)
processData
.
map
(
item
=>
{
if
(
!
originIds
.
includes
(
item
.
id
))
{
if
(
!
originIds
.
includes
(
item
.
id
))
{
tempOriginData
.
push
(
item
)
}
})
...
...
@@ -123,14 +137,14 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
setVisible
(
false
)
clearModalParams
()
}
// http://10.0.0.25:4000/project/1301/interface/api/189388
const
handleCancel
=
()
=>
{
setVisible
(
false
)
clearModalParams
()
}
const
otherHandle
=
<>
<
a
className=
"ant-btn"
href=
"/memberCenter/commodityAbility/commodity/goods/add"
target=
"_blank"
style=
{
{
marginRight
:
16
}
}
>
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.xinzenghuopin'
,
defaultMessage
:
'新增货品'
})
}
</
a
>
<
a
className=
"ant-btn"
href=
"/memberCenter/commodityAbility/commodity/goods/add"
target=
"_blank"
style=
{
{
marginRight
:
16
}
}
>
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.xinzenghuopin'
,
defaultMessage
:
'新增货品'
})
}
</
a
>
<
Tooltip
title=
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.dianjichaxun'
,
defaultMessage
:
'点击查询,列表可显示新增的物料'
})
}
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
...
...
@@ -146,7 +160,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
cancel=
{
handleCancel
}
fetchTableData=
{
fetchOrderApi
.
getPurchaseRequesitionMaterielList
}
rowSelection=
{
rowSelection
}
resetModal=
{
{
destroyOnClose
:
true
}
}
resetModal=
{
{
destroyOnClose
:
true
}
}
modalType=
'none'
tableProps=
{
{
rowKey
:
'id'
,
...
...
@@ -158,33 +172,35 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
})
}
}
formilyProps=
{
{
ctx
:
{
schema
:
addRequesitionMaterialSchema
,
components
:
{
ModalSearch
:
Search
,
Submit
,
Children
,
CustomInputSearch
,
CustomCategorySearch
},
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'code'
,
FORM_FILTER_PATH
,
);
FormEffectHooks
.
onFieldChange$
(
'brandId'
).
subscribe
(()
=>
{
searchBrandOptionEffect
(
actions
,
'brandId'
)
})
FormEffectHooks
.
onFieldChange$
(
'customerCategoryId'
).
subscribe
(()
=>
{
searchCustomerCategoryOptionEffect
(
actions
,
'customerCategoryId'
)
})
},
expressionScope
:
{
otherHandle
}
ctx
:
{
schema
:
addRequesitionMaterialSchema
,
components
:
{
ModalSearch
:
Search
,
Submit
,
Children
,
CustomInputSearch
,
CustomCategorySearch
,
Cascader
},
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'code'
,
FORM_FILTER_PATH
,
);
useAsyncCascader
(
'materialGroupId'
,
fetchTreeData
)
FormEffectHooks
.
onFieldChange$
(
'brandId'
).
subscribe
(()
=>
{
searchBrandOptionEffect
(
actions
,
'brandId'
)
})
FormEffectHooks
.
onFieldChange$
(
'customerCategoryId'
).
subscribe
(()
=>
{
searchCustomerCategoryOptionEffect
(
actions
,
'customerCategoryId'
)
})
},
expressionScope
:
{
otherHandle
}
}
}
}
{
...
restProps
}
/>
...
...
src/pages/transaction/purchaseRequisition/increaseRequisition/components/materialModalTable/useGetTableSearchData.tsx
0 → 100644
View file @
5ce1c294
import
{
getProductMaterialGroupTree
}
from
"@/services/ProductV2Api"
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
"@formily/antd"
const
{
onFormMount$
}
=
FormEffectHooks
const
EMPTY_ARRAY
=
[]
export
const
EMPTY
=
{
totalCount
:
0
,
data
:
[],
}
export
const
useAsyncCascader
=
async
(
name
,
service
:
()
=>
Promise
<
any
[]
>
)
=>
{
const
{
setFieldState
}
=
createFormActions
()
onFormMount$
().
subscribe
(()
=>
{
service
().
then
(
res
=>
{
setFieldState
(
name
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-component-props.options'
,
res
)
})
}).
catch
(
err
=>
{
setFieldState
(
name
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-component-props.options'
,
[])
})
})
})
}
export
const
fetchTreeData
=
async
()
=>
{
try
{
const
{
data
,
code
}
=
await
getProductMaterialGroupTree
({
rootNodeId
:
'0'
});
if
(
code
===
1000
)
{
return
data
;
}
return
EMPTY_ARRAY
}
catch
{
return
EMPTY_ARRAY
}
}
src/pages/transaction/purchaseRequisition/increaseRequisition/index.less
View file @
5ce1c294
...
...
@@ -4,4 +4,19 @@
width: 100%;
}
}
.RadioMian{
display: flex;
.RadioItem{
border-radius: 4px;
background: #F5F6F7;
padding: 5px 10px;
margin-right: 10px;
}
.Select{
background: rgba(0,169,143,0.04);
border: 1px solid #00A98F;
}
}
}
src/pages/transaction/purchaseRequisition/increaseRequisition/index.tsx
View file @
5ce1c294
import
React
,
{
useRef
,
useState
,
useEffect
}
from
'react'
import
React
,
{
useRef
,
useState
,
useEffect
,
useMemo
}
from
'react'
import
{
history
,
useIntl
}
from
'umi'
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
import
{
Button
,
Col
,
message
,
Row
,
Select
,
Upload
}
from
'antd'
import
{
Button
,
Col
,
message
,
R
adio
,
R
ow
,
Select
,
Upload
}
from
'antd'
import
{
createFormActions
,
registerVirtualBox
,
useFormSpy
}
from
'@formily/antd'
import
{
SaveOutlined
,
LinkOutlined
,
UploadOutlined
}
from
'@ant-design/icons'
import
NiceForm
from
'@/components/NiceForm'
...
...
@@ -26,6 +26,7 @@ import { UPLOAD_TYPE } from '@/constants'
import
styles
from
'./index.less'
import
{
getAuth
}
from
'@/utils/auth'
const
addSchemaAction
=
createFormActions
()
const
{
Option
}
=
Select
;
const
RowStyle
=
styled
(
props
=>
<
Row
style=
{
{
marginTop
:
12
,
justifyContent
:
"flex-end"
}
}
justify=
'end'
{
...
props
}
>
...
...
@@ -71,6 +72,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
const
[
initFormValue
,
setInitFormValue
]
=
useState
<
any
>
({})
const
{
formContext
}
=
useFormDetail
()
const
rowvendorMemberInfoRef
=
useRef
<
any
>
({});
const
deliveryTypeListRef
=
useRef
<
any
>
({});
const
[
deliveryType
,
setdeliveryType
]
=
useState
(
''
);
const
[
deliveryTypeList
,
setdeliveryTypeList
]
=
useState
([]);
const
intl
=
useIntl
()
// 请购单物料
...
...
@@ -81,37 +85,60 @@ const IncreaseRequisition: React.FC<{}> = () => {
setFormLoading
(
true
)
getPurchaseRequisitionDetail
({
id
}).
then
((
res
:
any
)
=>
{
const
{
data
}
=
res
console
.
log
(
data
,
'data'
)
const
_orderProductRequests
=
procurementRenderField
(
data
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
props
.
isDefaultAddress
=
false
;
state
.
visible
=
data
.
deliveryMethod
==
1
?
true
:
false
;
});
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
data
.
deliveryMethod
!=
1
?
true
:
false
;
});
if
(
data
.
deliveryType
)
{
if
(
data
.
deliveryMethod
==
1
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
}
if
(
data
.
deliveryMethod
==
2
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
true
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
}
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
setdeliveryType
(
data
.
deliveryType
)
}
setInitFormValue
(()
=>
procurmentRenderInit
(
data
))
setTimeout
(()
=>
{
addSchemaAction
.
setFieldValue
(
'products'
,
_orderProductRequests
)
addSchemaAction
.
setFieldValue
(
'attachments'
,
data
.
attachments
)
addSchemaAction
.
setFieldValue
(
'deliveryAddressId'
,
data
.
receiverAddressResponse
)
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
data
.
deliveryType
)
},
500
)
setFormLoading
(
false
)
})
}
else
{
const
userInfo
=
getAuth
();
const
userInfo
:
any
=
getAuth
();
addSchemaAction
.
setFieldValue
(
'requisitioner'
,
userInfo
.
name
)
addSchemaAction
.
setFieldValue
(
'requisitionerId'
,
userInfo
.
userId
)
if
(
userInfo
.
orgId
&&
userInfo
.
orgName
)
{
addSchemaAction
.
setFieldValue
(
'vendorMemberName'
,
userInfo
.
orgName
||
''
)
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
userInfo
.
orgId
||
''
)
}
}
},
[])
const
setLik
=
(
row
)
=>
{
console
.
log
(
row
)
rowvendorMemberInfoRef
.
current
=
row
;
}
const
Jump
=
()
=>
{
if
(
Object
.
keys
(
rowvendorMemberInfoRef
.
current
).
length
)
{
history
.
push
(
`/memberAbility/manage/maintain/detail/basicInfo?id=
${
rowvendorMemberInfoRef
.
current
.
memberId
}
&validateId=
${
rowvendorMemberInfoRef
.
current
.
id
}
`
)
history
.
push
(
`/member
Center/member
Ability/manage/maintain/detail/basicInfo?id=
${
rowvendorMemberInfoRef
.
current
.
memberId
}
&validateId=
${
rowvendorMemberInfoRef
.
current
.
id
}
`
)
}
}
// 供应会员
...
...
@@ -174,6 +201,27 @@ const IncreaseRequisition: React.FC<{}> = () => {
const
handleOrderMember
=
()
=>
{
memberRef
.
current
.
setVisible
(
true
)
}
// 配送方式
const
changeDeliveryType
=
(
e
)
=>
{
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
e
.
target
.
value
)
}
// 自定义组建
const
RadioNode
=
()
=>
{
return
(
<
Radio
.
Group
onChange=
{
changeDeliveryType
}
defaultValue=
{
id
?
deliveryType
:
""
}
>
<
div
className=
{
styles
.
RadioMian
}
>
{
deliveryTypeList
.
map
((
item
)
=>
(
<
div
className=
{
`${styles.RadioItem} ${item.deliveryType == deliveryType ? styles.Select : ''}`
}
key=
{
item
.
deliveryType
}
>
<
Radio
value=
{
item
.
deliveryType
}
disabled=
{
item
.
disabled
}
>
{
item
.
deliveryTypeName
}
</
Radio
>
</
div
>
))
}
</
div
>
</
Radio
.
Group
>
)
}
const
memberBtn
=
<
div
className=
'connectBtn'
onClick=
{
handleOrderMember
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
{
intl
.
formatMessage
({
id
:
'purchaseRequisition.xuanze'
,
defaultMessage
:
'选择'
})
}
</
div
>
...
...
@@ -278,10 +326,12 @@ const IncreaseRequisition: React.FC<{}> = () => {
}
const
fetchOptions
=
(
service
)
=>
{
console
.
log
(
service
,
'service'
)
return
async
function
()
{
const
res
=
await
service
();
if
(
res
.
code
===
1000
)
{
const
deliveryTypeList
=
res
.
data
.
deliveryTypes
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
true
}
})
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeList
;
setdeliveryTypeList
(
deliveryTypeList
)
return
res
.
data
.
deliveryMethods
.
map
((
item
)
=>
{
return
{
label
:
item
.
deliveryMethodName
,
value
:
item
.
deliveryMethod
}
})
}
return
[];
...
...
@@ -334,6 +384,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
actions=
{
addSchemaAction
}
schema=
{
increaseSchema
}
onSubmit=
{
handleSubmit
}
components=
{
{
RadioNode
}
}
effects=
{
(
$
,
ctx
)
=>
{
$
(
'onFormMount'
).
subscribe
(()
=>
{
})
useEditHideField
()
...
...
@@ -351,20 +404,39 @@ const IncreaseRequisition: React.FC<{}> = () => {
formContext
.
useAttachmentChangeForContext
(
ctx
)
$
(
'onFieldChange'
,
'deliveryMethod'
).
subscribe
(
res
=>
{
if
(
res
.
value
===
2
)
{
if
(
res
.
values
[
1
]?.
title
===
"物流"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
false
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
true
;
});
}
else
{
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
}
if
(
res
.
values
[
1
]?.
title
===
"自提"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
true
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
}
if
(
res
.
values
[
1
]?.
title
===
"无需配送"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
&&
deliveryTypeListRef
.
current
?.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
true
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
false
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
}
})
...
...
@@ -380,6 +452,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
enclosureColumns
,
enclosureColumnsButton
,
vendorMemberNameNode
,
}
}
/>
...
...
src/pages/transaction/purchaseRequisition/increaseRequisition/schema/index.ts
View file @
5ce1c294
...
...
@@ -187,6 +187,16 @@ const delivery: ISchema = {
span
:
1
}
},
deliveryType
:
{
type
:
'string'
,
visible
:
false
,
title
:
"客户配送方式"
,
"x-component"
:
'RadioNode'
,
"x-component-props"
:
{
span
:
1
,
},
},
//
deliveryAddressId
:
{
visible
:
false
,
...
...
src/pages/transaction/purchaseRequisition/increaseRequisition/schema/modal.ts
View file @
5ce1c294
...
...
@@ -66,6 +66,17 @@ import { getIntl } from 'umi';
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
},
},
},
materialGroupId
:
{
type
:
'string'
,
'x-component'
:
'Cascader'
,
'x-component-props'
:
{
placeholder
:
'物料组'
,
allowClear
:
true
,
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
},
style
:
{
width
:
'150px'
},
showSearch
:
true
},
},
type
:
{
type
:
'string'
,
"x-component-props"
:
{
...
...
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