Commit b423e8db authored by 张帆's avatar 张帆

站点切换问题优化

parent 8ff34ba6
......@@ -112,7 +112,7 @@
"@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/amap": "1.1.0-beta.56",
"@wisdom-map/arcgismap": "1.4.0-190",
"@wisdom-map/arcgismap": "1.4.0-192",
"@wisdom-map/basemap": "1.1.0-29",
"@wisdom-map/util": "^1.0.28-0",
"@wisdom-utils/components": "0.1.322",
......
......@@ -227,20 +227,24 @@ const GlobalHeaderRight = props => {
}
let stationSerach=(value)=>{
let showstation = roleStationArr.current.filter((item)=>{
return item.name.includes(value)
if(item.description){
return item.description.includes(value)
}else{
return item.name.includes(value)
}
})
setStationList(showstation)
}
let closePan=(name)=>{
let closePan=(name,stationname)=>{
stationOpen.current=false
setUpdate(stationOpen.current)
currentStationChange(name)
currentStationChange(name,stationname)
}
const currentStationChange = value => {
const currentStationChange = (value,stationname) => {
setStationValue(value);
const arr = roleStationArr.current.filter(item => item.name == value);
window.globalConfig.menuStation = arr.length ? arr[0] : {};
localStorage.setItem('globMenuStation', arr.length ? arr[0] : {})
const arr = roleStationArr.current.filter(item => item.name == stationname);
window._menuStation = arr.length ? arr[0] : {};
localStorage.setItem('globMenuStation', arr.length ? JSON.stringify(arr[0]) : '{}')
setTimeout(()=>{
slectDom.current.blur()
},200)
......@@ -250,7 +254,7 @@ const GlobalHeaderRight = props => {
if (global.userInfo) {
roleStationArr.current = global.userInfo.roles.filter(item => item.name.includes('站点_'));
if (roleStationArr.current.length) {
let stationname=roleStationArr.current[0].name
let stationname=roleStationArr.current[0].description?roleStationArr.current[0]:roleStationArr.current[0].name
let saveOption=roleStationArr.current[0]
if(global.mapsettings&&global.mapsettings.layers){
global.mapsettings.layers.forEach((item)=>{
......@@ -259,10 +263,11 @@ const GlobalHeaderRight = props => {
if(roalarr.length){
roalarr.forEach((result)=>{
if(result.includes('站点_')){
stationname=result
// stationname=result
roleStationArr.current.forEach((respon)=>{
if(respon.name==result){
saveOption=respon
stationname=respon.description?respon.description:respon.name
}
})
}
......@@ -271,9 +276,9 @@ const GlobalHeaderRight = props => {
}
})
}
window.globalConfig.menuStation = saveOption;
window._menuStation = saveOption;
setStationList(roleStationArr.current)
localStorage.setItem('globMenuStation', saveOption)
localStorage.setItem('globMenuStation',JSON.stringify(saveOption))
setStationValue(stationname);
}
}
......@@ -284,14 +289,13 @@ const GlobalHeaderRight = props => {
{
roleStationArr.current.length>1&&(
<div className={styles.curentPersonStationWriper}>
<span>站点:</span>
<div className={styles.currentPersonStationSlect}>
<Select
style={{ width: '100%' }}
ref={slectDom}
bordered={false}
onSearch={stationSerach}
onChange={currentStationChange}
// onChange={currentStationChange}
onFocus={()=>{stationOpen.current=true;setUpdate(stationOpen.current)}}
onBlur={()=>{
setTimeout(()=>{
......@@ -310,12 +314,14 @@ const GlobalHeaderRight = props => {
{
showStationList.map((item)=>{
return (
<li style={{background:item.name==stationvalue?"#1685ff47":""}} onClick={()=>{closePan(item.name)}}>
<img src={item.name==stationvalue?stationChoose:stationNotChoose}></img>
<span style={{
color:item.name==stationvalue?"#1685ff":"#000",
fontWeight:item.name==stationvalue?"600":"400",
}}>{item.name}</span>
<li style={{background:item.description?item.description==stationvalue?"#1685ff47":"":item.name==stationvalue?"#1685ff47":""}} onClick={()=>{closePan(item.description?item.description:item.name,item.name)}}>
<img src={item.description?item.description==stationvalue?stationChoose:stationNotChoose:item.name==stationvalue?stationChoose:stationNotChoose}></img>
<span
title={item.description?item.description:item.name}
style={{
color:item.description?item.description==stationvalue?"#1685ff":"#000":item.name==stationvalue?"#1685ff":"#000",
fontWeight:item.description?item.description==stationvalue?"600":"400":item.name==stationvalue?"600":"400",
}}>{item.description?item.description:item.name}</span>
</li>
)
})
......
......@@ -145,7 +145,7 @@
.scalnameSlectMenu{
width: 100%;
max-height: 300px;
display: flex;
// display: flex;
flex-direction: column;
margin: 0;
padding: 0;
......@@ -155,7 +155,19 @@
height: 30px;
align-items: center;
color: black;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 5px;
&:hover{
background-color: rgb(227,240,255);
}
cursor: pointer;
span{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
img{
width: 20px;
height: 20px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment