<template>
  <Dialog :show="tempData.show"
          :vue-name="dialogConfig.vueName"
          :height="dialogConfig.height"
          :width="dialogConfig.width"
          :resize="true"
          :header="dialogConfig.header"
          :dialog-type="dialogConfig.type"
          :position="dialogConfig.position">
    <template slot="default">
      <PointToPointRes ref="PointToPointResTemp" :data="tempData.infoData.data"></PointToPointRes>
    </template>
  </Dialog>
</template>

<script lang="ts">
import {Component, Vue, Watch} from 'vue-property-decorator'
import Dialog from '@/components/dialog/index.vue'
import PointToPointRes from "@/views/on-map-view/PointToPointRes.vue";

@Component({
  components: {
    Dialog,
    PointToPointRes
  },
  props: {
    tempData: {
      type: Object,
      required: true,
      default: () => {
        return {}
      }
    }
  }
})
export default class PointToPointResTemp extends Vue {
  private dialogConfig = {
    width: '1170px',
    height: '29.5rem',
    header: {
      title: `${this.$t('message.routeQuery.pointRoute')}`,
      hasIcon: false,
      iconSrc: '',
      hasMin: true,
      hasMax: false
    },
    position: {
      top: '8.25rem',
      left: '30.125rem'
    },
    vueName: ''
  }

  @Watch('tempData', {
    deep: true,
    immediate: true
  })
  dataChange(data: any) {
    const dialogData = data.dialogData
    this.dialogConfig.vueName = dialogData.vueName
    this.dialogConfig.header.title = `${this.$t('message.routeQuery.pointRoute')}`
  }

  public mounted() {
    window.addEventListener("setItemEvent", (e: any) => {
      if (e.key === 'language') {
        this.dialogConfig.header.title = `${this.$t('message.routeQuery.pointRoute')}`
      }
    });
  }
}
</script>

<style scoped lang="scss">
</style>
