智慧园区前端大屏
shuishen
2024-11-25 edb7c649a139c8a06e48acf79121c8529a66b598
src/views/pd/components/dynamicPanel.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-11-09 15:41:35
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-11-20 17:16:17
 * @LastEditTime: 2024-11-25 11:26:01
 * @FilePath: \bigScreen\src\views\pd\components\dynamicPanel.vue
 * @Description: 
 * 
@@ -12,6 +12,12 @@
const emit = defineEmits(['closePanel'])
import { onUnmounted } from 'vue'
let timeOne = null
let timeTwo = null
let timeThree = null
let timeFour = null
let timeFive = null
const panelData = reactive({
  data: [
    {
@@ -19,189 +25,249 @@
      title: '典型案例1',
      content: '南片区松节油储罐区泄漏事故: 南片区某企业松节油储罐泄漏,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      eventProfile: '2024年11月11日11时,南片区江西殷莱特化工有限公司松节油储罐泄漏,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      specificPollutantPosition: {
      oneCentent: '企业关闭前置阀门切断泄漏源,向罐内适量注水,抬高液位。',
      onePointPosition: {
        lng: 115.10175740,
        lat: 27.27356477
      },
      specificPollutant: '松节油,无色至淡黄色油状液体,具有松香气味。 熔点:无 沸点:154~170℃相对密度(水=1):0.85~0.87 饱和蒸气压(kPa):2.67(51.4℃)溶解性:不溶于水,溶于乙醇、氯仿、醚等多数有机溶剂。',
      transitPointPosition: {
        lng: 115.10231042,
        lat: 27.27352320
      twoContent: '关闭绿源污水处理厂旁雨水排口,拦截污染水体。',
      twoPointPosition: {
        lng: 115.10921467,
        lat: 27.27166382
      },
      wastewaterTreatmentPosition: {
      threeContent: '启用绿源污水处理厂事故应急池,将已拦截废水泵入应急池。',
      threePointPosition: {
        lng: 115.10814596,
        lat: 27.27257473
      },
      wastewaterTreatment: '事故应急结束后,应急指挥部组织专家评估组指导企业对受污染的废水进入废水处理中站进行处理,对公共应急池的事故废水进行水质监测,分析水质达标情况,并研判处理处置方式,在确保安全的情况下转转输至绿源污水处理厂处理。'
      fourContent: '应急指挥部指导企业处理受污染废水, 监测公共应急池水质 ,确保达标后安全转运至绿源污水处理厂。',
      fourPointPosition: {
        lng: 115.10845441,
        lat: 27.27327366
      }
    },
    {
      key: 2,
      title: '典型案例2',
      content: '北片区碱类腐蚀性物质泄漏事故: 北片区某企业(位于吉兴路以北)在生产过程中操作失误,大量含碱废水泄漏,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      content: '北片区碱类腐蚀性物质泄漏事故: 北片区某企业在生产过程中操作失误,大量含碱废水泄漏,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      eventProfile: '2024年10月15日14时,北片区江西宏润香料有限公司在生产过程中操作失误,大量含碱废水泄漏,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      specificPollutantPosition: {
        lng: 115.10446199,
        lat: 27.28453867
      },
      specificPollutant: '液碱,无色透明液体。是重要的化工基础原料,用途极广。化学工业用于制造甲酸、草酸、硼砂、苯酚、氰化钠及肥皂、合成脂肪酸、合成洗涤剂等,呈碱性。',
      transitPointPosition: {
        lng: 115.10508747,
        lat: 27.28393479
      oneCentent: '企业关闭前置阀门,切断泄漏源,用砂土等筑堤堵截泄漏液体或者引流到安全地点。',
      onePointPosition: {
        lng: 115.10505420,
        lat: 27.28806335
      },
      wastewaterTreatmentPosition: {
      twoContent: '园区关闭北区雨水排口,拦截污染水体。',
      twoPointPosition: {
        lng: 115.10620654,
        lat: 27.29710382
      },
      threeContent: '园区启用北区公共应急池,将已拦截废水泵入应急池。',
      threePointPosition: {
        lng: 115.10467136,
        lat: 27.29415383
      },
      fourContent: '将拦截废水从应急池中通过北区污水提升泵站转移至绿源污水处理厂进行处置。',
      fourPointPosition: {
        lng: 115.10814596,
        lat: 27.27257473
      },
      wastewaterTreatment: '将拦截废水从应急池中通过北区污水提升泵站转移至绿源污水处理厂进行处置,同时在排口下游展开应急监测,确保废水没有进入周边水系。'
      fiveContent: '排口下游展开应急监测,确保废水没有进入周边水系。',
      fivePointPosition: {
        lng: 115.10921467,
        lat: 27.27166382
      },
    },
    {
      key: 3,
      title: '典型案例3',
      content: '危险化学品运输事故: 化工集中区北区(吉兴路以南)某企业的危化品运输车辆金工大道危化品运专用运输道上发生侧翻,大量盐酸流至路面,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      eventProfile: '2024年11月04日18时,化工集中区北区江西迷斯婕生物科技有限公司的危化品运输车辆金工大道危化品运专用运输道上发生侧翻,大量盐酸流至路面,如不采取措施,将造成污染事故,影响到赣江下游水质。',
      specificPollutantPosition: {
        lng: 115.10392960,
        lat: 27.28660330
      },
      specificPollutant: '盐酸是无色液体(工业用盐酸会因有杂质三价铁盐而略显黄色),为氯化氢的水溶液,具有刺激性气味。',
      transitPointPosition: {
        lng: 115.10468990,
        lat: 27.28756147
      oneCentent: '调度金龙水库清水,稀释污染团。',
      onePointPosition: {
        lng: 115.10488545,
        lat: 27.27678110
      },
      wastewaterTreatmentPosition: {
        lng: 115.10814596,
        lat: 27.27257473
      twoContent: '转输至江西粤鹏环保高新技术开发有限公司事故应急池、初期雨水池。',
      twoPointPosition: {
        lng: 115.10545135,
        lat: 27.28043872
      },
      wastewaterTreatment: '对转输至企业应急空间的事故废水进行水质监测,分析水质达标情况,并研判处理处置方式,在确保安全的情况下加药处理或者排入企业废水处理站处理'
      threeContent: '转输至江西腾龙源环保科技有限公司事故应急池、初期雨水池。',
      threePointPosition: {
        lng: 115.10332118,
        lat: 27.27831698
      },
    },
  ]
})
let isSpeaking = false
const dynamicVectorLayer = new DC.VectorLayer('dynamicVectorLayer').addTo(window.$viewer)
const dynamicHtmlLayer = new DC.HtmlLayer('dynamicHtmlLayer').addTo(window.$viewer)
const schemeStart = (item) => {
  emit('closePanel')
  clearAll()
  let center = DC.Position.fromObject(item.specificPollutantPosition)
  let circle = new DC.Circle(center, 20)
  circle.setStyle({
    material: new DC.CircleWaveMaterialProperty({
      color: DC.Color.RED.withAlpha(0.9),
      speed: 20,
      count: 5,
      gradient: 0.5
    })
  })
  dynamicVectorLayer.addOverlay(circle)
  let divContent = new DC.DivIcon(
    new DC.Position(item.specificPollutantPosition.lng, item.specificPollutantPosition.lat, 70),
    `<div class="dynamic-event-profile-map-popup">
  window.$viewer.flyToPosition(new DC.Position(item.onePointPosition.lng, item.onePointPosition.lat, 400, 0, -90, 0), () => {
    let oneCenter = DC.Position.fromObject(item.onePointPosition)
    let oneCircle = new DC.Circle(oneCenter, 20)
    oneCircle.setStyle({
      material: new DC.CircleWaveMaterialProperty({
        color: DC.Color.RED.withAlpha(0.9),
        speed: 20,
        count: 5,
        gradient: 0.5
      })
    })
    dynamicVectorLayer.addOverlay(oneCircle)
    let oneCentent = new DC.DivIcon(
      new DC.Position(item.onePointPosition.lng, item.onePointPosition.lat, 70),
      `<div class="dynamic-map-popup">
          <div class="content-wrap">
            <div class="title">事件概况</div>
            <div class="content">
              <p>${item.eventProfile}</p>
              <p>特征污染物:${item.specificPollutant}</p>
              <p>${item.oneCentent}</p>
              </div>
              </div>
              <div class="arrow"></div>
              </div>`
      // <p>特征污染物:${item.specificPollutant}</p>
    )
    dynamicHtmlLayer.addOverlay(oneCentent)
  }, 3)
  timeTwo = setTimeout(() => {
    let twoCenter = DC.Position.fromObject(item.twoPointPosition)
    let twoCircle = new DC.Circle(twoCenter, 10)
    twoCircle.setStyle({
      material: new DC.CircleWaveMaterialProperty({
        color: DC.Color.fromRandom(),
        speed: 20,
        count: 5,
        gradient: 0.5
      })
    })
    dynamicVectorLayer.addOverlay(twoCircle)
    let twoContent = new DC.DivIcon(
      new DC.Position(item.twoPointPosition.lng, item.twoPointPosition.lat, 70),
      `<div class="dynamic-event-profile-map-popup">
          <div class="content-wrap">
            <div class="content">
              <p>${item.twoContent}</p>
              </div>
              </div>
              <div class="arrow"></div>
              </div>`
      // <p>特征污染物:${item.specificPollutant}</p>
    )
    dynamicHtmlLayer.addOverlay(twoContent)
    // 执行对应的事件函数
    window.$viewer.flyToPosition(new DC.Position(item.twoPointPosition.lng, item.twoPointPosition.lat, 400, 0, -90, 0), () => { }, 3)
  }, 5000)
  timeThree = setTimeout(() => {
    let threeCenter = DC.Position.fromObject(item.threePointPosition)
    let threeCircle = new DC.Circle(threeCenter, 30)
    threeCircle.setStyle({
      classificationType: 0,
      material: new DC.CircleSpiralMaterialProperty({
        color: DC.Color.BLUE.withAlpha(0.2),
        speed: 8.0
      })
    })
    dynamicVectorLayer.addOverlay(threeCircle)
    let threeContent = new DC.DivIcon(
      new DC.Position(item.threePointPosition.lng, item.threePointPosition.lat, 70),
      `<div class="dynamic-map-popup">
          <div class="content-wrap">
            <div class="content">
              <p>${item.threeContent}</p>
            </div>
          </div>
          <div class="arrow"></div>
      </div>`
  )
  dynamicHtmlLayer.addOverlay(divContent)
        </div>`
    )
    dynamicHtmlLayer.addOverlay(threeContent)
  window.$viewer.flyToPosition(new DC.Position(item.specificPollutantPosition.lng, item.specificPollutantPosition.lat, 400, 0, -90, 0), () => {
    const utterance = new SpeechSynthesisUtterance(`事件概况:${item.eventProfile}特征污染物:${item.specificPollutant}`)
    window.$viewer.flyToPosition(new DC.Position(item.threePointPosition.lng, item.threePointPosition.lat, 400, 0, -90, 0), () => { }, 3)
  }, 10000)
    isSpeaking = true
  item.fourPointPosition && (timeFour = setTimeout(() => {
    let FourCenter = DC.Position.fromObject(item.fourPointPosition)
    let fourCircle = new DC.Circle(FourCenter, 10)
    fourCircle.setStyle({
      material: new DC.CircleWaveMaterialProperty({
        color: DC.Color.fromRandom(),
        speed: 20,
        count: 5,
        gradient: 0.5
      })
    })
    dynamicVectorLayer.addOverlay(fourCircle)
    utterance.onend = () => {
      isSpeaking = false
      // 执行对应的事件函数
      window.$viewer.flyToPosition(new DC.Position(item.transitPointPosition.lng, item.transitPointPosition.lat, 400, 0, -90, 0), () => {
        let centerT = DC.Position.fromObject(item.transitPointPosition)
        let circleT = new DC.Circle(centerT, 10)
        circleT.setStyle({
          material: new DC.CircleWaveMaterialProperty({
            color: DC.Color.fromRandom(),
            speed: 20,
            count: 5,
            gradient: 0.5
          })
        })
        dynamicVectorLayer.addOverlay(circleT)
        const utteranceTow = new SpeechSynthesisUtterance('')
        isSpeaking = true
        utteranceTow.onend = () => {
          isSpeaking = false
          window.$viewer.flyToPosition(new DC.Position(item.wastewaterTreatmentPosition.lng, item.wastewaterTreatmentPosition.lat, 400, 0, -90, 0), () => {
            let centerThree = DC.Position.fromObject(item.wastewaterTreatmentPosition)
            let circleThree = new DC.Circle(centerThree, 30)
            circleThree.setStyle({
              classificationType: 0,
              material: new DC.CircleSpiralMaterialProperty({
                color: DC.Color.BLUE.withAlpha(0.2),
                speed: 8.0
              })
            })
            dynamicVectorLayer.addOverlay(circleThree)
            let divIconT = new DC.DivIcon(
              new DC.Position(item.wastewaterTreatmentPosition.lng, item.wastewaterTreatmentPosition.lat, 70),
              `<div class="dynamic-map-popup">
                <div class="content-wrap">
                  <div class="title">绿源进水口</div>
                  <div class="content">
                    <p>${item.wastewaterTreatment}</p>
                  </div>
                </div>
                <div class="arrow"></div>
    let fourContent = new DC.DivIcon(
      new DC.Position(item.fourPointPosition.lng, item.fourPointPosition.lat, 70),
      `<div class="dynamic-event-profile-map-popup">
          <div class="content-wrap">
            <div class="content">
              <p>${item.fourContent}</p>
              </div>
              </div>
              <div class="arrow"></div>
              </div>`
            )
            dynamicHtmlLayer.addOverlay(divIconT)
    )
    dynamicHtmlLayer.addOverlay(fourContent)
    // 执行对应的事件函数
    window.$viewer.flyToPosition(new DC.Position(item.fourPointPosition.lng, item.fourPointPosition.lat, 400, 0, -90, 0), () => { }, 3)
  }, 15000))
            const utteranceThree = new SpeechSynthesisUtterance(item.wastewaterTreatment)
  item.fivePointPosition && (timeFive = setTimeout(() => {
    let fiveCenter = DC.Position.fromObject(item.fivePointPosition)
    let fiveCircle = new DC.Circle(fiveCenter, 10)
    fiveCircle.setStyle({
      material: new DC.CircleWaveMaterialProperty({
        color: DC.Color.fromRandom(),
        speed: 20,
        count: 5,
        gradient: 0.5
      })
    })
    dynamicVectorLayer.addOverlay(fiveCircle)
            isSpeaking = true
            utteranceThree.onend = () => {
              isSpeaking = false
            }
            window.speechSynthesis.speak(utteranceThree)
          }, 3)
        }
        window.speechSynthesis.speak(utteranceTow)
      }, 3)
    }
    window.speechSynthesis.speak(utterance)
  }, 3)
    let fiveContent = new DC.DivIcon(
      new DC.Position(item.fivePointPosition.lng, item.fivePointPosition.lat, 70),
      `<div class="dynamic-event-profile-map-popup">
          <div class="content-wrap">
            <div class="content">
              <p>${item.fiveContent}</p>
              </div>
              </div>
              <div class="arrow"></div>
              </div>`
    )
    dynamicHtmlLayer.addOverlay(fiveContent)
    // 执行对应的事件函数
    window.$viewer.flyToPosition(new DC.Position(item.fivePointPosition.lng, item.fivePointPosition.lat, 400, 0, -90, 0), () => { }, 3)
  }, 20000))
}
const clearAll = () => {
  if (isSpeaking) {
    window.speechSynthesis.cancel()
  }
  timeOne && (clearTimeout(timeOne), timeOne = null)
  timeTwo && (clearTimeout(timeTwo), timeTwo = null)
  timeThree && (clearTimeout(timeThree), timeThree = null)
  timeFour && (clearTimeout(timeFour), timeFour = null)
  dynamicVectorLayer.clear()
  dynamicHtmlLayer.clear()