Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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-admin
Commits
7fb3a840
Commit
7fb3a840
authored
Jan 13, 2022
by
GuanHua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2' of
http://10.0.0.22:3000/lingxi/lingxi-business-system
into v2
parents
4307b1ff
8c51fa80
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
22 deletions
+27
-22
useAsyncInitSelect.ts
src/formSchema/effects/useAsyncInitSelect.ts
+22
-17
index.tsx
...gManage/platformCoupon/components/DeliverCoupon/index.tsx
+4
-5
schema.tsx
...Manage/platformCoupon/components/DeliverCoupon/schema.tsx
+1
-0
No files found.
src/formSchema/effects/useAsyncInitSelect.ts
View file @
7fb3a840
...
@@ -8,26 +8,30 @@ const { onFormInit$ } = FormEffectHooks
...
@@ -8,26 +8,30 @@ const { onFormInit$ } = FormEffectHooks
* @param service 触发的异步函数, 需返回一个{label: any, value: any}形式的数组
* @param service 触发的异步函数, 需返回一个{label: any, value: any}形式的数组
*/
*/
export
const
useAsyncInitSelect
=
(
name
:
string
[],
service
:
()
=>
Promise
<
any
>
)
=>
{
export
const
useAsyncInitSelect
=
(
name
:
string
[],
service
:
()
=>
Promise
<
any
>
)
=>
{
const
{
dispatch
,
setFieldState
}
=
createFormActions
()
const
{
dispatch
,
setFieldState
}
=
createFormActions
();
const
linkage
=
useLinkageUtils
()
const
linkage
=
useLinkageUtils
();
onFormInit$
().
subscribe
(()
=>
{
onFormInit$
().
subscribe
(()
=>
{
setFieldState
(
name
,
state
=>
{
const
nameStr
:
string
=
name
.
toString
();
FormPath
.
setIn
(
state
,
'props.x-props.hasFeedback'
,
true
)
const
formPath
:
string
=
`*(
${
nameStr
}
)`
;
})
name
.
forEach
(
v
=>
linkage
.
loaded
(
v
))
setFieldState
(
formPath
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-props.hasFeedback'
,
true
);
});
linkage
.
loading
(
formPath
);
service
().
then
(
res
=>
{
service
().
then
(
res
=>
{
name
.
forEach
(
v
=>
{
name
.
forEach
(
v
=>
{
linkage
.
loaded
(
v
)
linkage
.
enum
(
v
,
res
[
v
]
||
[]);
linkage
.
enum
(
v
,
res
[
v
])
});
})
// 请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch
?.(
'requestAsyncSelect'
,
{
dispatch
&&
dispatch
(
'requestAsyncSelect'
,
{
name
,
name
,
payload
:
res
payload
:
res
,
})
});
}).
catch
(
err
=>
{
}).
finally
(()
=>
{
// linkage.loaded(name)
linkage
.
loaded
(
formPath
);
// linkage.enum(name, [])
});
})
})
})
}
}
\ No newline at end of file
src/pages/marketingManage/platformCoupon/components/DeliverCoupon/index.tsx
View file @
7fb3a840
...
@@ -298,17 +298,16 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
...
@@ -298,17 +298,16 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
});
});
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
const
{
data
=
{}
}:
any
=
res
;
const
{
const
{
memberTypes
=
[],
memberTypes
=
[],
levels
=
[],
levels
=
[],
suitableMemberTypes
=
[],
suitableMemberTypes
=
[],
}
=
data
;
}
=
res
.
data
;
return
{
return
{
memberType
:
memberTypes
.
map
(
item
=>
({
label
:
item
.
memberTypeName
,
value
:
item
.
memberTypeId
})),
memberType
Enum
:
memberTypes
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
level
:
levels
.
map
(
item
=>
({
label
:
item
.
levelTag
,
value
:
item
.
level
})),
level
:
levels
.
map
(
item
=>
({
label
:
item
.
levelTag
,
value
:
item
.
level
})),
suitableMemberType
:
suitableMemberTypes
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
suitableMemberType
:
suitableMemberTypes
?
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
};
};
}
}
return
{};
return
{};
...
@@ -400,7 +399,7 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
...
@@ -400,7 +399,7 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
FORM_FILTER_PATH
,
FORM_FILTER_PATH
,
);
);
useAsyncInitSelect
(
useAsyncInitSelect
(
[
'memberType'
,
'level'
,
'suitableMemberType'
],
[
'memberType
Enum
'
,
'level'
,
'suitableMemberType'
],
fetchSelectOptions
,
fetchSelectOptions
,
);
);
},
},
...
...
src/pages/marketingManage/platformCoupon/components/DeliverCoupon/schema.tsx
View file @
7fb3a840
...
@@ -69,6 +69,7 @@ export const drawerSchema: ISchema = {
...
@@ -69,6 +69,7 @@ export const drawerSchema: ISchema = {
'x-component'
:
'NumberPicker'
,
'x-component'
:
'NumberPicker'
,
'x-component-props'
:
{
'x-component-props'
:
{
placeholder
:
'会员ID'
,
placeholder
:
'会员ID'
,
min
:
0
,
},
},
},
},
memberTypeEnum
:
{
memberTypeEnum
:
{
...
...
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