提交 0673a9bb 作者: 温凯

fix:航线详情-预计时长未统计出来

上级 fb992f45
......@@ -247,6 +247,30 @@ export default {
}
this.orgList = tree;
},
convertToSeconds(timeString) {
const regex = /(\d+)\s*(小时|分钟|秒)/g;
let totalSeconds = 0;
let match;
while ((match = regex.exec(timeString)) !== null) {
const value = parseInt(match[1], 10);
const unit = match[2];
switch (unit) {
case '小时':
totalSeconds += value * 3600; // 1小时 = 3600秒
break;
case '分钟':
totalSeconds += value * 60; // 1分钟 = 60秒
break;
case '秒':
totalSeconds += value; // 直接加秒
break;
}
}
return totalSeconds;
},
changeNode() {
this.$refs.CascaderRef.dropDownVisible = false;
},
......@@ -304,6 +328,7 @@ export default {
departmentId: this.departmentId,
name: this.name,
speed: this.form[0].speed,
flyTime: this.convertToSeconds(this.time)
};
try {
let res = await AirLine.add({
......@@ -312,6 +337,7 @@ export default {
distance: airway.distance,
departmentId: airway.departmentId,
sourceType: 1,
flyTime:airway.flyTime,
linePointSaveReqVOS: airway.content.map((point) => ({
latitude: point.coordinate.latitude,
longitude: point.coordinate.longitude,
......
......@@ -272,6 +272,30 @@ export default {
}
this.orgList = tree;
},
convertToSeconds(timeString) {
const regex = /(\d+)\s*(小时|分钟|秒)/g;
let totalSeconds = 0;
let match;
while ((match = regex.exec(timeString)) !== null) {
const value = parseInt(match[1], 10);
const unit = match[2];
switch (unit) {
case '小时':
totalSeconds += value * 3600; // 1小时 = 3600秒
break;
case '分钟':
totalSeconds += value * 60; // 1分钟 = 60秒
break;
case '秒':
totalSeconds += value; // 直接加秒
break;
}
}
return totalSeconds;
},
async getLabel() {
this.rootNode.$emit("getLabelList", {
callback: (data) => {
......@@ -336,6 +360,7 @@ export default {
departmentId: this.departmentId, //部门id
name: this.name,
speed: this.form[0].speed,
flyTime: this.convertToSeconds(this.time)
};
try {
let res = await AirLine.add({
......@@ -344,6 +369,7 @@ export default {
distance: airway.distance,
departmentId: airway.departmentId,
sourceType: 1,
flyTime:airway.flyTime,
linePointSaveReqVOS: airway.content.map((point) => ({
latitude: point.coordinate.latitude,
longitude: point.coordinate.longitude,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论