<template>
  <el-dialog
    v-model="dialogVisible"
    :title="'变更记录'"
    width="80%">
   
    <el-table :data="dataList" border style="width: 100%">
        <el-table-column label="序号" width="60" type="index">
          <template #default="scope">
              <span>{{ scope.$index + 1 }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="create_time" label="变更时间" align="center" width="120"/>
        <el-table-column prop="rule_str" label="变更规则" align="center" />
    </el-table>
    <pagination
        v-show="total > 0"
        :total="total"
        v-model:page="queryParams.currentpage"
        v-model:limit="queryParams.pageSize"
        @pagination="changeLogMethod"
    />
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="handlerClose">关 闭</el-button>
      </div>
    </template>
  </el-dialog>

</template>

<script setup>

import { ref, reactive } from 'vue';
import { ElMessage } from 'element-plus';
import { changeLog } from '@/api/classification/monitorManagement.js'
const props = defineProps({
    hideComponent: {
        type: Array,
        default: () => [],
    }
})
const dialogVisible = ref(false);
const currentStep = ref(1);
const desensitizationDialogVisible = ref(false);
const currentField = ref({});
const dataList = ref([]);
const queryParams = ref({
    "currentpage": 1,
    "pageSize": 10,
    'clientId': ''
})
const total = ref(0)


function changeLogMethod() {
  changeLog(queryParams.value).then(res => {
    dataList.value = res.data
    total.value = res.totalCount
  })
}

function show(clientId) {
  queryParams.value.clientId = clientId;
  queryParams.value.currentpage = 1;
  changeLogMethod()
  dialogVisible.value = true;
}

function handlerClose() {
  dialogVisible.value = false;
}

// 关键：通过defineExpose暴露方法，供父组件调用
defineExpose({
  show
});
</script>

<style scoped lang="scss">
.step-content {
  min-height: 400px;
}

.version-select {
  margin-bottom: 20px;
}

.field-selection {
  display: flex;
  height: 400px;
}

.tree-container {
  width: 250px;
  height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.table-container {
  flex: 1;
  height: 100%;
  overflow-y: auto;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
}

.el-divider {
  height: 100%;
  margin: 0 10px;
}

.flex-container { 
  display: flex;
}

.align-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.flex1 {
  flex: 1;
}
.version-select-content {
  margin-left: 15px;
}
.pagination {
    background: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .pagination-info {
      color: #666;
      font-size: 14px;
    }
  }
</style>