Commit b423e8db authored by 张帆's avatar 张帆

站点切换问题优化

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