You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.0 KiB
Vue

2 years ago
<template>
<div class="logMainClass">
<h3>日志列表</h3>
<div class="boxLogTable">
<el-table
v-loading="logLoading"
:data="tableData"
border
stripe
style="width: 100%"
height="100%"
>
2 years ago
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<!-- <el-table-column prop="id" label="Id" width="80"> </el-table-column> -->
2 years ago
<el-table-column prop="line_name" label="线路"> </el-table-column>
<el-table-column prop="cmdid" label="装置编号"> </el-table-column>
2 years ago
<el-table-column label="规约" width="100">
<template slot-scope="scope">
{{ protocolMap[scope.row.protocol] }}
</template>
</el-table-column>
2 years ago
<el-table-column prop="file_name" label="文件名">
<template slot-scope="scope">
<a :href="'/dl/?id=' + scope.row.id" class="buttonText">{{
scope.row.file_name
}}</a>
2 years ago
</template>
</el-table-column>
<el-table-column label="文件大小">
<template slot-scope="scope">
{{ scope.row.file_size | changeType }}
</template>
</el-table-column>
<el-table-column prop="create_time" label="上传时间"> </el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import { getqueryUploadsApi } from "@/utils/api/index";
export default {
name: "log",
components: {},
data() {
return {
tableData: [],
logLoading: false,
2 years ago
protocolMap: {
65280: "国网I1",
65296: "陕西",
65281: "安徽",
65282: "江苏",
65283: "湖南",
65284: "浙江",
65285: "河南全景",
65286: "河南郑州",
65290: "河南统一视频v2020",
},
2 years ago
};
},
filters: {
changeType(val) {
if (val == "0") return "0B";
var k = 1024;
var sizes = ["B", "KB", "MB", "GB", "TB"];
2 years ago
let i = Math.floor(Math.log(val) / Math.log(k)); //得出该数字的单位应该是kB?MB
return (val / Math.pow(k, i)).toPrecision(3) + "" + sizes[i];
},
},
computed: {},
created() {},
mounted() {
this.getLogList();
},
methods: {
getLogList() {
this.logLoading = true;
getqueryUploadsApi()
.then((res) => {
this.tableData = res.data;
this.logLoading = false;
})
.catch((err) => {});
},
},
};
</script>
<style lang="less">
.logMainClass {
height: calc(100% - 24px);
width: calc(100% - 24px);
padding: 12px;
h3 {
margin-bottom: 12px;
font-size: 16px;
line-height: 24px;
}
.boxLogTable {
height: calc(100% - 36px);
background: #fcc;
2 years ago
.el-table__cell {
text-align: center;
}
2 years ago
.el-table thead {
th.el-table__cell {
background: #fafafa;
}
}
.buttonText {
cursor: pointer;
color: #606266;
&:hover {
color: #337ab7;
text-decoration: underline;
}
}
}
}
</style>