refactor code

This commit is contained in:
marvzhang
2020-02-20 12:28:26 +08:00
parent e3883faf1c
commit c18921ce4b
3 changed files with 49 additions and 32 deletions

View File

@@ -0,0 +1,40 @@
<template>
<div class="legend">
<el-tag type="primary" size="small">
<i class="el-icon-loading"></i>
{{$t('Pending')}}
</el-tag>
<el-tag type="warning" size="small">
<i class="el-icon-loading"></i>
{{$t('Running')}}
</el-tag>
<el-tag type="success" size="small">
<i class="el-icon-check"></i>
{{$t('Finished')}}
</el-tag>
<el-tag type="danger" size="small">
<i class="el-icon-error"></i>
{{$t('Error')}}
</el-tag>
<el-tag type="info" size="small">
<i class="el-icon-video-pause"></i>
{{$t('Cancelled')}}
</el-tag>
<el-tag type="danger" size="small">
<i class="el-icon-warning"></i>
{{$t('Abnormal')}}
</el-tag>
</div>
</template>
<script>
export default {
name: 'StatusLegend'
}
</script>
<style scoped>
.legend .el-tag {
margin-right: 5px;
}
</style>

View File

@@ -170,7 +170,6 @@
<el-table
:data="getTasksByNode(scope.row)"
class="table"
:header-cell-style="{background:'rgb(48, 65, 86)',color:'white'}"
border
style="margin: 5px 10px"
max-height="240px"
@@ -339,32 +338,7 @@
<!--./tabs-->
<!--legend-->
<div class="legend">
<el-tag type="primary" size="small">
<i class="el-icon-loading"></i>
{{$t('Pending')}}
</el-tag>
<el-tag type="warning" size="small">
<i class="el-icon-loading"></i>
{{$t('Running')}}
</el-tag>
<el-tag type="success" size="small">
<i class="el-icon-check"></i>
{{$t('Finished')}}
</el-tag>
<el-tag type="danger" size="small">
<i class="el-icon-error"></i>
{{$t('Error')}}
</el-tag>
<el-tag type="info" size="small">
<i class="el-icon-video-pause"></i>
{{$t('Cancelled')}}
</el-tag>
<el-tag type="danger" size="small">
<i class="el-icon-warning"></i>
{{$t('Abnormal')}}
</el-tag>
</div>
<status-legend/>
<!--./legend-->
<!--table list-->
@@ -578,10 +552,12 @@ import {
import dayjs from 'dayjs'
import CrawlConfirmDialog from '../../components/Common/CrawlConfirmDialog'
import StatusTag from '../../components/Status/StatusTag'
import StatusLegend from '../../components/Status/StatusLegend'
export default {
name: 'SpiderList',
components: {
StatusLegend,
CrawlConfirmDialog,
StatusTag
},
@@ -1201,8 +1177,4 @@ export default {
.el-table >>> .latest-tasks .el-tag {
margin: 3px 3px 0 0;
}
.legend .el-tag {
margin-right: 5px;
}
</style>

View File

@@ -45,6 +45,10 @@
</div>
<!--./filter-->
<!--legend-->
<status-legend/>
<!--./legend-->
<!--table list-->
<el-table :data="filteredTableData"
ref="table"
@@ -169,10 +173,11 @@ import {
} from 'vuex'
import dayjs from 'dayjs'
import StatusTag from '../../components/Status/StatusTag'
import StatusLegend from '../../components/Status/StatusLegend'
export default {
name: 'TaskList',
components: { StatusTag },
components: { StatusLegend, StatusTag },
data () {
return {
// setInterval handle