Blame view

src/components/oa/staffAttendanceDetail.vue 2.07 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
  <template>
    <el-dialog
      :title="$t('staffAttendance.attendanceDetail')"
      :visible.sync="visible"
      width="70%"
    >
      <el-table
        :data="details"
        border
        style="width: 100%"
        v-loading="loading"
      >
        <el-table-column
          prop="staffName"
          :label="$t('staffAttendance.staffName')"
          align="center"
        ></el-table-column>
        
        <el-table-column
          :label="$t('staffAttendance.face')"
          align="center"
        >
          <template slot-scope="scope">
            <el-image
              style="width: 60px; height: 60px; border-radius: 4px;"
              :src="scope.row.facePath || '/img/noPhoto.jpg'"
              fit="cover"
            ></el-image>
          </template>
        </el-table-column>
        
        <el-table-column
          prop="clockTime"
          :label="$t('staffAttendance.clockTime')"
          align="center"
        ></el-table-column>
      </el-table>
      
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('common.close') }}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import { queryAttendanceLog } from '@/api/oa/staffAttendanceManageApi'
  
  export default {
    name: 'StaffAttendanceDetail',
    data() {
      return {
        visible: false,
        loading: false,
        details: [],
        params: {}
      }
    },
    methods: {
      open(params) {
        this.params = params || {}
        this.visible = true
        this.loadDetails()
      },
      
      async loadDetails() {
        try {
          this.loading = true
          const { data } = await queryAttendanceLog({
            ...this.params,
            page: 1,
            row: 30,
            communityId: getCommunityId()
          })
          this.details = data || []
        } catch (error) {
          console.error('Failed to load attendance details:', error)
          this.$message.error(this.$t('staffAttendance.loadDetailFailed'))
        } finally {
          this.loading = false
        }
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .dialog-footer {
    text-align: right;
  }
  </style>