Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f8373dec
authored
Jan 21, 2025
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix 限制时间回退
1 parent
8e7600b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
tabWorkOrder/index.wxs
utils/timeFormat/time-utils.js
tabWorkOrder/index.wxs
View file @
f8373de
var replaceItemText = function (item) {
var replaceItemText = function (item) {
var reg = getRegExp(';~;', 'g')
var reg = getRegExp(';~;', 'g')
// return item.replace(reg, ' ')
// return item.replace(reg, ' ')
return item ? item.replace(reg, ' ') : null
return item ? item.replace(reg, ' ') : null
...
@@ -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 {
...
...
utils/timeFormat/time-utils.js
View file @
f8373de
...
@@ -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
// 一天的毫秒数
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment