From 192701e41e574ed800ac7bca42c1ebdc9e01fc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=B8=85=E7=88=BD?= Date: Sat, 12 Apr 2025 16:27:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E5=90=8E=E5=8F=B0=20-=20?= =?UTF-8?q?=E6=B5=81=E9=87=8F=E6=B1=A0=E5=88=86=E9=A1=B5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/AdministratorPermissions.php | 23 +------ .../application/superadmin/model/Company.php | 22 ------- .../superadmin/model/WechatFriend.php | 29 --------- SuperAdmin/app/dashboard/customers/page.tsx | 61 ++++++++++++++++++- 4 files changed, 60 insertions(+), 75 deletions(-) diff --git a/Server/application/superadmin/model/AdministratorPermissions.php b/Server/application/superadmin/model/AdministratorPermissions.php index d0aa39e4..4e6c0dce 100644 --- a/Server/application/superadmin/model/AdministratorPermissions.php +++ b/Server/application/superadmin/model/AdministratorPermissions.php @@ -10,28 +10,7 @@ class AdministratorPermissions extends Model { // 设置数据表名 protected $name = 'administrator_permissions'; - - // 设置主键 - protected $pk = 'id'; - - // 自动写入时间戳 - protected $autoWriteTimestamp = true; - - // 定义时间戳字段名 - protected $createTime = 'createTime'; - protected $updateTime = 'updateTime'; - protected $deleteTime = 'deleteTime'; - - // 定义字段类型 - protected $type = [ - 'id' => 'integer', - 'adminId' => 'integer', - 'permissions' => 'json', - 'createTime' => 'integer', - 'updateTime' => 'integer', - 'deleteTime' => 'integer' - ]; - + /** * 保存管理员权限 * @param int $adminId 管理员ID diff --git a/Server/application/superadmin/model/Company.php b/Server/application/superadmin/model/Company.php index 1ce7a350..b37b408b 100644 --- a/Server/application/superadmin/model/Company.php +++ b/Server/application/superadmin/model/Company.php @@ -10,26 +10,4 @@ class Company extends Model { // 设置数据表名 protected $name = 'company'; - - // 设置主键 - protected $pk = 'id'; - - // 设置时间格式为datetime类型 - protected $autoWriteTimestamp = 'datetime'; - - // 定义时间戳字段名 - protected $createTime = 'createTime'; - protected $updateTime = 'lastUpdateTime'; - - // 定义字段类型 - protected $type = [ - 'id' => 'integer', - 'tenantId' => 'integer', - 'isTop' => 'integer', - 'level' => 'integer', - 'parentId' => 'integer', - 'privileges' => 'json', - 'createTime' => 'datetime', - 'lastUpdateTime' => 'datetime' - ]; } \ No newline at end of file diff --git a/Server/application/superadmin/model/WechatFriend.php b/Server/application/superadmin/model/WechatFriend.php index aed6877a..f7e8bb7e 100644 --- a/Server/application/superadmin/model/WechatFriend.php +++ b/Server/application/superadmin/model/WechatFriend.php @@ -10,33 +10,4 @@ class WechatFriend extends Model { // 设置数据表名 protected $name = 'wechat_friend'; - - // 不使用自增主键 - protected $pk = null; - - // 指定自动时间字段的格式 - protected $autoWriteTimestamp = 'datetime'; - - // 定义时间戳字段名 - protected $createTime = 'createTime'; - protected $updateTime = 'updateTime'; - - // 定义字段类型 - protected $type = [ - 'id' => 'integer', - 'wechatAccountId' => 'integer', - 'gender' => 'integer', - 'addFrom' => 'integer', - 'isDeleted' => 'integer', - 'isPassed' => 'integer', - 'accountId' => 'integer', - 'groupId' => 'integer', - 'updateTime' => 'integer', - 'labels' => 'json', - 'extendFields' => 'json', - 'thirdParty' => 'json', - 'deleteTime' => 'datetime', - 'passTime' => 'datetime', - 'createTime' => 'datetime' - ]; } \ No newline at end of file diff --git a/SuperAdmin/app/dashboard/customers/page.tsx b/SuperAdmin/app/dashboard/customers/page.tsx index 71acd49c..43508bd9 100644 --- a/SuperAdmin/app/dashboard/customers/page.tsx +++ b/SuperAdmin/app/dashboard/customers/page.tsx @@ -124,6 +124,7 @@ export default function CustomersPage() { const [totalPages, setTotalPages] = useState(1) const [totalItems, setTotalItems] = useState(0) const [pageSize, setPageSize] = useState(10) + const [jumpToPage, setJumpToPage] = useState("") // 获取客户列表数据 useEffect(() => { @@ -158,6 +159,22 @@ export default function CustomersPage() { } }; + // 处理页码跳转 + const handleJumpToPage = () => { + const page = parseInt(jumpToPage); + if (!isNaN(page) && page >= 1 && page <= totalPages) { + setCurrentPage(page); + setJumpToPage(""); + } + }; + + // 处理每页显示条数变化 + const handlePageSizeChange = (size: string) => { + const newSize = parseInt(size); + setPageSize(newSize); + setCurrentPage(1); // 重置为第一页 + }; + // Filter customers based on search and filters (兼容示例数据) const filteredCustomers = customersData.filter((customer) => { const matchesSearch = @@ -365,8 +382,25 @@ export default function CustomersPage() { {/* 分页控件 */} {!isLoading && !error && customers.length > 0 && (
-
- 共 {totalItems} 条记录,当前第 {currentPage}/{totalPages} 页 +
+
+ 共 {totalItems} 条记录,当前第 {currentPage}/{totalPages} 页 +
+
+ 每页显示: + + +
+ + {/* 页码跳转 */} +
+ 跳转到 + setJumpToPage(e.target.value)} + onKeyDown={(e) => e.key === "Enter" && handleJumpToPage()} + className="h-8 w-16 text-center" + min={1} + max={totalPages} + /> + + +
)}