Blame view

src/views/oa/attendanceClassesStaffManageList.vue 8.53 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
d4a6b78f   wuxw   OA 中考勤功能开发完成
2
    <div class="attendance-classes-staff-manage-container">
8e6e71fd   wuxw   优化代码
3
4
5
6
7
8
      <el-row :gutter="10">
        <el-col :span="3">
          <div class="list-group-border-radius">
            <div class=" treeview">
              <ul class="list-group text-center ">
                <li v-for="(item, index) in attendanceClassesStaffManageInfo.attendanceClassess" :key="index" @click="swatchClass(item)"
d4a6b78f   wuxw   OA 中考勤功能开发完成
9
                  :class="{ 'vc-node-selected': attendanceClassesStaffManageInfo.conditions.classesId == item.classesId }"
8e6e71fd   wuxw   优化代码
10
                  class="list-group-item node-orgTree">
d4a6b78f   wuxw   OA 中考勤功能开发完成
11
12
13
14
                  {{ item.classesName }}
                </li>
              </ul>
            </div>
8e6e71fd   wuxw   优化代码
15
          </div>
d4a6b78f   wuxw   OA 中考勤功能开发完成
16
        </el-col>
8e6e71fd   wuxw   优化代码
17
        <el-col :span="21">
d4a6b78f   wuxw   OA 中考勤功能开发完成
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
          <el-card>
            <div slot="header" class="flex justify-between">
              <span>{{ $t('attendanceClassesStaffManage.search.title') }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-input v-model="attendanceClassesStaffManageInfo.conditions.staffNameLike"
                  :placeholder="$t('attendanceClassesStaffManage.search.staffName')" clearable />
              </el-col>
              <el-col :span="16">
                <el-button type="primary" @click="_queryAttendanceClassesStaffMethod">
                  <i class="el-icon-search"></i>
                  {{ $t('common.search') }}
                </el-button>
                <el-button @click="_resetAttendanceClassesStaffMethod">
                  <i class="el-icon-refresh"></i>
                  {{ $t('common.reset') }}
                </el-button>
              </el-col>
            </el-row>
          </el-card>
  
          <el-card style="margin-top: 20px;">
            <div slot="header" class="flex justify-between">
              <span>{{ $t('attendanceClassesStaffManage.list.title') }}</span>
              <el-button type="primary" size="small" style="float: right;" @click="_openAddAttendanceClassesStaffModal">
                <i class="el-icon-plus"></i>
                {{ $t('common.add') }}
              </el-button>
            </div>
            <el-table :data="attendanceClassesStaffManageInfo.attendanceClassesStaffs" border style="width: 100%"
              v-loading="loading">
              <el-table-column prop="personFace" :label="$t('attendanceClassesStaffManage.table.face')" align="center"
                width="100">
                <template slot-scope="scope">
                  <div style="position: relative; display: inline-block;"
                    @click="showImg(scope.row.personFace || '/img/noPhoto.jpg')">
                    <el-image style="width: 50px; height: 50px" :src="scope.row.personFace || '/img/noPhoto.jpg'"
                      fit="cover">
                      <div slot="error" class="image-slot">
                        <img src="/img/noPhoto.jpg" style="width: 50px; height: 50px">
                      </div>
                    </el-image>
                    <img src="/img/icon-bigimg.png" style="position: absolute;right: 0;bottom: 0;" width="50" height="50"
                      alt="">
                  </div>
                </template>
              </el-table-column>
              <el-table-column prop="staffId" :label="$t('attendanceClassesStaffManage.table.staffId')" align="center" />
              <el-table-column prop="staffName" :label="$t('attendanceClassesStaffManage.table.staffName')"
                align="center" />
              <el-table-column prop="createTime" :label="$t('attendanceClassesStaffManage.table.createTime')"
                align="center" />
              <el-table-column :label="$t('common.operation')" align="center" width="200">
                <template slot-scope="scope">
                  <el-button size="mini" type="danger" @click="_openDeleteAttendanceClassesStaffModel(scope.row)">
                    {{ $t('common.delete') }}
                  </el-button>
                  <el-button size="mini" type="primary" @click="openStaffDetail(scope.row)">
                    {{ $t('common.detail') }}
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
  
            <el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
              :total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
              @current-change="handleCurrentChange" style="margin-top: 20px;" />
          </el-card>
        </el-col>
      </el-row>
  
      <delete-attendance-classes-staff ref="deleteDialog" @success="handleSuccess" />
      <view-image ref="viewImage" />
    </div>
  </template>
  
  <script>
  import { listAttendanceClassesStaff, listAttendanceClassess } from '@/api/oa/attendanceClassesStaffManageApi'
  import DeleteAttendanceClassesStaff from '@/components/oa/deleteAttendanceClassesStaff'
  import ViewImage from '@/components/system/viewImage'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'AttendanceClassesStaffManageList',
    components: {
      DeleteAttendanceClassesStaff,
      ViewImage
    },
    data() {
      return {
        loading: false,
        attendanceClassesStaffManageInfo: {
          attendanceClassesStaffs: [],
          total: 0,
          records: 1,
          moreCondition: false,
          csId: '',
          attendanceClassess: [],
          conditions: {
            classesId: '',
            staffId: '',
            staffNameLike: '',
            page: 1,
            row: 10
          }
        },
        page: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    created() {
      this.communityId = getCommunityId()
      this._loadAttendanceClass()
    },
    methods: {
      async _listAttendanceClassesStaffs(page = 1, rows = 10) {
        try {
          this.loading = true
          this.attendanceClassesStaffManageInfo.conditions.page = page
          this.attendanceClassesStaffManageInfo.conditions.row = rows
  
          const { data, total } = await listAttendanceClassesStaff(this.attendanceClassesStaffManageInfo.conditions)
          this.attendanceClassesStaffManageInfo.attendanceClassesStaffs = data
          this.page.total = total
        } catch (error) {
          console.error('获取考勤员工列表失败:', error)
          this.$message.error(this.$t('attendanceClassesStaffManage.fetchError'))
        } finally {
          this.loading = false
        }
      },
      _openAddAttendanceClassesStaffModal() {
        this.$router.push(`/views/oa/addAttendanceClassesStaff?classesId=${this.attendanceClassesStaffManageInfo.conditions.classesId}`)
      },
      _openDeleteAttendanceClassesStaffModel(row) {
        this.$refs.deleteDialog.open(row)
      },
      _queryAttendanceClassesStaffMethod() {
        this.page.current = 1
        this._listAttendanceClassesStaffs()
      },
      _resetAttendanceClassesStaffMethod() {
        this.attendanceClassesStaffManageInfo.conditions.staffNameLike = ''
        this._queryAttendanceClassesStaffMethod()
      },
      swatchClass(item) {
        this.attendanceClassesStaffManageInfo.conditions.classesId = item.classesId
        this._listAttendanceClassesStaffs()
      },
      async _loadAttendanceClass() {
        try {
          const { data } = await listAttendanceClassess({ page: 1, row: 100 })
          this.attendanceClassesStaffManageInfo.attendanceClassess = data
          if (data && data.length > 0) {
            this.swatchClass(data[0])
          }
        } catch (error) {
          console.error('获取考勤班次失败:', error)
          this.$message.error(this.$t('attendanceClassesStaffManage.fetchClassError'))
        }
      },
      showImg(url) {
        this.$refs.viewImage.open(url)
      },
      openStaffDetail(staff) {
1db0a60c   wuxw   优化常用菜单 和搜索功能
187
        this.$router.push(`/views/staff/staffDetail?staffId=${staff.staffId}`)
d4a6b78f   wuxw   OA 中考勤功能开发完成
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
      },
      handleSizeChange(val) {
        this.page.size = val
        this._listAttendanceClassesStaffs(this.page.current, val)
      },
      handleCurrentChange(val) {
        this._listAttendanceClassesStaffs(val, this.page.size)
      },
      handleSuccess() {
        this._listAttendanceClassesStaffs(this.page.current, this.page.size)
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .attendance-classes-staff-manage-container {
    padding: 20px;
  
    .tree-card {
      height: 100%;
  
      .treeview {
        height: 100%;
  
        .list-group {
          list-style: none;
          padding: 0;
          margin: 0;
  
          .list-group-item {
            padding: 10px 15px;
            margin-bottom: 5px;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
            text-align: center;
  
            &:hover {
              background-color: #f5f5f5;
            }
  
            &.vc-node-selected {
              background-color: #409EFF;
              color: white;
              border-color: #409EFF;
            }
          }
        }
      }
    }
  }
  </style>