<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">
      <TrackRecord :is-history="tempData.infoData.isHistory" :ship-data="tempData.infoData.shipData"
                   ref="TrackRecordTemp"></TrackRecord>
    </template>
  </Dialog>
</template>

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

@Component({
  components: {
    Dialog,
    TrackRecord
  },
  props: {
    tempData: {
      type: Object,
      required: true,
      default: () => {
        return {}
      }
    }
  }
})
export default class TrackRecordTemp extends Vue {
  private dialogConfig = {
    width: '39.375rem',
    height: '25rem',
    header: {
      title: '轨迹记录',
      hasIcon: false,
      iconSrc: '',
      hasMin: true,
      hasMax: false
    },
    position: {
      top: '9.375rem',
      left: '48.125rem'
    },
    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>
