init ai page

This commit is contained in:
Chuck1sn
2025-05-21 09:43:57 +08:00
parent f103993960
commit d12862ea39
20 changed files with 140 additions and 32 deletions

View File

@@ -1,11 +1,11 @@
VITE_APP_PORT=5173
VITE_SOURCE_MAP=true
# mock
#VITE_ENABLE_MOCK=true
#VITE_BASE_URL=http://localhost:5173
VITE_ENABLE_MOCK=true
VITE_BASE_URL=http://localhost:5173
# local
VITE_ENABLE_MOCK=false
VITE_BASE_URL=http://localhost:8080
#VITE_ENABLE_MOCK=false
#VITE_BASE_URL=http://localhost:8080
# dev
#VITE_ENABLE_MOCK=false
#VITE_BASE_URL=https://localhost/api

View File

@@ -8,7 +8,7 @@ import Sidebar from "./Sidebar.vue";
<Headbar></Headbar>
<Sidebar>
</Sidebar>
<article class="ml-64 mt-14">
<article class="ml-64">
<RouterView></RouterView>
</article>
</template>

View File

@@ -30,8 +30,8 @@ import PositionIcon from "./icons/PositionIcon.vue";
import RoleIcon from "./icons/RoleIcon.vue";
import SchedulerIcon from "./icons/SchedulerIcon.vue";
import SettingsIcon from "./icons/SettingsIcon.vue";
// 导入图标组件
import UsersIcon from "./icons/UsersIcon.vue";
import AiChatIcon from "./icons/AiChatIcon.vue";
// 菜单配置
const menuItems = [
@@ -70,11 +70,15 @@ const menuItems = [
path: `${RoutePath.DASHBOARD}/${RoutePath.SCHEDULERVIEW}`,
icon: SchedulerIcon,
},
{
title: "AI 对话",
path: `${RoutePath.DASHBOARD}/${RoutePath.AICHATVIEW}`,
icon: AiChatIcon,
},
];
const route = useRoute();
// 判断当前路由是否激活
const isActive = (path: string) => {
return route.path === path;
};

View File

@@ -0,0 +1,3 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bot-icon lucide-bot"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>
</template>

View File

