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
c7caca16
Commit
c7caca16
authored
Sep 01, 2022
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改门店列表不刷新的问题
parent
1a04ac87
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
13 deletions
+63
-13
index.jsx
src/components/BaiduMap/index.jsx
+27
-2
storeModal.jsx
src/pages/chainStoreManage/components/storeModal.jsx
+27
-4
index.jsx
src/pages/chainStoreManage/index.jsx
+9
-7
No files found.
src/components/BaiduMap/index.jsx
View file @
c7caca16
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Map
,
Marker
,
ZoomControl
,
CityListControl
}
from
'
react-bmapgl
'
;
import
{
Modal
,
Input
}
from
'
antd
'
;
export
default
props
=>
{
const
{
visible
,
onSetPoint
,
onCancel
,
lngLat
}
=
props
;
const
{
visible
,
onSetPoint
,
onCancel
,
lngLat
,
addrInfo
}
=
props
;
let
defaultLnglat
=
{
lng
:
116.404449
,
lat
:
39.914889
};
if
(
lngLat
)
{
defaultLnglat
=
lngLat
;
...
...
@@ -27,6 +27,31 @@ export default props => {
setLnglatText
(
`
${
e
.
latlng
.
lng
}
,
${
e
.
latlng
.
lat
}
`
);
};
// const translateCallback = obj => {
// console.log('obj :>> ', obj);
// setLnglat(obj.points[0]);
// };
const
getPoint
=
()
=>
{
// const convertor = new window.BMapGL.Convertor();
const
myGeo
=
new
window
.
BMapGL
.
Geocoder
();
// 将地址解析结果显示在地图上,并调整地图视野
myGeo
.
getPoint
(
addrInfo
.
address
||
''
,
point
=>
{
if
(
point
)
{
// convertor.translate([point], 1, 5, translateCallback);
setLnglat
(
point
);
}
},
addrInfo
.
provice
||
'
北京市
'
,
);
};
useEffect
(()
=>
{
if
(
visible
)
getPoint
();
},
[
visible
]);
return
(
<
Modal
title=
"门店信息"
...
...
src/pages/chainStoreManage/components/storeModal.jsx
View file @
c7caca16
...
...
@@ -24,13 +24,17 @@ const StoreModal = props => {
const
{
visible
,
onCancel
,
form
:
{
getFieldDecorator
,
setFieldsValue
,
validateFields
,
resetFields
},
form
:
{
getFieldDecorator
,
setFieldsValue
,
getFieldsValue
,
validateFields
,
resetFields
},
formInfo
,
}
=
props
;
const
[
areaAddr
,
setAreaAddr
]
=
useState
([]);
const
[
visibleMap
,
setVisibleMap
]
=
useState
(
false
);
const
[
times
,
setTimes
]
=
useState
([{
name
:
'
time0
'
}]);
const
[
formData
,
setFormData
]
=
useState
({});
const
[
mapInfo
,
setMapInfo
]
=
useState
({
provice
:
''
,
address
:
''
,
});
const
divDom
=
useRef
();
...
...
@@ -82,7 +86,22 @@ const StoreModal = props => {
};
// 显示地图
const
openMap
=
v
=>
setVisibleMap
(
v
);
const
openMap
=
v
=>
{
const
values
=
getFieldsValue
();
let
provice
=
'
北京市
'
;
if
(
values
.
addr
.
length
>
0
)
{
areaAddr
.
forEach
(
item
=>
{
if
(
item
.
value
===
values
.
addr
[
0
])
{
provice
=
item
.
label
;
}
});
}
setMapInfo
({
provice
,
address
:
values
.
address
,
});
setVisibleMap
(
v
);
};
// 获取地址省
const
getAreaAddr
=
async
id
=>
{
...
...
@@ -162,7 +181,7 @@ const StoreModal = props => {
};
useEffect
(()
=>
{
if
(
props
.
visible
)
{
if
(
visible
)
{
resetFields
();
const
info
=
Object
.
assign
({},
formInfo
);
if
(
info
&&
info
.
id
)
{
...
...
@@ -186,7 +205,9 @@ const StoreModal = props => {
setFormData
(
info
);
getLazyAddr
(
info
);
}
else
{
getAreaAddr
(
0
);
if
(
areaAddr
.
length
<
1
)
{
getAreaAddr
();
}
setFormData
({});
}
}
...
...
@@ -197,6 +218,7 @@ const StoreModal = props => {
title=
"门店信息"
visible=
{
visible
}
width=
"800px"
maskClosable=
{
false
}
onOk=
{
()
=>
onSubmit
()
}
onCancel=
{
()
=>
handleCancel
()
}
>
...
...
@@ -293,6 +315,7 @@ const StoreModal = props => {
</
Form
>
<
MapModal
visible=
{
visibleMap
}
addrInfo=
{
mapInfo
}
onCancel=
{
()
=>
openMap
(
false
)
}
onSetPoint=
{
e
=>
onSetPoint
(
e
)
}
></
MapModal
>
...
...
src/pages/chainStoreManage/index.jsx
View file @
c7caca16
...
...
@@ -34,13 +34,6 @@ export default () => {
setStoreInfo
(
info
);
setVisible
(
true
);
};
const
closeModal
=
isReload
=>
{
if
(
isReload
===
true
)
{
// eslint-disable-next-line no-unused-expressions
table
.
current
?.
reload
?.();
}
setVisible
(
false
);
};
// 获取市区街道
const
loadData
=
async
selectedOptions
=>
{
...
...
@@ -111,6 +104,14 @@ export default () => {
}
getList
(
params
);
};
const
closeModal
=
isReload
=>
{
if
(
isReload
)
{
// eslint-disable-next-line no-unused-expressions
onSearch
(
refSearch
.
current
?.
getFieldValue
?.()
||
{});
}
setStoreInfo
({});
setVisible
(
false
);
};
const
onReset
=
()
=>
{
if
(
refSearch
.
current
&&
refSearch
.
current
.
resetFields
)
{
...
...
@@ -280,6 +281,7 @@ export default () => {
</
div
>
<
Table
dataSource=
{
dataList
}
ref=
{
table
}
bordered
columns=
{
columns
}
rowKey=
{
record
=>
record
.
id
}
...
...
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