Commit f8373dec by 张立顺

fix 限制时间回退

1 parent 8e7600b5
...@@ -13,7 +13,7 @@ var isIncludesItem = function (list, item) { ...@@ -13,7 +13,7 @@ var isIncludesItem = function (list, item) {
} }
var formatPosition = function (item, positionTypeList) { var formatPosition = function (item, positionTypeList) {
var filterData = positionTypeList.filter(function (v) { var filterData = positionTypeList.filter(function(v) {
return v.positionValue == item return v.positionValue == item
}) })
return (filterData.length && filterData[0] && filterData[0].positionName) || '' return (filterData.length && filterData[0] && filterData[0].positionName) || ''
...@@ -31,7 +31,7 @@ var isDateWithin7Days = function (date) { ...@@ -31,7 +31,7 @@ var isDateWithin7Days = function (date) {
// 计算时间差对应的天数 // 计算时间差对应的天数
var diffDays = Math.floor(diffMilliseconds / oneDay) var diffDays = Math.floor(diffMilliseconds / oneDay)
// console.log(diffDays, 'diffDays'); // console.log(diffDays, 'diffDays');
return diffDays >= -60 return diffDays >= -7
} }
var isDateWithin60Days = function (date) { var isDateWithin60Days = function (date) {
var oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数 var oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数
...@@ -47,15 +47,14 @@ var isDateWithin60Days = function (date) { ...@@ -47,15 +47,14 @@ var isDateWithin60Days = function (date) {
return diffDays >= -60 return diffDays >= -60
} }
var filterIncludes = function (item, arr) { var filterIncludes = function(item, arr) {
return arr.indexOf(item) > -1 return arr.indexOf(item) > -1
} }
var filterDisabled = function (role, weeklyList, date, disabledStatus) { var filterDisabled = function(role, weeklyList, date, disabledStatus) {
console.log(role, weeklyList) console.log(role, weeklyList)
if (role == 'staff') { // 员工七天内可操作 if (role == 'staff') { // 员工七天内可操作
return (weeklyList.indexOf(date) > -1 && !disabledStatus) || !isDateWithin7Days(date) return (weeklyList.indexOf(date) > -1 && !disabledStatus) || !isDateWithin7Days(date)
// return false;
} else if (role == 'super') { // 超管60天内可操作 } else if (role == 'super') { // 超管60天内可操作
return (weeklyList.indexOf(date) > -1 && !disabledStatus) || !isDateWithin60Days(date) return (weeklyList.indexOf(date) > -1 && !disabledStatus) || !isDateWithin60Days(date)
} else { } else {
......
...@@ -214,9 +214,7 @@ function isDateWithin7Days(date) { ...@@ -214,9 +214,7 @@ function isDateWithin7Days(date) {
// 计算时间差对应的天数 // 计算时间差对应的天数
const diffDays = Math.floor(diffMilliseconds / oneDay) const diffDays = Math.floor(diffMilliseconds / oneDay)
// console.log(diffDays, 'diffDays'); // console.log(diffDays, 'diffDays');
// return diffDays >= -7 return diffDays >= -7
// return true;
return diffDays >= -60
} }
function isDateWithin60Days(date) { function isDateWithin60Days(date) {
const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数 const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!