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
5ef44bef
Commit
5ef44bef
authored
Dec 11, 2020
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
思考判断工作流不同的逻辑中
parent
faea484b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
10 deletions
+72
-10
index.tsx
src/pages/afterService/components/GoodsDrawer/index.tsx
+71
-10
index.tsx
...pplication/returnPrSubmit/components/ReturnForm/index.tsx
+1
-0
No files found.
src/pages/afterService/components/GoodsDrawer/index.tsx
View file @
5ef44bef
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
* @Author: XieZhiXiong
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-11 1
6:25:51
* @LastEditTime: 2020-12-11 1
8:39:09
* @Description: 维修商品抽屉组件
* @Description: 维修商品抽屉组件
*/
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Drawer
,
Button
,
Pagination
}
from
'antd'
;
import
{
Drawer
,
Button
,
Pagination
,
message
}
from
'antd'
;
import
{
createFormActions
}
from
'@formily/antd'
;
import
{
createFormActions
}
from
'@formily/antd'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
...
@@ -18,6 +18,7 @@ import NestTable from '@/components/NestTable';
...
@@ -18,6 +18,7 @@ import NestTable from '@/components/NestTable';
import
{
goodItem
,
OrderListParams
,
OrderListRes
}
from
'./interface'
;
import
{
goodItem
,
OrderListParams
,
OrderListRes
}
from
'./interface'
;
import
{
listSearchSchema
}
from
'./schema'
;
import
{
listSearchSchema
}
from
'./schema'
;
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
PublicApi
}
from
'@/services/api'
;
const
formActions
=
createFormActions
();
const
formActions
=
createFormActions
();
...
@@ -42,6 +43,11 @@ interface GoodsDrawerProps {
...
@@ -42,6 +43,11 @@ interface GoodsDrawerProps {
nestProps
?:
{
nestProps
?:
{
[
key
:
string
]:
any
,
[
key
:
string
]:
any
,
};
};
/**
* 流程类型:1.订单交易流程 2.售后换货流程 3.售后退货流程 4.售后维修流程
*/
type
:
1
|
2
|
3
|
4
,
};
};
interface
GoodsDrawerState
{
interface
GoodsDrawerState
{
...
@@ -58,6 +64,7 @@ interface GoodsDrawerState {
...
@@ -58,6 +64,7 @@ interface GoodsDrawerState {
selectedRowKeys
:
number
[];
selectedRowKeys
:
number
[];
childSelectedRowKeys
:
number
[];
childSelectedRowKeys
:
number
[];
loading
:
boolean
;
loading
:
boolean
;
currentProcessEnum
:
number
;
};
};
// 跟 选中的子节点 找到 父级选中的 keys
// 跟 选中的子节点 找到 父级选中的 keys
...
@@ -124,6 +131,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -124,6 +131,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
selectedRowKeys
:
[],
selectedRowKeys
:
[],
childSelectedRowKeys
:
[],
childSelectedRowKeys
:
[],
loading
:
false
,
loading
:
false
,
currentProcessEnum
:
0
,
};
};
};
};
...
@@ -201,26 +209,58 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -201,26 +209,58 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
];
];
// 获取订单列表
// 获取订单列表
getOrderList
=
()
=>
{
getOrderList
=
async
()
=>
{
const
{
page
,
size
,
searchVal
}
=
this
.
state
;
const
{
page
,
size
,
searchVal
}
=
this
.
state
;
const
{
fetchOrderList
}
=
this
.
props
;
const
{
fetchOrderList
,
type
}
=
this
.
props
;
if
(
!
fetchOrderList
)
{
if
(
!
fetchOrderList
)
{
return
;
return
;
}
}
this
.
setState
({
loading
:
true
});
this
.
setState
({
loading
:
true
});
fetchOrderList
({
const
orderListRes
=
await
fetchOrderList
({
current
:
`
${
page
}
`
,
current
:
`
${
page
}
`
,
pageSize
:
`
${
size
}
`
,
pageSize
:
`
${
size
}
`
,
...
searchVal
,
...
searchVal
,
})
})
.
then
(
res
=>
{
if
(
orderListRes
)
{
this
.
setState
({
dataSource
:
res
});
// 获取对应订单列表的工作流类型
})
const
payload
=
[];
.
finally
(()
=>
{
this
.
setState
({
loading
:
false
});
orderListRes
.
data
.
forEach
(
item
=>
{
item
.
productDateilss
.
forEach
(
product
=>
{
const
atom
=
{
productId
:
product
.
productId
,
memberId
:
product
.
memberId
,
memberRoleId
:
product
.
memberRoleId
,
shopId
:
item
.
shopId
,
type
,
// 流程类型
};
payload
.
push
(
atom
);
});
});
});
const
processEnumRes
:
any
=
await
PublicApi
.
postOrderGetProcessEnum
({
list
:
payload
,
},
{
ctlType
:
'none'
,
});
console
.
log
(
'processEnumRes'
,
processEnumRes
)
if
(
processEnumRes
.
code
!==
1000
)
{
message
.
error
(
'获取工作流枚举失败,请稍候再试'
);
return
;
}
this
.
setState
({
dataSource
:
{
data
:
orderListRes
.
data
.
map
((
item
,
index
)
=>
({
...
item
,
processEnum
:
processEnumRes
.
data
[
index
].
processEnum
,
})),
totalCount
:
orderListRes
.
totalCount
,
},
});
}
this
.
setState
({
loading
:
false
});
};
};
componentDidUpdate
(
prevProps
)
{
componentDidUpdate
(
prevProps
)
{
...
@@ -259,6 +299,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -259,6 +299,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 子表格选中行
// 子表格选中行
handleChildSelectChange
=
(
record
:
any
,
selected
:
any
,
selectedRows
:
any
)
=>
{
handleChildSelectChange
=
(
record
:
any
,
selected
:
any
,
selectedRows
:
any
)
=>
{
console
.
log
(
'selectedRows'
,
selectedRows
)
const
{
const
{
childSelectedRowKeys
,
childSelectedRowKeys
,
dataSource
:
{
dataSource
:
{
...
@@ -273,6 +314,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -273,6 +314,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
childArr
.
splice
(
childArr
.
findIndex
((
item
:
any
)
=>
item
===
record
.
id
),
1
);
childArr
.
splice
(
childArr
.
findIndex
((
item
:
any
)
=>
item
===
record
.
id
),
1
);
}
}
// const filtered = this.filterProductByProcessEnum(childArr, data);
if
(
!
(
'checked'
in
this
.
props
))
{
if
(
!
(
'checked'
in
this
.
props
))
{
this
.
setState
({
childSelectedRowKeys
:
childArr
});
this
.
setState
({
childSelectedRowKeys
:
childArr
});
}
}
...
@@ -297,6 +339,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -297,6 +339,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 取消全选
// 取消全选
childArr
=
childArr
.
filter
((
item
:
any
)
=>
!
changeRows
.
some
((
e
:
any
)
=>
e
.
id
===
item
));
childArr
=
childArr
.
filter
((
item
:
any
)
=>
!
changeRows
.
some
((
e
:
any
)
=>
e
.
id
===
item
));
}
}
// const filtered = this.filterProductByProcessEnum(childArr, data);
if
(
!
(
'checked'
in
this
.
props
))
{
if
(
!
(
'checked'
in
this
.
props
))
{
this
.
setState
({
childSelectedRowKeys
:
childArr
});
this
.
setState
({
childSelectedRowKeys
:
childArr
});
}
}
...
@@ -324,6 +368,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -324,6 +368,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
childArr
=
childArr
.
filter
((
item
:
any
)
=>
!
setChildArr
.
some
((
e
:
any
)
=>
e
===
item
));
childArr
=
childArr
.
filter
((
item
:
any
)
=>
!
setChildArr
.
some
((
e
:
any
)
=>
e
===
item
));
}
}
// const filtered = this.filterProductByProcessEnum(childArr, data);
if
(
!
(
'checked'
in
this
.
props
))
{
if
(
!
(
'checked'
in
this
.
props
))
{
this
.
setState
({
childSelectedRowKeys
:
childArr
});
this
.
setState
({
childSelectedRowKeys
:
childArr
});
}
}
...
@@ -344,6 +389,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -344,6 +389,8 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
data
.
forEach
((
item
:
any
)
=>
{
data
.
forEach
((
item
:
any
)
=>
{
setChildArr
=
[...
setChildArr
,
...
item
.
productDateilss
.
map
((
item
:
any
)
=>
item
.
id
)];
setChildArr
=
[...
setChildArr
,
...
item
.
productDateilss
.
map
((
item
:
any
)
=>
item
.
id
)];
});
});
// const filtered = this.filterProductByProcessEnum(setChildArr, data);
// 第一步判断 selected true:全选,false:取消全选
// 第一步判断 selected true:全选,false:取消全选
if
(
selected
)
{
if
(
selected
)
{
// 第二步:父Table选中,子Table全选中,设置子Table 的 SelectedRowKeys
// 第二步:父Table选中,子Table全选中,设置子Table 的 SelectedRowKeys
...
@@ -423,6 +470,20 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
...
@@ -423,6 +470,20 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
}
}
};
};
// 过滤工作流不同的 商品
filterProductByProcessEnum
=
(
selectKeys
,
data
)
=>
{
const
first
=
data
.
length
?
data
[
0
]
:
null
;
if
(
!
first
)
{
return
;
}
const
filtered
=
data
.
filter
(
item
=>
item
.
processEnum
===
first
.
processEnum
);
if
(
filtered
.
length
!==
data
.
length
)
{
message
.
warning
(
'已过滤掉售后工作流不同的商品'
);
}
return
filtered
;
};
render
()
{
render
()
{
const
{
const
{
page
,
page
,
...
...
src/pages/afterService/returnApplication/returnPrSubmit/components/ReturnForm/index.tsx
View file @
5ef44bef
...
@@ -612,6 +612,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
...
@@ -612,6 +612,7 @@ const ReturnForm: React.FC<BillsFormProps> = ({
<
GoodsDrawer
<
GoodsDrawer
title=
"选择退货商品"
title=
"选择退货商品"
type=
{
3
}
visible=
{
visibleGoodsDrawer
}
visible=
{
visibleGoodsDrawer
}
fetchOrderList=
{
getOrderList
}
fetchOrderList=
{
getOrderList
}
onClose=
{
()
=>
setVisibleGoodsDrawer
(
false
)
}
onClose=
{
()
=>
setVisibleGoodsDrawer
(
false
)
}
...
...
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