From 2d50079e24fe18c0cb903cd49eec07ad0d9f96a4 Mon Sep 17 00:00:00 2001 From: lijiahang Date: Fri, 11 Aug 2023 16:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orion-ops-ui/src/assets/style/layout.less | 38 ++++++++++++++++++- orion-ops-ui/src/types/global.ts | 10 +++-- orion-ops-ui/src/types/table.ts | 25 ++++++++++++ orion-ops-ui/src/utils/index.ts | 4 +- .../menu/components/menu-form-modal.vue | 7 ++-- .../system/menu/components/menu-table.vue | 28 +++++--------- orion-ops-ui/src/views/system/menu/index.vue | 3 +- .../system/menu/{type => types}/enum.types.ts | 0 .../system/menu/{type => types}/form.rules.ts | 0 .../menu/{type => types}/table.columns.ts | 2 +- 10 files changed, 87 insertions(+), 30 deletions(-) create mode 100644 orion-ops-ui/src/types/table.ts rename orion-ops-ui/src/views/system/menu/{type => types}/enum.types.ts (100%) rename orion-ops-ui/src/views/system/menu/{type => types}/form.rules.ts (100%) rename orion-ops-ui/src/views/system/menu/{type => types}/table.columns.ts (97%) diff --git a/orion-ops-ui/src/assets/style/layout.less b/orion-ops-ui/src/assets/style/layout.less index 1cc3918c..50525289 100644 --- a/orion-ops-ui/src/assets/style/layout.less +++ b/orion-ops-ui/src/assets/style/layout.less @@ -7,18 +7,52 @@ .table-search-card { width: 100%; + padding-top: 16px; margin-bottom: 16px; + + .arco-form-item { + margin-bottom: 0; + } +} + +.table-bar-handle { + display: flex; + align-items: center; + justify-content: end } .table-card { width: 100%; + + .arco-card-header { + padding: 8px 16px 0 16px; + + .arco-card-header-title { + display: flex; + justify-content: space-between; + + .table-title { + display: flex; + align-items: center; + font-size: 16px; + font-weight: 600; + } + } + } + } .table-wrapper { - margin-top: 16px; + &-8 { + margin-top: 8px; + } + + &-16 { + margin-top: 16px; + } } -.table-option-wrapper { +.table-handle-wrapper { .arco-btn-text { padding: 0 8px; } diff --git a/orion-ops-ui/src/types/global.ts b/orion-ops-ui/src/types/global.ts index d28b5d4a..8095a246 100644 --- a/orion-ops-ui/src/types/global.ts +++ b/orion-ops-ui/src/types/global.ts @@ -26,9 +26,13 @@ export interface PostData { export interface Pagination { page?: number; limit?: number; - current?: number; - pageSize?: number; - total?: number; +} + +export interface DataGrid { + page: number; + limit: number; + total: number; + rows: T[]; } export type TimeRanger = [string, string]; diff --git a/orion-ops-ui/src/types/table.ts b/orion-ops-ui/src/types/table.ts new file mode 100644 index 00000000..840c20e4 --- /dev/null +++ b/orion-ops-ui/src/types/table.ts @@ -0,0 +1,25 @@ +import { PaginationProps, TableRowSelection } from '@arco-design/web-vue'; + +/** + * 默认分页 + */ +export const defaultPagination = (): PaginationProps => { + return { + current: 1, + pageSize: 10, + showTotal: true, + showPageSize: true, + pageSizeOptions: [10, 20, 30, 50, 100] + }; +}; + +/** + * 默认行选择器 + */ +export const defaultRowSelection = (): TableRowSelection => { + return { + type: 'checkbox', + showCheckedAll: true, + onlyCurrent: true, + }; +}; diff --git a/orion-ops-ui/src/utils/index.ts b/orion-ops-ui/src/utils/index.ts index 959ee36c..2ca87960 100644 --- a/orion-ops-ui/src/utils/index.ts +++ b/orion-ops-ui/src/utils/index.ts @@ -57,10 +57,12 @@ export function isEmptyStr(val: any) { return typeof (val) === 'undefined' || val == null || val === ''; } +export const YMD_HMS = 'yyyy-MM-dd HH:mm:ss'; + /** * 格式化时间 */ -export function dateFormat(date = new Date(), pattern = 'yyyy-MM-dd HH:mm:ss') { +export function dateFormat(date = new Date(), pattern = YMD_HMS) { const o = { 'M+': date.getMonth() + 1, 'd+': date.getDate(), diff --git a/orion-ops-ui/src/views/system/menu/components/menu-form-modal.vue b/orion-ops-ui/src/views/system/menu/components/menu-form-modal.vue index bc8ad0b6..37b578f9 100644 --- a/orion-ops-ui/src/views/system/menu/components/menu-form-modal.vue +++ b/orion-ops-ui/src/views/system/menu/components/menu-form-modal.vue @@ -107,16 +107,15 @@ diff --git a/orion-ops-ui/src/views/system/menu/index.vue b/orion-ops-ui/src/views/system/menu/index.vue index f871ca1c..2017294c 100644 --- a/orion-ops-ui/src/views/system/menu/index.vue +++ b/orion-ops-ui/src/views/system/menu/index.vue @@ -19,9 +19,10 @@