NEZ-3222 fix:notebook 中 table 不使用分页

This commit is contained in:
zyh
2023-10-13 10:46:19 +08:00
parent 43d06c348d
commit e5c12fff9c
9 changed files with 47 additions and 12 deletions

View File

@@ -118,6 +118,18 @@
} }
} }
} }
.table-chart-wrap{
height: auto !important;
min-height: 100px;
display: flex;
flex-direction: column;
.panel-chart{
flex: 1;
.tabel-chart-box{
height: auto !important;
}
}
}
.no-data{ .no-data{
text-align: center; text-align: center;
position: absolute; position: absolute;

View File

@@ -2,7 +2,7 @@
<template> <template>
<!-- <div :style="showHeader&&chartInfo.param.showHeader ? '' : 'padding-top: 15px;'" class="nz-chart" :class="showHeader&&chartInfo.param.showHeader ? '' : 'no-header'" > --> <!-- <div :style="showHeader&&chartInfo.param.showHeader ? '' : 'padding-top: 15px;'" class="nz-chart" :class="showHeader&&chartInfo.param.showHeader ? '' : 'no-header'" > -->
<div class="nz-chart" :class="chartInfo.param.showHeader===0 ? 'no-header' : ''"> <div class="nz-chart" :class="chartInfo.param.showHeader===0 ? 'no-header' : ''">
<loading :loading="loading"></loading> <!-- <loading :loading="loading"></loading> -->
<chart-no-data v-if="isNoData || isError || chartChildrenData || (isExportHtml&&(isAutotopology(chartInfo.type) || isDiagram(chartInfo.type) || isMap(chartInfo.type)))"></chart-no-data> <chart-no-data v-if="isNoData || isError || chartChildrenData || (isExportHtml&&(isAutotopology(chartInfo.type) || isDiagram(chartInfo.type) || isMap(chartInfo.type)))"></chart-no-data>
<template v-else> <template v-else>
<chart-time-series <chart-time-series
@@ -174,6 +174,7 @@
:globalVariables="globalVariables" :globalVariables="globalVariables"
></chart-endpoint-info> ></chart-endpoint-info>
<chart-table <chart-table
:from="from"
:ref="'chart' + chartInfo.id" :ref="'chart' + chartInfo.id"
v-if="isTable(chartInfo.type)" v-if="isTable(chartInfo.type)"
:chart-data="chartData" :chart-data="chartData"

View File

@@ -4,7 +4,7 @@
ref="dataTable" ref="dataTable"
class="chart-table" class="chart-table"
:data="tableData" :data="tableData"
:height="'100%'" :height="from==='notebook'?undefined:'100%'"
:width="'100%'" :width="'100%'"
border border
@sort-change="tableDataSort" @sort-change="tableDataSort"
@@ -92,6 +92,9 @@ import lodash from 'lodash'
export default { export default {
name: 'chart-table', name: 'chart-table',
mixins: [chartMixin, chartFormat], mixins: [chartMixin, chartFormat],
props: {
from: String
},
data () { data () {
return { return {
tableData: [], tableData: [],
@@ -116,7 +119,7 @@ export default {
} }
}, },
showPagination () { showPagination () {
if (this.chartInfo.param.tableOptions && this.chartInfo.param.tableOptions.pagination === 'disabled') { if ((this.chartInfo.param.tableOptions && this.chartInfo.param.tableOptions.pagination === 'disabled') || this.from === 'notebook') {
return false return false
} else { } else {
return true return true
@@ -141,10 +144,15 @@ export default {
// 设置默认排序 // 设置默认排序
setDefaultSort () { setDefaultSort () {
const columns = this.chartInfo.param.columns const columns = this.chartInfo.param.columns
const defaultSortColumn = lodash.get(this, 'chartInfo.param.tableOptions.defaultSortColumn', columns[0].title) if (columns.length) {
let defaultSortColumn = lodash.get(this, 'chartInfo.param.tableOptions.defaultSortColumn', undefined)
if (!defaultSortColumn) {
defaultSortColumn = columns[0].title
}
const defaultSort = lodash.get(this, 'chartInfo.param.tableOptions.defaultSort', 'asc') const defaultSort = lodash.get(this, 'chartInfo.param.tableOptions.defaultSort', 'asc')
const order = defaultSort === 'asc' ? 'ascending' : 'descending' const order = defaultSort === 'asc' ? 'ascending' : 'descending'
this.$refs.dataTable.sort(defaultSortColumn, order) this.$refs.dataTable.sort(defaultSortColumn, order)
}
}, },
// 设置pageSize // 设置pageSize
setPageSize () { setPageSize () {

View File

@@ -29,7 +29,7 @@
<div @click="download('pdf')">{{$t('notebook.downloadAs',{format:'PDF'})}}</div> <div @click="download('pdf')">{{$t('notebook.downloadAs',{format:'PDF'})}}</div>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-has="'notebook_view'"> <el-dropdown-item v-has="'notebook_view'">
<div @click="download('markdown')">{{$t('notebook.downloadAs',{format:'markdown'})}}</div> <div @click="download('html')">{{$t('notebook.downloadAs',{format:'markdown'})}}</div>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-has="'notebook_view'"> <el-dropdown-item v-has="'notebook_view'">
<div @click="downloadJson()">{{$t('notebook.downloadNotebook')}} JSON</div> <div @click="downloadJson()">{{$t('notebook.downloadNotebook')}} JSON</div>

View File

@@ -859,6 +859,7 @@
popper-class="right-box-select-top prevent-clickoutside" popper-class="right-box-select-top prevent-clickoutside"
size="small" size="small"
@change="change" @change="change"
:disabled="from==='notebook'"
> >
<el-option :label="$t('overall.enabled')" value="enabled"></el-option> <el-option :label="$t('overall.enabled')" value="enabled"></el-option>
<el-option :label="$t('overall.disabled')" value="disabled"></el-option> <el-option :label="$t('overall.disabled')" value="disabled"></el-option>
@@ -1565,6 +1566,9 @@ export default {
}, },
dataLink: this.chartConfig.param.dataLink dataLink: this.chartConfig.param.dataLink
} }
if (this.from === 'notebook') {
this.chartConfig.param.tableOptions.pagination = 'disabled'
}
break break
case 'log': case 'log':
if (this.oldType === 'log') { if (this.oldType === 'log') {

View File

@@ -557,9 +557,6 @@ export default {
} }
delete this.editChart.elements delete this.editChart.elements
} }
if (this.from === 'notebook') {
this.editChart.span = 12
}
}, },
editChartChange (newEditChart) { editChartChange (newEditChart) {
this.editChart = { this.editChart = {
@@ -725,6 +722,9 @@ export default {
defaultSort: null defaultSort: null
} }
} }
if (this.from === 'notebook') {
obj.param.tableOptions.pagination = 'disabled'
}
} }
if (obj.type === 'stat') { if (obj.type === 'stat') {
if (!obj.param.sparklineMode) { obj.param.sparklineMode = 'none' } if (!obj.param.sparklineMode) { obj.param.sparklineMode = 'none' }

View File

@@ -510,6 +510,7 @@
popper-class="right-box-select-top prevent-clickoutside" popper-class="right-box-select-top prevent-clickoutside"
size="small" size="small"
@change="change" @change="change"
:disabled="from==='notebook'"
> >
<el-option :label="$t('overall.enabled')" value="enabled"></el-option> <el-option :label="$t('overall.enabled')" value="enabled"></el-option>
<el-option :label="$t('overall.disabled')" value="disabled"></el-option> <el-option :label="$t('overall.disabled')" value="disabled"></el-option>
@@ -1193,6 +1194,9 @@ export default {
}, },
dataLink: this.chartConfig.param.dataLink dataLink: this.chartConfig.param.dataLink
} }
if (this.from === 'notebook') {
this.chartConfig.param.tableOptions.pagination = 'disabled'
}
break break
} }
this.oldType = type this.oldType = type

View File

@@ -18,7 +18,10 @@
> >
<div <div
class="panel-chart-wrap" class="panel-chart-wrap"
:class="{'text-chart-wrap':item.type==='text'}" :class="{
'text-chart-wrap':item.type==='text',
'table-chart-wrap':item.type==='table'
}"
v-for="item in copyDataList" v-for="item in copyDataList"
:key="item.id"> :key="item.id">
<panel-chart <panel-chart

View File

@@ -163,5 +163,8 @@ export default {
body { body {
height: auto !important; height: auto !important;
} }
.panel-chart-wrap{
page-break-inside: avoid;
}
} }
</style> </style>