@@ -15,6 +15,7 @@ export enum RoutePath {
DEPARTMENTVIEW = "departments",
POSITIONVIEW = "positions",
CREATEUSERVIEW = "create-user",
AICHATVIEW = "ai/chat",
SCHEDULERVIEW = "scheduler",
UPSERTUSERVIEW = "upsert-user",
UPSERTROLEVIEW = "upsert-role",
@@ -39,6 +40,7 @@ export enum RouteName {
DEPARTMENTVIEW = "departments",
POSITIONVIEW = "positions",
CREATEUSERVIEW = "create-user",
AICHATVIEW = "ai/chat",
SCHEDULERVIEW = "scheduler",
UPSERTUSERVIEW = "upsert-user",
UPSERTROLEVIEW = "upsert-role",

View File

@@ -0,0 +1,16 @@
import type { RouteRecordRaw } from "vue-router";
import { EPermission, RouteName, RoutePath } from "../constants";
const aiRoutes: RouteRecordRaw[] = [
{
path: RoutePath.AICHATVIEW,
name: RouteName.AICHATVIEW,
component: () => import("@/views/AiChatView.vue"),
meta: {
requiresAuth: true,
// hasPermission: EPermission.READ_USER_ROLE_PERMISSION,
},
},
];
export default aiRoutes;

View File

@@ -3,6 +3,7 @@ import Dashboard from "../../components/Dashboard.vue";
import OverView from "../../views/OverView.vue";
import { EPermission, ERole, RouteName, RoutePath } from "../constants";
import userManagementRoutes from "./user";
import aiRoutes from "./ai";
const dashboardRoutes: RouteRecordRaw = {
path: RoutePath.DASHBOARD,
@@ -29,6 +30,7 @@ const dashboardRoutes: RouteRecordRaw = {
},
},
...userManagementRoutes,
...aiRoutes,
{
path: RoutePath.NOTFOUND,
name: RouteName.NOTFOUND,

View File

@@ -0,0 +1,81 @@
<template>
<div class="flex flex-col w-1/2 mx-auto box-border pt-14 min-h-screen">
<div class="flex flex-col gap-y-5 flex-1 pt-14">
<div class="flex items-start gap-2.5 ">
<img class="w-8 h-8 rounded-full" src="/trump.jpg" alt="Jese image">
<div
class="flex flex-col leading-1.5 p-4 border-gray-200 bg-gray-100 rounded-e-xl rounded-es-xl dark:bg-gray-700">
<div class="flex items-center space-x-2 rtl:space-x-reverse">
<span class="text-sm font-semibold text-gray-900 dark:text-white">Bonnie Green</span>
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">11:46</span>
</div>
<p class="text-sm font-normal py-2.5 text-gray-900 dark:text-white">That's awesome. I think our users will
really
appreciate the improvements.</p>
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">Delivered</span>
</div>
</div>
<div dir="rtl" class="flex items-start gap-2.5">
<img class="w-8 h-8 rounded-full" src="/trump.jpg" alt="Jese image">
<div
class="flex flex-col leading-1.5 p-4 border-gray-200 bg-gray-100 rounded-e-xl rounded-es-xl dark:bg-gray-700">
<div class="flex items-center space-x-2">
<span class="text-sm font-semibold text-gray-900 dark:text-white">Bonnie Green</span>
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">11:46</span>
</div>
<p dir="ltr" class="text-sm font-normal py-2.5 text-gray-900 dark:text-white">That's awesome. I think our
users
will
really appreciate the improvements.</p>
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">Delivered</span>
</div>
</div>
</div>
<form class="flex-none pb-2">
<div class="w-full mb-4 border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600">
<div class="px-4 py-2 bg-white rounded-t-lg dark:bg-gray-800">
<label for="comment" class="sr-only">Your comment</label>
<textarea id="comment" rows="4"
class="w-full px-0 text-sm text-gray-900 bg-white border-0 dark:bg-gray-800 focus:ring-0 dark:text-white dark:placeholder-gray-400"
placeholder="给知路智能体发送消息" required></textarea>
</div>
<div class="flex items-center justify-between px-3 py-2 border-t dark:border-gray-600 border-gray-200">
<button type="submit"
class="inline-flex items-center py-2.5 px-4 text-xs font-medium text-center text-white bg-blue-700 rounded-lg focus:ring-4 focus:ring-blue-200 dark:focus:ring-blue-900 hover:bg-blue-800">
Post comment
</button>
<div class="flex ps-0 space-x-1 rtl:space-x-reverse sm:ps-2">
<button type="button"
class="inline-flex justify-center items-center p-2 text-gray-500 rounded-sm cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600">
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 12 20">
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2"
d="M1 6v8a5 5 0 1 0 10 0V4.5a3.5 3.5 0 1 0-7 0V13a2 2 0 0 0 4 0V6" />
</svg>
<span class="sr-only">Attach file</span>
</button>
<button type="button"
class="inline-flex justify-center items-center p-2 text-gray-500 rounded-sm cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600">
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
viewBox="0 0 16 20">
<path
d="M8 0a7.992 7.992 0 0 0-6.583 12.535 1 1 0 0 0 .12.183l.12.146c.112.145.227.285.326.4l5.245 6.374a1 1 0 0 0 1.545-.003l5.092-6.205c.206-.222.4-.455.578-.7l.127-.155a.934.934 0 0 0 .122-.192A8.001 8.001 0 0 0 8 0Zm0 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z" />
</svg>
<span class="sr-only">Set location</span>
</button>
<button type="button"
class="inline-flex justify-center items-center p-2 text-gray-500 rounded-sm cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600">
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
viewBox="0 0 20 18">
<path
d="M18 0H2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2Zm-5.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm4.376 10.481A1 1 0 0 1 16 15H4a1 1 0 0 1-.895-1.447l3.5-7A1 1 0 0 1 7.468 6a.965.965 0 0 1 .9.5l2.775 4.757 1.546-1.887a1 1 0 0 1 1.618.1l2.541 4a1 1 0 0 1 .028 1.011Z" />
</svg>
<span class="sr-only">Upload image</span>
</button>
</div>
</div>
</div>
</form>
</div>
</template>

View File

@@ -1,5 +1,5 @@
<template>
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['部门分配']" />
<h1 class="text-xl mb-2 font-semibold text-gray-900 sm:text-2xl ">部门分配</h1>

View File

@@ -1,5 +1,5 @@
<template>
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['绑定权限']" />
<h1 class="text-xl mb-2 font-semibold text-gray-900 sm:text-2xl ">

View File

@@ -1,5 +1,5 @@
<template>
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['岗位分配']" />
<h1 class="text-xl mb-2 font-semibold text-gray-900 sm:text-2xl ">岗位分配</h1>

View File

@@ -1,5 +1,5 @@
<template>
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="relative overflow-x-auto px-4 pt-6 xl:grid-cols-3 xl:gap-4 rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['角色分配']" />
<h1 class="text-xl mb-2 font-semibold text-gray-900 sm:text-2xl ">角色分配</h1>

View File

@@ -1,5 +1,5 @@
<template>
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['部门管理']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">部门管理</h1>
@@ -65,7 +65,7 @@
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">
<div class="flex items-center gap-x-2">
<button @click="handleUpsertDepartmentClick(department)"
class="flex items-center justify-center min-w-25 gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 "
class="flex items-center justify-center whitespace-nowrap gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 "
type="button">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path>
@@ -76,7 +76,7 @@
<span>编辑</span>
</button>
<button
class="flex items-center justify-center min-w-25 gap-x-1
class="flex items-center justify-center whitespace-nowrap gap-x-1
bg-red-700 hover:bg-red-800
focus:ring-red-500 text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm px-5 py-2.5"
@click="handleDeleteDepartmentClick(department)" type="button">

View File

@@ -1,5 +1,5 @@
<template>
<div class="grid grid-cols-5 gap-4 p-4">
<div class="grid grid-cols-5 gap-4 p-4 mt-14">
<div class="col-span-3 bg-white rounded-lg shadow-sm p-4 md:p-6">
<div class="flex justify-between pb-4 mb-4 border-b border-gray-200 ">
<div class="flex items-center">

View File

@@ -1,5 +1,5 @@
<template>
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['权限管理']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">权限管理</h1>
@@ -63,7 +63,7 @@
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">
<div class="flex items-center gap-x-2">
<button @click="handleUpsertPermissionClick(permission)"
class="flex items-center justify-center min-w-25 gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 "
class="flex items-center justify-center whitespace-nowrap gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 "
type="button">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path>
@@ -74,7 +74,7 @@
<span>编辑</span>
</button>
<button
class="flex items-center justify-center min-w-25 gap-x-1
class="flex items-center justify-center whitespace-nowrap gap-x-1
bg-red-700 hover:bg-red-800 focus:outline-none
focus:ring-red-500 text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm px-5 py-2.5 "
@click="handleDeletePermissionClick(permission)" type="button">

View File

@@ -1,5 +1,5 @@
<template>
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['岗位管理']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">岗位管理</h1>

View File

@@ -1,5 +1,5 @@
<template>
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['角色管理']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">角色管理</h1>
@@ -72,7 +72,7 @@
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">
<div class="flex items-center gap-x-2">
<button @click="handleUpsertRoleClick(role)"
class="flex items-center justify-center min-w-25 gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 "
class="flex items-center justify-center whitespace-nowrap gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 "
type="button">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path>
@@ -83,7 +83,7 @@
<span>编辑</span>
</button>
<button
class="flex items-center justify-center min-w-25 block gap-x-1
class="flex items-center justify-center whitespace-nowrap block gap-x-1
bg-red-700 hover:bg-red-800 focus:outline-none
focus:ring-red-500 block text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm px-5 py-2.5"
@click="handleDeleteRoleClick(role)" type="button">

View File

@@ -1,5 +1,5 @@
<template>
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['任务管理']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">任务管理</h1>

View File

@@ -1,5 +1,5 @@
<template>
<div class="grid grid-cols-1 px-4 pt-6 xl:grid-cols-3 xl:gap-4 ">
<div class="grid grid-cols-1 px-4 pt-6 xl:grid-cols-3 xl:gap-4 mt-14">
<div class="mb-4 col-span-full xl:mb-2">
<Breadcrumbs :names="['用户设置']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">用户设置</h1>

View File

@@ -1,5 +1,5 @@
<template>
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg">
<div class="px-4 pt-6 xl:grid-cols-3 xl:gap-4 sm:rounded-lg mt-14">
<div class="mb-4 col-span-full">
<Breadcrumbs :names="['用户管理']" />
<h1 class="text-xl font-semibold text-gray-900 sm:text-2xl ">用户管理</h1>
@@ -71,10 +71,10 @@
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap max-w-sm overflow-hidden text-ellipsis">
{{ user.username }}
</td>
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">
<td class="px-6 py-4 max-w-sm whitespace-nowrap overflow-hidden text-ellipsis">
{{ dayjs(user.createTime).format("llll") }}
</td>
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">
<td class="px-6 py-4 max-w-sm whitespace-nowrap overflow-hidden text-ellipsis">
<div class="flex items-center">
<div class="h-2.5 w-2.5 rounded-full me-2" :class="user.enable ? 'bg-blue-500' : 'bg-red-500'"></div> {{
user.enable === true ? "启用" : "禁用" }}
@@ -83,17 +83,17 @@
<td class="px-6 py-4 max-w-sm overflow-hidden text-ellipsis">
<div class="flex items-center gap-x-2">
<button
class="text-gray-900 bg-white border min-w-25 border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-4 py-2.5 "
class="text-gray-900 bg-white border whitespace-nowrap border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-4 py-2.5 "
@click="handleBindRoleClick(user)" type="button">
分配角色
</button>
<button
class="text-gray-900 bg-white border min-w-25 border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-4 py-2.5 "
class="text-gray-900 bg-white border whitespace-nowrap border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-4 py-2.5 "
@click="handleBindPositionClick(user)" type="button">
分配岗位
</button>
<button
class="text-gray-900 bg-white border min-w-25 border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-4 py-2.5 "
class="text-gray-900 bg-white border whitespace-nowrap border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-4 py-2.5 "
@click="handleBindDepartmentClick(user)" type="button">
分配部门
</button>
@@ -103,7 +103,7 @@
<!-- Edit Modal toggle -->
<div class="flex items-center gap-x-2">
<button @click="handleUpsertUserClick(user)"
class="flex items-center justify-center min-w-25 gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2.5 "
class="flex items-center justify-center whitespace-nowrap gap-x-1 text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2.5 "
type="button">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path>
@@ -113,7 +113,7 @@
</svg>
<span>编辑</span>
</button>
<button class="flex items-center justify-center min-w-25 gap-x-1
<button class="flex items-center justify-center whitespace-nowrap gap-x-1
bg-red-700 hover:bg-red-800 focus:outline-none focus:ring-red-300
text-white focus:ring-4 focus:outline-nonefont-medium rounded-lg text-sm px-4 py-2.5"
@click="handleDeleteUserClick(user)" type="button">