修改时间格式显示,添加shell运行错误状态

This commit is contained in:
junleea 2025-08-03 17:27:29 +08:00
parent 296ba34b38
commit 8c4f04d821
3 changed files with 40 additions and 3 deletions

View File

@ -67,8 +67,24 @@ export default {
data[i].RunTime = Math.round(data[i].RunTime * 100) / 100; data[i].RunTime = Math.round(data[i].RunTime * 100) / 100;
} }
this.tableData = data; this.tableData = data;
for(let i = 0;i<this.tableData.length;i++) {
this.tableData[i].UpdatedAt = this.formattedTime(this.tableData[i].UpdatedAt);
this.tableData[i].CreatedAt = this.formattedTime(this.tableData[i].CreatedAt)
//console.log('this.ConfigFileList:',this.ConfigFileList);
}
this.currentPageData(); this.currentPageData();
}, },
formattedTime(isoTime) {
const date = new Date(isoTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
onSubmit() { onSubmit() {
getDeviceList({ token: token }); getDeviceList({ token: token });
}, },

View File

@ -80,13 +80,19 @@ export default {
if (data !== undefined && data !== null) { if (data !== undefined && data !== null) {
this.tableData = data; this.tableData = data;
} }
this.currentPageData();
} catch (e) { } catch (e) {
console.log(e); console.log(e);
ElMessage.error("获取文件列表失败"); ElMessage.error("获取文件列表失败");
} finally { } finally {
this.loading = false; this.loading = false;
} }
for(let i = 0;i<this.tableData.length;i++) {
this.tableData[i].UpdatedAt = this.formattedTime(this.tableData[i].UpdatedAt);
this.tableData[i].CreatedAt = this.formattedTime(this.tableData[i].CreatedAt)
//console.log('this.ConfigFileList:',this.ConfigFileList);
}
this.currentPageData();
}, },
addConfigFileV() { addConfigFileV() {
this.addConfigFileVisible = true; this.addConfigFileVisible = true;
@ -190,6 +196,17 @@ export default {
reader.readAsArrayBuffer(this.avatar_file); reader.readAsArrayBuffer(this.avatar_file);
}); });
}, },
formattedTime(isoTime) {
const date = new Date(isoTime);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
async uploadFile() { async uploadFile() {
if (this.avatar_file == null) { if (this.avatar_file == null) {
alert("请先选择要上传的文件"); alert("请先选择要上传的文件");

View File

@ -621,7 +621,7 @@ export default {
width="100" width="100"
> >
<template #default="scope"> <template #default="scope">
<el-tag <el-tag
v-if="scope.row.Status === 0" v-if="scope.row.Status === 0"
>任务提交</el-tag >任务提交</el-tag
> >
@ -632,7 +632,11 @@ export default {
<el-tag <el-tag
v-if="scope.row.Status === 2" v-if="scope.row.Status === 2"
type="success" type="success"
>已完成</el-tag> >执行成功</el-tag>
<el-tag
v-if="scope.row.Status === 3"
type="danger"
>执行出错</el-tag>
</template> </template>
</el-table-column> </el-table-column>