2026-05-09 03:04:09 +00:00
|
|
|
|
<template>
|
|
|
|
|
|
<header class="topbar" :class="{ 'chat-mode': isChat }">
|
|
|
|
|
|
<div class="title-group">
|
2026-05-30 15:46:51 +08:00
|
|
|
|
<div class="eyebrow">{{ eyebrowLabel }}</div>
|
2026-05-09 03:04:09 +00:00
|
|
|
|
<h1>{{ currentView.title }}</h1>
|
|
|
|
|
|
<p>{{ currentView.desc }}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="top-actions">
|
2026-05-20 21:00:47 +08:00
|
|
|
|
<template v-if="isChat">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div v-for="kpi in chatKpis" :key="kpi.label" class="kpi-chip" :style="{ '--chip-color': kpi.color }">
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>{{ kpi.unit }}</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.meta }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else-if="isOverview">
|
2026-05-09 03:04:09 +00:00
|
|
|
|
<div class="range-combo" aria-label="首页时间范围">
|
|
|
|
|
|
<div class="range-shell">
|
|
|
|
|
|
<span class="range-meta">
|
|
|
|
|
|
<i class="mdi mdi-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>
|
|
|
|
|
|
|
2026-05-30 15:46:51 +08:00
|
|
|
|
<div class="custom-range-wrap">
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="custom-range-btn"
|
|
|
|
|
|
type="button"
|
2026-05-09 03:04:09 +00:00
|
|
|
|
:class="{ active: isCustomRange }"
|
|
|
|
|
|
:aria-expanded="calendarOpen"
|
|
|
|
|
|
aria-haspopup="dialog"
|
|
|
|
|
|
@click="calendarOpen = !calendarOpen"
|
|
|
|
|
|
>
|
|
|
|
|
|
<i class="mdi mdi-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="mdi mdi-close"></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>
|
|
|
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
|
|
|
<button class="ghost-btn" type="button" @click="calendarOpen = false">取消</button>
|
|
|
|
|
|
<button class="apply-btn" type="button" :disabled="!canApplyCustomRange" @click="applyCustomRange">
|
|
|
|
|
|
应用
|
|
|
|
|
|
</button>
|
2026-05-30 15:46:51 +08:00
|
|
|
|
</footer>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="dashboard-switch-wrap">
|
|
|
|
|
|
<EnterpriseSelect
|
|
|
|
|
|
v-model="overviewDashboardValue"
|
|
|
|
|
|
class="dashboard-switch-select"
|
|
|
|
|
|
:options="overviewDashboardOptions"
|
|
|
|
|
|
aria-label="选择看板类型"
|
|
|
|
|
|
size="default"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-05-29 09:44:03 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else-if="isRequestDetail">
|
|
|
|
|
|
<div class="detail-topbar-actions">
|
|
|
|
|
|
<div v-if="detailKpis.length" class="kpi-chips detail-kpi-chips">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="kpi in detailKpis"
|
|
|
|
|
|
:key="kpi.label"
|
|
|
|
|
|
class="kpi-chip detail-kpi-chip"
|
|
|
|
|
|
:style="{ '--chip-color': kpi.color }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>{{ kpi.unit }}</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.meta }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="detailAlerts.length" class="detail-alert-strip">
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-for="alert in detailAlerts"
|
|
|
|
|
|
:key="alert.label"
|
|
|
|
|
|
class="detail-alert-pill"
|
|
|
|
|
|
:class="alert.tone"
|
|
|
|
|
|
>
|
|
|
|
|
|
<i :class="alert.icon || 'mdi mdi-alert-circle-outline'"></i>
|
|
|
|
|
|
<span>{{ alert.label }}</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2026-05-20 21:00:47 +08:00
|
|
|
|
|
|
|
|
|
|
<template v-else-if="isWorkbench">
|
2026-05-28 12:09:49 +08:00
|
|
|
|
<div class="topbar-toolset" aria-label="工作台快捷工具">
|
|
|
|
|
|
<button class="topbar-icon-btn notification-btn" type="button" aria-label="通知">
|
|
|
|
|
|
<i class="mdi mdi-bell-outline"></i>
|
|
|
|
|
|
<span v-if="topbarNotificationCount" class="notification-badge">{{ topbarNotificationCount }}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<button class="topbar-icon-btn" type="button" aria-label="帮助">
|
|
|
|
|
|
<i class="mdi mdi-help-circle-outline"></i>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
|
|
<button class="company-switcher" type="button" aria-label="切换公司">
|
|
|
|
|
|
<span>{{ displayCompanyName }}</span>
|
|
|
|
|
|
<i class="mdi mdi-chevron-down"></i>
|
|
|
|
|
|
</button>
|
2026-05-20 21:00:47 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-05-24 21:44:17 +08:00
|
|
|
|
<template v-else-if="isDocuments">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div v-for="kpi in documentKpis" :key="kpi.label" class="kpi-chip" :style="{ '--chip-color': kpi.color }">
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>单</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.delta }} <i :class="kpi.arrow"></i></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-05-20 21:00:47 +08:00
|
|
|
|
<template v-else-if="isRequests">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div v-for="kpi in requestKpis" :key="kpi.label" class="kpi-chip" :style="{ '--chip-color': kpi.color }">
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>单</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.delta }} <i :class="kpi.arrow"></i></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-05-28 22:33:53 +08:00
|
|
|
|
<template v-else-if="showDigitalEmployeeWorkRecordKpis">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="kpi in digitalEmployeeWorkRecordKpis"
|
|
|
|
|
|
:key="kpi.label"
|
|
|
|
|
|
class="kpi-chip"
|
|
|
|
|
|
:style="{ '--chip-color': kpi.color }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>条</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.delta }} <i :class="kpi.arrow"></i></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else-if="isApproval">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div v-for="kpi in approvalKpis" :key="kpi.label" class="kpi-chip" :style="{ '--chip-color': kpi.color }">
|
2026-05-09 03:04:09 +00:00
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>{{ kpi.unit }}</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.meta }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="topbar-spacer"></div>
|
|
|
|
|
|
<button class="create-top-btn" type="button">
|
|
|
|
|
|
<i class="mdi mdi-check-circle"></i>
|
|
|
|
|
|
<span>批量通过</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-05-20 21:00:47 +08:00
|
|
|
|
<template v-else-if="isPolicies">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div v-for="kpi in knowledgeKpis" :key="kpi.label" class="kpi-chip" :style="{ '--chip-color': kpi.color }">
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}</span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span v-if="kpi.meta" class="chip-delta" :class="kpi.trend">{{ kpi.meta }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<template v-else-if="isEmployees">
|
|
|
|
|
|
<div class="kpi-chips">
|
|
|
|
|
|
<div v-for="kpi in employeeKpis" :key="kpi.label" class="kpi-chip" :style="{ '--chip-color': kpi.color }">
|
|
|
|
|
|
<span class="chip-value">{{ kpi.value }}<small>{{ kpi.unit }}</small></span>
|
|
|
|
|
|
<span class="chip-label">{{ kpi.label }}</span>
|
|
|
|
|
|
<span class="chip-delta" :class="kpi.trend">{{ kpi.meta }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</header>
|
|
|
|
|
|
</template>
|
2026-05-09 03:04:09 +00:00
|
|
|
|
|
2026-05-30 15:46:51 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
|
import { computed, ref, watch } from 'vue'
|
|
|
|
|
|
|
|
|
|
|
|
import EnterpriseSelect from '../shared/EnterpriseSelect.vue'
|
2026-05-09 03:04:09 +00:00
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
currentView: { type: Object, required: true },
|
|
|
|
|
|
search: { type: String, default: '' },
|
2026-05-20 21:00:47 +08:00
|
|
|
|
activeView: { type: String, default: '' },
|
|
|
|
|
|
ranges: { type: Array, default: () => [] },
|
|
|
|
|
|
activeRange: { type: String, default: '' },
|
|
|
|
|
|
employeeSummary: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => null
|
|
|
|
|
|
},
|
|
|
|
|
|
knowledgeSummary: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => null
|
|
|
|
|
|
},
|
2026-05-29 13:17:39 +08:00
|
|
|
|
requestSummary: {
|
2026-05-20 21:00:47 +08:00
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => null
|
|
|
|
|
|
},
|
2026-05-28 22:33:53 +08:00
|
|
|
|
documentSummary: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => null
|
|
|
|
|
|
},
|
|
|
|
|
|
digitalEmployeeSummary: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => null
|
|
|
|
|
|
},
|
2026-05-28 12:09:49 +08:00
|
|
|
|
companyName: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: ''
|
2026-05-20 21:00:47 +08:00
|
|
|
|
},
|
|
|
|
|
|
detailMode: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: false
|
|
|
|
|
|
},
|
2026-05-29 09:44:03 +08:00
|
|
|
|
detailAlerts: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => []
|
|
|
|
|
|
},
|
|
|
|
|
|
detailKpis: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => []
|
|
|
|
|
|
},
|
2026-05-30 15:46:51 +08:00
|
|
|
|
customRange: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => ({ start: '2024-07-06', end: '2024-07-12' })
|
|
|
|
|
|
},
|
|
|
|
|
|
overviewDashboard: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'finance'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits([
|
|
|
|
|
|
'update:search',
|
|
|
|
|
|
'update:activeRange',
|
|
|
|
|
|
'update:customRange',
|
|
|
|
|
|
'update:overviewDashboard',
|
|
|
|
|
|
'batchApprove',
|
|
|
|
|
|
'openChat',
|
|
|
|
|
|
'newApplication'
|
|
|
|
|
|
])
|
|
|
|
|
|
const isChat = computed(() => props.activeView === 'chat')
|
|
|
|
|
|
const isOverview = computed(() => props.activeView === 'overview')
|
|
|
|
|
|
const isWorkbench = computed(() => props.activeView === 'workbench')
|
|
|
|
|
|
const isRequestDetail = computed(() => ['requests', 'documents', 'audit', 'digitalEmployees', 'receiptFolder'].includes(props.activeView) && props.detailMode)
|
2026-05-29 13:17:39 +08:00
|
|
|
|
const isDocuments = computed(() => props.activeView === 'documents' && !props.detailMode)
|
|
|
|
|
|
const isRequests = computed(() => props.activeView === 'requests')
|
2026-05-28 22:33:53 +08:00
|
|
|
|
const isDigitalEmployees = computed(() => props.activeView === 'digitalEmployees')
|
|
|
|
|
|
const isApproval = computed(() => props.activeView === 'approval')
|
2026-05-30 15:46:51 +08:00
|
|
|
|
const isPolicies = computed(() => props.activeView === 'policies')
|
|
|
|
|
|
const isEmployees = computed(() => props.activeView === 'employees')
|
|
|
|
|
|
const eyebrowLabel = computed(() => (
|
|
|
|
|
|
String(props.currentView?.eyebrow || '').trim()
|
|
|
|
|
|
|| (isChat.value ? 'Smart Finance Q&A' : 'Smart Expense Operations')
|
|
|
|
|
|
))
|
2026-05-28 12:09:49 +08:00
|
|
|
|
const displayCompanyName = computed(() => String(props.companyName || '远光软件股份有限公司').trim() || '远光软件股份有限公司')
|
|
|
|
|
|
const topbarNotificationCount = computed(() => {
|
|
|
|
|
|
const summary = props.documentSummary ?? {}
|
|
|
|
|
|
const count = Number(summary.toProcess ?? summary.toSubmit ?? 8)
|
|
|
|
|
|
return Number.isFinite(count) && count > 0 ? Math.min(count, 99) : 0
|
2026-05-20 21:00:47 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const requestKpis = computed(() => {
|
|
|
|
|
|
const summary = props.requestSummary ?? {}
|
|
|
|
|
|
const total = Number(summary.total ?? 0)
|
|
|
|
|
|
const draft = Number(summary.draft ?? 0)
|
|
|
|
|
|
const inProgress = Number(summary.inProgress ?? 0)
|
|
|
|
|
|
const completed = Number(summary.completed ?? 0)
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '全部单据', value: total, delta: '当前', trend: 'up', arrow: 'mdi mdi-minus', color: 'var(--theme-primary)' },
|
2026-05-20 21:00:47 +08:00
|
|
|
|
{ label: '草稿', value: draft, delta: '待提交', trend: draft > 0 ? 'down' : 'up', arrow: draft > 0 ? 'mdi mdi-arrow-down' : 'mdi mdi-minus', color: '#f59e0b' },
|
|
|
|
|
|
{ label: '审批中', value: inProgress, delta: '处理中', trend: inProgress > 0 ? 'up' : 'down', arrow: inProgress > 0 ? 'mdi mdi-arrow-up' : 'mdi mdi-minus', color: '#3b82f6' },
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '已完成', value: completed, delta: '已归档', trend: 'up', arrow: 'mdi mdi-arrow-up' , color: 'var(--success)' }
|
2026-05-24 21:44:17 +08:00
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const documentKpis = computed(() => {
|
|
|
|
|
|
const summary = props.documentSummary ?? {}
|
|
|
|
|
|
const total = Number(summary.total ?? 0)
|
|
|
|
|
|
const toSubmit = Number(summary.toSubmit ?? 0)
|
|
|
|
|
|
const toProcess = Number(summary.toProcess ?? 0)
|
|
|
|
|
|
const archived = Number(summary.archived ?? 0)
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '全部单据', value: total, delta: '当前', trend: 'up', arrow: 'mdi mdi-minus', color: 'var(--theme-primary)' },
|
2026-05-24 21:44:17 +08:00
|
|
|
|
{ label: '待提交', value: toSubmit, delta: '草稿待办', trend: toSubmit > 0 ? 'down' : 'up', arrow: toSubmit > 0 ? 'mdi mdi-arrow-down' : 'mdi mdi-minus', color: '#f59e0b' },
|
|
|
|
|
|
{ label: '待我处理', value: toProcess, delta: '审批待办', trend: toProcess > 0 ? 'down' : 'up', arrow: toProcess > 0 ? 'mdi mdi-arrow-down' : 'mdi mdi-minus', color: '#3b82f6' },
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '已归档', value: archived, delta: '归档入账', trend: 'up', arrow: 'mdi mdi-arrow-up', color: 'var(--success)' }
|
2026-05-20 21:00:47 +08:00
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-28 22:33:53 +08:00
|
|
|
|
const showDigitalEmployeeWorkRecordKpis = computed(() => {
|
|
|
|
|
|
const summary = props.digitalEmployeeSummary ?? {}
|
|
|
|
|
|
return isDigitalEmployees.value && summary.section === 'workRecords'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const digitalEmployeeWorkRecordKpis = computed(() => {
|
|
|
|
|
|
const summary = props.digitalEmployeeSummary ?? {}
|
|
|
|
|
|
const total = Number(summary.total ?? 0)
|
|
|
|
|
|
const succeeded = Number(summary.succeeded ?? 0)
|
|
|
|
|
|
const failed = Number(summary.failed ?? 0)
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '日志总数',
|
|
|
|
|
|
value: total,
|
|
|
|
|
|
delta: '当前',
|
|
|
|
|
|
trend: 'up',
|
|
|
|
|
|
arrow: 'mdi mdi-minus',
|
|
|
|
|
|
color: 'var(--theme-primary)'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '成功数量',
|
|
|
|
|
|
value: succeeded,
|
|
|
|
|
|
delta: total ? `占比 ${Math.round((succeeded / total) * 100)}%` : '等待数据',
|
|
|
|
|
|
trend: 'up',
|
|
|
|
|
|
arrow: succeeded > 0 ? 'mdi mdi-arrow-up' : 'mdi mdi-minus',
|
|
|
|
|
|
color: 'var(--success)'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '失败数量',
|
|
|
|
|
|
value: failed,
|
|
|
|
|
|
delta: failed > 0 ? '需要关注' : '暂无失败',
|
|
|
|
|
|
trend: failed > 0 ? 'down' : 'up',
|
|
|
|
|
|
arrow: failed > 0 ? 'mdi mdi-arrow-down' : 'mdi mdi-minus',
|
|
|
|
|
|
color: '#ef4444'
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const chatKpis = [
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '今日已问数', value: 86, unit: '次', meta: '较昨日 +18', trend: 'up', color: 'var(--theme-primary)' },
|
2026-05-09 03:04:09 +00:00
|
|
|
|
{ label: '已解决问题', value: 72, unit: '条', meta: '解决率 83.7%', trend: 'up', color: '#3b82f6' },
|
|
|
|
|
|
{ label: '知识命中率', value: '92.3', unit: '%', meta: '较昨日 +2.6%', trend: 'up', color: '#8b5cf6' },
|
|
|
|
|
|
{ label: '平均响应时长', value: 2.1, unit: 's', meta: '较昨日 -0.3s', trend: 'down', color: '#f59e0b' }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
const approvalKpis = [
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '待审批单据', value: 12, unit: '单', meta: '较昨日 +3', trend: 'up', color: 'var(--theme-primary)' },
|
2026-05-09 03:04:09 +00:00
|
|
|
|
{ label: '高风险单据', value: 4, unit: '单', meta: '较昨日 +1', trend: 'up', color: '#ef4444' },
|
|
|
|
|
|
{ label: '即将超时', value: 3, unit: '单', meta: '30 分钟内', trend: 'down', color: '#f59e0b' },
|
2026-05-27 09:17:57 +08:00
|
|
|
|
{ label: '今日已处理', value: 28, unit: '单', meta: '通过率 86%', trend: 'up', color: 'var(--success)' }
|
2026-05-09 03:04:09 +00:00
|
|
|
|
]
|
|
|
|
|
|
|
2026-05-20 21:00:47 +08:00
|
|
|
|
const knowledgeKpis = computed(() => {
|
|
|
|
|
|
const summary = props.knowledgeSummary ?? {}
|
|
|
|
|
|
const totalDocuments = Number(summary.totalDocuments ?? 0)
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '文档总数',
|
|
|
|
|
|
value: String(totalDocuments),
|
|
|
|
|
|
meta: '',
|
|
|
|
|
|
trend: 'up',
|
2026-05-27 09:17:57 +08:00
|
|
|
|
color: 'var(--theme-primary)'
|
2026-05-20 21:00:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const employeeKpis = computed(() => {
|
|
|
|
|
|
const summary = props.employeeSummary ?? {}
|
|
|
|
|
|
const total = Number(summary.total ?? 0)
|
|
|
|
|
|
const active = Number(summary.active ?? 0)
|
|
|
|
|
|
const onboarding = Number(summary.onboarding ?? 0)
|
|
|
|
|
|
const disabled = Number(summary.disabled ?? 0)
|
|
|
|
|
|
const followUp = Number(summary.followUp ?? 0)
|
|
|
|
|
|
const departments = Number(summary.departments ?? 0)
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '员工总数',
|
|
|
|
|
|
value: total,
|
|
|
|
|
|
unit: '人',
|
|
|
|
|
|
meta: `覆盖 ${departments} 个部门`,
|
|
|
|
|
|
trend: 'up',
|
2026-05-27 09:17:57 +08:00
|
|
|
|
color: 'var(--theme-primary)'
|
2026-05-20 21:00:47 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '在职账号',
|
|
|
|
|
|
value: active,
|
|
|
|
|
|
unit: '人',
|
|
|
|
|
|
meta: total ? `占比 ${Math.round((active / total) * 100)}%` : '等待数据',
|
|
|
|
|
|
trend: 'up',
|
|
|
|
|
|
color: '#3b82f6'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '待处理状态',
|
|
|
|
|
|
value: onboarding + disabled,
|
|
|
|
|
|
unit: '人',
|
|
|
|
|
|
meta: `试用 ${onboarding} / 停用 ${disabled}`,
|
|
|
|
|
|
trend: onboarding + disabled > 0 ? 'down' : 'up',
|
|
|
|
|
|
color: '#f59e0b'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '同步待处理',
|
|
|
|
|
|
value: followUp,
|
|
|
|
|
|
unit: '人',
|
|
|
|
|
|
meta: followUp > 0 ? '存在待同步账号' : '资料已同步',
|
|
|
|
|
|
trend: followUp > 0 ? 'down' : 'up',
|
|
|
|
|
|
color: '#8b5cf6'
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
2026-05-30 15:46:51 +08:00
|
|
|
|
const calendarOpen = ref(false)
|
|
|
|
|
|
const draftStart = ref(props.customRange.start)
|
|
|
|
|
|
const draftEnd = ref(props.customRange.end)
|
|
|
|
|
|
const overviewDashboardOptions = [
|
|
|
|
|
|
{ label: '财务看板', value: 'finance' },
|
|
|
|
|
|
{ label: '风险看板', value: 'risk' },
|
|
|
|
|
|
{ label: '系统看板', value: 'system' }
|
|
|
|
|
|
]
|
|
|
|
|
|
const overviewDashboardValue = computed({
|
|
|
|
|
|
get: () => props.overviewDashboard,
|
|
|
|
|
|
set: (value) => emit('update:overviewDashboard', value)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const rangeOptions = computed(() =>
|
2026-05-20 21:00:47 +08:00
|
|
|
|
props.ranges.map((range, index) => ({
|
|
|
|
|
|
value: range,
|
|
|
|
|
|
label: String(range)
|
|
|
|
|
|
}))
|
|
|
|
|
|
)
|
2026-05-09 03:04:09 +00:00
|
|
|
|
|
|
|
|
|
|
const activeOption = computed(() =>
|
|
|
|
|
|
rangeOptions.value.find((option) => option.value === props.activeRange) ?? rangeOptions.value[0]
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const isCustomRange = computed(() => props.activeRange === 'custom')
|
2026-05-20 21:00:47 +08:00
|
|
|
|
const activeDateLabel = computed(() => {
|
|
|
|
|
|
if (isCustomRange.value) return formatRangeLabel(props.customRange.start, props.customRange.end)
|
|
|
|
|
|
return buildPresetRangeLabel(activeOption.value?.label)
|
|
|
|
|
|
})
|
2026-05-09 03:04:09 +00:00
|
|
|
|
|
|
|
|
|
|
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 applyCustomRange() {
|
|
|
|
|
|
if (!canApplyCustomRange.value) return
|
|
|
|
|
|
emit('update:customRange', { start: draftStart.value, end: draftEnd.value })
|
|
|
|
|
|
emit('update:activeRange', 'custom')
|
|
|
|
|
|
calendarOpen.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-20 21:00:47 +08:00
|
|
|
|
function formatRangeLabel(start, end) {
|
|
|
|
|
|
if (!start || !end) return '选择时间段'
|
|
|
|
|
|
if (start === end) return start
|
|
|
|
|
|
return `${start} ~ ${end}`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function toDateLabel(date) {
|
|
|
|
|
|
const year = date.getFullYear()
|
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
|
const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
|
return `${year}-${month}-${day}`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function buildPresetRangeLabel(label) {
|
|
|
|
|
|
const now = new Date()
|
|
|
|
|
|
const today = toDateLabel(now)
|
|
|
|
|
|
|
|
|
|
|
|
if (label === '今日') {
|
|
|
|
|
|
return today
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (label === '近10日') {
|
|
|
|
|
|
const start = new Date(now)
|
|
|
|
|
|
start.setHours(0, 0, 0, 0)
|
|
|
|
|
|
start.setDate(start.getDate() - 9)
|
|
|
|
|
|
return `${toDateLabel(start)} ~ ${today}`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (label === '本周') {
|
|
|
|
|
|
const start = new Date(now)
|
|
|
|
|
|
const day = start.getDay() || 7
|
|
|
|
|
|
start.setHours(0, 0, 0, 0)
|
|
|
|
|
|
start.setDate(start.getDate() - day + 1)
|
|
|
|
|
|
return `${toDateLabel(start)} ~ ${today}`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (label === '本月') {
|
|
|
|
|
|
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return today
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
2026-05-09 03:04:09 +00:00
|
|
|
|
|
2026-05-27 09:17:57 +08:00
|
|
|
|
<style scoped src="../../assets/styles/components/top-bar.css"></style>
|