<template>
  <div>
    <el-table
    :data="exitContent"

    ref="refTable"

  >
    <!-- <el-table-column type="index" width="55" label="序号" /> -->

    <el-table-column
      prop="mapType"
      width="86"
      label="类型"

    >
      <template #default="scope">
        {{scope.$index+1}}.{{ getMapType(scope.row.mapType)}}
      </template>
    </el-table-column>
    <el-table-column
    prop="actionType"

    label="状态"

  >
    <template #default="scope">
      <el-tooltip
      class="box-item"
      effect="dark"
      :content="scope.row.time"
      placement="top"
    >
    {{ getActionType(scope.row.actionType) }}
    </el-tooltip>



    </template>
  </el-table-column>
  <el-table-column
  show-overflow-tooltip

    label="信息"

  >
  <template #default="scope">
    {{getExitType(scope.row.tips)}}
  </template>

  </el-table-column>

    <el-table-column
      label="操作"
      align="center"
      prop="unit"


    >
      <template #default="scope">
        <el-button
          type="primary"
          :disabled="!scope.row.isrevoke"
          size="small"
          @click="exitRecogn(scope.row,scope.$index)"
          ><span style="color: #fff">恢复</span></el-button
        >
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>
<script  setup lang="ts">
  import {storeToRefs} from 'pinia'
  import useMapLog from "@map/store/modules/mapLog"
  const  mapLog = useMapLog()
  const {exitContent} = storeToRefs(mapLog)
  const { proxy } = getCurrentInstance();
  const $ldMap = inject("$ldMap");
  const getMapType = (val)=>{
    return val =='regon'?'特征物':'管线'
  }
  const getActionType =(val)=>{
     let  action ={
        'add': '新增',
        'edit': '编辑',
        'delete': '删除',
        'save':'保存',
        'data':'初始化'
     }
     return action[val]
  }
  const getExitType=(val=>{

    let  action ={
        'House': '房屋',
        'River': '河流',
        'Road': '道路',
        'Station':'站点',
        'h':'房屋投影点',
        'x':'检修井投影点',
        's':'站点',

     }
     return val? action[val]:'数据'
  })
  const exitRecogn = (data,index)=>{
    $ldMap.recoveryData(data).then(()=>{
      proxy.$modal.msgSuccess("恢复成功");
      mapLog.revokeContent(index)

    }).catch(()=>{
      proxy.$modal.msgSuccess("功能完善中");
    })
  }


</script>
