<template>
  <div>
    <c-dialog :showFooter="false"
              :title="'操作历史'"
              :visible="diaVisible"
              @cancel="diaCancel">

      <div class="mod-demo__demo}">

        <c-table column-type="index"
                 :pageVisible="true"
                 ref="table"
                 :url="tableUrl"
                 :params="tableParams"
                 keyword="OperHistory"
                 :operations="operations"
                 :tableHeight="tableHeight">
        </c-table>
      </div>

    </c-dialog>

  </div>
</template>

<script>
import CTable from '@c/CTableNoPage'
import { mapGetters } from 'vuex'
import CDialog from '@c/CDialog'

export default {
  data () {
    return {
      loading: false,
      diaVisible: false,
      codeId: '',
      // 模板列表
      tableUrl: 'https://epmet-cloud.elinkservice.cn/api/third/code/history',
      tableParams: {
        type: Object, // table的查询参数
        default () {
          return {}
        }
      },
      // 列表操作栏的操作项数组
      operations: []

    }
  },
  components: {
    CTable, CDialog
  },
  mounted () {
  },
  methods: {
    initData (codeId) {
      this.codeId = codeId
      this.tableParams.codeId = codeId

      this.diaVisible = true

      this.$nextTick(() => {
        this.$refs.table.loadData() // 解决表格错位
      })
    },

    diaCancel () {
      this.diaVisible = false
    }
  },
  computed: {
    tableHeight () {
      // return this.clientHeight - 60 - 80 - 80 - 50 - 400
      return this.clientHeight * 0.6 - 40
    },
    ...mapGetters(['clientHeight'])
  }
}
</script>
