This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue

108 lines
2.9 KiB
Vue
Raw Normal View History

2021-04-14 18:35:42 +08:00
<template>
<div>
<div class="top-tools top-tools--sub">
<div class="top-tool-left">
<div class="sub-list-title">Name<slot name="title"></slot></div>
<div class="sub-list-tabs">
2021-04-20 15:31:57 +08:00
<div v-for="tab in tabs" :key="tab.prop" :class="{'sub-list-tab--active': tab.active || tab.prop=== targetTab}" class="sub-list-tab" @click="changeTab(tab.prop)">{{tab.name}}</div>
2021-04-14 18:35:42 +08:00
</div>
</div>
2021-04-20 19:27:49 +08:00
<div class="top-tool-right" v-if="!customTool">
2021-04-14 18:35:42 +08:00
<div v-if="layout.indexOf('searchInput') > -1" class="top-tool-search margin-r-20">
<search-input :searchMsg="searchMsg" position="endpoint-bottom" @search="search"></search-input>
</div>
<slot name="top-tool-right"></slot>
<button v-if="layout.indexOf('elementSet') > -1" id="account-column-setting" class="top-tool-btn margin-r-20"
type="button" @click="tools.showCustomTableTitle = true">
<i class="nz-icon-gear nz-icon"></i>
</button>
</div>
2021-04-20 19:27:49 +08:00
<div class="top-tool-right" v-else>
<slot name="top-tool-right"></slot>
</div>
2021-04-14 18:35:42 +08:00
</div>
<!-- 自定义table列 -->
<transition name="el-zoom-in-top">
2021-04-14 18:35:42 +08:00
<element-set
v-if="tools.showCustomTableTitle && layout.indexOf('elementSet') > -1"
2021-04-14 18:35:42 +08:00
ref="customTableTitle"
:custom-table-title="customTableTitle"
:original-table-title="tableTitle"
:tableId="tableId"
@close="tools.showCustomTableTitle = false"
@update="updateCustomTableTitle"
></element-set>
</transition>
<div class="sub-container">
2021-04-26 21:42:15 +08:00
<div :class="targetTab === 'panel' ? 'bottom-panel' : 'nz-table2'">
2021-04-14 18:35:42 +08:00
<slot></slot>
</div>
2021-04-27 19:24:26 +08:00
<div class="pagination-bottom" v-if="showPagination">
2021-04-14 18:35:42 +08:00
<slot name="pagination"></slot>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'nzBottomDataList',
props: {
from: {
type: String,
default: ''
},
tableTitle: {
type: Array
},
customTableTitle: {
type: Array
},
layout: {
type: Array,
default () { return [] }
},
searchMsg: {
type: Object
},
tableId: {
type: String,
default: ''
},
tabs: {
type: Array
2021-04-20 15:31:57 +08:00
},
2021-04-20 19:27:49 +08:00
targetTab: String,
customTool: {
type: Boolean,
default: false
2021-04-27 19:24:26 +08:00
},
showPagination: {
type: Boolean,
default: true
2021-04-20 19:27:49 +08:00
}
2021-04-14 18:35:42 +08:00
},
data () {
return {
tools: {
toTopBtnTop: this.$tableHeight.toTopBtnTop, // to-top按钮的top属性
tableHover: false, // 控制滚动条和top按钮同时出现
showCustomTableTitle: false // 自定义列弹框是否显示
}
}
},
methods: {
updateCustomTableTitle (custom) {
this.$emit('update:customTableTitle', custom)
},
search (searchObj) {
this.$emit('search', searchObj)
},
// 切换tab
changeTab (tab) {
this.$emit('changeTab', tab)
}
}
}
</script>