<template>
  <dee-static-cmp
    :cmp-options="tableLayout"
    :result-data="tableData"
  />
</template>

<script>
import { get } from '@/utils/http'
export default {
  name: 'RelatedECN',
  displayName: '相关ECN(自变更通告产生)',
  modelRelationObjs: ['DxDocument', 'DxPart'],
  props: {
    modelName: {
      type: String,
      default: () => ''
    },
    basicData: {
      type: Object,
      default: () => null
    }
  },
  data() {
    return {
      tableLayout: {
        typeName: 'DxChangeNotice',
        value: 'RelatedECN'
      },
      tableData: []
    }
  },
  computed: {},
  watch: {
    basicData: {
      deep: true,
      handler: function() {
        this.getTableData()
      }
    }

  },
  // 生命周期 - 创建完成(访问当前this实例)
  created() {},
  // 生命周期 - 挂载完成(访问DOM元素)
  mounted() {
    if (this.basicData) {
      this.getTableData()
    }
  },
  methods: {
    getTableData() {
      if (!this.basicData) {
        return
      }
      const id = this.basicData.versionId
      if (id) {
        get(`/DxChangeNotice/findByAfterAffectedId/${id}`).then(res => {
          this.tableData = res.items
        })
      } else {
        this.tableData = []
      }
    }
  }
}
</script>
<style lang="scss">
/* @import url(); 引入css类 */

</style>