From 08cbc0296e1168e342f5a979b917907990f1d118 Mon Sep 17 00:00:00 2001
From: "Crane.z" <1481445951@qq.com>
Date: Thu, 21 May 2026 13:37:34 +0800
Subject: [PATCH] feat:The query results support batch selection and copying.
---
.../Main/Explore/DataView/DataView.vue | 53 +--
.../Main/Explore/DataView/ResultGrid.vue | 376 ++++++++++++++++++
2 files changed, 406 insertions(+), 23 deletions(-)
create mode 100644 frontend/src/components/Main/Explore/DataView/ResultGrid.vue
diff --git a/frontend/src/components/Main/Explore/DataView/DataView.vue b/frontend/src/components/Main/Explore/DataView/DataView.vue
index f04325e..dd4c27c 100644
--- a/frontend/src/components/Main/Explore/DataView/DataView.vue
+++ b/frontend/src/components/Main/Explore/DataView/DataView.vue
@@ -3,19 +3,15 @@
id="doc"
v-loading="state.loading"
class="data-view"
- @contextmenu.prevent="preventDefaultContextMenu"
style="z-index: 99;position: relative"
+ @contextmenu.prevent="preventDefaultContextMenu"
>
-
+
-
-
+
@@ -26,16 +22,15 @@ import store from '@/store'
import Toolbar from '@/framework/components/Toolbar/index.vue'
import { Subject } from 'rxjs'
import ExportDataDialog from '@/components/Main/Explore/DataView/ExportDataDialog.vue'
-import { AgGridVue } from 'ag-grid-vue'
+
import RightMenu from '@/components/Main/Explore/DataView/RightMenu.vue'
import { SpecialCharacters, GeneralInsertSQL, GeneralUpdateSQL } from './const'
-import 'ag-grid-community/styles/ag-grid.css'
-import 'ag-grid-community/styles/ag-theme-balham.css'
+import ResultGrid from '@/components/Main/Explore/DataView/ResultGrid.vue'
export default {
name: 'DataView',
- components: { ExportDataDialog, Toolbar, AgGridVue, RightMenu },
+ components: { ExportDataDialog, Toolbar, ResultGrid, RightMenu },
props: {
meta: {
type: Object,
@@ -166,15 +161,6 @@ export default {
onClick: this.onExport
}
},
- defaultColDef: {
- resizable: true,
- sortable: false,
- filter: false
- },
- gridOptions: {
- suppressMovableColumnsHints: true,
- suppressSortingHints: true
- },
init: false,
currentRow: null,
menus: [
@@ -244,6 +230,27 @@ export default {
this.reloadTable()
this.init = true
},
+ fallbackWriteClipboardText(text, originalError) {
+ const textarea = document.createElement('textarea')
+ textarea.value = text
+ textarea.setAttribute('readonly', '')
+ textarea.style.position = 'fixed'
+ textarea.style.left = '-9999px'
+ document.body.appendChild(textarea)
+ textarea.select()
+ try {
+ const copied = document.execCommand('copy')
+ if (copied) {
+ this.$message.success(this.$t('CopySucceeded'))
+ } else {
+ throw originalError || new Error('clipboard unavailable')
+ }
+ } catch (error) {
+ this.$message.error(`${this.$t('CopyFailed')}: ${error}`)
+ } finally {
+ document.body.removeChild(textarea)
+ }
+ },
onNextPage() {
this.$emit('action', { action: 'next_page' })
},
diff --git a/frontend/src/components/Main/Explore/DataView/ResultGrid.vue b/frontend/src/components/Main/Explore/DataView/ResultGrid.vue
new file mode 100644
index 0000000..fe095a9
--- /dev/null
+++ b/frontend/src/components/Main/Explore/DataView/ResultGrid.vue
@@ -0,0 +1,376 @@
+
+
+
+
+
+
+