修复设备信息时间显示错误的BUG

This commit is contained in:
fangxiang 2022-03-10 17:43:30 +08:00
parent 366262d2ef
commit b27110075f
2 changed files with 27 additions and 6 deletions

View File

@ -394,4 +394,5 @@ export default {
"win lower": "置底", "win lower": "置底",
"clean screen": "清屏", "clean screen": "清屏",
"CN/EN switch": "中英文切换", "CN/EN switch": "中英文切换",
DD: "天",
}; };

View File

@ -340,11 +340,30 @@ export default defineComponent({
() => $store.state.current_running_plan.trim() != "" () => $store.state.current_running_plan.trim() != ""
); );
const get_time_text = (s: number) => { const get_time_text = (s: number, show_ss: boolean = true) => {
const hh = (s / 3600).toFixed(0); console.log(s);
const mm = ((s % 3600) / 60).toFixed(0); var time = "";
const ss = ((s % 3600) % 60).toFixed(0); var second = s % 60;
return hh + $t.t("HH") + mm + $t.t("MM") + ss + $t.t("SS"); var minute = parseInt((parseInt(s.toString()) / 60).toString()) % 60;
if (show_ss) {
time = second + $t.t("SS");
}
if (minute >= 1) {
time = minute + $t.t("MM") + time;
}
var hour = parseInt((parseInt((s / 60).toString()) / 60).toString()) % 24;
if (hour >= 1) {
time = hour + $t.t("HH") + time;
}
var day = parseInt(
(
parseInt((parseInt((s / 60).toString()) / 60).toString()) / 24
).toString()
);
if (day >= 1) {
time = day + $t.t("DD") + time;
}
return time;
}; };
return { return {
@ -469,7 +488,8 @@ export default defineComponent({
).toFixed(0)} % <br /> ).toFixed(0)} % <br />
${$t.t("server run time")} : ${get_time_text(server_run_time)} <br /> ${$t.t("server run time")} : ${get_time_text(server_run_time)} <br />
${$t.t("server all run time")} : ${get_time_text( ${$t.t("server all run time")} : ${get_time_text(
server_all_run_time server_all_run_time,
false
)} <br /> )} <br />
${$t.t("current server system time")} : ${$date.formatDate( ${$t.t("current server system time")} : ${$date.formatDate(
new Date(current_system_time), new Date(current_system_time),