CN-240 feat: entity列表(行式)

This commit is contained in:
chenjinsong
2021-12-17 20:56:25 +08:00
parent a4707d27c4
commit 742120c51c
5 changed files with 28 additions and 7 deletions

View File

@@ -58,6 +58,7 @@
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
justify-content: center; justify-content: center;
flex-wrap: wrap;
.cn-entity__header { .cn-entity__header {
font-size: 16px; font-size: 16px;
@@ -76,6 +77,7 @@
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap;
.basic-info__item { .basic-info__item {
padding-right: 40px; padding-right: 40px;

View File

@@ -9,7 +9,7 @@
<div class="search__suffix"> <div class="search__suffix">
<i class="cn-icon cn-icon-search-advance"></i> <i class="cn-icon cn-icon-search-advance"></i>
</div> </div>
<div class="search__suffix"> <div class="search__suffix" @click="search">
<i class="el-icon-search"></i> <i class="el-icon-search"></i>
</div> </div>
</div> </div>
@@ -17,7 +17,7 @@
<div class="search__suffix"> <div class="search__suffix">
<i class="cn-icon cn-icon-search-advance"></i> <i class="cn-icon cn-icon-search-advance"></i>
</div> </div>
<div class="search__suffix"> <div class="search__suffix" @click="search">
<i class="el-icon-search"></i> <i class="el-icon-search"></i>
</div> </div>
</div> </div>
@@ -39,6 +39,11 @@ export default {
return { return {
searchContent: '' searchContent: ''
} }
},
methods: {
search () {
this.$emit('search', this.searchContent)
}
} }
} }
</script> </script>

View File

@@ -112,7 +112,7 @@ export default {
data () { data () {
return { return {
showList: false, showList: false,
listMode: 'block', // entity列表的模式list|block listMode: 'list', // entity列表的模式list|block
timeFilter: {}, timeFilter: {},
filterData: [ filterData: [

View File

@@ -7,11 +7,13 @@
<!-- 列表式 --> <!-- 列表式 -->
<template v-if="listMode === 'list'"> <template v-if="listMode === 'list'">
<div class="entity-list--list"> <div class="entity-list--list">
<div v-if="isCollapse" class="cn-entity__shadow"></div> <div v-if="isCollapse" @click="cancelCollapse" class="cn-entity__shadow"></div>
<entity-row <entity-row
v-for="(data, index) in listData" v-for="(data, index) in listData"
:entity="data" :entity="data"
:key="index" :key="index"
:ref="`entityRow${index}`"
:index="index"
@showCollapse="showCollapse" @showCollapse="showCollapse"
></entity-row> ></entity-row>
</div> </div>
@@ -71,7 +73,8 @@ export default {
showDetail: false, showDetail: false,
typeName: '', typeName: '',
entityList: [], entityList: [],
isCollapse: false isCollapse: false,
collapseIndex: 0
} }
}, },
methods: { methods: {
@@ -100,8 +103,13 @@ export default {
entityDetail (params) { entityDetail (params) {
this.$emit('showDetail', { ...params, icon: this.iconClass }) this.$emit('showDetail', { ...params, icon: this.iconClass })
}, },
showCollapse (isCollapse) { showCollapse (isCollapse, index) {
this.isCollapse = isCollapse this.isCollapse = isCollapse
this.collapseIndex = index
},
cancelCollapse () {
this.isCollapse = false
this.$refs[`entityRow${this.collapseIndex}`].cancelCollapse()
} }
} }
} }

View File

@@ -97,6 +97,9 @@
import entityListMixin from './entityListMixin' import entityListMixin from './entityListMixin'
export default { export default {
name: 'Row', name: 'Row',
props: {
index: Number
},
mixins: [entityListMixin], mixins: [entityListMixin],
data () { data () {
return { return {
@@ -106,7 +109,10 @@ export default {
methods: { methods: {
showCollapse () { showCollapse () {
this.isCollapse = !this.isCollapse this.isCollapse = !this.isCollapse
this.$emit('showCollapse', this.isCollapse) this.$emit('showCollapse', this.isCollapse, this.index)
},
cancelCollapse () {
this.isCollapse = false
} }
} }
} }