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
Hide 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
React
,
{
useState
,
useEffect
,
useCallback
}
from
'react'
;
import
{
Modal
,
Spin
}
from
'antd'
;
import
{
Modal
,
Spin
}
from
'antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
EyePreview
from
'@/components/EyePreview'
;
import
{
SearchForm
}
from
'../ModalForTable'
import
{
BasicForm
,
TablePagination
,
SearchForm
}
from
'../ModalForTable'
import
{
createAsyncFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
createAsyncFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
schema
}
from
'./schema'
;
import
{
schema
}
from
'./schema'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
useDebounceFn
}
from
'@umijs/hooks'
;
import
{
useDebounceFn
}
from
'@umijs/hooks'
;
import
{
Cascader
}
from
'antd'
;
const
{
onFieldInit$
}
=
FormEffectHooks
const
{
onFieldInit$
}
=
FormEffectHooks
...
@@ -22,13 +22,14 @@ const MALL_NAME = {
...
@@ -22,13 +22,14 @@ const MALL_NAME = {
const
ProcessProducts
=
({
visible
,
cancel
,
rowSelection
,
loading
,
...
restProps
})
=>
{
const
ProcessProducts
=
({
visible
,
cancel
,
rowSelection
,
loading
,
...
restProps
})
=>
{
const
authInfo
=
getAuth
();
const
authInfo
=
getAuth
();
const
fetchData
=
useCallback
(
async
(
params
:
any
)
=>
{
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
// /product/commodity/common/getCommodityListByBuyer
const
postData
=
{
const
postData
=
{
shopType
:
ENTERPRISE_MALL
[
authInfo
.
memberType
],
shopType
:
ENTERPRISE_MALL
[
authInfo
.
memberType
],
environment
:
1
,
environment
:
1
,
memberId
:
authInfo
.
memberId
,
memberId
:
authInfo
.
memberId
,
...
params
,
...
params
,
customerCategoryId
:
customerCategoryId
,
}
}
let
res
=
await
PublicApi
.
getProductCommodityCommonGetCommodityListByBuyer
(
postData
);
let
res
=
await
PublicApi
.
getProductCommodityCommonGetCommodityListByBuyer
(
postData
);
return
res
;
return
res
;
...
@@ -55,11 +56,11 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
...
@@ -55,11 +56,11 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
}
}
const
effects
=
()
=>
{
const
effects
=
()
=>
{
onFieldInit$
(
'bran
ch
Id'
).
subscribe
((
fieldState
)
=>
{
onFieldInit$
(
'bran
d
Id'
).
subscribe
((
fieldState
)
=>
{
changeBrand
({
name
:
''
})
changeBrand
({
name
:
''
})
});
});
onFieldInit$
(
'categoryId'
).
subscribe
((
fieldState
)
=>
{
onFieldInit$
(
'c
ustomerC
ategoryId'
).
subscribe
((
fieldState
)
=>
{
changeCategory
(
{
name
:
''
}
);
changeCategory
();
})
})
}
}
...
@@ -69,30 +70,19 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
...
@@ -69,30 +70,19 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
options
=
res
.
data
.
map
((
item
)
=>
{
return
{
label
:
item
.
name
,
value
:
item
.
id
}})
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
;
state
.
props
[
"x-component-props"
][
"options"
]
=
options
;
})
})
})
})
}
}
const
changeCategory
=
(
params
)
=>
{
const
changeCategory
=
()
=>
{
PublicApi
.
getProductSelectGetSelectCustomerCategory
(
params
).
then
(
res
=>
{
PublicApi
.
getProductCustomerGetCustomerCategoryTree
().
then
(
res
=>
{
let
options
=
[]
actions
.
setFieldState
(
"customerCategoryId"
,
(
state
)
=>
{
if
(
res
.
code
===
1000
)
{
state
.
props
[
"x-component-props"
][
"options"
]
=
res
.
data
;
options
=
res
.
data
.
map
((
item
)
=>
{
return
{
label
:
item
.
name
,
value
:
item
.
id
}})
}
actions
.
setFieldState
(
"categoryId"
,
(
state
)
=>
{
state
.
props
[
"x-component-props"
][
"options"
]
=
options
;
})
})
})
})
}
}
const
filterCategroyOption
=
(
input
,
option
)
=>
{
return
option
.
label
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
}
const
onCategory
=
useDebounceFn
((
value
)
=>
{
changeCategory
({
name
:
value
});
},
500
)
const
filterBrandOption
=
(
input
,
option
)
=>
{
const
filterBrandOption
=
(
input
,
option
)
=>
{
return
option
.
label
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
return
option
.
label
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
...
@@ -116,14 +106,13 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
...
@@ -116,14 +106,13 @@ const ProcessProducts = ({visible, cancel, rowSelection, loading, ...restProps})
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
SearchForm
<
SearchForm
request=
{
fetchData
}
request=
{
fetchData
}
components=
{
{
Cascader
}
}
schema=
{
schema
}
schema=
{
schema
}
actions=
{
actions
}
actions=
{
actions
}
effects=
{
effects
}
effects=
{
effects
}
expressionScope=
{
{
expressionScope=
{
{
rowSelection
:
rowSelection
,
rowSelection
:
rowSelection
,
columns
:
columns
,
columns
:
columns
,
filterCategroyOption
:
filterCategroyOption
,
onCategory
:
onCategory
.
run
,
filterBrandOption
:
filterBrandOption
,
filterBrandOption
:
filterBrandOption
,
onBrandSearch
:
onBrandSearch
.
run
onBrandSearch
:
onBrandSearch
.
run
}
}
}
}
...
...
src/pages/handling/components/ProcessProducts/schema.tsx
View file @
01cb6f2b
...
@@ -62,7 +62,7 @@ export const schema = {
...
@@ -62,7 +62,7 @@ export const schema = {
properties
:
{
properties
:
{
customerCategoryId
:
{
customerCategoryId
:
{
type
:
'string'
,
type
:
'string'
,
'x-component'
:
'
Select
'
,
'x-component'
:
'
Cascader
'
,
'x-component-props'
:
{
'x-component-props'
:
{
placeholder
:
'请选择商品品类'
,
placeholder
:
'请选择商品品类'
,
allowClear
:
true
,
allowClear
:
true
,
...
@@ -70,16 +70,10 @@ export const schema = {
...
@@ -70,16 +70,10 @@ export const schema = {
width
:
'200px'
,
width
:
'200px'
,
margin
:
'0 20px 0 0'
margin
:
'0 20px 0 0'
},
},
showSearch
:
true
,
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
}
optionFilterProp
:
"children"
,
filterOption
:
"{{filterCategroyOption}}"
,
onSearch
:
"{{onCategory}}"
// filterOption: {(input, option) =>
// option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
// }
}
}
},
},
bran
ch
Id
:
{
bran
d
Id
:
{
type
:
'string'
,
type
:
'string'
,
'x-component'
:
'Select'
,
'x-component'
:
'Select'
,
'x-component-props'
:
{
'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