<!--
@ 作者: han2015
@ 时间: 2025-05-12 15:39:13
@ 备注: 文档管理组件
-->
<script lang="ts" setup>
import { getUploadErrList,ErrUploadLog} from "@/api/doc/type"


const tableList=ref<ErrUploadLog[]>([])
const curLogContent=ref<string>("")
const moduleDrawer =ref(false)


const props = withDefaults(defineProps<{  
  uid:string,   //当前用户的uuid,注意已经且必须通过base64编码,因为后端获取Identifier后，会base64解码
}>(),{})

function loadLogList(){
  moduleDrawer.value=false
  getUploadErrList(props.uid).then(resp=>{
    tableList.value=resp.data
  })
}

function showLogDetail(row: any, column: any, event: Event){
  curLogContent.value=row.content
  moduleDrawer.value=true
}

defineExpose({loadLogList})

</script>

<template>
  <div class="app_container">
    <el-row><span style="margin: 12px 0px;font-weight: bold;font-size: 20px;"> 上传日志 </span>  </el-row>
    <el-table :data="tableList"
    stripe
    row-key="uuid"
    @row-click="showLogDetail"
    >
      <el-table-column property="ID" label="序号">
      </el-table-column>
      <el-table-column property="CreatedAt" label="创建时间">
        <template #default="scope">
          <span>{{ scope.row.CreatedAt.slice(0,16) }}</span>
        </template>
      </el-table-column>
      <el-table-column property="content" label="日志">
        <template #default="scope">
          <span v-if="scope.row.content.length>100">{{ scope.row.content.slice(0,100) }}</span>
          <span v-else>{{ scope.row.content }}</span>
        </template>
      </el-table-column>
    </el-table>
  </div>

  <el-drawer
    v-model="moduleDrawer"
    title="上传错误记录:"
    direction="rtl"
    size="30%"
    :style="{padding:'17px',backgroundColor:'#f3f3f3'}">
     <div v-html="curLogContent"></div>
  </el-drawer>
</template>

<style lang="scss" scoped>
.app_container {
  padding: 10px 30px 0px 30px;
  height: 100%;
  width: 100%;
}

</style>
