_checkinLog.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <script setup lang="ts">
  2. import apis from "@a"
  3. import dayjs from "dayjs"
  4. const props = withDefaults(defineProps<{ isSelf?: boolean; showImage?: boolean }>(), {
  5. isSelf: true,
  6. showImage: true
  7. })
  8. const emits = defineEmits<{ (e: "update:modelValue", v: string): void }>()
  9. const logs = ref()
  10. function load(id: string | number) {
  11. return new Promise((resolve) => {
  12. apis.device.inspectionRuleApi.queryCheckinList(id).then((res: any) => {
  13. logs.value = res.data
  14. resolve(res)
  15. })
  16. })
  17. }
  18. defineExpose({ load })
  19. </script>
  20. <template>
  21. <div class="text-center mt-5 mb-3 fs-1 fw-bold" v-if="props.isSelf && logs && logs.length > 0">
  22. 签到记录
  23. </div>
  24. <table class="checkin-log-table" v-if="logs && logs.length > 0">
  25. <thead>
  26. <tr>
  27. <th :style="{ width: isSelf ? '55px' : '60px' }">次序</th>
  28. <th v-if="!isSelf" :style="{ width: isSelf ? '90px' : '160px' }">签到人</th>
  29. <th :style="{ width: isSelf ? '135px' : '160px' }">签到时间</th>
  30. <th :style="{ width: isSelf ? 'auto' : '160px' }">签到状态</th>
  31. <th v-if="showImage" :style="{ width: isSelf ? '135px' : 'auto' }">签到图片</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <tr v-for="(row, index) in logs" :key="index">
  36. <td>{{ row.plannedSequence }}</td>
  37. <td v-if="!isSelf" :style="{ width: isSelf ? '90px' : '160px' }">
  38. {{ row.inspectorName }}
  39. </td>
  40. <td>
  41. <span v-if="row.executeTime" class="text-success">
  42. {{ dayjs(row.executeTime).format("YYYY/MM/DD HH:mm:ss") }}
  43. </span>
  44. <span v-else-if="row.planTime" class="text-danger">
  45. {{ dayjs(row.planTime).format("YYYY/MM/DD HH:mm:ss") }}
  46. </span>
  47. <span v-else>-</span>
  48. </td>
  49. <td>
  50. <el-tag v-if="row.checkinStatus == 1" type="success">已签到</el-tag>
  51. <el-tag v-else type="danger">未签到</el-tag>
  52. </td>
  53. <td v-if="showImage">
  54. <VbImagePreview
  55. v-if="row.imageUrl"
  56. :src="row.imageUrl"
  57. :width="45"
  58. :height="30"
  59. :image-style="{ margin: `4px 5px -4px 5px`, padding: 0 }"></VbImagePreview>
  60. <span v-else>-</span>
  61. </td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. <div class="no-data" v-else>暂无签到记录</div>
  66. </template>
  67. <style scoped>
  68. .checkin-log-table {
  69. width: 100%;
  70. border-collapse: collapse;
  71. border: 1px solid #ebeef5;
  72. border-radius: 4px;
  73. overflow: hidden;
  74. }
  75. .checkin-log-table th {
  76. background-color: #f5f7fa;
  77. padding: 12px 0;
  78. text-align: center;
  79. font-weight: 500;
  80. color: #909399;
  81. }
  82. .checkin-log-table td {
  83. padding: 12px 0;
  84. text-align: center;
  85. border-top: 1px solid #ebeef5;
  86. }
  87. .no-data {
  88. text-align: center;
  89. font-size: 18px;
  90. padding: 100px 20px;
  91. color: #909399;
  92. }
  93. </style>