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
01cb6f2b
Commit
01cb6f2b
authored
Jan 15, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改新建加工通知单时,加工商品搜索bug
parent
35a5d377
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
33 deletions
+16
-33
index.tsx
src/pages/handling/components/ProcessProducts/index.tsx
+13
-24
schema.tsx
src/pages/handling/components/ProcessProducts/schema.tsx
+3
-9
No files found.
src/pages/handling/components/ProcessProducts/index.tsx
View file @
01cb6f2b
import
React
,
{
useState
,
useEffect
,
useCallback
}
from
'react'
;
import
{
Modal
,
Spin
}
from
'antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
EyePreview
from
'@/components/EyePreview'
;
import
{
BasicForm
,
TablePagination
,
SearchForm
}
from
'../ModalForTable'
import
{
SearchForm
}
from
'../ModalForTable'
import
{
createAsyncFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
schema
}
from
'./schema'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
useDebounceFn
}
from
'@umijs/hooks'
;
import
{
Cascader
}
from
'antd'
;
const
{
onFieldInit$
}
=
FormEffectHooks
...
...
@@ -22,13 +22,14 @@ const MALL_NAME = {
const
ProcessProducts
=
({
visible
,
cancel
,
rowSelection
,
loading
,
...
restProps
})
=>
{
const
authInfo
=
getAuth
();
const
fetchData
=
useCallback
(
async
(
params
:
any
)
=>
{
cons
ole
.
log
(
params
);
cons
t
customerCategoryId
=
params
.
customerCategoryId
&&
Array
.
isArray
(
params
.
customerCategoryId
)
&&
params
.
customerCategoryId
.
pop
(
);
// /product/commodity/common/getCommodityListByBuyer
const
postData
=
{
shopType
:
ENTERPRISE_MALL
[
authInfo
.
memberType
],
environment
:
1
,
memberId
:
authInfo
.
memberId
,
...
params
,
customerCategoryId
:
customerCategoryId
,
}
let
res
=
await
PublicApi
.
getProductCommodityCommonGetCommodityListByBuyer
(
postData
);
return
res
;
...
...
@@ -55,11 +56,11 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
}
const
effects
=
()
=>
{
onFieldInit$
(
'bran
ch
Id'
).
subscribe
((
fieldState
)
=>
{
onFieldInit$
(
'bran
d
Id'
).
subscribe
((
fieldState
)
=>
{
changeBrand
({
name
:
''
})
});
onFieldInit$
(
'categoryId'
).
subscribe
((
fieldState
)
=>
{
changeCategory
(
{
name
:
''
}
);
onFieldInit$
(
'c
ustomerC
ategoryId'
).
subscribe
((
fieldState
)
=>
{
changeCategory
();
})
}
...
...
@@ -69,30 +70,19 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
if
(
res
.
code
===
1000
)
{
options
=
res
.
data
.
map
((
item
)
=>
{
return
{
label
:
item
.
name
,
value
:
item
.
id
}})
}
actions
.
setFieldState
(
"bran
ch
Id"
,
(
state
)
=>
{
actions
.
setFieldState
(
"bran
d
Id"
,
(
state
)
=>
{
state
.
props
[
"x-component-props"
][
"options"
]
=
options
;
})
})
}
const
changeCategory
=
(
params
)
=>
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
(
params
).
then
(
res
=>
{
let
options
=
[]
if
(
res
.
code
===
1000
)
{
options
=
res
.
data
.
map
((
item
)
=>
{
return
{
label
:
item
.
name
,
value
:
item
.
id
}})
}
actions
.
setFieldState
(
"categoryId"
,
(
state
)
=>
{
state
.
props
[
"x-component-props"
][
"options"
]
=
options
;
const
changeCategory
=
()
=>
{
PublicApi
.
getProductCustomerGetCustomerCategoryTree
().
then
(
res
=>
{
actions
.
setFieldState
(
"customerCategoryId"
,
(
state
)
=>
{
state
.
props
[
"x-component-props"
][
"options"
]
=
res
.
data
;
})
})
}
const
filterCategroyOption
=
(
input
,
option
)
=>
{
return
option
.
label
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
}
const
onCategory
=
useDebounceFn
((
value
)
=>
{
changeCategory
({
name
:
value
});
},
500
)
const
filterBrandOption
=
(
input
,
option
)
=>
{
return
option
.
label
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
...
...
@@ -116,14 +106,13 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
<
Spin
spinning=
{
loading
}
>
<
SearchForm
request=
{
fetchData
}
components=
{
{
Cascader
}
}
schema=
{
schema
}
actions=
{
actions
}
effects=
{
effects
}
expressionScope=
{
{
rowSelection
:
rowSelection
,
columns
:
columns
,
filterCategroyOption
:
filterCategroyOption
,
onCategory
:
onCategory
.
run
,
filterBrandOption
:
filterBrandOption
,
onBrandSearch
:
onBrandSearch
.
run
}
}
...
...
src/pages/handling/components/ProcessProducts/schema.tsx
View file @
01cb6f2b
...
...
@@ -62,7 +62,7 @@ export const schema = {
properties
:
{
customerCategoryId
:
{
type
:
'string'
,
'x-component'
:
'
Select
'
,
'x-component'
:
'
Cascader
'
,
'x-component-props'
:
{
placeholder
:
'请选择商品品类'
,
allowClear
:
true
,
...
...
@@ -70,16 +70,10 @@ export const schema = {
width
:
'200px'
,
margin
:
'0 20px 0 0'
},
showSearch
:
true
,
optionFilterProp
:
"children"
,
filterOption
:
"{{filterCategroyOption}}"
,
onSearch
:
"{{onCategory}}"
// filterOption: {(input, option) =>
// option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
// }
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
}
}
},
bran
ch
Id
:
{
bran
d
Id
:
{
type
:
'string'
,
'x-component'
:
'Select'
,
'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