<template>
  <div class="pa-3">
    <m-card title="DDL明细">
      <div class="pa-3">
        <Empty v-if="!strList.length"></Empty>
        <p v-for="(item, index) in strList" :key="index">{{ item }}</p>
      </div>
    </m-card>
  </div>
</template>

<script>
import Empty from '@/components/Common/empty'
import MCard from '@/components/MCard'
import { api } from '@/api/dataGovernance'
export default {
  name: 'data-resource-ddl',
  components: {
    MCard,
    Empty
  },
  data () {
    return {
      strList: []
    }
  },
  created () {
    this.init()
  },
  methods: {
    async init () {
      try {
        const { data } = await api.getDDL({ id: this.$route.params.id })
        if (!data.DDL) {
          return
        }
        this.strList = data.DDL.split('\n')
      } catch (error) {
        this.$snackbar.error(error)
      }
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
