<template>
  <div>
    <table cellpadding="5" cellspacing="0" width="100%" v-loading="tableDataLoading">
      <tbody>
        <tr v-for="o in storeField" :key="o.value">
          <td width="17%" valign="middle"><b>{{o.field}}：</b></td>
          <td height="40" valign="middle">{{o.value}}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
export default {
  props: {tabName: String, ID: [Number, String]},
  data() {
    return {
      tableDataLoading: false,
      storeField: {}// 存储字段
    }
  },
  watch: {
    tabName(val) {
      if (val === 'stored' && this.ID) {
        this.storeField = {}
        this.getStoreField()
      }
    },
    ID(val) {
      if (val && this.tabName === 'stored') {
        this.storeField = {}
        this.getStoreField()
      }
    }
  },
  created() {
    this.getStoreField()
  },
  methods: {
    // 存储字段
    async getStoreField() {
      this.tableDataLoading = true
      try {
        let res = await axios.get('/ui/indexlist/storefield', {params: {ID: this.ID}})
        this.storeField = res.data.data
      } catch (e) {
      }
      this.tableDataLoading = false
    }
  }
}
</script>
<style scoped>
</style>
