Initial commit: One Pipe System

完整的管理系统,包含账户管理、卡片管理、套餐管理、财务管理等功能模块。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sexygoat
2026-01-22 16:35:33 +08:00
commit 222e5bb11a
495 changed files with 145440 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
/**
* 表格选择管理 Composable
*/
import { ref, computed } from 'vue'
export function useTableSelection<T = any>() {
// 选中的行
const selectedRows = ref<T[]>([])
// 选中的ID列表
const selectedIds = computed(() => {
return selectedRows.value.map((row: any) => row.id)
})
// 选中的数量
const selectedCount = computed(() => selectedRows.value.length)
// 是否有选中项
const hasSelected = computed(() => selectedRows.value.length > 0)
// 处理选择变化
const handleSelectionChange = (selection: T[]) => {
selectedRows.value = selection
}
// 清空选择
const clearSelection = () => {
selectedRows.value = []
}
// 判断是否选中指定项
const isSelected = (row: any) => {
return selectedIds.value.includes(row.id)
}
// 切换选中状态
const toggleSelection = (row: T) => {
const index = selectedRows.value.findIndex((item: any) => item.id === (row as any).id)
if (index > -1) {
selectedRows.value.splice(index, 1)
} else {
selectedRows.value.push(row)
}
}
return {
selectedRows,
selectedIds,
selectedCount,
hasSelected,
handleSelectionChange,
clearSelection,
isSelected,
toggleSelection
}
}