<template>
  <a-table
    size="small"
    :scroll="{ y: 500 }"
    bordered
    :pagination="false"
    :columns="detailColumns"
    :dataSource="tableData"
    :loading="detailLoading"
  >
    <template slot="detailAction" slot-scope="text">
      <a v-if="true">{{ text }}</a>
    </template>
    <template slot="editRemark" slot-scope="text, record">
      <a-button type="link" size="small" @click="toEdit(record)">编辑</a-button>
    </template>
  </a-table>
<!--  <a-tabs default-active-key="1" @change="callback">
    <a-tab-pane key="1" tab="原始预警数据">
      <a-table
        size="small"
        :scroll="{ y: 500 }"
        bordered
        :pagination="false"
        :columns="detailColumns"
        :dataSource="tableData"
        :loading="detailLoading"
      >
        <template slot="detailAction" slot-scope="text">
          <a v-if="true">{{ text }}</a>
        </template>
        <template slot="editRemark" slot-scope="text, record">
          <a-button type="link" size="small" @click="toEdit(record)">编辑</a-button>
        </template>
      </a-table>
    </a-tab-pane>
    <a-tab-pane key="2" tab="参数预警数据">
      <warn-history ref="warnHistory" style="overflow: scroll; height: 600px" />
    </a-tab-pane>
  </a-tabs>-->
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { filterObj } from '@/utils/util'
import vue from 'vue'
import warnHistory from './warning_table/warnHistory.vue'
export default {
  name: 'YjTableDialog',
  mixins: [JeecgListMixin],
  components: { warnHistory },
  props: {
    tableData: {
      type: Object,
      default: () => { }
    }
  },
  data() {
    return {
      /* table加载状态 */
      detailLoading: false,
      detailColumns: [
        {
          title: '序号',
          key: 'rowIndex',
          dataIndex: '',
          width: 80,
          align: 'center',
          customRender: (t, r, i) => parseInt(i) + 1
        },
        {
          title: '井号',
          width: 100,
          align: 'center',
          dataIndex: 'JH',
          scopedSlots: { customRender: 'detailAction' }
        },
        {
          title: '报警类别',
          width: 90,
          align: 'center',
          dataIndex: 'SOURCE'
        },
        {
          title: '异常类型',
          width: 80,
          align: 'center',
          dataIndex: 'CATOGARY'
        },
        {
          title: '异常描述',
          align: 'center',
          dataIndex: 'BJNR',
          width: 300
        },
        {
          title: '报警时间',
          width: 120,
          dataIndex: 'WARN_TIME',
          align: 'center',
          sorter: true
        },
        {
          title: '现场判别',
          width: 100,
          dataIndex: 'JUDGE',
          align: 'center'
        },
        {
          title: '记录人',
          width: 80,
          dataIndex: 'RECORDER',
          align: 'center'
        },
        {
          title: '记录时间',
          width: 150,
          dataIndex: 'UPDATED',
          align: 'center'
        },
        {
          title: '备注',
          width: 100,
          dataIndex: 'REMARK',
          align: 'center'
        }
      ]
    }
  },
  watch: {
  },
  created() {
    console.log('aaa')
  },
  mounted() {
  },
  methods: {
    callback(val) {
      console.log(val)
      if (val == 2) {
        this.$refs.warnHistory.init()
      }
    }
  },

  beforeDestroy() {
  }
}
</script>

<style lang="less" scoped>
/deep/ .ant-card-body {
  padding: 7px;
}

.fixHeight {
  height: 100%;
  /deep/ .ant-spin-nested-loading {
    height: calc(100% - 35px);
    .ant-spin-container {
      height: 100%;
      .ant-table {
        height: 100%;
        .ant-table-content {
          height: 100%;
          .ant-table-scroll {
            height: 100%;
            overflow: hidden;
          }
        }
      }
    }
  }
}

/deep/ .high-light-row {
  background: yellow;
  td {
    color: red;
  }
}
</style>
