[Core] [Metadata] Fixed switching table query data results in null query columns (close #489)

This commit is contained in:
qianmoQ 2023-11-12 20:08:31 +08:00
parent ffbf241e13
commit 9d36f17e90

View File

@ -118,7 +118,7 @@
style="width: 100%; min-height: 460px; height: 460px;" style="width: 100%; min-height: 460px; height: 460px;"
:gridOptions="gridOptions" :gridOptions="gridOptions"
:columnDefs="configure.headers" :columnDefs="configure.headers"
:rowData="configure.columns" :rowData="configure.datasets"
:tooltipShowDelay="100" :tooltipShowDelay="100"
:sortingOrder="['desc', 'asc', null]" :sortingOrder="['desc', 'asc', null]"
:rowSelection="'multiple'" :rowSelection="'multiple'"
@ -210,6 +210,7 @@ export default defineComponent({
configure: { configure: {
headers: [], headers: [],
columns: [], columns: [],
datasets: [],
pagination: null as Pagination, pagination: null as Pagination,
operator: PaginationEnum operator: PaginationEnum
}, },
@ -249,7 +250,7 @@ export default defineComponent({
if (response.status && response.data) { if (response.status && response.data) {
this.configure.headers = createColumnDefs(response.data.headers, response.data.types); this.configure.headers = createColumnDefs(response.data.headers, response.data.types);
this.originalColumns = this.configure.headers this.originalColumns = this.configure.headers
this.configure.columns = response.data.columns; this.configure.datasets = response.data.columns;
this.configure.pagination = response.data.pagination; this.configure.pagination = response.data.pagination;
this.visibleContent.content = '```sql\n' + response.data.content + '\n```'; this.visibleContent.content = '```sql\n' + response.data.content + '\n```';
} }
@ -266,15 +267,15 @@ export default defineComponent({
}, },
handlerRefererData(configure: TableFilter) handlerRefererData(configure: TableFilter)
{ {
this.configure.columns = []; this.configure.datasets = [];
this.gridOptions.overlayNoRowsTemplate = '<span></span>'; this.gridOptions.overlayNoRowsTemplate = '<span></span>';
this.refererLoading = true; this.refererLoading = true;
TableService.getData(this.id, configure) TableService.getData(this.id, configure)
.then(response => { .then(response => {
if (response.status && response.data) { if (response.status && response.data) {
this.configure.headers = createColumnDefs(response.data.headers, response.data.types); this.configure.headers = createColumnDefs(response.data.headers, response.data.types);
this.configure.columns = response.data.columns; this.configure.datasets = response.data.columns;
if (this.configure.columns.length <= 0) { if (this.configure.datasets.length <= 0) {
this.gridOptions.overlayNoRowsTemplate = '<span>No Rows To Show</span>'; this.gridOptions.overlayNoRowsTemplate = '<span>No Rows To Show</span>';
} }
this.configure.pagination = response.data.pagination; this.configure.pagination = response.data.pagination;