From 2ccdee9129c31f73f900b6c6ef0e11ba228b4d1f Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Mon, 8 Apr 2024 20:21:31 +0800 Subject: [PATCH] [Core] [Refactor] [UI] [Source] [Manager] Add row filter --- core/datacap-ui/src/i18n/langs/en/source.ts | 3 + core/datacap-ui/src/i18n/langs/zhCn/source.ts | 3 + core/datacap-ui/src/model/table.ts | 14 ++ .../admin/source/components/TableData.vue | 25 ++- .../source/components/TableRowFilter.vue | 191 ++++++++++++++++++ core/datacap-web/src/model/TableFilter.ts | 44 ++-- .../admin/source/components/TableColumn.vue | 81 -------- 7 files changed, 251 insertions(+), 110 deletions(-) create mode 100644 core/datacap-ui/src/views/pages/admin/source/components/TableRowFilter.vue delete mode 100644 core/datacap-web/src/views/admin/source/components/TableColumn.vue diff --git a/core/datacap-ui/src/i18n/langs/en/source.ts b/core/datacap-ui/src/i18n/langs/en/source.ts index 90646e79..c40530ae 100644 --- a/core/datacap-ui/src/i18n/langs/en/source.ts +++ b/core/datacap-ui/src/i18n/langs/en/source.ts @@ -85,6 +85,9 @@ export default { copyRows: 'Copy Rows', deleteRows: 'Delete Rows', visibleColumn: 'Visible Column', + filterData: 'Filter Data', + filterCondition: 'Filter Condition', + addFilter: 'Add Filter', }, tip: { selectSource: 'Please select a source', diff --git a/core/datacap-ui/src/i18n/langs/zhCn/source.ts b/core/datacap-ui/src/i18n/langs/zhCn/source.ts index b4e69f3a..99d1a03b 100644 --- a/core/datacap-ui/src/i18n/langs/zhCn/source.ts +++ b/core/datacap-ui/src/i18n/langs/zhCn/source.ts @@ -85,6 +85,9 @@ export default { copyRows: '复制行', deleteRows: '删除行', visibleColumn: '可见列', + filterData: '筛选数据', + filterCondition: '筛选条件', + addFilter: '添加筛选条件', }, tip: { selectSource: '请选择数据源', diff --git a/core/datacap-ui/src/model/table.ts b/core/datacap-ui/src/model/table.ts index b8efc828..6a99b9de 100644 --- a/core/datacap-ui/src/model/table.ts +++ b/core/datacap-ui/src/model/table.ts @@ -82,6 +82,20 @@ export interface ColumnFilter value?: any } +export class ColumnFilterRequest +{ + public static of(): ColumnFilter + { + return { + index: 0, + column: undefined, + operator: undefined, + operations: Array(), + value: undefined + } + } +} + export interface SqlColumn { column?: string diff --git a/core/datacap-ui/src/views/pages/admin/source/components/TableData.vue b/core/datacap-ui/src/views/pages/admin/source/components/TableData.vue index abf8e737..c58bfce7 100644 --- a/core/datacap-ui/src/views/pages/admin/source/components/TableData.vue +++ b/core/datacap-ui/src/views/pages/admin/source/components/TableData.vue @@ -95,11 +95,18 @@ + @@ -136,16 +145,18 @@ import { ToastUtils } from '@/utils/toast' import Button from '@/views/ui/button' import Tooltip from '@/views/ui/tooltip' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' -import { ArrowLeft, ArrowLeftToLine, ArrowRight, ArrowRightToLine, Cog, Columns, Copy, Eye, Minus, Plus, RectangleEllipsis, RefreshCw } from 'lucide-vue-next' +import { ArrowLeft, ArrowLeftToLine, ArrowRight, ArrowRightToLine, Cog, Columns, Copy, Eye, Filter, Minus, Plus, RectangleEllipsis, RefreshCw } from 'lucide-vue-next' import { Input } from '@/components/ui/input' import TableCellInfo from '@/views/pages/admin/source/components/TableCellInfo.vue' import TableRowDelete from '@/views/pages/admin/source/components/TableRowDelete.vue' import SqlInfo from '@/views/components/sql/SqlInfo.vue' import TableColumn from '@/views/pages/admin/source/components/TableColumn.vue' +import TableRowFilter from '@/views/pages/admin/source/components/TableRowFilter.vue' export default defineComponent({ name: 'TableData', components: { + TableRowFilter, TableColumn, SqlInfo, TableRowDelete, @@ -157,7 +168,7 @@ export default defineComponent({ Button, Tooltip, Popover, PopoverContent, PopoverTrigger, - ArrowLeftToLine, ArrowLeft, ArrowRight, ArrowRightToLine, Cog, Plus, RectangleEllipsis, Copy, Minus, Eye, RefreshCw, Columns + ArrowLeftToLine, ArrowLeft, ArrowRight, ArrowRightToLine, Cog, Plus, RectangleEllipsis, Copy, Minus, Eye, RefreshCw, Columns, Filter }, props: { info: { diff --git a/core/datacap-ui/src/views/pages/admin/source/components/TableRowFilter.vue b/core/datacap-ui/src/views/pages/admin/source/components/TableRowFilter.vue new file mode 100644 index 00000000..565112ca --- /dev/null +++ b/core/datacap-ui/src/views/pages/admin/source/components/TableRowFilter.vue @@ -0,0 +1,191 @@ + + + diff --git a/core/datacap-web/src/model/TableFilter.ts b/core/datacap-web/src/model/TableFilter.ts index 6cf918d8..3d8e4259 100644 --- a/core/datacap-web/src/model/TableFilter.ts +++ b/core/datacap-web/src/model/TableFilter.ts @@ -1,19 +1,19 @@ -import {OrderFilter} from "@/model/OrderFilter"; -import {Pagination} from "@/entity/Pagination"; -import {Operator} from "@/enum/Operator"; +import { OrderFilter } from '@/model/OrderFilter' +import { Pagination } from '@/entity/Pagination' +import { Operator } from '@/enum/Operator' export class TableFilter { - pagination?: Pagination; - orders?: Array; - type?: SqlType; - columns?: Array; - original?: Map; - preview?: boolean; - value?: string; - filter: Filter; - newColumns?: Array; - columnId?: number; + pagination?: Pagination + orders?: Array + type?: SqlType + columns?: Array + original?: Map + preview?: boolean + value?: string + filter: Filter + newColumns?: Array + columnId?: number } export enum SqlType @@ -32,22 +32,22 @@ export enum SqlType export class SqlColumn { - column?: string; - value?: string; - original?: Map; + column?: string + value?: string + original?: Map } export class ColumnFilter { - index: number; - column: string; - operator: string; - operations: Array; + index: number + column: string + operator: string + operations: Array value: any } export class Filter { - condition: string; - filters: Array; + condition: string + filters: Array } diff --git a/core/datacap-web/src/views/admin/source/components/TableColumn.vue b/core/datacap-web/src/views/admin/source/components/TableColumn.vue deleted file mode 100644 index 7ebd3819..00000000 --- a/core/datacap-web/src/views/admin/source/components/TableColumn.vue +++ /dev/null @@ -1,81 +0,0 @@ - -