派生自 wuyushui/SewerAndRainNetwork

chenzeping
2021-04-19 39638e1ec95822792c7520dcd0f5a807957cadde
src/components/panel/topicSearch/SolidWasteSearch.vue
@@ -29,7 +29,8 @@
    <el-scrollbar style="height:286.22px">
      <div class="environmental-risk-list" v-for="(item,index) in searchDataDisplay" :key="index"
           @click="setBounced(item)">
        <i class="state"></i>
        <!--        <i class="state"></i>-->
        <img src="../../../../public/assets/images/map/solidwaste/gf_green2.png" alt="" class="state">
        <div>
          <h3>###炼化部</h3>
          <p>所属部门:<span>{{ item.Name }}</span></p>
@@ -43,7 +44,7 @@
<script>
import mapApi from '@/api/mapApi'
import publicBounced from '@/components/BaseNav/PublicBounced/PublicBounced'
import WasteSolidIndex from '@/components/BaseNav/WasteSolid/WasteSolidIndex'
export default {
  name: 'SolidWasteSearch',
@@ -51,6 +52,33 @@
  data () {
    return {
      judgeVisible: true,
      form: {
        keyword: '固废面板数据查询',
        // 数据的传递
        transferData: 1
      },
      levelOfRisk: [
        {
          name: '全部',
          value: 1
        },
        {
          name: '正常',
          value: 2
        },
        {
          name: '预警',
          value: 3
        }
      ],
      // 数据搜索之后,存储数据的
      searchDataDisplay: [],
      instance: null,
      intervals: [],
      layer: window.map,
      L: window.L,
      times: 5,
      colors: ['#98FB98', '#ff0000'],
      solidWasteTypeOptions: [{
        value: '1',
        label: '区域',
@@ -115,81 +143,10 @@
          label: '长度(m)',
          key: 'length'
        }]
      }],
      form: {
        keyword: '固废面板数据查询',
        // 数据的传递
        transferData: 1
      },
      levelOfRisk: [
        {
          name: '全部',
          value: 1
        },
        {
          name: '正常',
          value: 2
        },
        {
          name: '预警',
          value: 3
        }
      ],
      // 数据搜索之后,存储数据的
      searchDataDisplay: [],
      searchDataDisplayName: '',
      searchDataDisplayId: ''
      }]
    }
  },
  methods: {
    // 点击搜索实现数据的搜索展示
    async handleSearch (data) {
      // console.log(this.form.keyword)
      const result = await mapApi.getSolidWaste(data)
      console.log(result)
      this.searchDataDisplay = result.Result.DataInfo
      this.searchDataDisplayName = result.Result.DataInfo[0].Name
      this.searchDataDisplayId = result.Result.DataInfo[0].StoragePlaceId
      console.log(this.searchDataDisplayName)
    },
    // 数据展示,点击进行弹框及点的展示
    setBounced (val) {
      const pos = [val.Latitude, val.Longitude]
      window.map.flyTo(pos, 11)
      const t1 = setTimeout(async () => {
        const dataValue = {
          StoragePlaceId: this.searchDataDisplayId
        }
        // console.log(e.layer.options.totransferData.Name)
        // 弹框标题
        const title = this.searchDataDisplayName
        console.log(title)
        // 基本信息 tabs
        const resultBasic = await mapApi.getSolidWasteBaseInfo(dataValue)
        // 详细信息展示 table
        const resultDetailed = await mapApi.getSolidWasteDetail(dataValue)
        // 绑定弹框实例
        const PublicBounced = window.Vue.extend(publicBounced)
        const instance = new PublicBounced().$mount()
        document.body.appendChild(instance.$el)
        // document.body.removeChild(instance.$el)
        // 通过方法 向绑定弹框传递数据
        instance.setData(title, resultBasic.Result.DataInfo, resultDetailed.Result.DataInfo, 'gufei')
        // this.setPanTo(e.latlng, 300)
      }, 3000)
      console.log(t1)
      // clearTimeout(t1)
    },
    // flayTo() 弹框的可滑动事件
    setPanTo (pos, value) {
      var position = pos
      position = window.map.latLngToLayerPoint(position)
      position.y += value
      position = window.map.layerPointToLatLng(position)
      window.map.flyTo(position)
    },
    // select的option的数据选择
    handlePipelineType (val) {
      this.solidWasteTypeOptions.forEach(item => {
@@ -197,6 +154,28 @@
          this.handleSearch(item.value)
        }
      })
    },
    // 点击搜索实现数据的搜索展示
    async handleSearch (data) {
      // console.log(this.form.keyword)
      const result = await mapApi.getSolidWaste(data)
      this.searchDataDisplay = result.Result.DataInfo
    },
    // 数据展示,点击进行弹框及点的展示
    setBounced (val) {
      console.log(val)
      const pos = [val.Latitude, val.Longitude]
      window.map.flyTo(pos, 15)
      window.$layer.open({
        content: {
          content: WasteSolidIndex, // 组件
          parent: this, // 父组件
          data: { // 传递的参数
            storagePlaceId: val.StoragePlaceId
          }
        },
        title: val.Name
      })
    }
  }
}