<template>
|
<div class="table_workLogist">
|
<a-table ref="table" bordered :rowKey="(record,index)=>{return index}" :columns="columns"
|
:dataSource="dataList" :pagination="false" :loading="loading">
|
<template slot="status" slot-scope="status">
|
<div v-if="status == '3' || status == '23'" style="color: #00ee00;width: 100%; height: 100%;">运行</div>
|
<div v-else-if="status == '1' || status == '2'" style="color: #ffea91;width: 100%; height: 100%;">待机</div>
|
<div v-else-if="status == '0'" style="color: #A8A8A8;width: 100%; height: 100%;">关机</div>
|
<div v-else-if="status == '22'" style="color: red;width: 100%; height: 100%;">报警</div>
|
</template>
|
</a-table>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: 'WorkLogList',
|
props: {
|
dataList: {
|
type: Array,
|
required: true,
|
default: []
|
},
|
loading: {
|
type: Boolean,
|
default: false
|
}
|
},
|
data() {
|
return {
|
disabled: true,
|
disableMixinCreated: true,
|
columns: [
|
{
|
title: '状态',
|
align: 'center',
|
dataIndex: 'status',
|
scopedSlots: { customRender: 'status' }
|
},
|
{
|
title: '开始时间',
|
align: 'center',
|
dataIndex: 'startTime'
|
},
|
{
|
title: '结束时间',
|
align: 'center',
|
dataIndex: 'endTime'
|
},
|
{
|
title: '持续时间',
|
align: 'center',
|
dataIndex: 'duration',
|
customRender: (t, r, index) => {
|
var ss = parseInt(t)
|
if (ss >= 3600) {
|
// 根据秒数转换成对应的时分秒
|
const hour = parseInt(ss / 3600) < 10 ? '0' + parseInt(ss / 3600) : parseInt(ss / 3600)
|
const min = parseInt(ss % 3600 / 60) < 10 ? '0' + parseInt(ss % 3600 / 60) : parseInt(ss % 3600 / 60)
|
const sec = parseInt(ss % 3600 % 60) < 10 ? '0' + parseInt(ss % 3600 % 60) : parseInt(ss % 3600 % 60)
|
if (min == '00') {
|
if (sec == '00') {
|
return hour + '小时'
|
} else {
|
return hour + '小时' + sec + '秒'
|
}
|
|
} else {
|
if (sec == '00') {
|
return hour + '小时' + min + '分'
|
} else {
|
return hour + '小时' + min + '分' + sec + '秒'
|
}
|
}
|
} else if (60 < ss && ss < 3600) {
|
const min1 = parseInt(ss % 3600 / 60) < 10 ? '0' + parseInt(ss % 3600 / 60) : parseInt(ss % 3600 / 60)
|
const sec1 = parseInt(ss % 3600 % 60) < 10 ? '0' + parseInt(ss % 3600 % 60) : parseInt(ss % 3600 % 60)
|
return min1 + '分' + sec1 + '秒'
|
} else {
|
const sec2 = parseInt(ss % 3600 % 60) < 10 ? '0' + parseInt(ss % 3600 % 60) : parseInt(ss % 3600 % 60)
|
return sec2 + '秒'
|
}
|
}
|
},
|
{
|
title: '程序号',
|
align: 'center',
|
dataIndex: 'sequenceNumber'
|
}
|
]
|
}
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
@media screen and (min-width: 1920px) {
|
.table_workLogist {
|
height: 417px !important;
|
overflow: auto;
|
}
|
}
|
|
@media screen and (min-width: 1680px) and (max-width: 1920px) {
|
.table_workLogist {
|
height: 417px !important;
|
overflow: auto;
|
}
|
}
|
|
@media screen and (min-width: 1400px) and (max-width: 1680px) {
|
.table_workLogist {
|
height: 266px !important;
|
overflow: auto;
|
}
|
}
|
|
@media screen and (min-width: 1280px) and (max-width: 1400px) {
|
.table_workLogist {
|
height: 360px !important;
|
overflow: auto;
|
}
|
}
|
|
@media screen and (max-width: 1280px) {
|
.table_workLogist {
|
height: 170px !important;
|
overflow: auto;
|
}
|
}
|
</style>
|