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
e86a725b
Commit
e86a725b
authored
Jul 08, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加 分页展示相关
parent
ee716a42
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
28 deletions
+53
-28
index.tsx
...CouponUnsubmitted/components/CouponForm/effects/index.tsx
+33
-1
useBusinessEffects.ts
...itted/components/CouponForm/effects/useBusinessEffects.ts
+18
-23
schema.tsx
...erchantCouponUnsubmitted/components/CouponForm/schema.tsx
+2
-4
No files found.
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/effects/index.tsx
View file @
e86a725b
...
...
@@ -2,13 +2,14 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:03:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-0
2 10:32:13
* @LastEditTime: 2021-07-0
8 16:35:58
* @Description:
*/
import
{
FormPath
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
useAsyncInitSelect
}
from
'@/formSchema/effects/useAsyncInitSelect'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
import
{
ResponseType
}
from
'../../../../../components/MemberCheckboxGroup'
;
const
{
onFieldMount$
,
...
...
@@ -62,6 +63,25 @@ const fetchApplicationUserRole = async () => {
return
{};
};
// 获取 实用会员选项
const
fetchMemberOtions
:
(
params
:
{
current
:
string
,
pageSize
:
string
,
levelConfigIds
:
string
,
roleIds
:
string
})
=>
Promise
<
ResponseType
>
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getMemberAbilityLevelTagPage
(
params
);
if
(
res
.
code
===
1000
)
{
const
options
=
res
.
data
.
data
.
map
(
item
=>
({
label
:
item
.
roleName
,
value
:
item
.
id
,
level
:
item
.
level
,
roleName
:
item
.
roleName
,
levelTypeName
:
item
.
levelTypeName
,
memberTypeName
:
item
.
memberTypeName
,
}));
return
{
data
:
options
,
totalCount
:
res
.
data
.
totalCount
,
};
}
};
export
const
createEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
}
=
actions
;
...
...
@@ -97,6 +117,7 @@ export const createEffects = (context, actions) => {
});
});
// 初始化 适用商城数据
onFieldMount$
(
'suitableMallTypes'
).
subscribe
(()
=>
{
PublicApi
.
getManageShopFindByMemberType
().
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
...
...
@@ -107,4 +128,14 @@ export const createEffects = (context, actions) => {
}
});
});
// 初始化 适用会员列表
onFieldMount$
(
'applicationMemberLevel'
).
subscribe
(()
=>
{
setFieldState
(
'applicationMemberLevel'
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-component-props'
,
{
showMoreAction
:
true
,
fetchOptions
:
fetchMemberOtions
,
});
});
});
};
\ No newline at end of file
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/effects/useBusinessEffects.ts
View file @
e86a725b
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-0
2 14:14:20
* @LastEditTime: 2021-07-0
8 17:08:56
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
,
IFormActions
}
from
'@formily/antd'
;
...
...
@@ -17,7 +17,6 @@ import {
MERCHANT_COUPON_RECEIVE_ACTIVITY
,
MERCHANT_COUPON_RECEIVE_OPERATE
,
}
from
'@/constants/marketing'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
{
onFieldInputChange$
,
...
...
@@ -190,28 +189,24 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
});
// 适用用户角色
onField
Value
Change$
(
'applicationUserRole'
).
subscribe
(
state
=>
{
onField
Input
Change$
(
'applicationUserRole'
).
subscribe
(
state
=>
{
const
{
value
}
=
state
;
const
filtered
=
(
value
||
[]).
filter
((
item
)
=>
item
!==
0
);
// 过滤掉 0全选元素
// 查询会员列表,0 表示全部
PublicApi
.
getMemberAbilityLevelTagPage
({
roleIds
:
filtered
.
join
(
','
),
current
:
`
${
1
}
`
,
pageSize
:
`
${
9999
}
`
,
levelConfigIds
:
''
,
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
options
=
res
.
data
.
data
.
map
(
item
=>
({
label
:
item
.
roleName
,
value
:
item
.
id
,
level
:
item
.
level
,
roleName
:
item
.
roleName
,
levelTypeName
:
item
.
levelTypeName
,
memberTypeName
:
item
.
memberTypeName
,
}));
linkage
.
enum
(
'applicationMemberLevel'
,
options
);
}
let
filtered
=
[...
value
];
// 这里处理一下全部,当点击了 全部 把 0 去掉,否则插入一个 0
if
(
value
.
includes
(
0
))
{
filtered
=
(
value
||
[]).
filter
((
item
)
=>
item
!==
0
);
// 过滤掉 0全选元素
}
else
{
filtered
.
unshift
(
0
);
}
setFieldState
(
'applicationMemberLevel'
,
fieldState
=>
{
FormPath
.
setIn
(
fieldState
,
'props.x-component-props'
,
Object
.
assign
({},
fieldState
.
props
[
'x-component-props'
],
{
extraParams
:
{
roleIds
:
filtered
.
join
(
','
),
levelConfigIds
:
''
,
},
}));
});
});
...
...
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/schema.tsx
View file @
e86a725b
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:05:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-0
2 13:54:30
* @LastEditTime: 2021-07-0
8 16:43:22
* @Description:
*/
import
{
ISchema
}
from
'@formily/antd'
;
...
...
@@ -527,11 +527,9 @@ const schema: ISchema = {
},
applicationMemberLevel
:
{
type
:
'string'
,
enum
:
[],
required
:
true
,
'x-component'
:
'MemberCheckboxGroup'
,
'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