<template>
  <div style="margin-top:20px">
    <div class="table-content">
      <el-table :data="tableData" style="width: 100%" tooltip-effect="dark" v-loading="loading" :height="tableHeight">
        <el-table-column label="项目名称" prop="projectName"> </el-table-column>
        <el-table-column label="分组" prop="groupName"></el-table-column>
        <el-table-column label="接口名称" prop="interfaceName"></el-table-column>
        <el-table-column label="绑定时间" prop="bindTime">
          <template slot-scope="scope">
            <div class="color-606266 line-18">{{ scope.row.bindTime | timeStampToYmd }}</div>
            <div class="color-606266 line-18">{{ scope.row.bindTime | timeStampToHms }}</div>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <dm-delete @confirm="cancelBind(scope.row)" tips="确定要接触绑定吗?">
              <el-button type="text">解除绑定</el-button>
            </dm-delete>
            <!-- <el-button type="text">日志</el-button> -->
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { getRequest } from '@/api/api';
export default {
  props: {
    tableData: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {};
  },
  methods: {
    cancelBind(item) {
      var that = this;
      let params = {
        id: item.openPlatformInterfaceId
      };
      getRequest('/gateway-manage/platform/capacity/unbind', params)
        .then(res => {
          if (res.data.code == '0000') {
            this.$emit('getList');
          } else {
            this.$message.error(res.data.message);
          }
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  },
  components: {}
};
</script>
<style lang="less" scoped></style>
