2021-12-14 16:42:45 +08:00
|
|
|
<template>
|
2022-01-06 15:32:24 +08:00
|
|
|
<div class="entity-list" id="entityList">
|
2022-05-26 17:14:00 +08:00
|
|
|
<loading :loading="loading"></loading>
|
2021-12-14 16:42:45 +08:00
|
|
|
<div class="entity-list__content">
|
|
|
|
|
<!-- 列表式 -->
|
|
|
|
|
<template v-if="listMode === 'list'">
|
|
|
|
|
<div class="entity-list--list">
|
2022-01-06 17:59:23 +08:00
|
|
|
<div class="no-data" v-if="noData">No data</div>
|
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">
|
2022-01-06 17:59:23 +08:00
|
|
|
<div class="no-data" v-if="noData">No data</div>
|
2021-12-14 16:42:45 +08:00
|
|
|
<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>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import Card from '@/views/entityExplorer/entityList/Card'
|
|
|
|
|
import Row from '@/views/entityExplorer/entityList/Row'
|
2022-05-26 17:14:00 +08:00
|
|
|
import Loading from '@/components/common/Loading'
|
2021-12-14 16:42:45 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'EntityList',
|
|
|
|
|
props: {
|
|
|
|
|
listData: Array,
|
|
|
|
|
from: String,
|
|
|
|
|
pageObj: Object,
|
|
|
|
|
loading: Boolean,
|
2022-05-14 21:53:52 +08:00
|
|
|
timeFilter: Object,
|
2022-05-12 10:15:41 +08:00
|
|
|
listMode: String
|
2021-12-14 16:42:45 +08:00
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
'entity-card': Card,
|
2022-05-26 17:14:00 +08:00
|
|
|
'entity-row': Row,
|
|
|
|
|
Loading
|
2021-12-14 16:42:45 +08:00
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
showDetail: false,
|
|
|
|
|
typeName: '',
|
2021-12-16 23:03:39 +08:00
|
|
|
entityList: [],
|
2021-12-28 21:23:18 +08:00
|
|
|
isCollapse: true,
|
2022-01-05 20:24:02 +08:00
|
|
|
collapseIndex: 0,
|
2022-01-06 16:28:16 +08:00
|
|
|
tableId: 'entityList',
|
2022-01-06 17:59:23 +08:00
|
|
|
listDataCopy: [],
|
|
|
|
|
noData: false
|
2021-12-14 16:42:45 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
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
|
|
|
}
|
2022-01-06 17:59:23 +08:00
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
listData: {
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
if (!n || n.length === 0) {
|
|
|
|
|
this.timeout = setTimeout(() => {
|
|
|
|
|
this.noData = true
|
|
|
|
|
}, 500)
|
|
|
|
|
} else {
|
|
|
|
|
clearTimeout(this.timeout)
|
|
|
|
|
this.noData = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-14 16:42:45 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|