+
-
-
-
-
-
+
+
User
-
-
-
-
{page.data.user.nickname}
- @{page.data.user.username}
-
+ @{page.data.user.username}
-
-
-
-
-
-
- 个人资料
-
+ 个人资料
-
-
- 设置
-
+ 设置
-
-
-
-
-
+ >
-
-
-
{/if}
-
-
\ No newline at end of file
+ border-radius: 20px;
+ }
+
diff --git a/src/lib/components/table/DeviceTable.svelte b/src/lib/components/table/DeviceTable.svelte
new file mode 100644
index 0000000..e69de29
diff --git a/src/lib/components/table/UserTable.svelte b/src/lib/components/table/UserTable.svelte
new file mode 100644
index 0000000..f846e69
--- /dev/null
+++ b/src/lib/components/table/UserTable.svelte
@@ -0,0 +1,160 @@
+
+
+ {#if users.total > 0}
+
+
+
+
+
+
+
+
+
+
+ |
+
+ |
+ {#each newRowTitles as item,index(index)}
+ {item.title} |
+ {/each}
+
+
+
+
+
+ {#if users.records}
+
+ {#each users.records as record(record.id)}
+
+ |
+
+ |
+ {record.id} |
+ {record.username} |
+ {record.nickname} |
+
+
+ {#if record.avatar}
+ 
+ {/if}
+
+ |
+
+ {#each record.roles as role (role.id)}
+ {role.name}
+ {/each}
+ |
+
+ {/each}
+
+
+
+
+
+
+
+ page {users.current} of {users.pages}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ {/if}
+
+
+
+
+
+
+ {:else }
+
No users found
+ {/if}
+
\ No newline at end of file
diff --git a/src/lib/components/table/UserTableOld.svelte b/src/lib/components/table/UserTableOld.svelte
new file mode 100644
index 0000000..f5984b2
--- /dev/null
+++ b/src/lib/components/table/UserTableOld.svelte
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ |
+ {#each newRowTitles as item,index(index)}
+ {item.title} |
+ {/each}
+
+
+
+ {#await data.streamed.userList}
+
+
+ |
+
+ |
+
+
+ {:then userList}
+
+ {#each userList.records as record(record.id)}
+
+ |
+
+ |
+ {record.id} |
+ {record.username} |
+ {record.nickname} |
+
+
+ {#if record.avatar}
+ 
+ {/if}
+
+ |
+
+ {#each record.roles as role (role.id)}
+ {role.name}
+ {/each}
+ |
+
+ {/each}
+
+
+
+
+
+
+
+ page {userList.current} of {userList.pages}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ {:catch error}
+
+
+
+
+
+ 组件加载失败: {error.message}
+
+
+ |
+
+
+ {/await}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/lib/types/api.ts b/src/lib/types/api.ts
index 646f23c..76319f1 100644
--- a/src/lib/types/api.ts
+++ b/src/lib/types/api.ts
@@ -24,3 +24,27 @@ export interface LoginSuccess {
}
+export interface DeviceResponse {
+ id: number;
+ name: string;
+ model: string;
+ typeId: number;
+ locationId: number;
+ snmpCommunity: string;
+ manufacturer: string;
+ purchaseDate: Date;
+ status: number;
+ remark: string;
+}
+
+export interface CreateDeviceRequest {
+ name: string;
+ model: string;
+ typeId: number;
+ locationId: number;
+ snmpCommunity: string;
+ manufacturer: string;
+ purchaseDate: Date;
+ status: number;
+ remark: string;
+}
\ No newline at end of file
diff --git a/src/lib/types/icon-ids.ts b/src/lib/types/icon-ids.ts
index 299f11c..7a59567 100644
--- a/src/lib/types/icon-ids.ts
+++ b/src/lib/types/icon-ids.ts
@@ -16,5 +16,6 @@ export type IconId =
"user-settings" |
"user-profile"|
"auth"|
- "chevron-up-down"
+ "chevron-up-down"|
+ "laptop-settings"
;
\ No newline at end of file
diff --git a/src/lib/types/layout.ts b/src/lib/types/layout.ts
index 39f9d91..2668bd0 100644
--- a/src/lib/types/layout.ts
+++ b/src/lib/types/layout.ts
@@ -5,7 +5,7 @@ export interface NavItem {
id: string;
icon?: IconId;
label: string;
- href: RouteId;
+ href?: RouteId;
isActive?: boolean;
isDisabled?: boolean;
isHidden?: boolean;
diff --git a/src/routes/admin/+page.svelte b/src/routes/admin/+page.svelte
index 483c8d6..7b77f0f 100644
--- a/src/routes/admin/+page.svelte
+++ b/src/routes/admin/+page.svelte
@@ -1,18 +1,4 @@
-
- {#if isAdmin}
-
- 是管理员
-
- {:else }
-
- 没有权限
-
- {/if}
\ No newline at end of file
diff --git a/src/routes/app/settings/auth/users/+page.svelte b/src/routes/app/settings/auth/users/+page.svelte
index 668d1b3..83db4be 100644
--- a/src/routes/app/settings/auth/users/+page.svelte
+++ b/src/routes/app/settings/auth/users/+page.svelte
@@ -1,192 +1,31 @@
-
-
-
-
用户管理
-
+
+
用户管理
+
-
-
-
-
-
-
-
-
- |
-
- |
- {#each newRowTitles as item,index(index)}
- {item.title} |
- {/each}
-
-
-
- {#await data.streamed.userList}
-
-
- |
-
- |
-
-
- {:then userList}
-
- {#each userList.records as record(record.id)}
-
- |
-
- |
- {record.id} |
- {record.username} |
- {record.nickname} |
-
-
- {#if record.avatar}
- 
- {/if}
-
- |
-
- {#each record.roles as role (role.id)}
- {role.name}
- {/each}
- |
-
- {/each}
-
-
-
-
-
-
-
- page {userList.current} of {userList.pages}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
- {:catch error}
-
-
-
-
-
- 组件加载失败: {error.message}
-
-
- |
-
-
- {/await}
-
-
-
-
-
-
\ No newline at end of file
+{#await data.streamed.userList}
+ 加载中
+{:then result}
+ {#await data.streamed.roles}
+ 加载中
+ {:then roles}
+
+ {:catch err}
+ 出错了: {err.message}
+ {/await}
+{:catch err}
+ 出错了: {err.message}
+{/await}
\ No newline at end of file
diff --git a/src/routes/app/settings/device/list/+page.server.ts b/src/routes/app/settings/device/list/+page.server.ts
new file mode 100644
index 0000000..3e2e1ca
--- /dev/null
+++ b/src/routes/app/settings/device/list/+page.server.ts
@@ -0,0 +1,25 @@
+import type { PageServerLoad } from './$types';
+import { COOKIE_TOKEN_KEY } from '$lib/components/constants/cookiesConstants.ts';
+import { redirect } from '@sveltejs/kit';
+import { deviceService } from '$lib/api/services/deviceService.ts';
+
+export const load:PageServerLoad = async ({ cookies }) => {
+
+ const token = cookies.get(COOKIE_TOKEN_KEY);
+
+ if (!token) {
+ throw redirect(302, '/auth/login');
+ }
+
+ const result = await deviceService.getAllDevices({ page: 1, size: 10 ,token:token});
+ console.log('result', result);
+
+
+ return {
+ streamed:{
+ result: {
+ list: result
+ }
+ }
+ };
+};
\ No newline at end of file
diff --git a/src/routes/app/settings/device/list/+page.svelte b/src/routes/app/settings/device/list/+page.svelte
new file mode 100644
index 0000000..ebb7e2f
--- /dev/null
+++ b/src/routes/app/settings/device/list/+page.svelte
@@ -0,0 +1,30 @@
+
+
+
+
+{#await data.streamed.deviceList}
+ 正在加载设备列表...
+ 请稍后...
+ {:then result}
+
+ 加载成功
+
+ {:catch error}
+ {error}
+ 请稍后...
+ {/await}
\ No newline at end of file
diff --git a/src/routes/app/settings/device/type/+page.svelte b/src/routes/app/settings/device/type/+page.svelte
new file mode 100644
index 0000000..e69de29