<template>
  <div class="layout-no-cols right-detail-tabs">
    <el-toolbar>
      <el-button @click="$router.back()" type="primary" size="medium" round class="shadow-primary"><i class="fa fa-chevron-left"></i> 返回上页</el-button>
    </el-toolbar>
    <el-tabs class="tabs-wrap" v-model="activeTabs">
      <el-tab-pane name="attribute">
        <span slot="label"><i class="fa fa-wpforms"></i>属性列表</span>
        <div class="pane-wrap padding-vertical-max">
          <el-table
            :data-read-url="getAttribute"
            ref="attributeTable"
            tooltip-effect="dark">
            <el-table-column type="index" width="80" align="left"></el-table-column>
            <el-table-column prop="name" label="名称" width="150"></el-table-column>
            <el-table-column prop="dataType" align="left" label="数据类型" width="150"></el-table-column>
            <el-table-column prop="options" label="允许的值" width="350" align="left"></el-table-column>
            <el-table-column label="用法" show-overflow-tooltip>
              <template slot-scope="scope"><span :title="scope.row.usage">{{ scope.row.usage }}</span></template>
            </el-table-column>
          </el-table>
        </div>
      </el-tab-pane>
      <el-tab-pane name="usage">
        <span slot="label"><i class="fa fa-cog"></i>使用情况</span>
        <div class="pane-wrap padding-vertical-max">
          <el-table :data-read-url="getUsage" ref="usageTable" tooltip-effect="dark">
            <el-table-column type="index" width="80" align="left"></el-table-column>
            <el-table-column prop="platform" label="平台" width="150"></el-table-column>
            <el-table-column prop="name" label="模板名称"></el-table-column>
            <el-table-column prop="rowNo" label="行号" width="150"></el-table-column>
            <el-table-column label="用法" show-overflow-tooltip >
              <template slot-scope="scope"><span v-html="scope.row.usage"></span></template>
            </el-table-column>
          </el-table>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
export default {
  props: {
    tagId: {
      type: String,
      required: false
    }
  },
  data() {
    return {
      activeTabs: 'attribute'
    }
  },
  methods: {
    getAttribute() {
      return ['/ui/tags/attribute', { params: {tagID: this.tagId} }]
    },
    getUsage() {
      return ['/ui/tags/usage', { params: {tagID: this.tagId} }]
    }
  }
}
</script>
<style scope>
</style>
