<template>
  <div class="platformTagList-wrap common-wrap">
    <nav-crumb :navpath="navpath"></nav-crumb>
    <div class="right-content">
      <div class="right-box">
        <!-- 子类 -->
        <div class="common-wrap__cateTags">
          <!-- <div class="common-wrap__currentTag inline-block">
            <a href="#/platformTagList?v=122" class="common-wrap__currentTag__name">全部</a>
            <i class="el-icon-arrow-right m-l-8 m-r-8"></i>
            <template v-for="(item,index) in currentTagDatas">
              <a href="" class="common-wrap__currentTag__name">{{item.name}}</a>
              <i class="el-icon-arrow-right m-l-8 m-r-8" v-if="currentTagDatas.length-1 != index"></i>
            </template>
          </div>
          <div class="common-wrap__childTag inline-block">
            <template v-for="(item,index) in childTagDatas">
              <a href="" class="common-wrap__childTag__name">{{item.name}}</a>
            </template>
          </div> -->
          <tag-category :tagLibName="tagLibName"></tag-category>
        </div>
        <div class="common-wrap__opt">
          <el-input
            class="w-184"
            placeholder="请输入标签"
            prefix-icon="el-icon-search"
            v-model="tagSearch"
            @keyup.enter.native="searchEnterFun">
          </el-input>
          <el-button type="primary" @click="toAddMyTagLib" class="fr">添加至我的标签库</el-button>
        </div>
        <div class="common-wrap__table m-t-20">
          <el-table
            ref="multipleTable"
            :data="tagTableData"
            tooltip-effect="dark"
            style="width: 100%"
            @selection-change="handleSelectChange">
            <el-table-column
              type="selection"
              >
            </el-table-column>
            <el-table-column
              prop="name"
              label="标签名称"
              >
              <!-- <template slot-scope="scope">{{ scope.row.name }}</template> -->
            </el-table-column>
            <el-table-column
              prop="tagDescribe"
              label="标签描述"
              >
            </el-table-column>
            <el-table-column
              label="是否实时"
              >
              <template slot-scope="scope">
                {{scope.row.isRealTime == 1? '实时':'非实时'}}
              </template>
            </el-table-column>
            <el-table-column
              label="操作">
              <template slot-scope="scope">
                <router-link :to="{path:'/platformTagDetail',query:{name:scope.row.id}}" class="edit-btn el-button--text">详情</router-link>
                <el-button type="text" size="small" class="p-l-32" @click="toAddMyTagLib(scope.row.id)">添加至我的标签库</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="block common-wrap__page text-right" v-if="tagTableData.length!=0">
          <el-pagination
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
          </el-pagination>
        </div>
      </div>
    </div>
    <vue-gic-footer></vue-gic-footer>
  </div>
</template>
<script>
  import navCrumb from '@/components/nav/nav.vue';
  import tagCategory from '@/components/tagCategory.vue';
  import { getRequest, postRequest, postJson, postForm } from '@/api/api';
  export default {
      name: "platformTagList",
      data() {
        return {
          // 面包屑参数
          navpath: [
            {
              name: '首页',
              path: ''
            },
            {
              name: '会员标签',
              path: ''
            }
          ],

          tagLibName: 'platformTag',// 面包屑分类需要的参数

          tagSearch: '', // 搜索值绑定的参数

          // 标签列表数据
          tagTableData:[
            {
              id: 1,
              name: "123",
              tagDescribe: '描述描述，最多200字，一行显示50字，默认显示一行',
              isRealTime: 1
            }
          ],

          // 分页参数
          currentPage: 1,
          pageSize: 20,
          total: 0,

          // 子分类数据
          currentTagDatas: [
            {
              id: 1,
              name: '基本信息',
            },
            {
              id: 2,
              name: '地理信息',
            },
          ],
          childTagDatas: [
            {
              id: 1,
              name: '其他一',
              num: 12
            },
            {
              id: 2,
              name: '其他二',
              num: 12
            },
          ],
        }
      },
      methods: {
        /**
         * 添加到我的标签库
         */
        toAddMyTagLib(id) {
          var that = this
          console.log(id)
        },

        /**
         * 搜索标签
         */
        searchEnterFun(e) {
          var that = this
          console.log(e)
        },

        /**
         * 表格---多选
         */
        handleSelectChange(val) {
          var that = this
          console.log(val);
        },

        /**
         * 分页---页码变化
         */
        handleSizeChange(val) {
          console.log(`每页 ${val} 条`);
        },
        /**
         * 分页---当前页变化
         */
        handleCurrentChange(val) {
          console.log(`当前页: ${val}`);
        },

        /**
         * 获取当前分类下下的标签
         */
        getTagList(val) {
          var that = this

        },
      },
      mounted() {
        var that = this
        console.log(that.$route.query);
        that.getTagList()
      },
      components: {
        navCrumb,
        tagCategory
      }
    }
</script>
<style lang="scss" scoped>


</style>
