<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">
      <PortQuery :port="tempData.infoData.portInfo" ref="PortQueryTemp"></PortQuery>
    </template>
  </Dialog>
</template>

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

@Component({
  components: {
    Dialog,
    PortQuery
  },
  props: {
    tempData: {
      type: Object,
      required: true,
      default: () => {
        return {}
      }
    }
  }
})
export default class PortQueryTemp extends Vue {
  private dialogConfig = {
    width: '39.375rem',
    height: '26.25rem',
    header: {
      title: '船舶历史轨迹',
      hasIcon: false,
      iconSrc: '',
      hasMin: true,
      hasMax: false
    },
    position: {
      top: '20%',
      left: '30%'
    },
    vueName: ''
  }

  @Watch('tempData', {
    deep: true,
    immediate: true
  })
  dataChange (data: any) {
    const dialogData = data.dialogData
    this.dialogConfig.header.title = dialogData.title
    this.dialogConfig.vueName = dialogData.vueName
  }
}
</script>

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