|
|
|
@ -52,8 +52,19 @@
|
|
|
|
|
><b>时间:{{ item.createTime }}</b>
|
|
|
|
|
<b>设备ID:{{ item.cmdid }}</b>
|
|
|
|
|
<b v-if="item.cmd.fileName">apk版本:{{ item.cmd.fileName }}</b>
|
|
|
|
|
<b>命令:{{ cmdCn[item.cmdName] }}</b></span
|
|
|
|
|
>
|
|
|
|
|
<b v-if="item.cmdDesc == ''">命令:{{ cmdCn[item.cmdName] }}</b
|
|
|
|
|
><b v-else>命令:{{ item.cmdDesc }}</b>
|
|
|
|
|
<b v-if="item.estimatedPublishTime * 1000 - newupdatatime > 0"
|
|
|
|
|
>命令预计拿走时间:
|
|
|
|
|
|
|
|
|
|
{{
|
|
|
|
|
$moment(item.estimatedPublishTime * 1000).format(
|
|
|
|
|
"MM-DD HH:mm:ss"
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
{{ remainingTime(item) }}
|
|
|
|
|
</b>
|
|
|
|
|
</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="commandList" v-else>
|
|
|
|
@ -174,6 +185,7 @@ export default {
|
|
|
|
|
cmdtimer: null,
|
|
|
|
|
endtimer: null,
|
|
|
|
|
updateTime: null,
|
|
|
|
|
newupdatatime: null,
|
|
|
|
|
//运维操作列表
|
|
|
|
|
operateOptions: [
|
|
|
|
|
{ id: 0, name: "全部" },
|
|
|
|
@ -192,19 +204,52 @@ export default {
|
|
|
|
|
operateR: 0,
|
|
|
|
|
leftcmdVal: "",
|
|
|
|
|
rightcmdVal: "",
|
|
|
|
|
intervalId: null, // 用于存储setInterval返回的ID
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {},
|
|
|
|
|
created() {
|
|
|
|
|
this.cmdtimer = setInterval(this.getCmdList, 60000); // 每10秒刷新数据
|
|
|
|
|
this.endtimer = setInterval(this.getEndList, 60000); // 每10秒刷新数据
|
|
|
|
|
this.cmdtimer = setInterval(this.getCmdList, 60000); // 每60秒刷新数据
|
|
|
|
|
this.endtimer = setInterval(this.getEndList, 60000); // 每60秒刷新数据
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getCmdList();
|
|
|
|
|
this.getEndList();
|
|
|
|
|
this.startCountdown(); // 在组件挂载后开始倒计时
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
startCountdown() {
|
|
|
|
|
// 清空之前可能存在的定时器
|
|
|
|
|
if (this.intervalId) {
|
|
|
|
|
clearInterval(this.intervalId);
|
|
|
|
|
}
|
|
|
|
|
// 开始倒计时,每秒执行一次remainingTime方法
|
|
|
|
|
this.intervalId = setInterval(() => {
|
|
|
|
|
this.newupdatatime = new Date().getTime(); // 更新当前时间
|
|
|
|
|
this.leftCommand.forEach((item) => {
|
|
|
|
|
this.remainingTime(item); // 重新计算每个项目的剩余时间
|
|
|
|
|
});
|
|
|
|
|
}, 1000); // 每秒执行一次
|
|
|
|
|
},
|
|
|
|
|
remainingTime(item) {
|
|
|
|
|
if (!this.newupdatatime) {
|
|
|
|
|
// 更新时间尚未设置,返回默认的倒计时时间或者不执行任何操作
|
|
|
|
|
return "计算中...";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const estimatedPublishTime = item.estimatedPublishTime * 1000;
|
|
|
|
|
const difference = estimatedPublishTime - this.newupdatatime;
|
|
|
|
|
const minutes = Math.floor(difference / 60000);
|
|
|
|
|
const seconds = Math.floor((difference % 60000) / 1000);
|
|
|
|
|
if (minutes == 0 && seconds == 0) {
|
|
|
|
|
this.getCmdList();
|
|
|
|
|
this.getEndList();
|
|
|
|
|
return `命令已下发`;
|
|
|
|
|
} else {
|
|
|
|
|
return ` 预估剩余:${minutes} 分钟 ${seconds} 秒`;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getCmdList() {
|
|
|
|
|
//this.leftComLoading = true;
|
|
|
|
|
getqueryCmdsApi({ p: 1, ps: 10000 })
|
|
|
|
@ -461,6 +506,9 @@ export default {
|
|
|
|
|
clearInterval(this.endtimer);
|
|
|
|
|
this.cmdtimer = null;
|
|
|
|
|
this.endtimer = null;
|
|
|
|
|
if (this.intervalId) {
|
|
|
|
|
clearInterval(this.intervalId);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|