Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
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
ReactWeb5
CivManage
Commits
d9071e9f
Commit
d9071e9f
authored
Mar 26, 2025
by
彭俊龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:自动化工单方案优化时间计算
parent
dada7c30
Pipeline
#96514
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
38 deletions
+56
-38
index.js
...manager/workOrder/autoCase/components/CaseModify/index.js
+55
-38
index.js
src/pages/bsmanager/workOrder/autoCase/index.js
+1
-0
No files found.
src/pages/bsmanager/workOrder/autoCase/components/CaseModify/index.js
View file @
d9071e9f
...
@@ -128,7 +128,7 @@ const CaseModify = props => {
...
@@ -128,7 +128,7 @@ const CaseModify = props => {
}
else
if
(
planType
===
'ByMonth'
&&
timeType
==
'week'
)
{
}
else
if
(
planType
===
'ByMonth'
&&
timeType
==
'week'
)
{
setTip
(
getTipByWeek
(
timeValues
,
weekValues
,
weekValues1
));
setTip
(
getTipByWeek
(
timeValues
,
weekValues
,
weekValues1
));
}
}
},
[
timeUnit
.
current
,
num
,
timeValues
,
weekValues
,
dayValues
]);
},
[
timeUnit
.
current
,
num
,
timeValues
,
weekValues
,
dayValues
,
startTime
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
visible
)
{
if
(
visible
)
{
...
@@ -432,33 +432,34 @@ const CaseModify = props => {
...
@@ -432,33 +432,34 @@ const CaseModify = props => {
//计算循环的下次执行时间
//计算循环的下次执行时间
const
handleTimeInfo
=
(
timeUnit
,
num
)
=>
{
const
handleTimeInfo
=
(
timeUnit
,
num
)
=>
{
if
(
startTime
)
{
if
(
startTime
)
{
setTip
(
startTime
.
add
(
num
,
timeUnit
).
format
(
'YYYY-MM-DD HH:mm:ss'
));
setTip
(
moment
(
startTime
)
.
add
(
num
,
timeUnit
).
format
(
'YYYY-MM-DD HH:mm:ss'
));
}
}
};
};
//计算下次执行时间每月按日
//计算下次执行时间每月按日
const
getTipByDay
=
(
dayVals
,
timeVals
)
=>
{
const
getTipByDay
=
(
dayVals
,
timeVals
)
=>
{
if
(
!
timeVals
.
length
||
!
dayVals
.
length
)
return
;
if
(
!
timeVals
.
length
||
!
dayVals
.
length
)
return
;
const
now
=
moment
(
startTime
)
const
times
=
timeVals
.
sort
((
a
,
b
)
=>
a
-
b
);
const
times
=
timeVals
.
sort
((
a
,
b
)
=>
a
-
b
);
if
(
dayVals
.
length
==
1
&&
dayVals
[
0
]
===
allDays
[
allDays
.
length
-
1
])
{
if
(
dayVals
.
length
==
1
&&
dayVals
[
0
]
===
allDays
[
allDays
.
length
-
1
])
{
return
moment
()
return
now
.
endOf
(
'month'
)
.
endOf
(
'month'
)
.
hour
(
times
[
0
])
.
hour
(
times
[
0
])
.
minute
(
0
)
.
minute
(
0
)
.
second
(
0
)
.
second
(
0
)
.
format
(
`YYYY-MM-DD HH:mm:ss`
);
.
format
(
`YYYY-MM-DD HH:mm:ss`
);
}
}
const
dayOfMonth
=
moment
()
.
date
();
//当前第几天
const
dayOfMonth
=
now
.
date
();
//当前第几天
const
dayvals
=
dayVals
.
sort
((
a
,
b
)
=>
a
-
b
).
filter
(
v
=>
v
>=
dayOfMonth
);
const
dayvals
=
dayVals
.
sort
((
a
,
b
)
=>
a
-
b
).
filter
(
v
=>
v
>=
dayOfMonth
);
if
(
dayvals
.
length
>
0
)
{
if
(
dayvals
.
length
>
0
)
{
return
moment
()
return
now
.
hour
(
times
[
0
])
.
hour
(
times
[
0
])
.
minute
(
0
)
.
minute
(
0
)
.
second
(
0
)
.
second
(
0
)
.
format
(
`YYYY-MM-
${
dayvals
[
0
]
<
10
?
`0
${
dayvals
[
0
]}
`
:
dayvals
[
0
]}
HH:mm:ss`
);
.
format
(
`YYYY-MM-
${
dayvals
[
0
]
<
10
?
`0
${
dayvals
[
0
]}
`
:
dayvals
[
0
]}
HH:mm:ss`
);
}
else
{
}
else
{
const
days
=
dayVals
.
filter
(
v
=>
v
!==
allDays
[
allDays
.
length
-
1
]);
const
days
=
dayVals
.
filter
(
v
=>
v
!==
allDays
[
allDays
.
length
-
1
]);
return
moment
()
return
now
.
add
(
1
,
'month'
)
.
add
(
1
,
'month'
)
.
hour
(
times
[
0
])
.
hour
(
times
[
0
])
.
minute
(
0
)
.
minute
(
0
)
...
@@ -478,7 +479,7 @@ const CaseModify = props => {
...
@@ -478,7 +479,7 @@ const CaseModify = props => {
};
};
const
getNextDateByTierAndWeekday
=
(
y
,
m
,
tier
,
weekday
,
timeVals
)
=>
{
const
getNextDateByTierAndWeekday
=
(
y
,
m
,
tier
,
weekday
,
timeVals
)
=>
{
let
now
=
moment
();
let
now
=
moment
(
startTime
);
let
year
=
y
||
now
.
year
();
let
year
=
y
||
now
.
year
();
let
month
=
m
||
now
.
month
()
+
1
;
// 获取当前月份(1~12)
let
month
=
m
||
now
.
month
()
+
1
;
// 获取当前月份(1~12)
...
@@ -526,34 +527,34 @@ const CaseModify = props => {
...
@@ -526,34 +527,34 @@ const CaseModify = props => {
const
weekObj
=
{};
const
weekObj
=
{};
weeks
.
forEach
((
v
,
i
)
=>
(
weekObj
[
v
]
=
i
+
1
));
weeks
.
forEach
((
v
,
i
)
=>
(
weekObj
[
v
]
=
i
+
1
));
const
weekNum
=
weekObj
[
targetWeekday
];
const
weekNum
=
weekObj
[
targetWeekday
];
const
today
=
moment
();
const
today
=
moment
(
startTime
);
const
nextDay
=
const
nextDay
=
today
.
isoWeekday
()
<
weekNum
today
.
isoWeekday
()
<
weekNum
?
today
.
isoWeekday
(
weekNum
)
// 本周还没到目标周几
?
today
.
isoWeekday
(
weekNum
)
// 本周还没到目标周几
:
today
.
add
(
1
,
'weeks'
).
isoWeekday
(
weekNum
);
// 目标周几已过,跳到下周
:
today
.
add
(
1
,
'weeks'
).
isoWeekday
(
weekNum
);
// 目标周几已过,跳到下周
return
nextDay
.
format
(
`YYYY-MM-DD
${
times
[
0
]}
:
mm:ss
`
);
return
nextDay
.
format
(
`YYYY-MM-DD
${
times
[
0
]}
:
00:00
`
);
};
};
//计算每天的下次请求时间
//计算每天的下次请求时间
const
getNextClosestTime
=
hourArray
=>
{
const
getNextClosestTime
=
hourArray
=>
{
if
(
!
hourArray
.
length
)
return
;
if
(
!
hourArray
.
length
)
return
;
const
timeArry
=
hourArray
.
sort
((
a
,
b
)
=>
a
-
b
);
const
timeArry
=
hourArray
.
sort
((
a
,
b
)
=>
a
-
b
);
const
now
=
moment
();
const
now
=
moment
(
startTime
);
const
currentHour
=
now
.
hour
();
const
currentHour
=
now
.
hour
();
// 找到大于当前小时的最近时间
// 找到大于当前小时的最近时间
// const nextHour = timeArry.find(h => h > currentHour);
// const nextHour = timeArry.find(h => h > currentHour);
if
(
timeArry
[
0
]
>
currentHour
)
{
if
(
timeArry
[
0
]
>
=
currentHour
)
{
return
moment
()
return
now
.
hour
(
timeArry
[
0
])
.
hour
(
timeArry
[
0
])
.
minute
(
0
)
.
minute
(
0
)
.
second
(
0
)
.
second
(
0
)
.
format
(
'YYYY-MM-DD HH:mm:ss'
);
.
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
else
{
}
else
{
// 如果所有时间都已经过了,返回明天的最早时间
// 如果所有时间都已经过了,返回明天的最早时间
return
moment
()
return
now
.
add
(
1
,
'days'
)
.
add
(
1
,
'days'
)
.
hour
(
timeArry
[
0
])
.
hour
(
timeArry
[
0
])
.
minute
(
0
)
.
minute
(
0
)
...
@@ -978,32 +979,46 @@ const CaseModify = props => {
...
@@ -978,32 +979,46 @@ const CaseModify = props => {
return
;
return
;
}
}
console
.
log
(
e
,
'eeeeeeee'
);
let
list
=
ruleInfos
;
let
list
=
ruleInfos
;
if
(
person
.
length
)
{
list
=
list
.
map
(
v
=>
list
=
list
.
map
(
v
=>
v
.
id
===
(
id
||
currentRuleId
.
current
)
v
.
id
===
(
id
||
currentRuleId
.
current
)
?
{
?
{
...
v
,
...
v
,
userIds
:
person
.
map
(
x
=>
{
userIds
:
person
.
length
>
0
?
person
.
map
(
x
=>
{
return
{
id
:
Number
(
x
.
value
),
name
:
x
.
label
};
return
{
id
:
Number
(
x
.
value
),
name
:
x
.
label
};
}),
})
:
[]
,
userIds
:
person
.
length
>
0
?
person
.
map
(
x
=>
{
return
{
id
:
Number
(
x
.
value
),
name
:
x
.
label
};
})
:
[]
,
}
}
:
v
,
:
v
,
);
);
}
// if (person.length) {
// list = list.map(v =>
// v.id === (id || currentRuleId.current)
// ? {
// ...v,
// userIds: person.length > 0 ? person.map(x => {
// return { id: Number(x.value), name: x.label };
// }) : [] ,
// }
// : v,
// );
// }
if
(
role
.
length
)
{
//
if (role.length) {
list
=
list
.
map
(
v
=>
//
list = list.map(v =>
v
.
id
===
(
id
||
currentRuleId
.
current
)
//
v.id === (id || currentRuleId.current)
?
{
//
? {
...
v
,
//
...v,
roleIds
:
role
.
map
(
x
=>
{
// roleIds: role.length > 0 ?
role.map(x => {
return
{
id
:
x
.
value
,
name
:
x
.
label
};
//
return { id: x.value, name: x.label };
})
,
// }) : []
,
}
//
}
:
v
,
//
: v,
);
//
);
}
//
}
setRuleInfos
(
list
);
setRuleInfos
(
list
);
setShowPersonSelect
(
false
);
setShowPersonSelect
(
false
);
}
else
if
(
type
==
'rule'
)
{
}
else
if
(
type
==
'rule'
)
{
...
@@ -1024,7 +1039,7 @@ const CaseModify = props => {
...
@@ -1024,7 +1039,7 @@ const CaseModify = props => {
};
};
const
hasValue
=
field
=>
field
!==
undefined
&&
field
!==
null
&&
field
.
trim
?.()
!==
''
;
const
hasValue
=
field
=>
field
!==
undefined
&&
field
!==
null
&&
field
.
trim
?.()
!==
''
;
const
isValid
=
()
=>
{
const
isValid
=
()
=>
{
const
{
schemeName
,
flowId
,
activityId
,
userIds
}
=
configInfo
;
const
{
schemeName
,
flowId
,
activityId
,
userIds
,
roleIds
}
=
configInfo
;
let
schemeNameErrMsg
=
''
;
let
schemeNameErrMsg
=
''
;
let
flowIdErrMsg
=
''
;
let
flowIdErrMsg
=
''
;
let
activityIdErrMsg
=
''
;
let
activityIdErrMsg
=
''
;
...
@@ -1049,7 +1064,7 @@ const CaseModify = props => {
...
@@ -1049,7 +1064,7 @@ const CaseModify = props => {
}
else
{
}
else
{
activityIdErrMsg
=
''
;
activityIdErrMsg
=
''
;
}
}
if
(
userIds
.
length
<
1
)
{
if
(
userIds
.
length
<
1
&&
roleIds
.
length
<
1
)
{
userIdsErrMsg
=
'请选择下一节点办理人'
;
userIdsErrMsg
=
'请选择下一节点办理人'
;
}
else
{
}
else
{
userIdsErrMsg
=
''
;
userIdsErrMsg
=
''
;
...
@@ -1066,7 +1081,7 @@ const CaseModify = props => {
...
@@ -1066,7 +1081,7 @@ const CaseModify = props => {
isOk
=
isOk
=
isOk
&&
isOk
&&
ruleInfos
.
every
(
ruleInfos
.
every
(
v
=>
v
.
userIds
.
length
>
0
&&
hasValue
(
v
.
ruleContent
)
&&
hasValue
(
v
.
ruleName
),
v
=>
(
v
.
userIds
.
length
>
0
||
v
.
roleIds
.
length
>
0
)
&&
hasValue
(
v
.
ruleContent
)
&&
hasValue
(
v
.
ruleName
),
);
);
let
infos
=
ruleInfos
;
let
infos
=
ruleInfos
;
for
(
let
i
of
infos
)
{
for
(
let
i
of
infos
)
{
...
@@ -1081,7 +1096,7 @@ const CaseModify = props => {
...
@@ -1081,7 +1096,7 @@ const CaseModify = props => {
i
.
ruleContentErrMsg
=
''
;
i
.
ruleContentErrMsg
=
''
;
}
}
if
(
i
.
userIds
.
length
<
1
)
{
if
(
i
.
userIds
.
length
<
1
&&
i
.
roleIds
.
length
<
1
)
{
i
.
userIdsErrMsg
=
'下一节点办理人必填'
;
i
.
userIdsErrMsg
=
'下一节点办理人必填'
;
}
else
{
}
else
{
i
.
userIdsErrMsg
=
''
;
i
.
userIdsErrMsg
=
''
;
...
@@ -1745,10 +1760,10 @@ const lineText = v => {
...
@@ -1745,10 +1760,10 @@ const lineText = v => {
<
span
style
=
{{
color
:
'red'
}}
>
{
v
.
ruleContentErrMsg
}
<
/span
>
<
span
style
=
{{
color
:
'red'
}}
>
{
v
.
ruleContentErrMsg
}
<
/span
>
<
Button
<
Button
block
block
style
=
{{
color
:
'#1890ff'
,
border
:
'1px solid #1890ff'
}}
style
=
{{
color
:
'#1890ff'
,
border
:
'1px solid #1890ff'
,
overflow
:
'hidden'
}}
onClick
=
{()
=>
handleRuleClick
(()
=>
setShowPersonSelect
(
true
),
v
.
id
)}
onClick
=
{()
=>
handleRuleClick
(()
=>
setShowPersonSelect
(
true
),
v
.
id
)}
>
>
{
v
.
userIds
.
length
?
v
.
userIds
.
map
(
v
=>
v
.
name
).
join
(
','
)
:
'选择下一节点办理人'
}
{
(
v
.
userIds
.
length
||
v
.
roleIds
.
length
)
?
[...(
v
.
userIds
),
...(
v
.
roleIds
)]
.
map
(
v
=>
v
.
name
).
join
(
','
)
:
'选择下一节点办理人'
}
<
/Button
>
<
/Button
>
<
span
style
=
{{
color
:
'red'
}}
>
{
v
.
userIdsErrMsg
}
<
/span
>
<
span
style
=
{{
color
:
'red'
}}
>
{
v
.
userIdsErrMsg
}
<
/span
>
<
/Space
>
<
/Space
>
...
@@ -1776,20 +1791,22 @@ const lineText = v => {
...
@@ -1776,20 +1791,22 @@ const lineText = v => {
<
/Row
>
<
/Row
>
<
div
<
div
style
=
{{
style
=
{{
width
:
'5
0
0px'
,
width
:
'5
4
0px'
,
padding
:
'10px'
,
padding
:
'10px'
,
margin
:
'10px auto'
,
margin
:
'10px auto'
,
}}
}}
>
>
<
Space
>
<
Space
>
<
span
>
开始时间:
<
/span
>
<
span
>
开始时间:
<
/span
>
<
DatePicker
locale
=
{
locale
}
value
=
{
startTime
}
onChange
=
{
t
=>
setStartTime
(
t
)}
/
>
<
DatePicker
showTime
=
{{
format
:
'HH'
}}
locale
=
{
locale
}
format
=
{
'YYYY-MM-DD HH:00'
}
value
=
{
startTime
}
onChange
=
{
t
=>
setStartTime
(
t
)}
/
>
<
span
>
结束时间:
<
/span
>
<
span
>
结束时间:
<
/span
>
<
DatePicker
locale
=
{
locale
}
value
=
{
endTime
}
onChange
=
{
t
=>
setEndTime
(
t
)}
/
>
<
DatePicker
locale
=
{
locale
}
value
=
{
endTime
}
onChange
=
{
t
=>
setEndTime
(
t
)}
/
>
<
/Space
>
<
/Space
>
<
div
<
div
style
=
{{
style
=
{{
width
:
'5
0
0px'
,
width
:
'5
4
0px'
,
background
:
'rgb(243, 243, 243)'
,
background
:
'rgb(243, 243, 243)'
,
padding
:
'10px'
,
padding
:
'10px'
,
margin
:
'10px auto'
,
margin
:
'10px auto'
,
...
...
src/pages/bsmanager/workOrder/autoCase/index.js
View file @
d9071e9f
...
@@ -141,6 +141,7 @@ const AutoCase = props => {
...
@@ -141,6 +141,7 @@ const AutoCase = props => {
{
{
align
:
'center'
,
align
:
'center'
,
title
:
'操作'
,
title
:
'操作'
,
fixed
:
'right'
,
render
:
(
text
,
record
,
i
)
=>
{
render
:
(
text
,
record
,
i
)
=>
{
return
(
return
(
<
Space
size
=
{
'middle'
}
direction
=
{
'horizontal'
}
>
<
Space
size
=
{
'middle'
}
direction
=
{
'horizontal'
}
>
...
...
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