From bc26c0aa93d8ad229e4c4a899f420df640165df8 Mon Sep 17 00:00:00 2001 From: liuyun Date: Sun, 11 Oct 2026 09:46:39 +0800 Subject: [PATCH] feat: toolbar justify-between, selection, and card-fill list-scroll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 搜索按钮置于表单最右(el-form--inline 设为 flex 容器) - ty-crud 工具条 justify-between:左新增/#toolbar、右批量 #toolbar-right(selectedRows) - ty-table 支持 selection 多选列 + selection-change - 卡片铺满剩余空间、列表内滚动(shell 固定视口 + el-table height=100%) - 用户管理页加批量删除示例 Co-Authored-By: Claude Opus 4.8 --- src/components/ty-crud.vue | 70 ++++++++++++++++++++++------ src/components/ty-table.vue | 81 +++++++++++++++++++++------------ src/layouts/default.vue | 18 +++++++- src/pages/system/user/index.vue | 26 +++++++++-- stats.html | 2 +- 5 files changed, 148 insertions(+), 49 deletions(-) diff --git a/src/components/ty-crud.vue b/src/components/ty-crud.vue index fd5c324..42edc5d 100644 --- a/src/components/ty-crud.vue +++ b/src/components/ty-crud.vue @@ -4,21 +4,29 @@ - +
- 新增{{ entityName }} - +
+ 新增{{ entityName }} + +
+
+ +
- +
+ - + +
(), { @@ -103,6 +114,7 @@ const props = withDefaults( editReadonlyKeys: () => [], actions: () => ['edit', 'delete'], collapseCount: 2, + selection: false, actionsWidth: 220, }, ) @@ -112,6 +124,7 @@ const list = ref[]>([]) const total = ref(0) const page = ref(1) const pageSize = ref(10) +const selectedRows = ref[]>([]) const query = reactive>(buildModel(props.searchSchema)) @@ -223,15 +236,42 @@ function handleCommand(action: CrudActionItem, row: Record): void { action.onClick(row) } +function onSelectionChange(rows: Record[]): void { + selectedRows.value = rows +} + +defineExpose({ reload: fetchList }) + onMounted(fetchList) diff --git a/src/components/ty-table.vue b/src/components/ty-table.vue index 706f03e..65ae36e 100644 --- a/src/components/ty-table.vue +++ b/src/components/ty-table.vue @@ -1,34 +1,43 @@