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

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

@Component({
  components: {
    Dialog,
    ShipInBerth
  },
  props: {
    tempData: {
      type: Object,
      required: true,
      default: () => {
        return {}
      }
    }
  }
})
export default class ShipInBerthTemp extends Vue {
  private dialogConfig = {
    width: '1400px',
    height: '29.5rem',
    header: {
      title: `船舶列表`,
      hasIcon: false,
      iconSrc: '',
      hasMin: true,
      hasMax: false
    },
    position: {
      top: '6.25rem',
      left: '53.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.areaList.shipList')}`
  }

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

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