Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
e81eac28
Commit
e81eac28
authored
Apr 06, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加刷新列表更新分组功能
parent
bf0c1fc1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
GoodsGroup.jsx
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
+7
-3
index.jsx
src/pages/GoodsManage/Takeaway/index.jsx
+17
-5
No files found.
src/pages/GoodsManage/Takeaway/components/GoodsGroup.jsx
View file @
e81eac28
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
forwardRef
,
useImperativeHandle
}
from
'
react
'
;
import
{
Button
,
Select
,
Tag
}
from
'
antd
'
;
import
{
DndProvider
}
from
'
react-dnd
'
;
import
HTML5Backend
from
'
react-dnd-html5-backend
'
;
...
...
@@ -8,7 +8,7 @@ import InsertTag from './InsertTag';
import
GroupInfo
from
'
./GroupInfo
'
;
import
{
apiDelStorage
,
apiSortStorage
,
apiStorageList
,
apiSupplierShopList
}
from
'
../../service
'
;
const
GoodsGroup
=
options
=>
{
const
GoodsGroup
=
forwardRef
((
options
,
ref
)
=>
{
const
[
groupEdit
,
setGroupEdit
]
=
useState
(
false
);
const
[
selected
,
setSelected
]
=
useState
(
0
);
const
[
storageId
,
setStorageId
]
=
useState
(
0
);
...
...
@@ -110,6 +110,10 @@ const GoodsGroup = options => {
options
.
changeGroup
(
selected
);
},
[
selected
]);
useImperativeHandle
(
ref
,
()
=>
({
setSelected
,
}));
return
(
<
div
className=
{
styles
.
groupBox
}
>
{
(
shops
&&
shops
.
length
&&
(
...
...
@@ -182,6 +186,6 @@ const GoodsGroup = options => {
/>
</
div
>
);
};
}
)
;
export
default
GoodsGroup
;
src/pages/GoodsManage/Takeaway/index.jsx
View file @
e81eac28
import
React
,
{
useState
,
useEffect
,
use
Callback
,
useMemo
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
use
Ref
}
from
'
react
'
;
import
{
Spin
,
Table
,
Pagination
,
message
,
notification
}
from
'
antd
'
;
import
{
unstable_batchedUpdates
}
from
'
react-dom
'
;
import
{
SortableContainer
,
SortableElement
,
SortableHandle
}
from
'
react-sortable-hoc
'
;
...
...
@@ -39,6 +39,8 @@ const Takeaway = options => {
const
[
visibleSwitchGroup
,
setVisibleSwitchGroup
]
=
useState
(
false
);
const
[
scribeToken
,
setScribeToken
]
=
useState
(
''
);
const
groupRef
=
useRef
(
null
);
const
rowSelection
=
{
selectedRowKeys
,
onChange
:
setSelectedRowKeys
,
...
...
@@ -184,11 +186,16 @@ const Takeaway = options => {
useEffect
(()
=>
{
const
stoken
=
PubSub
.
subscribe
(
'
refreshTakeAway
'
,
(
_
,
data
)
=>
{
setShopId
(
data
.
shopId
);
console
.
log
(
'
refreshTakeAway :>>
'
,
data
);
if
(
data
.
groupId
&&
groupId
!==
data
.
groupId
)
{
setGroupId
(
data
.
groupId
);
getDataList
(
0
,
pageSize
,
data
.
groupId
);
if
(
groupRef
.
current
)
{
groupRef
.
current
.
setSelected
(
`
${
data
.
groupId
}
`
);
}
}
});
setScribeToken
(
stoken
);
return
()
=>
{
PubSub
.
unsubscribe
(
scribeToken
);
};
...
...
@@ -208,7 +215,12 @@ const Takeaway = options => {
return
(
<
div
className=
{
styles
.
takeawayBox
}
>
<
Spin
spinning=
{
loading
}
>
<
GoodsGroup
shopId=
{
shopId
}
changeShop=
{
setShopId
}
changeGroup=
{
setGroupId
}
/>
<
GoodsGroup
ref=
{
groupRef
}
shopId=
{
shopId
}
changeShop=
{
setShopId
}
changeGroup=
{
setGroupId
}
/>
{
(
shopId
&&
(
<
ActionBar
selectedRowKeys=
{
selectedRowKeys
}
...
...
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