Browse Source

feat: 优化合并按钮颜色 任一为红即为红

wangqin
qingzhengli 9 months ago
parent
commit
f7b847cf15
  1. 14
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

14
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

@ -77,7 +77,13 @@ export class MarkerCluster {
}, 150); }, 150);
} }
getState({ config, extData }) { getState(data) {
if (Array.isArray(data)) {
return data.every((item) => this.getStateSingle(item));
} else return this.getStateSingle(data);
}
getStateSingle({ config, extData }) {
return typeof config.stateCallback === "function" return typeof config.stateCallback === "function"
? config.stateCallback?.() ? config.stateCallback?.()
: extData.deviceState == 1; : extData.deviceState == 1;
@ -106,11 +112,11 @@ export class MarkerCluster {
getContent(data) { getContent(data) {
const faultBg = require(`@screen/images/mapBg/fault.svg`); const faultBg = require(`@screen/images/mapBg/fault.svg`);
const normalBg = require(`@screen/images/mapBg/active.svg`); const normalBg = require(`@screen/images/mapBg/active.svg`);
const nowBg = this.getState(data) ? normalBg : faultBg;
if (data.length === 1) { if (data.length === 1) {
return ` return `
<div style=" <div style="
background-image: url(${this.getState(data[0]) ? normalBg : faultBg}); background-image: url(${nowBg});
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
width: 51px; width: 51px;
@ -133,7 +139,7 @@ export class MarkerCluster {
return ` return `
<div style=" <div style="
background-image: url(${normalBg}); background-image: url(${nowBg});
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
width: ${width}; width: ${width};

Loading…
Cancel
Save