// import Vue from 'vue'
// import showDialog from './showDialog.js';

// Vue.use(showDialog)

export const checkVisual = {
  methods: {
    //查看可视化
    checkVisual(Scenario, eventId, eventName) {
      this.$showDialog({
          Scenario:Scenario,
          eventId:eventId,
          eventName:eventName
      },true);
    },
    handleDownload(row) {
      var FileUrl = `http://${this.$c.hostname}:8012/onlinePreview?url=` + btoa(encodeURIComponent(this.$p + row.url))
      // var FileUrl =  `http://192.168.1.24:8012/onlinePreview?url=`+ btoa(encodeURIComponent(this.$p + row.url))
      const router = this.$router.resolve({
        path: '/checkFile',
        query: {
          row: JSON.stringify(row),
          FileUrl: FileUrl,
          isPicture: 0
        }
      })
      window.open(router.href, '_blank');
    },
  }
}

export const openVisual = {
  methods: {
    //查看可视化
    checkVisual({ Scenario, eventId, eventName }) {
      if (Scenario && Scenario.length > 0) {
        var visuals = {
          Scenario: Scenario,
          eventId: eventId,
          eventName: eventName
        }
        if (eventId) {
          this.$router.push({
            path: '/eventVisual',
            query: {
              visuals: JSON.stringify(visuals)
            }
          })
          return false
        }
        this.$refs.visualDialog.open(visuals)
      } else {
        this.$message.error('该事件下没有应用场景')
      }

    },

  }
}