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
d236f4c0
Commit
d236f4c0
authored
Oct 22, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:交易规则会员名称显示异常/选会员同memberId的数据选择异常、modalTable反选异常
parent
0429057f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
29 deletions
+36
-29
useRowSelectionTable.ts
src/hooks/useRowSelectionTable.ts
+2
-2
addRule.tsx
src/pages/ruleSettingManage/transactionRules/addRule.tsx
+4
-0
RuleSetting.tsx
...SettingManage/transactionRules/components/RuleSetting.tsx
+29
-26
index.tsx
...pages/ruleSettingManage/transactionRules/schema/index.tsx
+1
-1
No files found.
src/hooks/useRowSelectionTable.ts
View file @
d236f4c0
...
...
@@ -57,11 +57,11 @@ export const useRowSelectionTable = (options: useRowSelectionOptions = {}): [Tab
onSelect
:
(
record
,
selects
,
selectedRows
,
nativeEvent
)
=>
{
if
(
type
===
'radio'
)
{
// 单选情况下
setSelectedRowKeys
([
record
.
id
])
setSelectedRowKeys
([
record
[
customKey
]
])
setSelectRow
([
record
])
return
;
}
const
findIds
=
selectedRowKeys
.
indexOf
(
record
.
id
)
const
findIds
=
selectedRowKeys
.
indexOf
(
record
[
customKey
]
)
if
(
findIds
===
-
1
)
{
mergeRowKeys
(
record
[
customKey
])
mergeRow
(
record
)
...
...
src/pages/ruleSettingManage/transactionRules/addRule.tsx
View file @
d236f4c0
...
...
@@ -29,6 +29,10 @@ const AddRule:React.FC<{}> = (props) => {
const
formSubmit
=
async
(
values
)
=>
{
setIsDisabled
(
true
)
const
params
=
omit
(
values
,
[
'state'
])
console
.
log
(
params
,
'parmas'
)
// 切割memberId
let
res
:
any
=
{}
if
(
pageStatus
===
PageStatus
.
EDIT
){
res
=
await
PublicApi
.
postOrderTradingRulesBackgroundUpdata
(
params
)
...
...
src/pages/ruleSettingManage/transactionRules/components/RuleSetting.tsx
View file @
d236f4c0
...
...
@@ -34,7 +34,7 @@ export interface RuleSettingProps {
const
RuleSetting
:
React
.
FC
<
RuleSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
memberRowSelection
,
memberRowCtl
]
=
useRowSelectionTable
({
customKey
:
'memberId'
})
const
[
memberRowSelection
,
memberRowCtl
]
=
useRowSelectionTable
({
customKey
:
'member
Role
Id'
})
const
[
initValue
,
setInitialValue
]
=
useState
({})
const
[
membersLength
,
setMembersLength
]
=
useState
(
0
)
...
...
@@ -46,18 +46,20 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const
fetchMembersList
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getMemberManageAllProviderPage
(
params
)
return
res
.
data
const
{
code
,
data
}
=
res
let
_data
=
data
.
data
.
map
(
item
=>
({
...
item
,
memberRoleId
:
item
.
memberId
+
'_'
+
item
.
roleId
}))
return
{
totalCount
:
data
.
totalCount
,
data
:
_data
}
}
// table删除商品
const
handleDeleteTable
=
(
id
)
=>
{
const
value
=
addSchemaAction
.
getFieldValue
(
'memberIds'
)
addSchemaAction
.
setFieldValue
(
'memberIds'
,
findItemAndDelete
(
value
,
id
,
'memberId'
))
addSchemaAction
.
setFieldValue
(
'memberIds'
,
findItemAndDelete
(
value
,
id
,
'member
Role
Id'
))
}
const
handleAddMemberBtn
=
()
=>
{
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'memberIds'
)
memberRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
member
Role
Id
))
memberRowCtl
.
setSelectRow
(
checkBoxs
)
setVisibleChannelRroduct
(
true
)
}
...
...
@@ -72,9 +74,9 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
key
:
'memberId'
},
{
dataIndex
:
'
n
ame'
,
dataIndex
:
'
memberN
ame'
,
title
:
'会员名称'
,
key
:
'
n
ame'
,
key
:
'
memberN
ame'
,
// render: (_, record) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${record.id}`}>{_}</EyePreview>
},
{
...
...
@@ -96,7 +98,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
memberId
)
}
>
删除
</
Button
>
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
member
Role
Id
)
}
>
删除
</
Button
>
}
]
...
...
@@ -108,6 +110,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// 会员添加弹窗控制
const
handleOkAddMember
=
async
()
=>
{
setVisibleChannelRroduct
(
false
)
console
.
log
(
memberRowCtl
)
addSchemaAction
.
setFieldValue
(
'memberIds'
,
memberRowCtl
.
selectRow
)
}
...
...
@@ -117,6 +120,12 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const
columnsSetProduct
:
any
[]
=
[
{
dataIndex
:
'memberRoleId'
,
title
:
'MRID'
,
key
:
'memberRoleId'
,
className
:
'commonHide'
},
{
dataIndex
:
'memberId'
,
title
:
'ID'
,
key
:
'memberId'
...
...
@@ -176,9 +185,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
enum
:
[],
"x-component-props"
:
{
placeholder
:
'请选择会员类型'
,
// style: {
// width: 160
// }
}
},
roleId
:
{
...
...
@@ -186,9 +192,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
enum
:
[],
"x-component-props"
:
{
placeholder
:
'请选择会员角色'
,
// style: {
// width: 160
// }
}
},
level
:
{
...
...
@@ -196,9 +199,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
enum
:
[],
"x-component-props"
:
{
placeholder
:
'请选择会员等级'
,
// style: {
// width: 160
// }
}
},
submit
:
{
...
...
@@ -237,6 +237,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
useEffect
(()
=>
{
async
function
getInitValue
()
{
// @ts-ignore
const
{
data
}
=
await
PublicApi
.
getOrderTradingRulesBackgroundDetails
({
id
:
id
});
if
(
data
.
isTacitlyApprove
===
2
)
{
const
res
=
await
getBindingMembers
({
id
:
id
.
toString
(),
current
:
'1'
,
pageSize
:
'10'
})
...
...
@@ -245,7 +246,6 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
})
setMembersLength
(
res
.
totalCount
);
}
console
.
log
(
data
,
'data'
)
addSchemaAction
.
setFieldValue
(
'isTacitlyApprove'
,
data
.
isTacitlyApprove
===
1
?
1
:
2
)
setInitialValue
(
data
)
}
...
...
@@ -257,15 +257,18 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// 拿到绑定的会员
const
getBindingMembers
=
async
({
id
=
'1'
,
current
=
'1'
,
pageSize
=
'10'
})
=>
{
const
res
=
await
PublicApi
.
getOrderTradingRulesBackgroundMember
({
id
,
current
,
pageSize
})
return
res
.
data
const
{
code
,
data
}
=
res
let
_data
=
data
.
data
.
map
(
item
=>
({
...
item
,
memberRoleId
:
item
.
memberId
+
'_'
+
item
.
roleId
}))
return
{
totalCount
:
data
.
totalCount
,
data
:
_data
}
}
const
paginationChange
=
async
(
page
:
number
,
size
:
number
)
=>
{
if
(
id
!==
''
)
{
const
result
=
await
getBindingMembers
({
id
,
current
:
page
.
toString
(),
pageSize
:
size
.
toString
()})
addSchemaAction
.
setFieldValue
(
'memberIds'
,
result
.
data
)
}
}
// const paginationChange = async (page: number, size: number) => {
// if(id !== '') {
// const result = await getBindingMembers({id, current: page.toString(), pageSize: size.toString()})
// console.log(result.data, 'resu')
// addSchemaAction.setFieldValue('memberIds', result.data)
// }
// }
return
(
<>
...
...
@@ -276,7 +279,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
expressionScope=
{
{
tableColumns
,
tableAddButton
,
paginationChange
,
//
paginationChange,
membersLength
}
}
components=
{
{
...
...
@@ -322,7 +325,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
}
tableProps=
{
{
rowKey
:
'member
Id'
,
rowKey
:
'member
RoleId'
}
}
/>
...
...
src/pages/ruleSettingManage/transactionRules/schema/index.tsx
View file @
d236f4c0
...
...
@@ -105,7 +105,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'memberId'
,
rowKey
:
'member
Role
Id'
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
}
...
...
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