Blame view

src/components/oa/todayAttendanceDetail.vue 2.97 KB
d4a6b78f   wuxw   OA 中考勤功能开发完成
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  <template>
    <el-dialog
      :title="$t('todayAttendanceDetail.title')"
      :visible.sync="visible"
      width="80%"
      @close="handleClose"
    >
      <el-table
        :data="tableData"
        border
        style="width: 100%"
      >
        <el-table-column
          prop="specCd"
          :label="$t('todayAttendanceDetail.table.name')"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.specCd === '1001' ? $t('todayAttendanceDetail.table.work') : $t('todayAttendanceDetail.table.offWork') }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('todayAttendanceDetail.table.attendanceRange')"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.specCd === '1001' 
              ? `${timeMinFormat(scope.row.leaveValue)}~${timeMinFormat(scope.row.value)}` 
              : `${timeMinFormat(scope.row.value)}~${timeMinFormat(scope.row.lateValue)}` }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('todayAttendanceDetail.table.lateEarly')"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.specCd === '1001' 
              ? `${timeMinFormat(scope.row.value)}~${timeMinFormat(scope.row.lateValue)}` 
              : `${timeMinFormat(scope.row.leaveValue)}~${timeMinFormat(scope.row.value)}` }}
          </template>
        </el-table-column>
        <el-table-column
          prop="stateName"
          :label="$t('todayAttendanceDetail.table.status')"
          align="center"
        />
        <el-table-column
          :label="$t('todayAttendanceDetail.table.attendanceTime')"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.checkTime || $t('todayAttendanceDetail.table.notCheckIn') }}
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('todayAttendanceDetail.table.snapshot')"
          align="center"
        >
          <template slot-scope="scope">
            <el-image
              v-if="scope.row.state !== '10000'"
              style="width: 60px; height: 60px;"
              :src="scope.row.facePath"
              :preview-src-list="[scope.row.facePath]"
              fit="cover"
            />
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </template>
  
  <script>
  export default {
    name: 'TodayAttendanceDetail',
    data() {
      return {
        visible: false,
        tableData: []
      }
    },
    methods: {
      open(data) {
        this.tableData = data.attendanceClassesTaskDetails || []
        this.visible = true
      },
      handleClose() {
        this.tableData = []
        this.visible = false
      },
      timeMinFormat(time) {
        if (!time) return ''
        const hours = Math.floor(time / 60)
        const minutes = time % 60
        return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`
      }
    }
  }
  </script>
  
  <style scoped>
  .el-image {
    cursor: pointer;
    transition: transform 0.3s;
  }
  
  .el-image:hover {
    transform: scale(1.1);
  }
  </style>