<template>
  <div>
    <table width="100%" cellpadding="5" cellspacing="0" v-loading="tableDataLoading">
      <tbody>
        <tr v-for="o in tokenizedField" :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,
      tokenizedField: {} //  得分字段
    }
  },
  watch: {
    tabName(val) {
      if (val === 'tokenized' && this.ID) {
        this.tokenizedField = {}
        this.getTokenizedField()
      }
    },
    ID(val) {
      if (val && this.tabName === 'tokenized') {
        this.tokenizedField = {}
        this.getTokenizedField()
      }
    }
  },
  methods: {
    // 分词字段
    async getTokenizedField() {
      this.tableDataLoading = true
      try {
        let res = await axios.get('/ui/indexlist/tokenizedfield', {
          params: { ID: this.ID }
        })
        this.tokenizedField = res.data.data
      } catch (e) {
      }
      this.tableDataLoading = false
    }
  }
}
</script>
<style scoped>

</style>
