feat: improve layout shell, navigation composables and add UI assets

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-30 17:11:24 +08:00
parent d07f88ba34
commit 789f90dc1f
16 changed files with 1023 additions and 195 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
UI/AI助手.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
UI/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
UI/background_2560x1440.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
UI/login.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
UI/main_page.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
UI/发起请求.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
UI/报销.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -1,29 +1,46 @@
<template>
<!-- Login Page -->
<LoginView v-if="!loggedIn" @login="handleLogin" />
<LoginView
v-if="!loggedIn"
@login="handleLogin"
@recover-password="handleRecoverPassword"
@sso-login="handleSsoLogin"
/>
<!-- Main App -->
<div v-else class="app">
<SidebarRail
:nav-items="navItems"
:active-view="activeView"
@navigate="setView"
@open-chat="openChat"
@navigate="handleNavigate"
@open-chat="handleOpenChat"
/>
<main class="main">
<main
class="main"
:class="{
'chat-main': activeView === 'chat',
'overview-main': activeView === 'overview',
'requests-main': activeView === 'requests'
}"
>
<TopBar
:current-view="currentView"
:current-view="topBarView"
:search="search"
:active-view="activeView"
:ranges="ranges"
:active-range="activeRange"
:custom-range="customRange"
@update:search="search = $event"
@update:active-range="activeRange = $event"
@update:custom-range="customRange = $event"
@batch-approve="toast('已筛出 23 个低风险单据可进入批量通过确认')"
@open-chat="openChat"
@new-application="openNewChat"
@open-chat="handleOpenChat"
@new-application="openTravelCreate"
/>
<FilterBar
v-if="activeView !== 'chat'"
v-if="activeView !== 'chat' && activeView !== 'overview' && activeView !== 'requests'"
:compact="activeView === 'overview'"
:filters="filters"
:ranges="ranges"
@@ -31,23 +48,26 @@
@update:active-range="activeRange = $event"
/>
<DocFilterBar
v-if="activeView === 'chat'"
:doc-filters="docFilters"
:doc-months="docMonths"
:doc-types="docTypes"
:doc-statuses="docStatuses"
/>
<section class="workarea">
<section
class="workarea"
:class="{
'chat-workarea': activeView === 'chat',
'requests-workarea': activeView === 'requests'
}"
>
<OverviewView
v-if="activeView === 'overview'"
:filtered-requests="filteredRequests"
@ask="openChat"
@ask="handleOpenChat"
@approve="handleApprove"
@reject="handleReject"
/>
<TravelReimbursementCreateView
v-else-if="activeView === 'chat' && travelCreateMode"
@back-to-requests="backToRequests"
/>
<ChatView
v-else-if="activeView === 'chat'"
:documents="filteredDocuments"
@@ -61,7 +81,7 @@
@send="sendMessage"
@upload="handleUpload"
@draft="draft = $event"
@select-case="openChat"
@select-case="handleOpenChat"
@approve-case="toast(`${activeCase?.id} 已生成通过意见`)"
@reject-case="toast(`${activeCase?.id} 已转人工复核`)"
/>
@@ -69,9 +89,10 @@
<RequestsView
v-else-if="activeView === 'requests'"
:filtered-requests="filteredRequests"
@ask="openChat"
@ask="handleOpenChat"
@approve="handleApprove"
@reject="handleReject"
@create-request="openTravelCreate"
/>
<PoliciesView v-else-if="activeView === 'policies'" />
@@ -80,8 +101,9 @@
</section>
</main>
<ToastNotification :toast-text="toastText" />
</div>
<ToastNotification :toast-text="toastText" />
</template>
<script setup>
@@ -90,26 +112,37 @@ import './assets/styles/global.css'
import SidebarRail from './components/layout/SidebarRail.vue'
import TopBar from './components/layout/TopBar.vue'
import FilterBar from './components/layout/FilterBar.vue'
import DocFilterBar from './components/layout/DocFilterBar.vue'
import ToastNotification from './components/shared/ToastNotification.vue'
import LoginView from './views/LoginView.vue'
import OverviewView from './views/OverviewView.vue'
import ChatView from './views/ChatView.vue'
import TravelReimbursementCreateView from './views/TravelReimbursementCreateView.vue'
import RequestsView from './views/RequestsView.vue'
import PoliciesView from './views/PoliciesView.vue'
import AuditView from './views/AuditView.vue'
import { ref, computed, reactive } from 'vue'
import { ref, computed } from 'vue'
import { useNavigation, navItems } from './composables/useNavigation.js'
import { useRequests } from './composables/useRequests.js'
import { useChat } from './composables/useChat.js'
import { useToast } from './composables/useToast.js'
import { documents, docTypes, docStatuses, docMonths } from './data/requests.js'
import { documents } from './data/requests.js'
const loggedIn = ref(false)
const travelCreateMode = ref(false)
function handleLogin() {
loggedIn.value = true
function handleLogin(credentials) {
if (credentials.username && credentials.password) {
loggedIn.value = true
}
}
function handleRecoverPassword() {
toast('请联系系统管理员重置密码。')
}
function handleSsoLogin() {
toast('SSO 登录通道建设中。')
}
const { activeView, currentView, setView } = useNavigation()
@@ -117,19 +150,25 @@ const { requests, search, filters, ranges, activeRange, filteredRequests, approv
const { messages, draft, uploadedFiles, messageList, activeCase, prompts, sendMessage, handleUpload, openChat, openNewChat } = useChat(activeView)
const { toastText, toast } = useToast()
/* ── Document management state ── */
const docSearch = ref('')
const docFilters = reactive({ month: '2026-04', type: '全部类型', status: '全部状态' })
const customRange = ref({ start: '2024-07-06', end: '2024-07-12' })
const travelPrompts = ['帮我提交出差申请', '预订机票', '预订酒店', '预订火车票', '查询差旅政策']
const topBarView = computed(() => {
if (travelCreateMode.value) {
return {
title: '差旅报销助手',
desc: '帮你填写报销、检查材料、跟踪进度'
}
}
return currentView.value
})
const filteredDocuments = computed(() => {
const key = docSearch.value.trim().toLowerCase()
return documents.filter((doc) => {
const matchesSearch = !key || `${doc.id}${doc.applicant}${doc.destination}${doc.type}`.toLowerCase().includes(key)
const matchesType = docFilters.type === '全部类型' || doc.type === docFilters.type
const matchesStatus = docFilters.status === '全部状态' || doc.status === docFilters.status
const matchesMonth = doc.date.startsWith(docFilters.month)
return matchesSearch && matchesType && matchesStatus && matchesMonth
return matchesSearch
})
})
@@ -142,20 +181,62 @@ function handleReject(request) {
const msg = rejectRequest(request)
toast(msg)
}
function handleNavigate(view) {
travelCreateMode.value = false
setView(view)
}
function handleOpenChat(request) {
travelCreateMode.value = false
openChat(request)
}
function openTravelCreate() {
travelCreateMode.value = true
activeView.value = 'chat'
}
function backToRequests() {
travelCreateMode.value = false
activeView.value = 'requests'
}
</script>
<style scoped>
.app {
min-height: 100dvh;
display: grid;
grid-template-columns: 256px minmax(0, 1fr);
grid-template-columns: 220px minmax(0, 1fr);
background: var(--bg);
}
.main { min-width: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.main.overview-main {
grid-template-rows: auto minmax(0, 1fr);
}
.main.chat-main {
height: 100dvh;
grid-template-rows: auto minmax(0, 1fr);
overflow: hidden;
}
.main.requests-main {
height: 100dvh;
grid-template-rows: auto minmax(0, 1fr);
overflow: hidden;
}
.workarea { overflow: auto; padding: 24px; }
.workarea.chat-workarea {
min-height: 0;
overflow: hidden;
}
.workarea.requests-workarea {
min-height: 0;
overflow: hidden;
padding: 20px 24px;
}
@media (max-width: 1180px) {
.app { grid-template-columns: 236px minmax(0, 1fr); }
.app { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 760px) {
.app { display: block; }

BIN
src/assets/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@@ -71,7 +71,7 @@ const emit = defineEmits(['update:activeRange'])
.filters.compact {
display: flex;
justify-content: flex-end;
padding: 0 16px 12px;
padding: 8px 16px;
}
.filters label,
@@ -98,32 +98,39 @@ const emit = defineEmits(['update:activeRange'])
.segmented {
align-self: end;
display: inline-grid;
grid-auto-flow: column;
gap: 8px;
min-height: 30px;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
display: inline-flex;
gap: 0;
min-height: 40px;
padding: 3px;
border-radius: 10px;
background: #f1f5f9;
}
.segmented button {
min-height: 30px;
padding: 0 12px;
border: 1px solid #cbd5e1;
border-radius: 6px;
background: #fff;
color: #334155;
position: relative;
min-height: 34px;
padding: 0 20px;
border: none;
border-radius: 8px;
background: transparent;
color: #64748b;
font-size: 14px;
font-weight: 400;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
}
.segmented button:hover:not(.active) {
color: #334155;
background: rgba(255, 255, 255, 0.5);
}
.segmented button.active {
background: #f1f5f9;
background: #fff;
color: #1e293b;
font-weight: 500;
box-shadow: none;
font-weight: 600;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}
@media (max-width: 980px) {

View File

@@ -1,18 +1,21 @@
<template>
<aside class="rail" aria-label="主导航">
<div class="rail-brand">
<div class="brand-mark"></div>
<div class="brand-copy">
<strong>星海科技</strong>
<div class="brand-mark" aria-hidden="true">
<svg viewBox="0 0 36 36">
<path d="M19.8 4.5c5.7 1.1 9.9 5.7 10.5 11.6-2.8-.9-5.5-.7-7.9.6-2.8 1.5-4.5 4.3-5.2 8.2-4.4-2.8-6.5-6.5-6.3-11.1.2-4.2 3.5-7.8 8.9-9.3Z" />
<path d="M9 7.6c-3 3.5-4 7.3-2.9 11.2 1.2 4.2 4.6 7 10.1 8.5-2 1.8-4.6 2.6-7.6 2.3C5.1 26.7 3.5 23.1 3.7 19 4 14.4 5.7 10.6 9 7.6Z" />
</svg>
</div>
<button class="brand-toggle" type="button" aria-label="打开合规对话" @click="emit('openChat')">
<i class="pi pi-angle-left"></i>
<strong class="brand-name">星海科技</strong>
<button class="brand-toggle" type="button" aria-label="打开 AI 助手" @click="emit('openChat')">
<i class="pi pi-angle-double-left"></i>
</button>
</div>
<nav class="rail-nav">
<nav class="rail-nav" aria-label="功能导航">
<button
v-for="item in navItems"
v-for="item in decoratedNavItems"
:key="item.id"
class="nav-btn"
:class="{ active: activeView === item.id }"
@@ -20,30 +23,47 @@
@click="emit('navigate', item.id)"
>
<span class="nav-icon" v-html="item.icon"></span>
<span class="nav-copy">
<strong>{{ item.label }}</strong>
</span>
<span class="nav-label">{{ item.displayLabel }}</span>
<span v-if="item.badge" class="nav-badge">{{ item.badge }}</span>
</button>
</nav>
<div class="rail-user">
<div class="user-avatar"></div>
<div class="user-copy">
<button class="rail-user" type="button" aria-label="打开用户菜单">
<span class="user-avatar"></span>
<span class="user-copy">
<strong>张晓明</strong>
<span>财务管理员</span>
</div>
</span>
<i class="pi pi-angle-down"></i>
</div>
</button>
</aside>
</template>
<script setup>
defineProps({
import { computed } from 'vue'
const props = defineProps({
navItems: { type: Array, required: true },
activeView: { type: String, required: true }
})
const emit = defineEmits(['navigate', 'openChat'])
const sidebarMeta = {
overview: { label: '总览' },
requests: { label: '差旅申请/报销' },
chat: { label: 'AI助手' },
policies: { label: '政策规则' },
audit: { label: '审计追踪' }
}
const decoratedNavItems = computed(() =>
props.navItems.map((item) => ({
...item,
displayLabel: sidebarMeta[item.id]?.label ?? item.label,
badge: sidebarMeta[item.id]?.badge
}))
)
</script>
<style scoped>
@@ -53,120 +73,117 @@ const emit = defineEmits(['navigate', 'openChat'])
height: 100dvh;
display: grid;
grid-template-rows: auto 1fr auto;
gap: 0;
padding: 0;
background: #fff;
border-right: 1px solid var(--line);
background:
linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,250,.96)),
#fff;
border-right: 1px solid #dbe4ee;
box-shadow: 1px 0 0 rgba(15,23,42,.02);
z-index: 20;
}
.rail-brand,
.rail-user {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 8px;
}
.rail-brand {
padding: 16px;
border-bottom: 1px solid var(--line);
min-height: 86px;
display: grid;
grid-template-columns: 32px minmax(0, 1fr) 28px;
align-items: center;
gap: 10px;
padding: 22px 20px 18px;
}
.brand-mark,
.user-avatar {
width: 42px;
height: 42px;
.brand-mark {
width: 30px;
height: 30px;
display: grid;
place-items: center;
border-radius: 6px;
background: var(--primary);
color: #fff;
font-size: 16px;
font-weight: 700;
color: #07936f;
}
.user-avatar {
width: 32px;
height: 32px;
border-radius: 999px;
background: #e2f6ef;
color: #047857;
.brand-mark svg {
width: 30px;
height: 30px;
fill: currentColor;
}
.brand-copy,
.user-copy,
.nav-copy {
.brand-name {
min-width: 0;
display: grid;
}
.brand-copy strong,
.user-copy strong,
.nav-copy strong {
color: var(--ink);
font-size: 14px;
}
.user-copy span,
.nav-copy small {
margin-top: 2px;
color: var(--muted);
font-size: 12px;
line-height: 1.3;
color: #0f172a;
font-size: 16px;
font-weight: 800;
letter-spacing: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.brand-toggle {
width: 28px;
min-height: 28px;
height: 28px;
display: grid;
place-items: center;
border: 0;
border-radius: 6px;
border-radius: 7px;
background: transparent;
color: #94a3b8;
color: #718096;
transition: background 180ms var(--ease), color 180ms var(--ease);
}
.brand-toggle:hover {
background: #eef7f4;
color: #07936f;
}
.rail-nav {
display: grid;
gap: 4px;
align-content: start;
padding: 16px 12px;
gap: 14px;
padding: 16px 20px;
overflow-y: auto;
}
.nav-btn {
width: 100%;
min-height: 42px;
min-height: 48px;
display: grid;
grid-template-columns: auto 1fr;
grid-template-columns: 28px minmax(0, 1fr) auto;
align-items: center;
gap: 12px;
padding: 0 12px;
border: 1px solid transparent;
border-radius: 6px;
border-radius: 8px;
background: transparent;
color: #475569;
color: #64748b;
text-align: left;
transition: background 160ms var(--ease), color 160ms var(--ease);
transition:
background 180ms var(--ease),
border-color 180ms var(--ease),
color 180ms var(--ease),
box-shadow 180ms var(--ease);
}
.nav-btn:hover {
background: rgba(16,185,129,.07);
color: #0f9f78;
}
.nav-btn:hover,
.nav-btn.active {
background: rgba(16,185,129,.10);
color: var(--primary);
background: linear-gradient(90deg, rgba(16,185,129,.16), rgba(16,185,129,.08));
border-color: rgba(16,185,129,.10);
color: #059669;
box-shadow: inset 3px 0 0 #10b981;
}
.nav-icon {
width: 20px;
height: 20px;
width: 28px;
height: 28px;
display: grid;
place-items: center;
border-radius: 7px;
color: currentColor;
}
.nav-btn :deep(svg) {
width: 16px;
height: 16px;
width: 19px;
height: 19px;
stroke: currentColor;
stroke-width: 2;
fill: none;
@@ -174,43 +191,130 @@ const emit = defineEmits(['navigate', 'openChat'])
stroke-linejoin: round;
}
.nav-label {
min-width: 0;
color: currentColor;
font-size: 14px;
font-weight: 750;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.nav-badge {
min-width: 34px;
height: 22px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 8px;
border-radius: 999px;
background: #ff5b67;
color: #fff;
font-size: 12px;
font-weight: 800;
line-height: 1;
}
.rail-user {
padding: 16px;
border-top: 1px solid var(--line);
background: #fff;
min-width: 0;
min-height: 74px;
display: grid;
grid-template-columns: 38px minmax(0, 1fr) 22px;
align-items: center;
gap: 10px;
margin: 0;
padding: 16px 20px 18px;
border: 0;
border-top: 1px solid transparent;
background: transparent;
color: #64748b;
text-align: left;
transition: background 180ms var(--ease), border-color 180ms var(--ease);
}
.rail-user:hover {
border-top-color: #e2e8f0;
background: rgba(255,255,255,.72);
}
.user-avatar {
width: 36px;
height: 36px;
display: grid;
place-items: center;
border: 2px solid #fff;
border-radius: 999px;
background: linear-gradient(135deg, #0f9f78, #65d6b4);
box-shadow: 0 6px 14px rgba(15,159,120,.18);
color: #fff;
font-size: 14px;
font-weight: 800;
}
.user-copy {
min-width: 0;
display: grid;
gap: 2px;
}
.user-copy strong {
color: #334155;
font-size: 14px;
font-weight: 750;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-copy span {
color: #64748b;
font-size: 12px;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.rail-user .pi {
color: var(--muted);
justify-self: end;
color: #718096;
font-size: 13px;
}
@media (max-width: 980px) {
.rail {
position: relative;
height: auto;
gap: 14px;
}
.rail-nav {
grid-auto-flow: row;
}
}
@media (max-width: 760px) {
.rail {
border-right: 0;
border-bottom: 1px solid var(--line);
padding: 14px;
border-bottom: 1px solid #dbe4ee;
}
.rail-brand {
min-height: 68px;
padding: 16px;
}
.rail-nav {
display: flex;
gap: 10px;
padding: 8px 16px 16px;
overflow-x: auto;
padding-bottom: 2px;
}
.nav-btn {
min-width: 190px;
min-width: 148px;
}
.rail-user {
display: none;
}
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<header class="topbar">
<header class="topbar" :class="{ 'chat-mode': isChat }">
<div class="title-group">
<div class="eyebrow">Smart Expense Operations</div>
<h1>{{ currentView.title }}</h1>
@@ -7,24 +7,128 @@
</div>
<div class="top-actions">
<span class="search-wrap">
<span v-if="isChat || !isOverview" class="search-wrap" :class="{ wide: isChat }">
<i class="pi pi-search search-icon"></i>
<input :value="search" type="search" :placeholder="isChat ? '搜索单号、申请人、目的地' : '搜索申请人、单号、费用类型'" @input="emit('update:search', $event.target.value)" />
<input
:value="search"
type="search"
:placeholder="isChat ? '搜索报销单、发票、单号、部门...' : '搜索申请人、单号、费用类型...'"
@input="emit('update:search', $event.target.value)"
/>
</span>
<div v-if="!isChat" class="date-chip">
<i class="pi pi-calendar"></i>
<span>2024-07-06 ~ 2024-07-12</span>
</div>
<template v-if="isChat">
<button class="top-btn primary" type="button" @click="emit('newApplication')">
<i class="pi pi-plus"></i>
<span>新建出差申请</span>
<button class="icon-btn notification" type="button" aria-label="查看通知">
<i class="pi pi-bell"></i>
<span>1</span>
</button>
<button class="profile-btn" type="button" aria-label="打开用户菜单">
<span class="profile-avatar"></span>
<span class="profile-copy">
<strong>张晓明</strong>
<small>财务管理员</small>
</span>
<i class="pi pi-angle-down"></i>
</button>
</template>
<template v-else>
<button class="top-btn primary" type="button" @click="emit('openChat')">
<div v-if="isOverview" class="range-combo" aria-label="首页时间范围">
<div class="range-shell">
<span class="range-meta">
<i class="pi pi-calendar"></i>
<span>{{ activeDateLabel }}</span>
</span>
<div class="range-tabs" role="tablist" aria-label="时间范围">
<button
v-for="option in rangeOptions"
:key="option.value"
type="button"
role="tab"
:aria-selected="activeRange === option.value"
:class="{ active: activeRange === option.value }"
@click="setRange(option.value)"
>
{{ option.label }}
</button>
</div>
</div>
<div class="custom-range-wrap">
<button
class="custom-range-btn"
type="button"
:class="{ active: isCustomRange }"
:aria-expanded="calendarOpen"
aria-haspopup="dialog"
@click="calendarOpen = !calendarOpen"
>
<i class="pi pi-calendar-plus"></i>
<span>选择时间段</span>
</button>
<div v-if="calendarOpen" class="calendar-popover" role="dialog" aria-label="选择看板时间段">
<header>
<strong>选择看板时间段</strong>
<button type="button" aria-label="关闭日期选择" @click="calendarOpen = false">
<i class="pi pi-times"></i>
</button>
</header>
<div class="date-fields">
<label>
<span>开始日期</span>
<input v-model="draftStart" type="date" />
</label>
<label>
<span>结束日期</span>
<input v-model="draftEnd" type="date" />
</label>
</div>
<div class="quick-presets" aria-label="快捷时间段">
<button type="button" @click="applyDraft('2024-07-12', '2024-07-12')">今日</button>
<button type="button" @click="applyDraft('2024-07-06', '2024-07-12')">本周</button>
<button type="button" @click="applyDraft('2024-07-01', '2024-07-31')">本月</button>
</div>
<footer>
<button class="ghost-btn" type="button" @click="calendarOpen = false">取消</button>
<button class="apply-btn" type="button" :disabled="!canApplyCustomRange" @click="applyCustomRange">
应用
</button>
</footer>
</div>
</div>
</div>
<template v-else-if="isRequests">
<button class="month-chip" type="button" aria-label="选择报销月份">
<i class="pi pi-calendar"></i>
<span>2024-07</span>
<i class="pi pi-angle-down"></i>
</button>
<button class="icon-btn notification" type="button" aria-label="查看通知">
<i class="pi pi-bell"></i>
<span>3</span>
</button>
<button class="profile-btn" type="button" aria-label="打开用户菜单">
<span class="profile-avatar"></span>
<span class="profile-copy">
<strong>张晓明</strong>
<small>财务管理员</small>
</span>
<i class="pi pi-angle-down"></i>
</button>
</template>
<div v-else class="date-chip">
<i class="pi pi-calendar"></i>
<span>2024-07-06 ~ 2024-07-12</span>
</div>
<button v-if="!isRequests" class="top-btn primary" type="button" @click="emit('openChat')">
<i class="pi pi-sparkles"></i>
<span>AI 助手</span>
</button>
@@ -34,46 +138,151 @@
</template>
<script setup>
import { computed } from 'vue'
import { computed, ref, watch } from 'vue'
const props = defineProps({
currentView: { type: Object, required: true },
search: { type: String, default: '' },
activeView: { type: String, default: '' }
activeView: { type: String, default: '' },
ranges: { type: Array, default: () => [] },
activeRange: { type: String, default: '' },
customRange: {
type: Object,
default: () => ({ start: '2024-07-06', end: '2024-07-12' })
}
})
const emit = defineEmits(['update:search', 'batchApprove', 'openChat', 'newApplication'])
const emit = defineEmits([
'update:search',
'update:activeRange',
'update:customRange',
'batchApprove',
'openChat',
'newApplication'
])
const isChat = computed(() => props.activeView === 'chat')
const isOverview = computed(() => props.activeView === 'overview')
const isRequests = computed(() => props.activeView === 'requests')
const calendarOpen = ref(false)
const draftStart = ref(props.customRange.start)
const draftEnd = ref(props.customRange.end)
const fallbackRangeLabels = ['今日', '本周', '本月']
const dateLabels = {
'今日': '2024-07-12',
'本周': '2024-07-06 ~ 2024-07-12',
'本月': '2024-07'
}
const rangeOptions = computed(() =>
props.ranges.map((range, index) => ({
value: range,
label: fallbackRangeLabels[index] ?? String(range)
}))
)
const activeOption = computed(() =>
rangeOptions.value.find((option) => option.value === props.activeRange) ?? rangeOptions.value[0]
)
const isCustomRange = computed(() => props.activeRange === 'custom')
const activeDateLabel = computed(() => {
if (isCustomRange.value) return formatRangeLabel(props.customRange.start, props.customRange.end)
return dateLabels[activeOption.value?.label] ?? '2024-07-06 ~ 2024-07-12'
})
const canApplyCustomRange = computed(() =>
Boolean(draftStart.value && draftEnd.value && draftStart.value <= draftEnd.value)
)
watch(
() => props.customRange,
(range) => {
draftStart.value = range.start
draftEnd.value = range.end
},
{ deep: true }
)
function setRange(range) {
emit('update:activeRange', range)
calendarOpen.value = false
}
function applyDraft(start, end) {
draftStart.value = start
draftEnd.value = end
}
function applyCustomRange() {
if (!canApplyCustomRange.value) return
emit('update:customRange', { start: draftStart.value, end: draftEnd.value })
emit('update:activeRange', 'custom')
calendarOpen.value = false
}
function formatRangeLabel(start, end) {
if (!start || !end) return '选择时间段'
if (start === end) return start
return `${start} ~ ${end}`
}
</script>
<style scoped>
.topbar {
display: flex;
align-items: flex-start;
align-items: center;
justify-content: space-between;
gap: 24px;
padding: 16px;
padding: 18px 24px 20px;
background: #fff;
}
.topbar.chat-mode {
padding-bottom: 16px;
border-bottom: 1px solid #eef2f7;
}
.title-group {
min-width: 0;
}
.eyebrow {
display: inline-block;
margin-bottom: 8px;
padding: 3px 10px;
border-radius: 6px;
background: linear-gradient(135deg, rgba(16, 185, 129, 0.10), rgba(59, 130, 246, 0.10));
color: #0d9668;
font-size: 11px;
font-weight: 800;
letter-spacing: 1.2px;
text-transform: uppercase;
}
.topbar h1 {
color: #0f172a;
font-size: 26px;
font-weight: 800;
letter-spacing: 0;
line-height: 1.2;
}
.topbar p {
margin-top: 4px;
margin-top: 6px;
max-width: 720px;
color: var(--muted);
color: #64748b;
font-size: 14px;
line-height: 1.45;
line-height: 1.5;
}
.top-actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 16px;
gap: 14px;
flex-wrap: wrap;
}
@@ -82,31 +291,277 @@ const isChat = computed(() => props.activeView === 'chat')
width: 256px;
}
.search-wrap.wide {
width: min(340px, 28vw);
}
.search-icon {
position: absolute;
left: 13px;
left: 14px;
top: 50%;
transform: translateY(-50%);
color: var(--muted);
font-size: 14px;
color: #64748b;
font-size: 15px;
}
.search-wrap input {
width: 100%;
height: 40px;
padding: 0 14px 0 38px;
border: 1px solid #cbd5e1;
border-radius: 6px;
height: 42px;
padding: 0 14px 0 40px;
border: 1px solid #d7e0ea;
border-radius: 8px;
background: #fff;
color: #0f172a;
font-size: 14px;
transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-wrap input::placeholder {
color: #8da0b4;
}
.search-wrap input:focus {
border-color: #10b981;
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.16);
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
outline: none;
}
.range-combo {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
}
.range-shell {
height: 42px;
display: inline-flex;
align-items: center;
padding: 3px;
border: 1px solid #d7e0ea;
border-radius: 10px;
background: #fff;
box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.range-meta {
height: 34px;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0 12px;
border-right: 1px solid #e2e8f0;
color: #334155;
font-size: 13px;
font-weight: 650;
white-space: nowrap;
}
.range-meta .pi {
color: #10b981;
}
.range-tabs {
display: inline-flex;
align-items: center;
gap: 2px;
padding-left: 3px;
}
.range-tabs button {
height: 34px;
min-width: 54px;
padding: 0 14px;
border: 0;
border-radius: 8px;
background: transparent;
color: #64748b;
font-size: 13px;
font-weight: 700;
white-space: nowrap;
transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.range-tabs button:hover:not(.active) {
background: #f1f5f9;
color: #334155;
}
.range-tabs button.active {
background: #10b981;
color: #fff;
box-shadow: 0 6px 14px rgba(16, 185, 129, .18);
}
.custom-range-wrap {
position: relative;
}
.custom-range-btn {
height: 42px;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 0 13px;
border: 1px solid #d7e0ea;
border-radius: 10px;
background: #fff;
color: #334155;
font-size: 13px;
font-weight: 750;
white-space: nowrap;
transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.custom-range-btn:hover,
.custom-range-btn.active {
border-color: rgba(16, 185, 129, .34);
background: #f6fffb;
color: #0f9f78;
}
.custom-range-btn.active {
box-shadow: 0 0 0 3px rgba(16, 185, 129, .10);
}
.calendar-popover {
position: absolute;
top: calc(100% + 10px);
right: 0;
width: 336px;
z-index: 40;
display: grid;
gap: 14px;
padding: 16px;
border: 1px solid #d7e0ea;
border-radius: 12px;
background: #fff;
box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}
.calendar-popover::before {
content: "";
position: absolute;
top: -6px;
right: 30px;
width: 12px;
height: 12px;
border-top: 1px solid #d7e0ea;
border-left: 1px solid #d7e0ea;
background: #fff;
transform: rotate(45deg);
}
.calendar-popover header,
.calendar-popover footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.calendar-popover header strong {
color: #0f172a;
font-size: 15px;
}
.calendar-popover header button {
width: 30px;
height: 30px;
display: grid;
place-items: center;
border: 0;
border-radius: 8px;
background: transparent;
color: #64748b;
}
.calendar-popover header button:hover {
background: #f1f5f9;
color: #0f172a;
}
.date-fields {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.date-fields label {
display: grid;
gap: 6px;
}
.date-fields span {
color: #64748b;
font-size: 12px;
font-weight: 700;
}
.date-fields input {
width: 100%;
height: 38px;
padding: 0 9px;
border: 1px solid #d7e0ea;
border-radius: 8px;
color: #0f172a;
font-size: 13px;
}
.date-fields input:focus {
border-color: #10b981;
box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
outline: none;
}
.quick-presets {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
.quick-presets button {
height: 34px;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #f8fafc;
color: #334155;
font-size: 13px;
font-weight: 700;
}
.quick-presets button:hover {
border-color: rgba(16, 185, 129, .28);
background: #ecfdf5;
color: #0f9f78;
}
.ghost-btn,
.apply-btn {
height: 36px;
padding: 0 14px;
border-radius: 8px;
font-size: 13px;
font-weight: 750;
}
.ghost-btn {
border: 1px solid #d7e0ea;
background: #fff;
color: #334155;
}
.apply-btn {
border: 0;
background: #10b981;
color: #fff;
}
.apply-btn:disabled {
cursor: not-allowed;
background: #cbd5e1;
}
.date-chip {
height: 40px;
display: inline-flex;
@@ -121,6 +576,29 @@ const isChat = computed(() => props.activeView === 'chat')
font-weight: 400;
}
.month-chip {
height: 42px;
display: inline-flex;
align-items: center;
gap: 9px;
padding: 0 14px;
border: 1px solid #d7e0ea;
border-radius: 8px;
background: #fff;
color: #334155;
font-size: 14px;
font-weight: 750;
}
.month-chip .pi:first-child {
color: #64748b;
}
.month-chip:hover {
border-color: rgba(16, 185, 129, .32);
color: #0f9f78;
}
.date-chip .pi {
color: #94a3b8;
}
@@ -134,7 +612,7 @@ const isChat = computed(() => props.activeView === 'chat')
border: 0;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
font-weight: 650;
transition: background 160ms ease;
}
@@ -147,17 +625,174 @@ const isChat = computed(() => props.activeView === 'chat')
background: #0ea672;
}
@media (max-width: 760px) {
.icon-btn,
.profile-btn {
border: 0;
background: transparent;
}
.icon-btn {
position: relative;
width: 42px;
height: 42px;
display: grid;
place-items: center;
border-radius: 999px;
color: #334155;
font-size: 20px;
}
.icon-btn:hover,
.profile-btn:hover {
background: #f3f7fa;
}
.notification span {
position: absolute;
top: 4px;
right: 5px;
min-width: 18px;
height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
border: 2px solid #fff;
border-radius: 999px;
background: #ff3b45;
color: #fff;
font-size: 11px;
font-weight: 800;
line-height: 1;
}
.profile-btn {
min-height: 46px;
display: inline-grid;
grid-template-columns: 38px minmax(0, 1fr) 18px;
align-items: center;
gap: 10px;
padding: 4px 6px;
border-radius: 10px;
color: #334155;
text-align: left;
}
.profile-avatar {
width: 38px;
height: 38px;
display: grid;
place-items: center;
border-radius: 999px;
background: linear-gradient(135deg, #203047, #60758a);
color: #fff;
font-size: 14px;
font-weight: 800;
}
.profile-copy {
display: grid;
gap: 2px;
}
.profile-copy strong {
color: #172033;
font-size: 14px;
font-weight: 800;
}
.profile-copy small {
color: #64748b;
font-size: 12px;
}
.profile-btn .pi {
color: #64748b;
}
@media (max-width: 1120px) {
.range-combo {
width: 100%;
justify-content: flex-end;
}
}
@media (max-width: 960px) {
.topbar {
flex-direction: column;
align-items: stretch;
padding: 18px 16px;
}
.top-actions,
.search-wrap,
.date-chip {
.search-wrap.wide,
.date-chip,
.month-chip,
.top-btn {
width: 100%;
}
.range-combo {
justify-content: stretch;
}
.range-shell {
flex: 1;
}
.range-meta {
flex: 1;
}
.custom-range-btn {
width: 100%;
justify-content: center;
}
.calendar-popover {
right: auto;
left: 0;
}
.profile-btn {
justify-content: start;
}
}
@media (max-width: 640px) {
.range-combo {
display: grid;
gap: 8px;
}
.range-shell {
height: auto;
display: grid;
gap: 4px;
}
.range-meta {
width: 100%;
border-right: 0;
border-bottom: 1px solid #e2e8f0;
justify-content: center;
}
.range-tabs {
width: 100%;
padding-left: 0;
}
.range-tabs button {
flex: 1;
padding: 0 8px;
}
.calendar-popover {
width: min(336px, calc(100vw - 32px));
}
.date-fields {
grid-template-columns: 1fr;
}
}
</style>

View File

@@ -11,20 +11,20 @@ export const navItems = [
desc: '面向财务共享中心的审批、风控、SLA与自动化运营看板'
},
{
id: 'chat',
label: '审批中心',
navHint: 'AI 助手与单据处理',
icon: icons.message,
title: '单据管理中心',
desc: '管理出差申请、报销单据AI 辅助发起申请与智能审核。'
id: 'requests',
label: '差旅申请/报销',
navHint: '差旅单据与发起申请',
icon: icons.list,
title: '差旅申请/报销',
desc: '查看员工差旅报销单据、跟踪进度、发起申请'
},
{
id: 'requests',
label: '报销单',
navHint: '待审队列与风险处理',
icon: icons.list,
title: '报销申请队列',
desc: '按风险、补件状态和 AI 建议处理待审单据。'
id: 'chat',
label: 'AI助手',
navHint: '指标、趋势与行动建议',
icon: icons.message,
title: 'AI 财务助手',
desc: '问指标、看趋势、拿建议,辅助你处理当前报销运营工作'
},
{
id: 'policies',

View File

@@ -23,9 +23,10 @@ export function useRequests() {
|| (filters.risk === '高风险' && item.status === 'danger')
|| (filters.risk === '需解释' && item.status === 'warning')
|| (filters.risk === '低风险' && item.status === 'success')
const matchesRange = activeRange.value === '本月'
|| (activeRange.value === '本周' && item.range !== '本月')
|| (activeRange.value === '今日' && item.range === '今日')
const matchesRange = activeRange.value === 'custom'
|| activeRange.value === '本月'
|| (activeRange.value === '本周' && item.range !== '本月')
|| (activeRange.value === '今日' && item.range === '今日')
return matchesSearch && matchesEntity && matchesCategory && matchesRisk && matchesRange
})
})