Browse Source

感知时间持续时长计算方式修改

develop
wangsixiang 4 months ago
parent
commit
dc32f6246f
  1. 20
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue

20
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue

@ -115,7 +115,18 @@ function getDuration(warningTime) {
return `${padZero(hours)}:${padZero(minutes)}:${padZero(seconds)}`;
}
function getDurationEndTime(warningTime,endTime){
const momentStartTime = moment(warningTime, 'YYYY-MM-DD HH:mm:ss');
const momentEndTime = moment(endTime, 'YYYY-MM-DD HH:mm:ss');
const duration = moment.duration(momentEndTime.diff(momentStartTime));
const hours = Math.floor(duration.asHours());
const minutes = Math.floor(duration.minutes()); // 使 .minutes()
const seconds = Math.floor(duration.seconds()); // 使 .seconds()
// Math.abs()
// Math.abs()
return `${padZero(Math.abs(hours))}:${padZero(Math.abs(minutes))}:${padZero(Math.abs(seconds))}`;
// Math.abs()
}
function padZero(num) {
num = num.toString();
while (num.length < 2) {
@ -191,8 +202,11 @@ export default {
let _data = _.cloneDeep(this.formData)
_data.direction=DirectionTypes[_data.direction]
_data.roadName = '济菏高速'
_data.duration = getDuration(_data.warningTime);
if(_data.warningState==4&&_data.endTime!=null&&_data.endTime!=''&&_data.warningTime!=null){
_data.duration =getDurationEndTime(_data.warningTime,_data.endTime)
}else{
_data.duration = getDuration(_data.warningTime);
}
if(_data.lane){
_data.lane =_data.lane.toString().split(",") || []
} else if(_data.lang){

Loading…
Cancel
Save