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
linweijiong
jinfa-platform
Commits
5855a8a1
Commit
5855a8a1
authored
Aug 29, 2022
by
wzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 关联供应商回显修改
parent
9282289c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
39 deletions
+49
-39
useGetDetailCommon.tsx
src/pages/commodity/material/common/useGetDetailCommon.tsx
+3
-3
useGetTableSearchData.tsx
...pages/commodity/material/common/useGetTableSearchData.tsx
+4
-4
add.tsx
src/pages/commodity/material/materialPendingAdd/add.tsx
+42
-31
roles.ts
...ges/commodity/material/materialPendingAdd/schema/roles.ts
+0
-1
No files found.
src/pages/commodity/material/common/useGetDetailCommon.tsx
View file @
5855a8a1
...
...
@@ -25,10 +25,10 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
const
[
vendor
,
setVendor
]
=
useState
(
''
)
const
getVentor
=
(
vt
)
=>
{
getMemberAbilityMaintenanceCreateMterielPage
().
then
(
res
=>
{
getMemberAbilityMaintenanceCreateMterielPage
(
{
memberGlobalMqId
:
vt
}
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
val
=
res
.
data
.
data
?.
find
(
v
=>
v
.
memberGlobalMqId
===
vt
)
setVendor
(
val
?.
name
)
setVendor
(
res
.
data
.
data
?.[
0
]
?.
name
)
}
})
}
...
...
@@ -85,7 +85,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
const
basicInfoList
=
useMemo
(()
=>
{
const
show_
=
getAuth
()?.
memberRoleType
===
RoleEnum
.
Purchaser
;
if
(
initialValue
&&
!
vendor
&&
show_
)
{
if
(
initialValue
&&
!
vendor
&&
show_
&&
initialValue
?.
vendorMemberGlobalMQID
)
{
getVentor
(
initialValue
?.
vendorMemberGlobalMQID
)
}
const
basicInfoList_
=
[
...
...
src/pages/commodity/material/common/useGetTableSearchData.tsx
View file @
5855a8a1
...
...
@@ -51,9 +51,9 @@ export const fetchCategoryData = async () => {
}
}
export
const
fetchBrand
=
async
(
name
?:
string
)
=>
{
export
const
fetchBrand
=
async
()
=>
{
try
{
const
{
data
,
code
}
=
await
getProductSelectGetAllSelectBrand
(
{
name
}
);
const
{
data
,
code
}
=
await
getProductSelectGetAllSelectBrand
();
if
(
code
===
1000
)
{
return
data
;
}
...
...
@@ -62,9 +62,9 @@ export const fetchBrand = async (name?: string) => {
return
EMPTY_ARRAY
}
}
export
const
fetchVendor
=
async
(
name
?:
string
)
=>
{
export
const
fetchVendor
=
async
(
param
?:
Object
)
=>
{
try
{
const
{
data
,
code
}
=
await
getMemberAbilityMaintenanceCreateMterielPage
(
{
name
}
);
const
{
data
,
code
}
=
await
getMemberAbilityMaintenanceCreateMterielPage
(
param
);
if
(
code
===
1000
)
{
return
data
.
data
;
}
...
...
src/pages/commodity/material/materialPendingAdd/add.tsx
View file @
5855a8a1
...
...
@@ -95,6 +95,31 @@ const MaterialAdd: React.FC<IProps> = (props) => {
})
},
[])
const
searchFn
=
(
fn
,
key
:
string
,
key_val
:
string
,
param
?,
enum_
=
[])
=>
{
if
(
timer
)
{
clearTimeout
(
timer
)
timer
=
null
}
timer
=
setTimeout
(()
=>
{
fn
(
param
).
then
(
data
=>
{
formActions
.
setFieldState
(
key
,
state
=>
{
state
.
props
.
enum
=
[
...
enum_
,
...
data
.
map
((
item
)
=>
({
label
:
item
[
'name'
],
value
:
item
[
key_val
]
}))
];
state
.
originData
=
[
...
enum_
,
...
data
];
})
})
},
300
);
}
const
handleVendor
=
async
(
name
?)
=>
{
searchFn
(
fetchVendor
,
'vendor'
,
'memberGlobalMqId'
,
{
name
})
}
useEffect
(()
=>
{
if
(
!
formatInitialValue
)
{
return
...
...
@@ -117,13 +142,23 @@ const MaterialAdd: React.FC<IProps> = (props) => {
})
}
setVendor
({
vendorMemberId
:
formatInitialValue
.
vendorMemberId
,
vendorMemberRoleId
:
formatInitialValue
.
vendorMemberRoleId
,
vendorMemberGlobalMQID
:
formatInitialValue
.
vendorMemberGlobalMQID
,
vendorName
:
formatInitialValue
.
vendorName
,
})
if
(
formatInitialValue
.
vendorMemberGlobalMQID
)
{
formActions
.
getFieldState
(
'vendor'
,
state
=>
{
const
enum_
=
state
.
props
.
enum
if
(
enum_
.
length
)
{
const
find_
=
enum_
.
findIndex
(
val
=>
val
.
memberGlobalMqId
===
formatInitialValue
.
vendorMemberGlobalMQID
)
if
(
find_
===
-
1
)
{
searchFn
(
fetchVendor
,
'vendor'
,
'memberGlobalMqId'
,
{
memberGlobalMqId
:
formatInitialValue
.
vendorMemberGlobalMQID
},
enum_
)
}
}
})
setVendor
({
vendorMemberId
:
formatInitialValue
.
vendorMemberId
,
vendorMemberRoleId
:
formatInitialValue
.
vendorMemberRoleId
,
vendorMemberGlobalMQID
:
formatInitialValue
.
vendorMemberGlobalMQID
,
vendorName
:
formatInitialValue
.
vendorName
,
})
}
// if (!isAdd && !isEdit) {
// /* 最小单位(包) */
// if (formatInitialValue?.miniUnit) {
...
...
@@ -507,29 +542,6 @@ const MaterialAdd: React.FC<IProps> = (props) => {
});
}
};
const searchFn = (fn, key: string, key_val: string, name?: string) => {
if (timer) {
clearTimeout(timer)
timer = null
}
timer = setTimeout(() => {
fn(name).then(data => {
formActions.setFieldState(key, state => {
state.props.enum = data.map((item) => ({
label: item['name'],
value: item[key_val]
}));
state.originData = data;
})
})
}, 300);
}
const handleBrand = async (name?: string) => {
searchFn(fetchBrand, 'brand', 'id', name)
}
const handleVendor = async (name?: string) => {
searchFn(fetchVendor, 'vendor', 'memberGlobalMqId', name)
}
return (
<AnchorPage
title={renderTitle()}
...
...
@@ -570,7 +582,6 @@ const MaterialAdd: React.FC<IProps> = (props) => {
// className={styles.startText}
startText: <span>发货地</span>,
limitDecimalPoint,
handleBrand,
handleVendor
}}
effects={($, actions) => {
...
...
src/pages/commodity/material/materialPendingAdd/schema/roles.ts
View file @
5855a8a1
...
...
@@ -373,7 +373,6 @@ const brand = {
'x-component-props'
:
{
allowClear
:
true
,
showSearch
:
true
,
onSearch
:
'{{handleBrand}}'
,
optionFilterProp
:
'children'
,
filterOption
:
(
input
,
option
)
=>
(
option
!
.
children
as
unknown
as
string
).
toLowerCase
().
includes
(
input
.
toLowerCase
())
},
...
...
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