2021-12-14 16:42:45 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="entity-list">
|
|
|
|
|
<div class="entity__loading" v-show="loading">
|
|
|
|
|
<i class="el-icon-loading"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="entity-list__content">
|
|
|
|
|
<!-- 列表式 -->
|
|
|
|
|
<template v-if="listMode === 'list'">
|
|
|
|
|
<div class="entity-list--list">
|
2021-12-28 21:23:18 +08:00
|
|
|
<div v-if="!isCollapse" @click="collapse" class="cn-entity__shadow"></div>
|
2021-12-14 16:42:45 +08:00
|
|
|
<entity-row
|
|
|
|
|
v-for="(data, index) in listData"
|
|
|
|
|
:entity="data"
|
2021-12-31 10:40:37 +08:00
|
|
|
:listMode="listMode"
|
|
|
|
|
:timeFilter="timeFilter"
|
2021-12-14 16:42:45 +08:00
|
|
|
:key="index"
|
2021-12-17 20:56:25 +08:00
|
|
|
:ref="`entityRow${index}`"
|
|
|
|
|
:index="index"
|
2021-12-28 21:23:18 +08:00
|
|
|
@switchCollapse="switchCollapse"
|
2021-12-14 16:42:45 +08:00
|
|
|
></entity-row>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- 卡片式 -->
|
|
|
|
|
<template v-else-if="listMode === 'block'">
|
|
|
|
|
<div class="entity-list--block">
|
|
|
|
|
<entity-card
|
|
|
|
|
v-for="(data, index) in listData"
|
|
|
|
|
:entity="data"
|
2022-01-04 14:54:26 +08:00
|
|
|
:index="index"
|
2021-12-31 10:40:37 +08:00
|
|
|
:listMode="listMode"
|
|
|
|
|
:timeFilter="timeFilter"
|
2021-12-14 16:42:45 +08:00
|
|
|
:key="index"
|
|
|
|
|
></entity-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="entity-list__pagination">
|
|
|
|
|
<!-- <el-pagination
|
|
|
|
|
@size-change="size"
|
|
|
|
|
@prev-click="prev"
|
|
|
|
|
@next-click="next"
|
|
|
|
|
@current-change="current"
|
|
|
|
|
:currentPage="pageObj.pageNo"
|
|
|
|
|
:page-size="pageObj.pageSize"
|
|
|
|
|
:total="pageObj.total"
|
|
|
|
|
layout="total, prev, pager, next"
|
|
|
|
|
></el-pagination>-->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import Card from '@/views/entityExplorer/entityList/Card'
|
|
|
|
|
import Row from '@/views/entityExplorer/entityList/Row'
|
|
|
|
|
import { get } from '@/utils/http'
|
|
|
|
|
import { api } from '@/utils/api'
|
|
|
|
|
import * as echarts from 'echarts'
|
|
|
|
|
import { getChartColor, entityListLineOption } from '@/components/charts/chart-options'
|
|
|
|
|
import { legendMapping } from '@/components/charts/chart-table-title'
|
|
|
|
|
import unitConvert from '@/utils/unit-convert'
|
|
|
|
|
import { unitTypes } from '@/utils/constants'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'EntityList',
|
|
|
|
|
props: {
|
|
|
|
|
listData: Array,
|
|
|
|
|
from: String,
|
|
|
|
|
pageObj: Object,
|
|
|
|
|
loading: Boolean,
|
2021-12-31 10:40:37 +08:00
|
|
|
listMode: String,
|
|
|
|
|
timeFilter: Object
|
2021-12-14 16:42:45 +08:00
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
'entity-card': Card,
|
|
|
|
|
'entity-row': Row
|
|
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
showDetail: false,
|
|
|
|
|
typeName: '',
|
2021-12-16 23:03:39 +08:00
|
|
|
entityList: [],
|
2021-12-28 21:23:18 +08:00
|
|
|
isCollapse: true,
|
2021-12-17 20:56:25 +08:00
|
|
|
collapseIndex: 0
|
2021-12-14 16:42:45 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
size (val) {
|
|
|
|
|
this.$emit('pageSize', val)
|
|
|
|
|
},
|
|
|
|
|
// 点击上一页箭头
|
|
|
|
|
prev () {
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
},
|
|
|
|
|
// 点击下一页箭头
|
|
|
|
|
next () {
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
},
|
|
|
|
|
// currentPage 改变时会触发
|
|
|
|
|
current (val) {
|
|
|
|
|
this.$emit('pageNo', val)
|
|
|
|
|
this.scrollbarToTop()
|
|
|
|
|
},
|
|
|
|
|
scrollbarToTop () {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
const wraps = document.querySelectorAll('.el-table__body-wrapper')
|
|
|
|
|
wraps.scrollTop = 0
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
entityDetail (params) {
|
|
|
|
|
this.$emit('showDetail', { ...params, icon: this.iconClass })
|
2021-12-16 23:03:39 +08:00
|
|
|
},
|
2021-12-28 21:23:18 +08:00
|
|
|
switchCollapse (isCollapse, index) {
|
2021-12-16 23:03:39 +08:00
|
|
|
this.isCollapse = isCollapse
|
2021-12-17 20:56:25 +08:00
|
|
|
this.collapseIndex = index
|
|
|
|
|
},
|
2021-12-28 21:23:18 +08:00
|
|
|
collapse () {
|
|
|
|
|
this.isCollapse = true
|
|
|
|
|
this.$refs[`entityRow${this.collapseIndex}`].collapse()
|
2021-12-14 16:42:45 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|