Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
office-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
office
office-web
Commits
9e7fdbd4
Commit
9e7fdbd4
authored
Dec 15, 2019
by
无尘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加班次计算
parent
39d3f34f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
27 deletions
+84
-27
create-work-class.vue
src/components/app/dailyAttendance/create-work-class.vue
+82
-26
workSet.vue
src/views/enterpriseApp/dailyAttendance/workSet.vue
+2
-1
No files found.
src/components/app/dailyAttendance/create-work-class.vue
View file @
9e7fdbd4
...
...
@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2019-10-21 14:27:29
* @LastEditors: 无尘
* @LastEditTime: 2019-12-1
4 17:52:5
4
* @LastEditTime: 2019-12-1
5 17:41:1
4
-->
<!--
...
...
@@ -29,7 +29,7 @@ import createWorkClass from '@/components/app/dailyAttendance/create-work-class.
<el-radio-button
label=
"1"
>
1天1次上下班
</el-radio-button>
<!--
<el-radio-button
label=
"2"
>
1天2次上下班
</el-radio-button>
<el-radio-button
label=
"3"
>
1天3次上下班
</el-radio-button>
-->
</el-radio-group
><el-checkbox
class=
"m-l-20"
v-model=
"formData.clockType"
>
打卡时段设置
</el-checkbox>
><el-checkbox
class=
"m-l-20"
v-model=
"formData.clockType"
@
change=
"changeTimeRange"
>
打卡时段设置
</el-checkbox>
</div>
<div
class=
"times-set-content m-b-20"
>
<ul
v-if=
"!formData.clockType"
>
...
...
@@ -469,14 +469,19 @@ export default {
console
.
log
(
'下班时间-8 之后和上班时间比较:'
,
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
));
const
diff
=
parseInt
(
item
.
endTime
.
split
(
':'
)[
0
])
-
8
;
console
.
log
(
'下班时间-8:'
,
diff
,
rangeStart
,
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
));
if
(((
await
that
.
compareDate
(
item
.
startTime
,
item
.
endTime
))
&&
diff
<
0
&&
(
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
)))
||
(
diff
>
0
&&
!
(
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
))))
{
if
(((
await
that
.
compareDate
(
item
.
startTime
,
item
.
endTime
))
&&
diff
<
0
&&
(
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
)))
||
(
(
await
that
.
compareDate
(
item
.
startTime
,
item
.
endTime
))
&&
diff
>
0
&&
!
(
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
))))
{
// 如 00:00-07:00 12:00-18:00
console
.
log
(
1
);
rangeStart
=
await
that
.
hmPlushm
(
item
.
startTime
,
'00:01'
);
// 下班时间 - 8 ,如果比上班时间还小,就把上班时间之前作为可打卡开始的最小时间
}
console
.
log
(
rangeStart
);
// 跨天了(次日)
if
(
!
(
await
that
.
compareDate
(
item
.
startTime
,
item
.
endTime
))
&&
diff
<
0
&&
!
(
await
that
.
compareDate
(
item
.
startTime
,
rangeStart
)))
{
//
console
.
log
(
2
);
rangeStart
=
await
that
.
hmPlushm
(
item
.
startTime
,
'00:01'
);
// 下班时间 - 8 ,如果比上班时间还小,就把上班时间之前作为可打卡开始的最小时间
}
console
.
log
(
'是否跨天:'
,
!
(
await
that
.
compareDate
(
item
.
startTime
,
item
.
endTime
)));
/* if (!(await that.compareDate(item.startTime, item.endTime)) && diff > 0 && !(await that.compareDate(item.startTime, rangeStart))) {
// 09:07-09:05
rangeStart = await that.hmPlushm(item.startTime, '00:01'); // 下班时间 - 8 ,如果比上班时间还小,就把上班时间之前作为可打卡开始的最小时间
...
...
@@ -505,6 +510,11 @@ export default {
if
(
diff
>
24
&&
(
await
that
.
compareDate
(
item
.
startTime
,
rangeEnd
)))
{
rangeEnd
=
await
that
.
hmMinuxhm
(
item
.
startTime
,
'00:01'
);
// 上班时间 - 8 ,如果比下班时间还小,就把下班时间作为可打卡开始的最小时间
}
// 跨天的(次日)
if
(
!
(
await
that
.
compareDate
(
item
.
startTime
,
item
.
endTime
))
&&
diff
<
24
&&
(
await
that
.
compareDate
(
item
.
startTime
,
rangeEnd
)))
{
// 02:00-01:00 2 1+12 =13
<
24
,
rangeEnd
=
await
that
.
hmMinuxhm
(
item
.
startTime
,
'00:01'
);
}
// 比较开始于结束,如果开始大于结束,分段计算
if
(
!
(
await
that
.
compareDate
(
rangeStart
,
rangeEnd
)))
{
arr
.
push
([
rangeStart
+
':00'
,
'23:59:00'
].
join
(
'-'
));
...
...
@@ -518,26 +528,7 @@ export default {
*/
async
changeStart
(
e
,
item
)
{
const
that
=
this
;
let
hours
=
10.5
;
console
.
log
(
e
);
const
startTime
=
e
;
const
endTime
=
that
.
formData
.
classessTimesJson
[
0
].
endTime
;
if
(
await
that
.
compareDate
(
startTime
,
endTime
))
{
hours
=
await
that
.
timeDifference
(
startTime
,
endTime
);
}
else
{
// 跨天了(次日)如 21:00-04:00
hours
=
Number
(
await
that
.
timeDifference
(
startTime
,
'24:00'
))
+
Number
(
await
that
.
timeDifference
(
'00:00'
,
endTime
));
}
// 计算时间间隔
that
.
maxLate
=
hours
-
0.5
;
// 可设置的时间数必须小于最大的限制数 0.5
console
.
log
(
that
.
maxLate
);
if
(
that
.
maxLate
<
1.5
)
{
that
.
formData
.
lateRule
=
false
;
// 最大时间间隔小于 2小时,不能设置晚到规则
that
.
formData
.
lateRuleJson
=
[];
}
if
(
that
.
maxLate
>=
10.5
)
{
that
.
maxLate
=
10
;
// 最大只能填写是 10
}
await
that
.
setLateHours
();
// 计算当前禁用时间段
item
.
forbidStartBeginTime
=
await
that
.
forbidStartBeginTime
(
item
);
item
.
forbidStartEndTime
=
await
that
.
forbidStartEndTime
(
item
);
...
...
@@ -551,10 +542,22 @@ export default {
*/
async
changeEnd
(
e
,
item
)
{
const
that
=
this
;
await
that
.
setLateHours
();
// 计算当前禁用时间段
item
.
forbidStartBeginTime
=
await
that
.
forbidStartBeginTime
(
item
);
item
.
forbidStartEndTime
=
await
that
.
forbidStartEndTime
(
item
);
item
.
forbidEndStartTime
=
await
that
.
forbidEndStartTime
(
item
);
item
.
forbidEndEndTime
=
await
that
.
forbidEndEndTime
(
item
);
that
.
$forceUpdate
();
},
/**
* 计算设置晚到的时间
*/
async
setLateHours
()
{
const
that
=
this
;
let
hours
=
10.5
;
console
.
log
(
e
);
const
startTime
=
that
.
formData
.
classessTimesJson
[
0
].
startTime
;
const
endTime
=
e
;
const
endTime
=
that
.
formData
.
classessTimesJson
[
0
].
endTim
e
;
if
(
await
that
.
compareDate
(
startTime
,
endTime
))
{
hours
=
await
that
.
timeDifference
(
startTime
,
endTime
);
}
else
{
...
...
@@ -571,11 +574,28 @@ export default {
if
(
that
.
maxLate
>=
10.5
)
{
that
.
maxLate
=
10
;
}
},
/**
* 计算设置可选的时间段
*/
async
setRangeData
()
{
const
that
=
this
;
// 计算当前禁用时间段
let
item
=
that
.
formData
.
classessTimesJson
[
0
];
item
.
forbidStartBeginTime
=
await
that
.
forbidStartBeginTime
(
item
);
item
.
forbidStartEndTime
=
await
that
.
forbidStartEndTime
(
item
);
item
.
forbidEndStartTime
=
await
that
.
forbidEndStartTime
(
item
);
item
.
forbidEndEndTime
=
await
that
.
forbidEndEndTime
(
item
);
that
.
$forceUpdate
();
},
/**
* 开启打卡时间段限制
*/
async
changeTimeRange
(
e
)
{
const
that
=
this
;
if
(
e
)
{
await
that
.
setRangeData
();
}
},
/**
* 开启晚走规则
...
...
@@ -743,6 +763,7 @@ export default {
}
else
{
showMsg
.
showmsg
(
'新建成功'
,
'success'
);
}
that
.
hideDialog
();
return
false
;
}
errMsg
.
errorMsg
(
resData
);
...
...
@@ -754,11 +775,46 @@ export default {
});
});
},
/**
* 隐藏弹出层
*/
hideDialog
()
{
const
that
=
this
;
that
.
customDialog
=
false
;
that
.
$emit
(
'hideDetailDialog'
);
that
.
$nextTick
(()
=>
{
that
.
formData
=
{
classesId
:
''
,
classesName
:
''
,
// 班次名称
times
:
'1'
,
// 次数设置
classessTimesJson
:
[
{
startTime
:
'9:00'
,
endTime
:
'18:00'
,
allowStartBeginTime
:
''
,
forbidStartBeginTime
:
[],
allowStartEndTime
:
''
,
forbidStartEndTime
:
[],
allowEndStartTime
:
''
,
forbidEndStartTime
:
[],
allowEndEndTime
:
''
,
forbidEndEndTime
:
[]
}
],
clockType
:
false
,
// 1/0 打开时间段设置
relaxFlag
:
false
,
// 休息时间
relaxStartDate
:
'12:00'
,
relaxEndDate
:
'13:00'
,
isAllowLate
:
false
,
// 允许迟到
isMoreLate
:
false
,
// 严重迟到
isMostLate
:
false
,
// 旷工迟到
allowLateDate
:
'30'
,
// 允许迟到 分
moreLateDate
:
'35'
,
// 严重迟到 分
mostLateDate
:
'60'
,
// 旷工迟到 分
lateRule
:
false
,
// 晚走次日晚到
lateRuleJson
:
[]
};
});
},
/**
* 获取列表数据
...
...
src/views/enterpriseApp/dailyAttendance/workSet.vue
View file @
9e7fdbd4
...
...
@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2019-03-20 14:36:37
* @LastEditors: 无尘
* @LastEditTime: 2019-12-1
1 16:26:25
* @LastEditTime: 2019-12-1
5 16:31:44
-->
<!--
...
...
@@ -209,6 +209,7 @@ export default {
const
that
=
this
;
that
.
workClassShow
=
false
;
that
.
classesId
=
''
;
console
.
log
(
that
.
workClassShow
)
},
/**
* 删除
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment