<template>
  <div>
    <el-table 
    :data="tableShowData" 
    style="width: 100%" 
     >
     
    
      <el-table-column prop="id" label="火情编号" width="120" />
      <el-table-column prop="name" label="建筑名称" width="120" />
      <el-table-column prop="floorcount" label="火情楼层" width="120"  />
      <el-table-column prop="reporter" label="记录次数" width="120"  />
      <el-table-column prop="updateTime" label="归档时间" width="220" />

      <el-table-column prop="discription" label="火情描述" show-overflow-tooltip />
    
      <el-table-column label="详情查看">
        <template #default="scope"> 
        <el-button  @click="detailViewsFn(scope.row)">详情查看</el-button>
      </template>
      </el-table-column>
      <el-table-column
        label="操作"
      >
      <template #default="scope"> 
        <el-button  @click="fireSimulationFn(scope.row)">火情模拟</el-button>
        <el-button  @click="exportReportFn (scope.row)">导出报告</el-button>
      </template>
      
      </el-table-column>
      
    </el-table>
    <!-- 分页区域（固定在右下角） -->
    <div class="card-tabs-footer" >
      <div class="pagination-block">
        <span class="page-text">每页显示</span>
        <el-pagination
          v-model:current-page="currentPage2"
          v-model:page-size="pageSize2"
          :page-sizes="[10, 50, 100]"
          size="small"
          background
          layout="sizes, prev, pager, next"
          :total="tableShowData.length"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>
    <!-- 火情模拟对话框 -->
    <el-dialog
      v-model="isFireSimulationDialogVisible"
      width="800px"
      :before-close="handleClose"
      custom-class="task-scheduling-dialog"
    >
      <!-- 标题区域 -->
      <template #header>
        <div class="dialog-header">
          <span class="dialog-title">火情模拟</span>
          
        </div>
      </template>

      <!-- 内容区域 -->
      <div class="dialog-content">
        <div class="notification-box">
          <el-icon class="notification-icon"><Bell /></el-icon>
          <span class="notification-text">系统已开始进行火情模拟，点击跳转按钮可以进入大屏观察火情模拟</span>
        </div>


      </div>

      <!-- 底部按钮 -->
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" class="action-button">
            <template #icon><VideoPlay /></template>
            前往
          </el-button>
          <el-button class="action-button">
          
            确认
          </el-button>
          
        </div>
      </template>
    </el-dialog>

  </div>
</template>

<script setup>
import { useRoute,useRouter } from 'vue-router'
const emit = defineEmits(['archiveInfoDateBackcallFn'])
const props = defineProps({
  tableShowData: {
    type: Array,
    default: () => []
  },
  
})
const isFireSimulationDialogVisible = ref(false)
const route = useRoute()
const router = useRouter()
const imageRef = ref(null)
const showPreview = ref(false)

const fireSimulationFn = (info) => {
  isFireSimulationDialogVisible.value = true

  console.log("火情模拟",info)
}
const exportReportFn = (info) => { 
  console.log("导出报告",info)
}



const detailViewsFn = (info) => { 
  console.log("详情查看",info,route)
  router.push({
    name: 'floorDetailDate',
    
   
  })
  

}

// 分页数据
const currentPage2 = ref(1)
const pageSize2 = ref(10)
// 分页事件处理
const handleSizeChange = (val) => {
  console.log(`每页 ${val} 条`);
  // getNewTableData()//
};

const handleCurrentChange = (val) => {
  console.log(`当前页 ${val} 条`);
  // getNewTableData()
};


// const getNewTableData = () => { 
//   staffGetPageInfoApi({
//     "currentPageNum": currentPage2.value,
//     "currentPageSize": pageSize2.value,

//   }).then(res => { 
//       if(res.code === 200){
        
//         let tempData = res.data.list
//         // console.log(props.Operation,"--11111111111111111111111---*****---999555555555555999999----")
//         curTableShowData.value[0].tableBody = []
//         //获取未逻辑删除的数据
//         tempData = tempData.filter(element => {
//           return element.isDeleted === 0;
//         });
 
//         tempData.forEach(element => { 
//             element.Operation = [...props.Operation]
          
//           });
//         curTableShowData.value[0].tableBody = tempData
       
//         curTableShowData.value[0].total = res.data.total
//         curTableShowData.value[0].pageSize = res.data.pageSize
//           console.log(curTableShowData.value, '展示数据');

//       }
      
//     }).catch(err => { 
//       message.error(err.message)

//     })

// };
</script>
<style  scoped>
/* 分页区域固定在右下角 */
.card-tabs-footer {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 15px;
  width: auto; /* 自适应宽度 */
}

/* 分页内部 Flex 布局 */
.pagination-block {
  display: flex; /* 核心：启用 Flex 布局 */
  align-items: center; /* 垂直居中对齐 */
  gap: 12px; /* 文本与分页间距 */
}

/* 文本样式 */
.page-text {
  color: #606266;
  font-size: 14px;
  white-space: nowrap; /* 防止文本换行 */
}

/* 穿透修改 Element Plus 分页样式 */
:deep(.el-pagination) {
  display: flex; /* 确保分页组件水平排列 */
  align-items: center;
  margin: 0; /* 清除默认外边距 */
}

/* 表格行样式（全局样式需放在 scoped 外或使用 ::v-deep） */
:deep(.el-table .warning-row) {
  --el-table-tr-bg-color: var(--el-color-warning-light-9);
}

:deep(.el-table .success-row) {
  --el-table-tr-bg-color: var(--el-color-success-light-9);
}

.video-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.video-wrapper {
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 0.5rem;
  background: #f9f9f9;
}

.video-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #666;
}

.video-player {
  width: 100%;
  border-radius: 4px;
  aspect-ratio: 16/9;
  background: #000;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.dialog-title {
  font-size: 18px;
  font-weight: 600;
  color: #303133;
}

.status-indicator {
  display: flex;
  align-items: center;
  color: #67c23a;
  font-size: 14px;
}

.status-icon {
  margin-right: 6px;
  font-size: 16px;
}

.dialog-content {
  padding: 0 20px;
  height: 300px;
  
}

.notification-box {
  display: flex;
  align-items: center;
  padding: 15px;
  background-color: #f0f7ff;
  border-radius: 4px;
  margin-bottom: 20px;
}

.notification-icon {
  color: #409eff;
  font-size: 18px;
  margin-right: 10px;
}

.notification-text {
  color: #606266;
  font-size: 15px;
}

.progress-section {
  margin-bottom: 25px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #606266;
  font-size: 14px;
}

.progress-percent {
  color: #409eff;
  font-weight: 500;
}

.drone-info {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.info-tag {
  padding: 8px 12px;
  font-size: 13px;
}

.dialog-footer {
  width: 100%;

  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}


.action-button {
  padding: 10px 16px;
  flex: 0.21;
}

.cancel-button {
  padding: 10px 16px;
  color: #f56c6c;
  border-color: #f56c6c;
}

.cancel-button:hover {
  background-color: #fef0f0;
  color: #f56c6c;
}
</style>