gisMapColors.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. export const gisPointStatusColors = {
  2. normal: '#2ecc71',
  3. alarm: '#e74c3c',
  4. warning: '#f1c40f',
  5. workOrder: '#3498db',
  6. offline: '#95a5a6'
  7. }
  8. export const gisPointStatusIcons = {
  9. normal: new URL('../assets/gis/T_MarkPoint_Green.png', import.meta.url).href,
  10. alarm: new URL('../assets/gis/T_MarkPoint_Red.png', import.meta.url).href,
  11. warning: new URL('../assets/gis/T_MarkPoint_Yellow.png', import.meta.url).href,
  12. workOrder: new URL('../assets/gis/T_MarkPoint_Blue.png', import.meta.url).href,
  13. offline: new URL('../assets/gis/T_MarkPoint_Grey.png', import.meta.url).href
  14. }
  15. export const facilityPointIcons = {
  16. source: new URL('../assets/gis/T_MarkPoint_Blue.png', import.meta.url).href,
  17. plant: new URL('../assets/gis/T_MarkPoint_Green.png', import.meta.url).href,
  18. pumpStation: new URL('../assets/gis/T_MarkPoint_Red.png', import.meta.url).href,
  19. pipe: new URL('../assets/gis/T_MarkPoint_Yellow.png', import.meta.url).href,
  20. user: new URL('../assets/gis/T_MarkPoint_Black.png', import.meta.url).href
  21. }
  22. export function getFacilityPointIcon(type = '') {
  23. return facilityPointIcons[type] || facilityPointIcons.plant
  24. }
  25. const clusterPointIcon = new URL('../assets/gis/T_MarkPoint_Colorful.png', import.meta.url).href
  26. export function getMapClusterIcon(points = []) {
  27. const icons = [...new Set((Array.isArray(points) ? points : [])
  28. .map(point => point?.iconUrl || getMonitoringPointIcon(point))
  29. .filter(Boolean))]
  30. return icons.length === 1 ? icons[0] : clusterPointIcon
  31. }
  32. export const gisPointStatusLabels = {
  33. normal: '正常',
  34. alarm: '报警',
  35. warning: '预警',
  36. workOrder: '关联工单',
  37. offline: '离线'
  38. }
  39. export const gisPointStatusTagTypes = {
  40. normal: 'success',
  41. alarm: 'danger',
  42. warning: 'warning',
  43. workOrder: 'primary',
  44. offline: 'info'
  45. }
  46. export function getMonitoringPointStatus(point = {}) {
  47. const relatedOrderNo = point.relatedOrderNo ?? point.relatedWorkOrderNo ?? point.orderNo
  48. if (relatedOrderNo && relatedOrderNo !== '-') return 'workOrder'
  49. if (Number(point.alarmStatus) === 1) return 'alarm'
  50. if (Number(point.currentStatus) === 3) return 'warning'
  51. if (Number(point.onlineStatus) === 0) return 'offline'
  52. return 'normal'
  53. }
  54. export function getMonitoringPointColor(point = {}) {
  55. return gisPointStatusColors[getMonitoringPointStatus(point)] || gisPointStatusColors.normal
  56. }
  57. export function getMonitoringPointIcon(point = {}) {
  58. return gisPointStatusIcons[getMonitoringPointStatus(point)] || gisPointStatusIcons.normal
  59. }
  60. export function getMonitoringPointLabel(point = {}) {
  61. return gisPointStatusLabels[getMonitoringPointStatus(point)] || gisPointStatusLabels.normal
  62. }
  63. export function getMonitoringPointTagType(point = {}) {
  64. return gisPointStatusTagTypes[getMonitoringPointStatus(point)] || gisPointStatusTagTypes.normal
  65. }