b25b036d
wuxw
v1.9 优化日期
|
1
|
<template>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<div class="staff-attendance-manage-container">
<el-row :gutter="20">
<el-col :span="4">
<el-card class="box-card">
<div class="filter-wrapper">
<el-date-picker v-model="staffAttendanceManageInfo.curDate" type="month"
:placeholder="$t('staffAttendance.monthPlaceholder')" value-format="yyyy-MM" class="filter-item"
@change="handleDateChange"></el-date-picker>
<el-input v-model="staffAttendanceManageInfo.orgName" readonly
:placeholder="$t('staffAttendance.orgPlaceholder')" class="filter-item"
@focus="handleOrgFocus"></el-input>
<el-input v-model="staffAttendanceManageInfo.staffNameLike"
:placeholder="$t('staffAttendance.staffPlaceholder')" class="filter-item"
@keyup.enter.native="loadStaffs"></el-input>
|
6f916870
wuxw
优化甘肃客户反馈bug
|
19
20
21
22
23
|
<div class="filter-item text-right">
<el-button type="primary" @click="loadStaffs">
{{ $t('common.search') }}
</el-button>
</div>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
</div>
<div class="staff-list">
<ul class="staff-ul">
<li v-for="(item, index) in staffAttendanceManageInfo.staffs" :key="index" class="staff-item"
:class="{ 'active': staffAttendanceManageInfo.curStaffId === item.userId }" @click="switchStaff(item)">
{{ item.name }}
</li>
</ul>
</div>
</el-card>
</el-col>
<el-col :span="20">
<el-card class="box-card">
<div class="attendance-grid">
<el-row :gutter="20">
|
ecb5361a
wuxw
优化考勤
|
41
|
<el-col v-for="index in staffAttendanceManageInfo.maxDay" :key="index" :span="4" class="attendance-day "
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
42
|
:style="{ backgroundColor: getBgColor(index) }">
|
ecb5361a
wuxw
优化考勤
|
43
44
45
46
|
<div class="labeling-strip">
<div class="day-header">
{{ staffAttendanceManageInfo.curYear }}-{{ staffAttendanceManageInfo.curMonth }}-{{ index }}
</div>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
47
|
|
ecb5361a
wuxw
优化考勤
|
48
49
50
51
|
<div v-if="getDayAttendance(index) && getDayAttendance(index).state !== '30000'" class="strip"
@click="replenishCheckIn(index)">
<span> {{ $t('staffAttendance.replenish') }}</span>
</div>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
52
|
|
ecb5361a
wuxw
优化考勤
|
53
54
55
56
57
58
59
60
61
|
<div v-for="(item, detailIndex) in getAttendanceDetail(index)" :key="detailIndex"
class="attendance-detail">
<div v-if="item.rest">{{ item.rest }}</div>
<div v-else>
{{ item.specCd === '1001' ? $t('staffAttendance.work') : $t('staffAttendance.offWork') }}:
<span v-if="item.state !== '10000'">{{ formatTime(item.checkTime) }}</span>
<span v-else> - </span>
<span>({{ item.stateName }})</span>
</div>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
62
|
</div>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
63
|
|
ecb5361a
wuxw
优化考勤
|
64
65
66
67
68
|
<div class="log-link">
<el-link type="primary" @click="checkInLog(index)">
{{ $t('staffAttendance.log') }}
</el-link>
</div>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
69
70
71
72
73
74
75
76
77
|
</div>
</el-col>
</el-row>
</div>
</el-card>
</el-col>
</el-row>
<!-- 子组件 -->
|
6f916870
wuxw
优化甘肃客户反馈bug
|
78
|
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
79
80
|
<choose-org-tree ref="chooseOrgTree" @switchOrg="handleSwitchOrg"></choose-org-tree>
<staff-attendance-detail ref="staffAttendanceDetail"></staff-attendance-detail>
|
ecb5361a
wuxw
优化考勤
|
81
|
<staff-attendance-replenish-check-in ref="staffAttendanceReplenishCheckIn" @success="loadStaffAttendances"></staff-attendance-replenish-check-in>
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
82
83
84
85
86
87
88
89
|
</div>
</template>
<script>
import { getCommunityId } from '@/api/community/communityApi'
import {
queryStaffInfos,
queryAttendanceClassesTask,
|
6f916870
wuxw
优化甘肃客户反馈bug
|
90
|
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
91
|
} from '@/api/oa/staffAttendanceManageApi'
|
1a0bdbe0
wuxw
优化缴费页面
|
92
|
import { dateFormat } from '@/utils/dateUtil'
|
56732765
wuxw
修改员工界面部分bug
|
93
94
95
|
import ChooseOrgTree from '@/components/org/ChooseOrgTree'
import StaffAttendanceDetail from '@/components/oa/staffAttendanceDetail'
import StaffAttendanceReplenishCheckIn from '@/components/oa/staffAttendanceReplenishCheckIn'
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
96
97
98
99
|
export default {
name: 'StaffAttendanceManageList',
components: {
|
56732765
wuxw
修改员工界面部分bug
|
100
101
102
|
ChooseOrgTree,
StaffAttendanceDetail,
StaffAttendanceReplenishCheckIn
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
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
|
},
data() {
return {
communityId: '',
staffAttendanceManageInfo: {
staffs: [],
attendances: [],
classesId: '',
orgId: '',
orgName: '',
curDate: '',
curYear: '',
curMonth: '',
curStaffId: '',
maxDay: 31,
staffNameLike: ''
}
}
},
created() {
this.communityId = getCommunityId()
this.initStaffDate()
this.loadStaffs()
},
methods: {
initStaffDate() {
const date = new Date()
this.staffAttendanceManageInfo.curMonth = date.getMonth() + 1
this.staffAttendanceManageInfo.curYear = date.getFullYear()
this.staffAttendanceManageInfo.curDate = `${date.getFullYear()}-${date.getMonth() + 1}`
this.staffAttendanceManageInfo.maxDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()
},
handleDateChange(val) {
if (val) {
const values = val.split('-')
this.staffAttendanceManageInfo.curYear = values[0]
this.staffAttendanceManageInfo.curMonth = values[1]
this.staffAttendanceManageInfo.maxDay = new Date(values[0], values[1], 0).getDate()
this.loadStaffAttendances()
}
},
async loadStaffs() {
try {
const params = {
page: 1,
row: 100,
orgId: this.staffAttendanceManageInfo.orgId,
staffName: this.staffAttendanceManageInfo.staffNameLike,
communityId: this.communityId
}
|
6f916870
wuxw
优化甘肃客户反馈bug
|
156
|
const data = await queryStaffInfos(params)
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
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
|
this.staffAttendanceManageInfo.staffs = data.staffs || []
if (this.staffAttendanceManageInfo.staffs.length > 0) {
this.staffAttendanceManageInfo.curStaffId = this.staffAttendanceManageInfo.staffs[0].userId
this.loadStaffAttendances()
}
} catch (error) {
console.error('Failed to load staffs:', error)
}
},
async loadStaffAttendances() {
if (!this.staffAttendanceManageInfo.curStaffId || !this.staffAttendanceManageInfo.curDate) return
try {
const params = {
page: 1,
row: 1000,
date: this.staffAttendanceManageInfo.curDate,
staffId: this.staffAttendanceManageInfo.curStaffId,
communityId: this.communityId
}
const { data } = await queryAttendanceClassesTask(params)
this.staffAttendanceManageInfo.attendances = data || []
|
ecb5361a
wuxw
优化考勤
|
182
|
console.log(this.staffAttendanceManageInfo.attendances)
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
} catch (error) {
console.error('Failed to load staff attendances:', error)
}
},
handleOrgFocus() {
this.$refs.chooseOrgTree.open()
},
handleSwitchOrg(org) {
this.staffAttendanceManageInfo.orgId = org.orgId
this.staffAttendanceManageInfo.orgName = org.allOrgName
this.loadStaffs()
},
switchStaff(staff) {
this.staffAttendanceManageInfo.curStaffId = staff.userId
this.loadStaffAttendances()
},
getDayAttendance(day) {
if (!this.staffAttendanceManageInfo.attendances) return null
|
ecb5361a
wuxw
优化考勤
|
205
|
const attendance = this.staffAttendanceManageInfo.attendances.find(item => item.taskDay == day)
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
206
|
|
ecb5361a
wuxw
优化考勤
|
207
208
209
210
|
if (!attendance) {
return null
}
return attendance
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
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
|
},
getAttendanceDetail(day) {
const attendance = this.getDayAttendance(day)
if (!attendance) {
const date = new Date()
const taskYear = this.staffAttendanceManageInfo.curYear
const taskMonth = this.staffAttendanceManageInfo.curMonth
if (taskYear == date.getFullYear() && parseInt(taskMonth) == (date.getMonth() + 1) && day > date.getDate()) {
return [{ rest: this.$t('staffAttendance.notTime') }]
}
return [{ rest: this.$t('staffAttendance.noNeed') }]
}
return attendance.attendanceClassesTaskDetails || []
},
getBgColor(day) {
console.log(day)
return '#fff'
},
formatTime(time) {
if (!time) return ''
|
1a0bdbe0
wuxw
优化缴费页面
|
238
|
return dateFormat(time)
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
},
checkInLog(day) {
let month = this.staffAttendanceManageInfo.curMonth
if (month < 10) month = `0${month}`
if (day < 10) day = `0${day}`
const date = `${this.staffAttendanceManageInfo.curYear}-${month}-${day}`
this.$refs.staffAttendanceDetail.open({
staffId: this.staffAttendanceManageInfo.curStaffId,
date: date
})
},
replenishCheckIn(day) {
const details = this.getAttendanceDetail(day)
if (!details || details.length < 1) {
this.$message.warning(this.$t('staffAttendance.noTask'))
return
}
const newDetails = details.filter(item => item.state === '10000')
if (newDetails.length < 1) {
this.$message.warning(this.$t('staffAttendance.noTask'))
return
}
this.$refs.staffAttendanceReplenishCheckIn.open(newDetails)
}
}
}
</script>
<style lang="scss" scoped>
.staff-attendance-manage-container {
padding: 20px;
.box-card {
margin-bottom: 20px;
}
.filter-wrapper {
.filter-item {
margin-bottom: 15px;
width: 100%;
}
}
.staff-list {
max-height: 600px;
overflow-y: auto;
.staff-ul {
list-style: none;
padding: 0;
margin: 0;
.staff-item {
padding: 10px;
margin-bottom: 5px;
cursor: pointer;
border-radius: 4px;
text-align: center;
&:hover {
background-color: #f5f7fa;
}
&.active {
background-color: #409eff;
color: #fff;
}
}
}
}
.attendance-grid {
|
ecb5361a
wuxw
优化考勤
|
316
317
|
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
318
319
320
321
322
|
.attendance-day {
padding: 10px;
margin-bottom: 20px;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
ecb5361a
wuxw
优化考勤
|
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
height: 120px;
.labeling-strip {
position: relative;
.strip {
position: absolute;
top: 0;
right: 0;
background-color: #409eff;
color: #fff;
padding: 4px 8px;
font-size: 12px;
border-radius: 0 4px 0 4px;
cursor: pointer;
z-index: 1;
&:hover {
background-color: #66b1ff;
}
span {
white-space: nowrap;
}
}
}
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
349
350
351
352
353
354
355
|
.day-header {
font-weight: bold;
margin-bottom: 10px;
text-align: center;
}
|
ecb5361a
wuxw
优化考勤
|
356
357
358
359
|
|
d4a6b78f
wuxw
OA 中考勤功能开发完成
|
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
.replenish-btn {
color: #409eff;
cursor: pointer;
text-align: center;
margin-bottom: 10px;
&:hover {
text-decoration: underline;
}
}
.attendance-detail {
margin-bottom: 5px;
font-size: 12px;
}
.log-link {
text-align: center;
margin-top: 10px;
}
}
}
}
</style>
|