gbflowengine 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +271 -271
  2. package/dist/gbflowengine.css +1 -1
  3. package/dist/gbflowengine.js +8232 -6913
  4. package/dist/gbflowengine.js.map +1 -1
  5. package/dist/gbflowengine.umd.cjs +2 -2
  6. package/dist/gbflowengine.umd.cjs.map +1 -1
  7. package/package.json +85 -84
  8. package/src/center/DefinitionInspect.vue +291 -291
  9. package/src/center/FlowCenter.vue +33 -33
  10. package/src/center/index.js +29 -29
  11. package/src/center/storage.js +748 -748
  12. package/src/core/flow/condition.js +160 -160
  13. package/src/core/flow/customNode.js +385 -385
  14. package/src/core/flow/defaults.js +124 -124
  15. package/src/core/flow/flowConstant.js +265 -265
  16. package/src/core/flow/flowNodeUtils.js +29 -29
  17. package/src/core/flow/index.js +47 -47
  18. package/src/core/flow/node.js +44 -44
  19. package/src/core/flow/nodeFactory.js +58 -58
  20. package/src/core/flow/prediction.js +325 -325
  21. package/src/core/flow/schema.js +864 -864
  22. package/src/definition/FlowDefinitionDesigner.vue +338 -338
  23. package/src/definition/index.js +9 -9
  24. package/src/index.js +39 -39
  25. package/src/storage.js +200 -200
  26. package/src/testing/FlowTestPanel.vue +2502 -2502
  27. package/src/testing/UserConfigDrawer.vue +376 -376
  28. package/src/testing/diagram/FlowProgressDiagram.vue +318 -318
  29. package/src/testing/diagramModel.js +517 -517
  30. package/src/testing/index.js +23 -23
  31. package/src/testing/mock.js +246 -246
  32. package/src/testing/oaExecutors.js +51 -51
  33. package/src/testing/oaSeed.js +467 -467
  34. package/src/testing/sample.js +412 -412
  35. package/src/testing/seed.js +122 -122
  36. package/src/utils/format.js +27 -27
  37. package/src/visual/FlowCanvas.vue +440 -440
  38. package/src/visual/NodeProgressDetail.vue +43 -43
  39. package/src/visual/NodeStatusBadge.vue +17 -17
  40. package/src/visual/NodeWrap.vue +46 -46
  41. package/src/visual/ScWorkflow.vue +49 -49
  42. package/src/visual/SelectDialog.vue +459 -459
  43. package/src/visual/conditionHelpers.js +116 -116
  44. package/src/visual/index.js +6 -6
  45. package/src/visual/nodes/AddNode.vue +222 -222
  46. package/src/visual/nodes/ApproverNode.vue +347 -347
  47. package/src/visual/nodes/BranchNode.vue +441 -441
  48. package/src/visual/nodes/CustomNode.vue +339 -339
  49. package/src/visual/nodes/EndNode.vue +21 -21
  50. package/src/visual/nodes/PassNode.vue +100 -100
  51. package/src/visual/nodes/PromoterNode.vue +134 -134
  52. package/src/visual/nodes/RejectNode.vue +100 -100
  53. package/src/visual/nodes/SendNode.vue +151 -151
  54. package/src/visual/styles.scss +879 -879
  55. package/src/visual/useScNodeStatus.js +18 -18
  56. package/src/workbench/OaWorkbench.vue +1341 -1341
  57. package/src/workbench/components/ApprovalWorkspace.vue +2090 -2090
  58. package/src/workbench/components/CategoryIcon.vue +74 -74
  59. package/src/workbench/components/NotificationIcon.vue +73 -73
  60. package/src/workbench/components/ProcessSteps.vue +557 -557
  61. package/src/workbench/components/ResubmitDialog.vue +227 -227
  62. package/src/workbench/components/SidebarNav.vue +138 -138
  63. package/src/workbench/components/StartFlowDialog.vue +1058 -1058
  64. package/src/workbench/components/UserAvatar.vue +68 -68
  65. package/src/workbench/model.js +1080 -1080
  66. package/src/workbench/pages/DesignPage.vue +798 -798
  67. package/src/workbench/pages/HomePage.vue +1050 -1050
  68. package/src/workbench/pages/MonitorPage.vue +1029 -1029
  69. package/src/workbench/pages/NotificationsPage.vue +554 -554
  70. package/src/workbench/pages/RequestsPage.vue +644 -644
  71. package/src/workbench/pages/TaskCenterPage.vue +1155 -1155
  72. package/src/workbench/pages/TemplatesPage.vue +680 -680
  73. package/src/workbench/styles.scss +555 -555
  74. package/types/center.d.ts +5 -5
  75. package/types/core.d.ts +479 -479
  76. package/types/definition.d.ts +4 -4
  77. package/types/index.d.ts +34 -34
  78. package/types/testing.d.ts +20 -20
  79. package/types/visual.d.ts +20 -20
@@ -1,1341 +1,1341 @@
1
- <template>
2
- <div class="oa-shell" :class="{ 'is-mobile-detail': hideMobileNav }">
3
- <aside class="oa-sidebar">
4
- <div class="oa-sidebar__brand">
5
- <span class="oa-sidebar__mark" aria-hidden="true">
6
- <i></i><i></i><i></i>
7
- </span>
8
- <div class="oa-sidebar__titles">
9
- <strong>{{ title }}</strong>
10
- <span>{{ subtitle }}</span>
11
- </div>
12
- <span v-if="demo" class="oa-sidebar__env">测试</span>
13
- </div>
14
-
15
- <SidebarNav :groups="navGroups" :active-key="activeNavKey" @select="handleNav" />
16
-
17
- <div class="oa-sidebar__footer">
18
- <div class="oa-sidebar__status">
19
- <span class="oa-sidebar__status-dot"></span>
20
- <div>
21
- <strong>本地数据 · 自动保存</strong>
22
- <small>IndexedDB / localStorage</small>
23
- </div>
24
- </div>
25
- <button type="button" class="oa-sidebar__action" @click="userDrawerVisible = true">
26
- <el-icon><User /></el-icon>
27
- 用户与组织
28
- </button>
29
- <button v-if="demo" type="button" class="oa-sidebar__action" @click="resetDemo">
30
- <el-icon><RefreshLeft /></el-icon>
31
- 重置演示数据
32
- </button>
33
- </div>
34
- </aside>
35
-
36
- <div class="oa-stage">
37
- <header class="oa-topbar">
38
- <button
39
- type="button"
40
- class="oa-topbar__menu oa-mobile-only"
41
- aria-label="打开导航"
42
- @click="mobileNavOpen = true"
43
- >
44
- <el-icon><Menu /></el-icon>
45
- </button>
46
-
47
- <div class="oa-topbar__crumb">
48
- <span>{{ title }}</span>
49
- <el-icon><ArrowRight /></el-icon>
50
- <strong>{{ oa.viewTitle.value }}</strong>
51
- </div>
52
-
53
- <div ref="searchWrap" class="oa-search" :class="{ 'is-open': searchVisible }">
54
- <el-icon class="oa-search__icon"><Search /></el-icon>
55
- <input
56
- ref="searchInput"
57
- v-model="searchQuery"
58
- type="search"
59
- role="combobox"
60
- aria-label="全局搜索"
61
- :aria-expanded="searchVisible"
62
- placeholder="搜索流程、单号、发起人"
63
- @focus="searchOpen = true"
64
- @input="searchOpen = true"
65
- @keydown.enter.prevent="openFirstResult"
66
- @keydown.esc="closeSearch"
67
- />
68
- <kbd class="oa-search__kbd">Ctrl K</kbd>
69
-
70
- <div v-if="searchVisible" class="oa-search__panel">
71
- <div role="listbox" aria-label="搜索结果">
72
- <template v-if="searchResults.instances.length">
73
- <p class="oa-search__group-label">流程实例</p>
74
- <button
75
- v-for="instance in searchResults.instances"
76
- :key="instance.id"
77
- type="button"
78
- class="oa-search__result"
79
- role="option"
80
- @click="openSearchInstance(instance)"
81
- >
82
- <span class="oa-search__result-icon is-instance">
83
- <el-icon><Document /></el-icon>
84
- </span>
85
- <span class="oa-search__result-main">
86
- <strong>{{ instance.name }}</strong>
87
- <small>
88
- {{ instance.code }} · {{ instance.initiator?.name }}
89
- · {{ statusMeta(instance.state?.status).label }}
90
- </small>
91
- </span>
92
- <el-icon class="oa-search__result-arrow"><ArrowRight /></el-icon>
93
- </button>
94
- </template>
95
-
96
- <template v-if="searchResults.templates.length">
97
- <p class="oa-search__group-label">流程模板</p>
98
- <button
99
- v-for="definition in searchResults.templates"
100
- :key="definition.meta.id"
101
- type="button"
102
- class="oa-search__result"
103
- role="option"
104
- @click="openSearchTemplate(definition)"
105
- >
106
- <span class="oa-search__result-icon is-template">
107
- <el-icon><Grid /></el-icon>
108
- </span>
109
- <span class="oa-search__result-main">
110
- <strong>{{ definition.meta.name }}</strong>
111
- <small>{{ definition.meta.description || '流程模板' }}</small>
112
- </span>
113
- <span class="oa-chip">发起</span>
114
- </button>
115
- </template>
116
-
117
- <div v-if="!hasSearchResults" class="oa-search__empty">
118
- <el-icon><Search /></el-icon>
119
- 没有匹配的流程或模板
120
- </div>
121
- </div>
122
- <footer class="oa-search__foot">
123
- <span>按 Enter 打开首个结果</span>
124
- <span>Esc 关闭</span>
125
- </footer>
126
- </div>
127
- </div>
128
-
129
- <div class="oa-topbar__actions">
130
- <el-button class="oa-topbar__create" type="primary" :icon="Plus" @click="oa.navigate('templates')">
131
- 发起申请
132
- </el-button>
133
- <button
134
- type="button"
135
- class="oa-topbar__icon"
136
- :aria-label="`通知中心,${oa.unreadNotifications.value.length} 条未读`"
137
- @click="oa.navigate('notifications')"
138
- >
139
- <el-badge
140
- :value="oa.unreadNotifications.value.length"
141
- :hidden="!oa.unreadNotifications.value.length"
142
- :max="99"
143
- >
144
- <el-icon><Bell /></el-icon>
145
- </el-badge>
146
- </button>
147
-
148
- <el-dropdown trigger="click" popper-class="oa-user-popper" @command="handleUserCommand">
149
- <button type="button" class="oa-identity">
150
- <UserAvatar :name="oa.currentUserName.value" :size="30" />
151
- <span class="oa-identity__text">
152
- <strong>{{ oa.currentUserName.value }}</strong>
153
- <small>{{ oa.currentUserDept.value }}</small>
154
- </span>
155
- <el-icon class="oa-identity__arrow"><ArrowDown /></el-icon>
156
- </button>
157
- <template #dropdown>
158
- <el-dropdown-menu class="oa-user-menu">
159
- <li class="oa-user-menu__head">
160
- <strong>{{ oa.currentUserName.value }}</strong>
161
- <span>{{ oa.currentUserRoleNames.value.join(' / ') || '成员' }}</span>
162
- </li>
163
- <li class="oa-user-menu__label">切换身份(模拟不同角色)</li>
164
- <el-dropdown-item
165
- v-for="user in oa.usersWithStats.value"
166
- :key="user.id"
167
- :command="`user:${user.id}`"
168
- :class="{ 'is-current': String(user.id) === String(oa.currentUserId.value) }"
169
- >
170
- <span class="oa-user-menu__user">
171
- <UserAvatar :name="user.realName" :size="24" />
172
- <span class="oa-user-menu__text">
173
- <strong>{{ user.realName }}</strong>
174
- <small>{{ user.deptLabel }} · {{ user.roleLabel }}</small>
175
- </span>
176
- <em v-if="user.isAdmin" class="oa-chip oa-chip--primary">管理员</em>
177
- <em v-if="user.pending" class="oa-user-menu__pending">{{ user.pending }}</em>
178
- </span>
179
- </el-dropdown-item>
180
- <el-dropdown-item divided command="manage">
181
- <el-icon><Setting /></el-icon>用户与组织配置
182
- </el-dropdown-item>
183
- <el-dropdown-item v-if="demo" command="reset">
184
- <el-icon><RefreshLeft /></el-icon>重置演示数据
185
- </el-dropdown-item>
186
- </el-dropdown-menu>
187
- </template>
188
- </el-dropdown>
189
- </div>
190
- </header>
191
-
192
- <main ref="contentRef" class="oa-content">
193
- <div v-if="!oa.ready.value" class="oa-skeleton" aria-label="正在加载">
194
- <div class="oa-skeleton__row" style="height: 84px"></div>
195
- <div class="oa-skeleton__row" style="height: 96px"></div>
196
- <div class="oa-skeleton__row" style="height: 260px"></div>
197
- </div>
198
- <HomePage v-else-if="oa.view.value === 'home'" />
199
- <TaskCenterPage v-else-if="oa.view.value === 'tasks'" />
200
- <RequestsPage v-else-if="oa.view.value === 'requests'" />
201
- <TemplatesPage v-else-if="oa.view.value === 'templates'" />
202
- <NotificationsPage v-else-if="oa.view.value === 'notifications'" />
203
- <MonitorPage v-else-if="oa.view.value === 'monitor' && oa.isAdmin.value" />
204
- <DesignPage v-else-if="oa.view.value === 'design' && oa.isAdmin.value" />
205
- <div v-else class="oa-page">
206
- <div class="oa-card">
207
- <div class="oa-empty oa-no-permission">
208
- <span class="oa-empty__icon"><el-icon><Lock /></el-icon></span>
209
- <strong>当前身份没有该页面的访问权限</strong>
210
- <p>流程监控与流程设计仅对流程管理员开放。请切换到管理员身份,或返回工作台。</p>
211
- <el-button type="primary" plain @click="oa.navigate('home')">返回工作台</el-button>
212
- </div>
213
- </div>
214
- </div>
215
- </main>
216
- </div>
217
-
218
- <nav class="oa-mobile-nav" aria-label="移动端导航">
219
- <button
220
- v-for="item in mobileNav"
221
- :key="item.key"
222
- type="button"
223
- :class="{ 'is-active': item.isActive }"
224
- @click="handleMobileNav(item)"
225
- >
226
- <el-badge
227
- :value="item.badge || 0"
228
- :hidden="!item.badge"
229
- :max="99"
230
- class="oa-mobile-nav__badge"
231
- >
232
- <el-icon><component :is="item.icon" /></el-icon>
233
- </el-badge>
234
- <span>{{ item.label }}</span>
235
- </button>
236
- </nav>
237
-
238
- <el-drawer
239
- v-model="mobileNavOpen"
240
- direction="ltr"
241
- size="280px"
242
- :with-header="false"
243
- append-to-body
244
- class="oa-mobile-drawer"
245
- >
246
- <div class="oa-mobile-drawer__inner">
247
- <div class="oa-sidebar__brand">
248
- <span class="oa-sidebar__mark" aria-hidden="true">
249
- <i></i><i></i><i></i>
250
- </span>
251
- <div class="oa-sidebar__titles">
252
- <strong>{{ title }}</strong>
253
- <span>{{ subtitle }}</span>
254
- </div>
255
- </div>
256
- <SidebarNav :groups="navGroups" :active-key="activeNavKey" @select="handleNav" />
257
- <div class="oa-sidebar__footer">
258
- <button type="button" class="oa-sidebar__action" @click="userDrawerVisible = true; mobileNavOpen = false">
259
- <el-icon><User /></el-icon>
260
- 用户与组织
261
- </button>
262
- <button v-if="demo" type="button" class="oa-sidebar__action" @click="resetDemo(); mobileNavOpen = false">
263
- <el-icon><RefreshLeft /></el-icon>
264
- 重置演示数据
265
- </button>
266
- </div>
267
- </div>
268
- </el-drawer>
269
-
270
- <el-drawer
271
- v-model="detailDrawer"
272
- size="100%"
273
- :with-header="false"
274
- append-to-body
275
- class="oa-detail-drawer"
276
- >
277
- <ApprovalWorkspace
278
- v-if="oa.detailInstance.value"
279
- :instance="oa.detailInstance.value"
280
- dismissible
281
- @close="oa.closeInstanceDetail"
282
- />
283
- </el-drawer>
284
-
285
- <StartFlowDialog
286
- v-if="oa.startDialogDefinition.value"
287
- :definition="oa.startDialogDefinition.value"
288
- @close="oa.closeStartDialog"
289
- />
290
-
291
- <UserConfigDrawer
292
- v-model="userDrawerVisible"
293
- :users="oa.org.users"
294
- :departments="oa.org.departments"
295
- :roles="oa.org.roles"
296
- @save="handleApplyOrg"
297
- />
298
- </div>
299
- </template>
300
-
301
- <script setup>
302
- import { computed, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue'
303
- import { ElMessage, ElMessageBox } from 'element-plus'
304
- import {
305
- ArrowDown,
306
- ArrowRight,
307
- Bell,
308
- ChatDotRound,
309
- CircleCheck,
310
- Document,
311
- EditPen,
312
- Grid,
313
- House,
314
- Lock,
315
- Menu,
316
- Monitor,
317
- Plus,
318
- RefreshLeft,
319
- Search,
320
- Setting,
321
- Tickets,
322
- User
323
- } from '@element-plus/icons-vue'
324
- import UserConfigDrawer from '../testing/UserConfigDrawer.vue'
325
- import ApprovalWorkspace from './components/ApprovalWorkspace.vue'
326
- import SidebarNav from './components/SidebarNav.vue'
327
- import StartFlowDialog from './components/StartFlowDialog.vue'
328
- import UserAvatar from './components/UserAvatar.vue'
329
- import DesignPage from './pages/DesignPage.vue'
330
- import HomePage from './pages/HomePage.vue'
331
- import MonitorPage from './pages/MonitorPage.vue'
332
- import NotificationsPage from './pages/NotificationsPage.vue'
333
- import RequestsPage from './pages/RequestsPage.vue'
334
- import TaskCenterPage from './pages/TaskCenterPage.vue'
335
- import TemplatesPage from './pages/TemplatesPage.vue'
336
- import { statusMeta } from './model.js'
337
- import { useWorkbench } from './useWorkbench.js'
338
- import './styles.scss'
339
-
340
- defineOptions({ name: 'GbOaWorkbench' })
341
-
342
- const props = defineProps({
343
- title: { type: String, default: '流程中台' },
344
- subtitle: { type: String, default: '企业流程 · 审批协同' },
345
- seedInstances: { type: Array, default: () => [] },
346
- users: { type: Array, default: () => [] },
347
- departments: { type: Array, default: () => [] },
348
- roles: { type: Array, default: () => [] },
349
- initiatorId: { type: [String, Number], default: null },
350
- customExecutors: { type: Object, default: () => ({}) },
351
- customFetch: { type: Function, default: null },
352
- demo: { type: Boolean, default: false }
353
- })
354
-
355
- const oa = useWorkbench(props)
356
- provide('oaStore', oa)
357
-
358
- const userDrawerVisible = ref(false)
359
- const mobileNavOpen = ref(false)
360
- const searchQuery = ref('')
361
- const searchOpen = ref(false)
362
- const searchInput = ref(null)
363
- const searchWrap = ref(null)
364
- const contentRef = ref(null)
365
-
366
- const navGroups = computed(() => {
367
- const groups = [
368
- {
369
- label: '我的工作',
370
- items: [
371
- { key: 'home', label: '工作台', icon: House, view: 'home' },
372
- {
373
- key: 'tasks',
374
- label: '待办中心',
375
- icon: Tickets,
376
- view: 'tasks',
377
- badge: oa.pendingItems.value.length
378
- },
379
- { key: 'mine', label: '我的申请', icon: Document, view: 'requests', scope: 'mine' },
380
- { key: 'cc', label: '抄送我的', icon: ChatDotRound, view: 'requests', scope: 'cc' },
381
- { key: 'done', label: '已办事项', icon: CircleCheck, view: 'requests', scope: 'done' }
382
- ]
383
- },
384
- {
385
- label: '流程发起',
386
- items: [{ key: 'templates', label: '模板中心', icon: Grid, view: 'templates' }]
387
- }
388
- ]
389
- if (oa.isAdmin.value) {
390
- groups.push({
391
- label: '管理与治理',
392
- items: [
393
- { key: 'monitor', label: '流程监控', icon: Monitor, view: 'monitor' },
394
- { key: 'design', label: '流程设计', icon: EditPen, view: 'design' }
395
- ]
396
- })
397
- }
398
- groups.push({
399
- label: '消息',
400
- items: [
401
- {
402
- key: 'notifications',
403
- label: '通知中心',
404
- icon: Bell,
405
- view: 'notifications',
406
- badge: oa.unreadNotifications.value.length
407
- }
408
- ]
409
- })
410
- return groups
411
- })
412
-
413
- const activeNavKey = computed(() => {
414
- if (oa.view.value === 'requests') return oa.requestScope.value
415
- return oa.view.value
416
- })
417
-
418
- const mobileNav = computed(() => [
419
- {
420
- key: 'home',
421
- label: '工作台',
422
- icon: House,
423
- view: 'home',
424
- isActive: oa.view.value === 'home'
425
- },
426
- {
427
- key: 'tasks',
428
- label: '待办',
429
- icon: Tickets,
430
- view: 'tasks',
431
- badge: oa.pendingItems.value.length,
432
- isActive: oa.view.value === 'tasks'
433
- },
434
- {
435
- key: 'templates',
436
- label: '发起',
437
- icon: Plus,
438
- view: 'templates',
439
- isActive: oa.view.value === 'templates'
440
- },
441
- {
442
- key: 'notifications',
443
- label: '通知',
444
- icon: Bell,
445
- view: 'notifications',
446
- badge: oa.unreadNotifications.value.length,
447
- isActive: oa.view.value === 'notifications'
448
- },
449
- {
450
- key: 'mine',
451
- label: '我的',
452
- icon: Document,
453
- view: 'requests',
454
- scope: 'mine',
455
- isActive: oa.view.value === 'requests' && oa.requestScope.value === 'mine'
456
- }
457
- ])
458
-
459
- const searchResults = computed(() => oa.searchAll(searchQuery.value))
460
- const hasSearchResults = computed(
461
- () =>
462
- searchResults.value.instances.length > 0 ||
463
- searchResults.value.templates.length > 0
464
- )
465
- const searchVisible = computed(
466
- () => searchOpen.value && Boolean(searchQuery.value.trim())
467
- )
468
- const hideMobileNav = computed(
469
- () => Boolean(oa.detailInstance.value) || (
470
- oa.view.value === 'tasks' && Boolean(oa.activeTask.value)
471
- )
472
- )
473
- const detailDrawer = computed({
474
- get: () => Boolean(oa.detailInstance.value),
475
- set: (visible) => {
476
- if (!visible) oa.closeInstanceDetail()
477
- }
478
- })
479
-
480
- function handleNav(item) {
481
- if (item.view === 'tasks') oa.taskTab.value = 'approve'
482
- oa.navigate(item.view, { scope: item.scope })
483
- mobileNavOpen.value = false
484
- }
485
-
486
- function handleMobileNav(item) {
487
- if (item.view === 'tasks') oa.selectTask(null, null)
488
- handleNav(item)
489
- }
490
-
491
- function moveContentTop() {
492
- if (contentRef.value) contentRef.value.scrollTop = 0
493
- }
494
-
495
- watch(
496
- () => [oa.view.value, oa.requestScope.value],
497
- () => {
498
- moveContentTop()
499
- closeSearch()
500
- }
501
- )
502
-
503
- function closeSearch() {
504
- searchOpen.value = false
505
- }
506
-
507
- function openSearchInstance(instance) {
508
- closeSearch()
509
- searchQuery.value = ''
510
- oa.openInstanceDetail(instance.id)
511
- }
512
-
513
- function openSearchTemplate(definition) {
514
- closeSearch()
515
- searchQuery.value = ''
516
- oa.openStartDialog(definition.meta.id)
517
- }
518
-
519
- function openFirstResult() {
520
- const instance = searchResults.value.instances[0]
521
- if (instance) {
522
- openSearchInstance(instance)
523
- return
524
- }
525
- const template = searchResults.value.templates[0]
526
- if (template) openSearchTemplate(template)
527
- }
528
-
529
- async function handleUserCommand(command) {
530
- if (typeof command === 'string' && command.startsWith('user:')) {
531
- oa.switchUser(command.slice(5))
532
- ElMessage.success(`已切换为 ${oa.currentUserName.value}`)
533
- return
534
- }
535
- if (command === 'manage') {
536
- userDrawerVisible.value = true
537
- return
538
- }
539
- if (command === 'reset') {
540
- await resetDemo()
541
- }
542
- }
543
-
544
- function handleApplyOrg(payload) {
545
- oa.applyOrg(payload)
546
- userDrawerVisible.value = false
547
- ElMessage.success('人员与组织配置已更新')
548
- }
549
-
550
- async function resetDemo() {
551
- try {
552
- await ElMessageBox.confirm(
553
- '将清空本机保存的流程、实例、草稿与通知记录,并重新载入演示数据。确定继续?',
554
- '重置演示数据',
555
- {
556
- type: 'warning',
557
- confirmButtonText: '重置',
558
- cancelButtonText: '取消'
559
- }
560
- )
561
- } catch {
562
- return
563
- }
564
- await oa.resetDemoData()
565
- searchQuery.value = ''
566
- closeSearch()
567
- mobileNavOpen.value = false
568
- ElMessage.success('演示数据已重置')
569
- }
570
-
571
- function onDocumentPointerDown(event) {
572
- if (!searchOpen.value) return
573
- if (searchWrap.value && !searchWrap.value.contains(event.target)) closeSearch()
574
- }
575
-
576
- function onDocumentKeydown(event) {
577
- if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k') {
578
- event.preventDefault()
579
- searchInput.value?.focus()
580
- searchOpen.value = true
581
- }
582
- if (event.key === 'Escape') closeSearch()
583
- }
584
-
585
- onMounted(() => {
586
- document.addEventListener('pointerdown', onDocumentPointerDown)
587
- document.addEventListener('keydown', onDocumentKeydown)
588
- })
589
-
590
- onBeforeUnmount(() => {
591
- document.removeEventListener('pointerdown', onDocumentPointerDown)
592
- document.removeEventListener('keydown', onDocumentKeydown)
593
- })
594
-
595
- defineExpose({
596
- store: oa,
597
- definitions: oa.definitions,
598
- instances: oa.instances,
599
- navigate: oa.navigate
600
- })
601
- </script>
602
-
603
- <style scoped lang="scss">
604
- .oa-shell {
605
- display: flex;
606
- width: 100%;
607
- height: 100%;
608
- min-height: 0;
609
- overflow: hidden;
610
- }
611
-
612
- .oa-sidebar {
613
- display: flex;
614
- flex-direction: column;
615
- width: 228px;
616
- flex-shrink: 0;
617
- min-height: 0;
618
- background:
619
- radial-gradient(circle at 20% 0%, rgba(83, 129, 224, 0.16), transparent 28%),
620
- var(--oa-sidebar);
621
- color: var(--oa-sidebar-text);
622
- }
623
-
624
- .oa-sidebar__brand {
625
- display: flex;
626
- align-items: center;
627
- gap: 9px;
628
- flex-shrink: 0;
629
- padding: 17px 16px 13px;
630
- border-bottom: 1px solid rgba(255, 255, 255, 0.06);
631
- }
632
-
633
- .oa-sidebar__mark {
634
- position: relative;
635
- display: grid;
636
- grid-template-columns: repeat(2, 9px);
637
- grid-template-rows: repeat(2, 9px);
638
- gap: 3px;
639
- width: 24px;
640
- height: 24px;
641
- align-content: center;
642
- justify-content: center;
643
- flex-shrink: 0;
644
- border-radius: 6px;
645
- background: linear-gradient(135deg, #4d7ef0, #2b57c8);
646
-
647
- i {
648
- border-radius: 1.5px;
649
- background: #fff;
650
-
651
- &:nth-child(1) {
652
- opacity: 0.95;
653
- }
654
-
655
- &:nth-child(2) {
656
- opacity: 0.55;
657
- }
658
-
659
- &:nth-child(3) {
660
- grid-column: span 2;
661
- opacity: 0.76;
662
- }
663
- }
664
- }
665
-
666
- .oa-sidebar__titles {
667
- display: flex;
668
- flex-direction: column;
669
- min-width: 0;
670
-
671
- strong {
672
- overflow: hidden;
673
- color: #f0f5fd;
674
- font-size: 12.5px;
675
- font-weight: 650;
676
- letter-spacing: 0.01em;
677
- text-overflow: ellipsis;
678
- white-space: nowrap;
679
- }
680
-
681
- span {
682
- overflow: hidden;
683
- margin-top: 1px;
684
- color: #778aa1;
685
- font-size: 9.5px;
686
- text-overflow: ellipsis;
687
- white-space: nowrap;
688
- }
689
- }
690
-
691
- .oa-sidebar__env {
692
- margin-left: auto;
693
- padding: 1px 5px;
694
- border: 1px solid rgba(255, 255, 255, 0.14);
695
- border-radius: 3px;
696
- color: #a7bad2;
697
- font-size: 8.5px;
698
- letter-spacing: 0.03em;
699
- }
700
-
701
- :deep(.oa-nav) {
702
- flex: 1;
703
- min-height: 0;
704
- }
705
-
706
- .oa-sidebar__footer {
707
- flex-shrink: 0;
708
- display: flex;
709
- flex-direction: column;
710
- gap: 4px;
711
- padding: 11px 12px 14px;
712
- border-top: 1px solid rgba(255, 255, 255, 0.06);
713
- }
714
-
715
- .oa-sidebar__status {
716
- display: flex;
717
- align-items: center;
718
- gap: 7px;
719
- padding: 5px 6px 8px;
720
-
721
- strong {
722
- display: block;
723
- color: #8fa3bb;
724
- font-size: 9.5px;
725
- font-weight: 500;
726
- }
727
-
728
- small {
729
- display: block;
730
- margin-top: 1px;
731
- color: #5e7188;
732
- font-size: 8.5px;
733
- }
734
- }
735
-
736
- .oa-sidebar__status-dot {
737
- width: 5px;
738
- height: 5px;
739
- border-radius: 50%;
740
- background: #3db98a;
741
- box-shadow: 0 0 0 3px rgba(61, 185, 138, 0.09);
742
- }
743
-
744
- .oa-sidebar__action {
745
- display: flex;
746
- align-items: center;
747
- gap: 7px;
748
- width: 100%;
749
- padding: 6px 8px;
750
- border: none;
751
- border-radius: 5px;
752
- background: transparent;
753
- color: #8499b1;
754
- font-size: 10.5px;
755
- text-align: left;
756
- cursor: pointer;
757
-
758
- &:hover {
759
- background: rgba(255, 255, 255, 0.05);
760
- color: #dfe9f7;
761
- }
762
- }
763
-
764
- .oa-stage {
765
- flex: 1;
766
- min-width: 0;
767
- display: flex;
768
- flex-direction: column;
769
- min-height: 0;
770
- }
771
-
772
- .oa-topbar {
773
- position: relative;
774
- z-index: 30;
775
- flex-shrink: 0;
776
- display: flex;
777
- align-items: center;
778
- gap: 18px;
779
- height: 58px;
780
- padding: 0 20px;
781
- background: rgba(255, 255, 255, 0.96);
782
- border-bottom: 1px solid var(--oa-line);
783
- backdrop-filter: blur(12px);
784
- }
785
-
786
- .oa-topbar__menu {
787
- display: none;
788
- align-items: center;
789
- justify-content: center;
790
- width: 36px;
791
- height: 36px;
792
- flex-shrink: 0;
793
- border: 1px solid var(--oa-line);
794
- border-radius: 7px;
795
- background: #fff;
796
- color: var(--oa-muted);
797
- font-size: 17px;
798
- cursor: pointer;
799
- }
800
-
801
- .oa-topbar__crumb {
802
- display: flex;
803
- align-items: center;
804
- gap: 6px;
805
- flex-shrink: 0;
806
- color: var(--oa-faint);
807
- font-size: 11px;
808
-
809
- .el-icon {
810
- color: #c1cad7;
811
- font-size: 10px;
812
- }
813
-
814
- strong {
815
- color: var(--oa-ink);
816
- font-size: 11.5px;
817
- font-weight: 600;
818
- }
819
- }
820
-
821
- .oa-search {
822
- position: relative;
823
- display: flex;
824
- align-items: center;
825
- gap: 7px;
826
- width: min(380px, 36vw);
827
- height: 34px;
828
- padding: 0 9px;
829
- border: 1px solid var(--oa-line);
830
- border-radius: 7px;
831
- background: #f7f9fc;
832
- transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
833
-
834
- &:focus-within,
835
- &.is-open {
836
- border-color: #bfd0ee;
837
- background: #fff;
838
- box-shadow: 0 0 0 3px rgba(36, 86, 214, 0.06);
839
- }
840
-
841
- input {
842
- flex: 1;
843
- min-width: 0;
844
- border: none;
845
- outline: none;
846
- background: transparent;
847
- color: var(--oa-ink);
848
- font-size: 11.5px;
849
-
850
- &::-webkit-search-cancel-button {
851
- display: none;
852
- }
853
-
854
- &::placeholder {
855
- color: #a3aebe;
856
- }
857
- }
858
- }
859
-
860
- .oa-search__icon {
861
- flex-shrink: 0;
862
- color: #9ba7b8;
863
- font-size: 14px;
864
- }
865
-
866
- .oa-search__kbd {
867
- flex-shrink: 0;
868
- padding: 1px 5px;
869
- border: 1px solid #e1e6ef;
870
- border-radius: 3px;
871
- background: #fff;
872
- color: #a3aebe;
873
- font-family: inherit;
874
- font-size: 8.5px;
875
- }
876
-
877
- .oa-search__panel {
878
- position: absolute;
879
- top: calc(100% + 7px);
880
- left: 0;
881
- right: 0;
882
- z-index: 50;
883
- padding: 6px;
884
- border: 1px solid var(--oa-line);
885
- border-radius: 9px;
886
- background: #fff;
887
- box-shadow: 0 16px 45px rgba(15, 31, 55, 0.14);
888
- }
889
-
890
- .oa-search__group-label {
891
- margin: 7px 8px 4px;
892
- color: var(--oa-faint);
893
- font-size: 9px;
894
- font-weight: 600;
895
- letter-spacing: 0.06em;
896
- text-transform: uppercase;
897
- }
898
-
899
- .oa-search__result {
900
- display: flex;
901
- align-items: center;
902
- gap: 8px;
903
- width: 100%;
904
- padding: 7px 8px;
905
- border: none;
906
- border-radius: 6px;
907
- background: transparent;
908
- text-align: left;
909
- cursor: pointer;
910
-
911
- &:hover {
912
- background: #f6f9ff;
913
- }
914
- }
915
-
916
- .oa-search__result-icon {
917
- display: grid;
918
- place-items: center;
919
- width: 27px;
920
- height: 27px;
921
- flex-shrink: 0;
922
- border-radius: 6px;
923
- font-size: 13px;
924
-
925
- &.is-instance {
926
- background: var(--oa-primary-soft);
927
- color: var(--oa-primary);
928
- }
929
-
930
- &.is-template {
931
- background: #eef7f2;
932
- color: var(--oa-success);
933
- }
934
- }
935
-
936
- .oa-search__result-main {
937
- display: flex;
938
- flex-direction: column;
939
- flex: 1;
940
- min-width: 0;
941
-
942
- strong {
943
- overflow: hidden;
944
- color: var(--oa-ink);
945
- font-size: 11.5px;
946
- font-weight: 600;
947
- text-overflow: ellipsis;
948
- white-space: nowrap;
949
- }
950
-
951
- small {
952
- overflow: hidden;
953
- margin-top: 1px;
954
- color: var(--oa-faint);
955
- font-size: 9.5px;
956
- text-overflow: ellipsis;
957
- white-space: nowrap;
958
- }
959
- }
960
-
961
- .oa-search__result-arrow {
962
- color: #c1cad7;
963
- font-size: 11px;
964
- }
965
-
966
- .oa-search__empty {
967
- display: flex;
968
- align-items: center;
969
- justify-content: center;
970
- gap: 6px;
971
- padding: 26px 10px;
972
- color: var(--oa-faint);
973
- font-size: 11px;
974
- }
975
-
976
- .oa-search__foot {
977
- display: flex;
978
- align-items: center;
979
- justify-content: space-between;
980
- margin-top: 4px;
981
- padding: 7px 8px 2px;
982
- border-top: 1px solid #f0f3f8;
983
- color: var(--oa-faint);
984
- font-size: 9px;
985
- }
986
-
987
- .oa-topbar__actions {
988
- display: flex;
989
- align-items: center;
990
- gap: 8px;
991
- margin-left: auto;
992
- flex-shrink: 0;
993
- }
994
-
995
- .oa-topbar__create {
996
- min-height: 32px;
997
- padding: 6px 12px;
998
- font-size: 11.5px;
999
- }
1000
-
1001
- .oa-topbar__icon {
1002
- display: grid;
1003
- place-items: center;
1004
- width: 34px;
1005
- height: 34px;
1006
- border: 1px solid var(--oa-line);
1007
- border-radius: 7px;
1008
- background: #fff;
1009
- color: var(--oa-muted);
1010
- font-size: 16px;
1011
- cursor: pointer;
1012
- transition: border-color 0.15s ease, color 0.15s ease;
1013
-
1014
- &:hover {
1015
- border-color: #cbd8ef;
1016
- color: var(--oa-ink);
1017
- }
1018
-
1019
- :deep(.el-badge__content) {
1020
- top: 1px;
1021
- right: 4px;
1022
- height: 14px;
1023
- padding: 0 4px;
1024
- font-size: 9px;
1025
- }
1026
- }
1027
-
1028
- .oa-identity {
1029
- display: flex;
1030
- align-items: center;
1031
- gap: 7px;
1032
- padding: 2px 6px 2px 2px;
1033
- border: 1px solid transparent;
1034
- border-radius: 7px;
1035
- background: transparent;
1036
- cursor: pointer;
1037
-
1038
- &:hover {
1039
- border-color: var(--oa-line);
1040
- background: #f9fbfe;
1041
- }
1042
- }
1043
-
1044
- .oa-identity__text {
1045
- display: flex;
1046
- flex-direction: column;
1047
- align-items: flex-start;
1048
- min-width: 0;
1049
-
1050
- strong {
1051
- max-width: 80px;
1052
- overflow: hidden;
1053
- color: var(--oa-ink);
1054
- font-size: 11px;
1055
- font-weight: 600;
1056
- line-height: 1.3;
1057
- text-overflow: ellipsis;
1058
- white-space: nowrap;
1059
- }
1060
-
1061
- small {
1062
- max-width: 88px;
1063
- overflow: hidden;
1064
- color: var(--oa-faint);
1065
- font-size: 9px;
1066
- line-height: 1.3;
1067
- text-overflow: ellipsis;
1068
- white-space: nowrap;
1069
- }
1070
- }
1071
-
1072
- .oa-identity__arrow {
1073
- color: #a3aebe;
1074
- font-size: 10px;
1075
- }
1076
-
1077
- .oa-content {
1078
- flex: 1;
1079
- min-height: 0;
1080
- overflow: auto;
1081
- background: var(--oa-bg);
1082
- }
1083
-
1084
- .oa-no-permission {
1085
- padding: 80px 24px;
1086
- }
1087
-
1088
- .oa-mobile-nav {
1089
- display: none;
1090
- }
1091
-
1092
- .oa-mobile-drawer__inner {
1093
- display: flex;
1094
- flex-direction: column;
1095
- height: 100%;
1096
- background: var(--oa-sidebar);
1097
- }
1098
-
1099
- .oa-mobile-drawer__inner :deep(.oa-nav) {
1100
- flex: 1;
1101
- min-height: 0;
1102
- }
1103
-
1104
- .oa-user-menu {
1105
- min-width: 320px;
1106
- max-width: 340px;
1107
- max-height: 440px;
1108
- overflow-y: auto;
1109
- }
1110
-
1111
- .oa-user-menu__head {
1112
- display: flex;
1113
- flex-direction: column;
1114
- padding: 8px 12px 9px;
1115
-
1116
- strong {
1117
- color: var(--oa-ink);
1118
- font-size: 12px;
1119
- font-weight: 650;
1120
- }
1121
-
1122
- span {
1123
- margin-top: 1px;
1124
- color: var(--oa-faint);
1125
- font-size: 9.5px;
1126
- }
1127
- }
1128
-
1129
- .oa-user-menu__label {
1130
- margin: 2px 0 4px;
1131
- padding: 6px 12px 0;
1132
- border-top: 1px solid var(--oa-line);
1133
- color: var(--oa-faint);
1134
- font-size: 9px;
1135
- font-weight: 600;
1136
- letter-spacing: 0.04em;
1137
- }
1138
-
1139
- .oa-user-menu__user {
1140
- display: flex;
1141
- align-items: center;
1142
- gap: 8px;
1143
- width: 100%;
1144
- min-width: 0;
1145
-
1146
- > .oa-avatar {
1147
- flex: 0 0 auto;
1148
- }
1149
- }
1150
-
1151
- .oa-user-menu__text {
1152
- display: flex;
1153
- flex-direction: column;
1154
- flex: 1;
1155
- min-width: 0;
1156
-
1157
- strong {
1158
- overflow: hidden;
1159
- color: var(--oa-ink);
1160
- font-size: 11.5px;
1161
- font-weight: 600;
1162
- text-overflow: ellipsis;
1163
- white-space: nowrap;
1164
- }
1165
-
1166
- small {
1167
- overflow: hidden;
1168
- color: var(--oa-faint);
1169
- font-size: 9.5px;
1170
- text-overflow: ellipsis;
1171
- white-space: nowrap;
1172
- }
1173
- }
1174
-
1175
- .oa-user-menu__pending {
1176
- display: inline-grid;
1177
- place-items: center;
1178
- min-width: 16px;
1179
- height: 16px;
1180
- padding: 0 4px;
1181
- border-radius: 8px;
1182
- background: var(--oa-primary-soft);
1183
- color: var(--oa-primary);
1184
- font-size: 9px;
1185
- font-style: normal;
1186
- font-weight: 600;
1187
- }
1188
-
1189
- :deep(.el-dropdown-menu__item.is-current) {
1190
- background: var(--oa-primary-soft);
1191
- }
1192
-
1193
- @media (max-width: 1180px) {
1194
- .oa-topbar__create {
1195
- display: none;
1196
- }
1197
-
1198
- .oa-search {
1199
- width: min(320px, 30vw);
1200
- }
1201
- }
1202
-
1203
- @media (max-width: 960px) {
1204
- .oa-sidebar {
1205
- display: none;
1206
- }
1207
-
1208
- .oa-topbar {
1209
- gap: 10px;
1210
- height: 54px;
1211
- padding: 0 12px;
1212
- }
1213
-
1214
- .oa-topbar__menu {
1215
- display: inline-flex;
1216
- }
1217
-
1218
- .oa-topbar__crumb {
1219
- display: none;
1220
- }
1221
-
1222
- .oa-search {
1223
- flex: 1;
1224
- width: auto;
1225
- min-width: 0;
1226
- }
1227
-
1228
- .oa-search__kbd {
1229
- display: none;
1230
- }
1231
-
1232
- .oa-search__panel {
1233
- position: fixed;
1234
- top: 60px;
1235
- left: 10px;
1236
- right: 10px;
1237
- }
1238
-
1239
- .oa-identity__text,
1240
- .oa-identity__arrow {
1241
- display: none;
1242
- }
1243
-
1244
- .oa-identity {
1245
- padding: 2px;
1246
- }
1247
-
1248
- .oa-content {
1249
- padding-bottom: 0;
1250
- }
1251
-
1252
- .oa-shell.is-mobile-detail .oa-mobile-nav {
1253
- display: none;
1254
- }
1255
-
1256
- .oa-mobile-nav {
1257
- position: fixed;
1258
- right: 0;
1259
- bottom: 0;
1260
- left: 0;
1261
- z-index: 40;
1262
- display: grid;
1263
- grid-template-columns: repeat(5, minmax(0, 1fr));
1264
- padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
1265
- border-top: 1px solid var(--oa-line);
1266
- background: rgba(255, 255, 255, 0.97);
1267
- backdrop-filter: blur(12px);
1268
-
1269
- button {
1270
- display: flex;
1271
- flex-direction: column;
1272
- align-items: center;
1273
- justify-content: center;
1274
- gap: 2px;
1275
- min-height: 48px;
1276
- border: none;
1277
- border-radius: 7px;
1278
- background: transparent;
1279
- color: #8b97a9;
1280
- font-size: 9px;
1281
- cursor: pointer;
1282
-
1283
- .el-icon {
1284
- font-size: 18px;
1285
- }
1286
-
1287
- &.is-active {
1288
- color: var(--oa-primary);
1289
-
1290
- .el-icon {
1291
- transform: translateY(-1px);
1292
- }
1293
- }
1294
- }
1295
- }
1296
-
1297
- .oa-mobile-nav__badge {
1298
- :deep(.el-badge__content) {
1299
- top: 2px;
1300
- right: 2px;
1301
- height: 13px;
1302
- padding: 0 3px;
1303
- font-size: 8px;
1304
- }
1305
- }
1306
-
1307
- .oa-no-permission {
1308
- padding: 60px 20px;
1309
- }
1310
- }
1311
- </style>
1312
-
1313
- <style lang="scss">
1314
- .oa-detail-drawer.el-drawer {
1315
- max-width: 1080px;
1316
- }
1317
-
1318
- .oa-detail-drawer .el-drawer__body {
1319
- padding: 0;
1320
- overflow: hidden;
1321
- }
1322
-
1323
- .oa-mobile-drawer .el-drawer__body {
1324
- padding: 0;
1325
- }
1326
-
1327
- .oa-user-popper {
1328
- padding: 4px;
1329
- }
1330
-
1331
- .oa-user-popper .el-dropdown-menu__item {
1332
- padding: 6px 8px;
1333
- border-radius: 6px;
1334
- }
1335
-
1336
- @media (max-width: 960px) {
1337
- .oa-detail-drawer.el-drawer {
1338
- max-width: 100%;
1339
- }
1340
- }
1341
- </style>
1
+ <template>
2
+ <div class="oa-shell" :class="{ 'is-mobile-detail': hideMobileNav }">
3
+ <aside class="oa-sidebar">
4
+ <div class="oa-sidebar__brand">
5
+ <span class="oa-sidebar__mark" aria-hidden="true">
6
+ <i></i><i></i><i></i>
7
+ </span>
8
+ <div class="oa-sidebar__titles">
9
+ <strong>{{ title }}</strong>
10
+ <span>{{ subtitle }}</span>
11
+ </div>
12
+ <span v-if="demo" class="oa-sidebar__env">测试</span>
13
+ </div>
14
+
15
+ <SidebarNav :groups="navGroups" :active-key="activeNavKey" @select="handleNav" />
16
+
17
+ <div class="oa-sidebar__footer">
18
+ <div class="oa-sidebar__status">
19
+ <span class="oa-sidebar__status-dot"></span>
20
+ <div>
21
+ <strong>本地数据 · 自动保存</strong>
22
+ <small>IndexedDB / localStorage</small>
23
+ </div>
24
+ </div>
25
+ <button type="button" class="oa-sidebar__action" @click="userDrawerVisible = true">
26
+ <el-icon><User /></el-icon>
27
+ 用户与组织
28
+ </button>
29
+ <button v-if="demo" type="button" class="oa-sidebar__action" @click="resetDemo">
30
+ <el-icon><RefreshLeft /></el-icon>
31
+ 重置演示数据
32
+ </button>
33
+ </div>
34
+ </aside>
35
+
36
+ <div class="oa-stage">
37
+ <header class="oa-topbar">
38
+ <button
39
+ type="button"
40
+ class="oa-topbar__menu oa-mobile-only"
41
+ aria-label="打开导航"
42
+ @click="mobileNavOpen = true"
43
+ >
44
+ <el-icon><Menu /></el-icon>
45
+ </button>
46
+
47
+ <div class="oa-topbar__crumb">
48
+ <span>{{ title }}</span>
49
+ <el-icon><ArrowRight /></el-icon>
50
+ <strong>{{ oa.viewTitle.value }}</strong>
51
+ </div>
52
+
53
+ <div ref="searchWrap" class="oa-search" :class="{ 'is-open': searchVisible }">
54
+ <el-icon class="oa-search__icon"><Search /></el-icon>
55
+ <input
56
+ ref="searchInput"
57
+ v-model="searchQuery"
58
+ type="search"
59
+ role="combobox"
60
+ aria-label="全局搜索"
61
+ :aria-expanded="searchVisible"
62
+ placeholder="搜索流程、单号、发起人"
63
+ @focus="searchOpen = true"
64
+ @input="searchOpen = true"
65
+ @keydown.enter.prevent="openFirstResult"
66
+ @keydown.esc="closeSearch"
67
+ />
68
+ <kbd class="oa-search__kbd">Ctrl K</kbd>
69
+
70
+ <div v-if="searchVisible" class="oa-search__panel">
71
+ <div role="listbox" aria-label="搜索结果">
72
+ <template v-if="searchResults.instances.length">
73
+ <p class="oa-search__group-label">流程实例</p>
74
+ <button
75
+ v-for="instance in searchResults.instances"
76
+ :key="instance.id"
77
+ type="button"
78
+ class="oa-search__result"
79
+ role="option"
80
+ @click="openSearchInstance(instance)"
81
+ >
82
+ <span class="oa-search__result-icon is-instance">
83
+ <el-icon><Document /></el-icon>
84
+ </span>
85
+ <span class="oa-search__result-main">
86
+ <strong>{{ instance.name }}</strong>
87
+ <small>
88
+ {{ instance.code }} · {{ instance.initiator?.name }}
89
+ · {{ statusMeta(instance.state?.status).label }}
90
+ </small>
91
+ </span>
92
+ <el-icon class="oa-search__result-arrow"><ArrowRight /></el-icon>
93
+ </button>
94
+ </template>
95
+
96
+ <template v-if="searchResults.templates.length">
97
+ <p class="oa-search__group-label">流程模板</p>
98
+ <button
99
+ v-for="definition in searchResults.templates"
100
+ :key="definition.meta.id"
101
+ type="button"
102
+ class="oa-search__result"
103
+ role="option"
104
+ @click="openSearchTemplate(definition)"
105
+ >
106
+ <span class="oa-search__result-icon is-template">
107
+ <el-icon><Grid /></el-icon>
108
+ </span>
109
+ <span class="oa-search__result-main">
110
+ <strong>{{ definition.meta.name }}</strong>
111
+ <small>{{ definition.meta.description || '流程模板' }}</small>
112
+ </span>
113
+ <span class="oa-chip">发起</span>
114
+ </button>
115
+ </template>
116
+
117
+ <div v-if="!hasSearchResults" class="oa-search__empty">
118
+ <el-icon><Search /></el-icon>
119
+ 没有匹配的流程或模板
120
+ </div>
121
+ </div>
122
+ <footer class="oa-search__foot">
123
+ <span>按 Enter 打开首个结果</span>
124
+ <span>Esc 关闭</span>
125
+ </footer>
126
+ </div>
127
+ </div>
128
+
129
+ <div class="oa-topbar__actions">
130
+ <el-button class="oa-topbar__create" type="primary" :icon="Plus" @click="oa.navigate('templates')">
131
+ 发起申请
132
+ </el-button>
133
+ <button
134
+ type="button"
135
+ class="oa-topbar__icon"
136
+ :aria-label="`通知中心,${oa.unreadNotifications.value.length} 条未读`"
137
+ @click="oa.navigate('notifications')"
138
+ >
139
+ <el-badge
140
+ :value="oa.unreadNotifications.value.length"
141
+ :hidden="!oa.unreadNotifications.value.length"
142
+ :max="99"
143
+ >
144
+ <el-icon><Bell /></el-icon>
145
+ </el-badge>
146
+ </button>
147
+
148
+ <el-dropdown trigger="click" popper-class="oa-user-popper" @command="handleUserCommand">
149
+ <button type="button" class="oa-identity">
150
+ <UserAvatar :name="oa.currentUserName.value" :size="30" />
151
+ <span class="oa-identity__text">
152
+ <strong>{{ oa.currentUserName.value }}</strong>
153
+ <small>{{ oa.currentUserDept.value }}</small>
154
+ </span>
155
+ <el-icon class="oa-identity__arrow"><ArrowDown /></el-icon>
156
+ </button>
157
+ <template #dropdown>
158
+ <el-dropdown-menu class="oa-user-menu">
159
+ <li class="oa-user-menu__head">
160
+ <strong>{{ oa.currentUserName.value }}</strong>
161
+ <span>{{ oa.currentUserRoleNames.value.join(' / ') || '成员' }}</span>
162
+ </li>
163
+ <li class="oa-user-menu__label">切换身份(模拟不同角色)</li>
164
+ <el-dropdown-item
165
+ v-for="user in oa.usersWithStats.value"
166
+ :key="user.id"
167
+ :command="`user:${user.id}`"
168
+ :class="{ 'is-current': String(user.id) === String(oa.currentUserId.value) }"
169
+ >
170
+ <span class="oa-user-menu__user">
171
+ <UserAvatar :name="user.realName" :size="24" />
172
+ <span class="oa-user-menu__text">
173
+ <strong>{{ user.realName }}</strong>
174
+ <small>{{ user.deptLabel }} · {{ user.roleLabel }}</small>
175
+ </span>
176
+ <em v-if="user.isAdmin" class="oa-chip oa-chip--primary">管理员</em>
177
+ <em v-if="user.pending" class="oa-user-menu__pending">{{ user.pending }}</em>
178
+ </span>
179
+ </el-dropdown-item>
180
+ <el-dropdown-item divided command="manage">
181
+ <el-icon><Setting /></el-icon>用户与组织配置
182
+ </el-dropdown-item>
183
+ <el-dropdown-item v-if="demo" command="reset">
184
+ <el-icon><RefreshLeft /></el-icon>重置演示数据
185
+ </el-dropdown-item>
186
+ </el-dropdown-menu>
187
+ </template>
188
+ </el-dropdown>
189
+ </div>
190
+ </header>
191
+
192
+ <main ref="contentRef" class="oa-content">
193
+ <div v-if="!oa.ready.value" class="oa-skeleton" aria-label="正在加载">
194
+ <div class="oa-skeleton__row" style="height: 84px"></div>
195
+ <div class="oa-skeleton__row" style="height: 96px"></div>
196
+ <div class="oa-skeleton__row" style="height: 260px"></div>
197
+ </div>
198
+ <HomePage v-else-if="oa.view.value === 'home'" />
199
+ <TaskCenterPage v-else-if="oa.view.value === 'tasks'" />
200
+ <RequestsPage v-else-if="oa.view.value === 'requests'" />
201
+ <TemplatesPage v-else-if="oa.view.value === 'templates'" />
202
+ <NotificationsPage v-else-if="oa.view.value === 'notifications'" />
203
+ <MonitorPage v-else-if="oa.view.value === 'monitor' && oa.isAdmin.value" />
204
+ <DesignPage v-else-if="oa.view.value === 'design' && oa.isAdmin.value" />
205
+ <div v-else class="oa-page">
206
+ <div class="oa-card">
207
+ <div class="oa-empty oa-no-permission">
208
+ <span class="oa-empty__icon"><el-icon><Lock /></el-icon></span>
209
+ <strong>当前身份没有该页面的访问权限</strong>
210
+ <p>流程监控与流程设计仅对流程管理员开放。请切换到管理员身份,或返回工作台。</p>
211
+ <el-button type="primary" plain @click="oa.navigate('home')">返回工作台</el-button>
212
+ </div>
213
+ </div>
214
+ </div>
215
+ </main>
216
+ </div>
217
+
218
+ <nav class="oa-mobile-nav" aria-label="移动端导航">
219
+ <button
220
+ v-for="item in mobileNav"
221
+ :key="item.key"
222
+ type="button"
223
+ :class="{ 'is-active': item.isActive }"
224
+ @click="handleMobileNav(item)"
225
+ >
226
+ <el-badge
227
+ :value="item.badge || 0"
228
+ :hidden="!item.badge"
229
+ :max="99"
230
+ class="oa-mobile-nav__badge"
231
+ >
232
+ <el-icon><component :is="item.icon" /></el-icon>
233
+ </el-badge>
234
+ <span>{{ item.label }}</span>
235
+ </button>
236
+ </nav>
237
+
238
+ <el-drawer
239
+ v-model="mobileNavOpen"
240
+ direction="ltr"
241
+ size="280px"
242
+ :with-header="false"
243
+ append-to-body
244
+ class="oa-mobile-drawer"
245
+ >
246
+ <div class="oa-mobile-drawer__inner">
247
+ <div class="oa-sidebar__brand">
248
+ <span class="oa-sidebar__mark" aria-hidden="true">
249
+ <i></i><i></i><i></i>
250
+ </span>
251
+ <div class="oa-sidebar__titles">
252
+ <strong>{{ title }}</strong>
253
+ <span>{{ subtitle }}</span>
254
+ </div>
255
+ </div>
256
+ <SidebarNav :groups="navGroups" :active-key="activeNavKey" @select="handleNav" />
257
+ <div class="oa-sidebar__footer">
258
+ <button type="button" class="oa-sidebar__action" @click="userDrawerVisible = true; mobileNavOpen = false">
259
+ <el-icon><User /></el-icon>
260
+ 用户与组织
261
+ </button>
262
+ <button v-if="demo" type="button" class="oa-sidebar__action" @click="resetDemo(); mobileNavOpen = false">
263
+ <el-icon><RefreshLeft /></el-icon>
264
+ 重置演示数据
265
+ </button>
266
+ </div>
267
+ </div>
268
+ </el-drawer>
269
+
270
+ <el-drawer
271
+ v-model="detailDrawer"
272
+ size="100%"
273
+ :with-header="false"
274
+ append-to-body
275
+ class="oa-detail-drawer"
276
+ >
277
+ <ApprovalWorkspace
278
+ v-if="oa.detailInstance.value"
279
+ :instance="oa.detailInstance.value"
280
+ dismissible
281
+ @close="oa.closeInstanceDetail"
282
+ />
283
+ </el-drawer>
284
+
285
+ <StartFlowDialog
286
+ v-if="oa.startDialogDefinition.value"
287
+ :definition="oa.startDialogDefinition.value"
288
+ @close="oa.closeStartDialog"
289
+ />
290
+
291
+ <UserConfigDrawer
292
+ v-model="userDrawerVisible"
293
+ :users="oa.org.users"
294
+ :departments="oa.org.departments"
295
+ :roles="oa.org.roles"
296
+ @save="handleApplyOrg"
297
+ />
298
+ </div>
299
+ </template>
300
+
301
+ <script setup>
302
+ import { computed, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue'
303
+ import { ElMessage, ElMessageBox } from 'element-plus'
304
+ import {
305
+ ArrowDown,
306
+ ArrowRight,
307
+ Bell,
308
+ ChatDotRound,
309
+ CircleCheck,
310
+ Document,
311
+ EditPen,
312
+ Grid,
313
+ House,
314
+ Lock,
315
+ Menu,
316
+ Monitor,
317
+ Plus,
318
+ RefreshLeft,
319
+ Search,
320
+ Setting,
321
+ Tickets,
322
+ User
323
+ } from 'gbicons'
324
+ import UserConfigDrawer from '../testing/UserConfigDrawer.vue'
325
+ import ApprovalWorkspace from './components/ApprovalWorkspace.vue'
326
+ import SidebarNav from './components/SidebarNav.vue'
327
+ import StartFlowDialog from './components/StartFlowDialog.vue'
328
+ import UserAvatar from './components/UserAvatar.vue'
329
+ import DesignPage from './pages/DesignPage.vue'
330
+ import HomePage from './pages/HomePage.vue'
331
+ import MonitorPage from './pages/MonitorPage.vue'
332
+ import NotificationsPage from './pages/NotificationsPage.vue'
333
+ import RequestsPage from './pages/RequestsPage.vue'
334
+ import TaskCenterPage from './pages/TaskCenterPage.vue'
335
+ import TemplatesPage from './pages/TemplatesPage.vue'
336
+ import { statusMeta } from './model.js'
337
+ import { useWorkbench } from './useWorkbench.js'
338
+ import './styles.scss'
339
+
340
+ defineOptions({ name: 'GbOaWorkbench' })
341
+
342
+ const props = defineProps({
343
+ title: { type: String, default: '流程中台' },
344
+ subtitle: { type: String, default: '企业流程 · 审批协同' },
345
+ seedInstances: { type: Array, default: () => [] },
346
+ users: { type: Array, default: () => [] },
347
+ departments: { type: Array, default: () => [] },
348
+ roles: { type: Array, default: () => [] },
349
+ initiatorId: { type: [String, Number], default: null },
350
+ customExecutors: { type: Object, default: () => ({}) },
351
+ customFetch: { type: Function, default: null },
352
+ demo: { type: Boolean, default: false }
353
+ })
354
+
355
+ const oa = useWorkbench(props)
356
+ provide('oaStore', oa)
357
+
358
+ const userDrawerVisible = ref(false)
359
+ const mobileNavOpen = ref(false)
360
+ const searchQuery = ref('')
361
+ const searchOpen = ref(false)
362
+ const searchInput = ref(null)
363
+ const searchWrap = ref(null)
364
+ const contentRef = ref(null)
365
+
366
+ const navGroups = computed(() => {
367
+ const groups = [
368
+ {
369
+ label: '我的工作',
370
+ items: [
371
+ { key: 'home', label: '工作台', icon: House, view: 'home' },
372
+ {
373
+ key: 'tasks',
374
+ label: '待办中心',
375
+ icon: Tickets,
376
+ view: 'tasks',
377
+ badge: oa.pendingItems.value.length
378
+ },
379
+ { key: 'mine', label: '我的申请', icon: Document, view: 'requests', scope: 'mine' },
380
+ { key: 'cc', label: '抄送我的', icon: ChatDotRound, view: 'requests', scope: 'cc' },
381
+ { key: 'done', label: '已办事项', icon: CircleCheck, view: 'requests', scope: 'done' }
382
+ ]
383
+ },
384
+ {
385
+ label: '流程发起',
386
+ items: [{ key: 'templates', label: '模板中心', icon: Grid, view: 'templates' }]
387
+ }
388
+ ]
389
+ if (oa.isAdmin.value) {
390
+ groups.push({
391
+ label: '管理与治理',
392
+ items: [
393
+ { key: 'monitor', label: '流程监控', icon: Monitor, view: 'monitor' },
394
+ { key: 'design', label: '流程设计', icon: EditPen, view: 'design' }
395
+ ]
396
+ })
397
+ }
398
+ groups.push({
399
+ label: '消息',
400
+ items: [
401
+ {
402
+ key: 'notifications',
403
+ label: '通知中心',
404
+ icon: Bell,
405
+ view: 'notifications',
406
+ badge: oa.unreadNotifications.value.length
407
+ }
408
+ ]
409
+ })
410
+ return groups
411
+ })
412
+
413
+ const activeNavKey = computed(() => {
414
+ if (oa.view.value === 'requests') return oa.requestScope.value
415
+ return oa.view.value
416
+ })
417
+
418
+ const mobileNav = computed(() => [
419
+ {
420
+ key: 'home',
421
+ label: '工作台',
422
+ icon: House,
423
+ view: 'home',
424
+ isActive: oa.view.value === 'home'
425
+ },
426
+ {
427
+ key: 'tasks',
428
+ label: '待办',
429
+ icon: Tickets,
430
+ view: 'tasks',
431
+ badge: oa.pendingItems.value.length,
432
+ isActive: oa.view.value === 'tasks'
433
+ },
434
+ {
435
+ key: 'templates',
436
+ label: '发起',
437
+ icon: Plus,
438
+ view: 'templates',
439
+ isActive: oa.view.value === 'templates'
440
+ },
441
+ {
442
+ key: 'notifications',
443
+ label: '通知',
444
+ icon: Bell,
445
+ view: 'notifications',
446
+ badge: oa.unreadNotifications.value.length,
447
+ isActive: oa.view.value === 'notifications'
448
+ },
449
+ {
450
+ key: 'mine',
451
+ label: '我的',
452
+ icon: Document,
453
+ view: 'requests',
454
+ scope: 'mine',
455
+ isActive: oa.view.value === 'requests' && oa.requestScope.value === 'mine'
456
+ }
457
+ ])
458
+
459
+ const searchResults = computed(() => oa.searchAll(searchQuery.value))
460
+ const hasSearchResults = computed(
461
+ () =>
462
+ searchResults.value.instances.length > 0 ||
463
+ searchResults.value.templates.length > 0
464
+ )
465
+ const searchVisible = computed(
466
+ () => searchOpen.value && Boolean(searchQuery.value.trim())
467
+ )
468
+ const hideMobileNav = computed(
469
+ () => Boolean(oa.detailInstance.value) || (
470
+ oa.view.value === 'tasks' && Boolean(oa.activeTask.value)
471
+ )
472
+ )
473
+ const detailDrawer = computed({
474
+ get: () => Boolean(oa.detailInstance.value),
475
+ set: (visible) => {
476
+ if (!visible) oa.closeInstanceDetail()
477
+ }
478
+ })
479
+
480
+ function handleNav(item) {
481
+ if (item.view === 'tasks') oa.taskTab.value = 'approve'
482
+ oa.navigate(item.view, { scope: item.scope })
483
+ mobileNavOpen.value = false
484
+ }
485
+
486
+ function handleMobileNav(item) {
487
+ if (item.view === 'tasks') oa.selectTask(null, null)
488
+ handleNav(item)
489
+ }
490
+
491
+ function moveContentTop() {
492
+ if (contentRef.value) contentRef.value.scrollTop = 0
493
+ }
494
+
495
+ watch(
496
+ () => [oa.view.value, oa.requestScope.value],
497
+ () => {
498
+ moveContentTop()
499
+ closeSearch()
500
+ }
501
+ )
502
+
503
+ function closeSearch() {
504
+ searchOpen.value = false
505
+ }
506
+
507
+ function openSearchInstance(instance) {
508
+ closeSearch()
509
+ searchQuery.value = ''
510
+ oa.openInstanceDetail(instance.id)
511
+ }
512
+
513
+ function openSearchTemplate(definition) {
514
+ closeSearch()
515
+ searchQuery.value = ''
516
+ oa.openStartDialog(definition.meta.id)
517
+ }
518
+
519
+ function openFirstResult() {
520
+ const instance = searchResults.value.instances[0]
521
+ if (instance) {
522
+ openSearchInstance(instance)
523
+ return
524
+ }
525
+ const template = searchResults.value.templates[0]
526
+ if (template) openSearchTemplate(template)
527
+ }
528
+
529
+ async function handleUserCommand(command) {
530
+ if (typeof command === 'string' && command.startsWith('user:')) {
531
+ oa.switchUser(command.slice(5))
532
+ ElMessage.success(`已切换为 ${oa.currentUserName.value}`)
533
+ return
534
+ }
535
+ if (command === 'manage') {
536
+ userDrawerVisible.value = true
537
+ return
538
+ }
539
+ if (command === 'reset') {
540
+ await resetDemo()
541
+ }
542
+ }
543
+
544
+ function handleApplyOrg(payload) {
545
+ oa.applyOrg(payload)
546
+ userDrawerVisible.value = false
547
+ ElMessage.success('人员与组织配置已更新')
548
+ }
549
+
550
+ async function resetDemo() {
551
+ try {
552
+ await ElMessageBox.confirm(
553
+ '将清空本机保存的流程、实例、草稿与通知记录,并重新载入演示数据。确定继续?',
554
+ '重置演示数据',
555
+ {
556
+ type: 'warning',
557
+ confirmButtonText: '重置',
558
+ cancelButtonText: '取消'
559
+ }
560
+ )
561
+ } catch {
562
+ return
563
+ }
564
+ await oa.resetDemoData()
565
+ searchQuery.value = ''
566
+ closeSearch()
567
+ mobileNavOpen.value = false
568
+ ElMessage.success('演示数据已重置')
569
+ }
570
+
571
+ function onDocumentPointerDown(event) {
572
+ if (!searchOpen.value) return
573
+ if (searchWrap.value && !searchWrap.value.contains(event.target)) closeSearch()
574
+ }
575
+
576
+ function onDocumentKeydown(event) {
577
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k') {
578
+ event.preventDefault()
579
+ searchInput.value?.focus()
580
+ searchOpen.value = true
581
+ }
582
+ if (event.key === 'Escape') closeSearch()
583
+ }
584
+
585
+ onMounted(() => {
586
+ document.addEventListener('pointerdown', onDocumentPointerDown)
587
+ document.addEventListener('keydown', onDocumentKeydown)
588
+ })
589
+
590
+ onBeforeUnmount(() => {
591
+ document.removeEventListener('pointerdown', onDocumentPointerDown)
592
+ document.removeEventListener('keydown', onDocumentKeydown)
593
+ })
594
+
595
+ defineExpose({
596
+ store: oa,
597
+ definitions: oa.definitions,
598
+ instances: oa.instances,
599
+ navigate: oa.navigate
600
+ })
601
+ </script>
602
+
603
+ <style scoped lang="scss">
604
+ .oa-shell {
605
+ display: flex;
606
+ width: 100%;
607
+ height: 100%;
608
+ min-height: 0;
609
+ overflow: hidden;
610
+ }
611
+
612
+ .oa-sidebar {
613
+ display: flex;
614
+ flex-direction: column;
615
+ width: 228px;
616
+ flex-shrink: 0;
617
+ min-height: 0;
618
+ background:
619
+ radial-gradient(circle at 20% 0%, rgba(83, 129, 224, 0.16), transparent 28%),
620
+ var(--oa-sidebar);
621
+ color: var(--oa-sidebar-text);
622
+ }
623
+
624
+ .oa-sidebar__brand {
625
+ display: flex;
626
+ align-items: center;
627
+ gap: 9px;
628
+ flex-shrink: 0;
629
+ padding: 17px 16px 13px;
630
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
631
+ }
632
+
633
+ .oa-sidebar__mark {
634
+ position: relative;
635
+ display: grid;
636
+ grid-template-columns: repeat(2, 9px);
637
+ grid-template-rows: repeat(2, 9px);
638
+ gap: 3px;
639
+ width: 24px;
640
+ height: 24px;
641
+ align-content: center;
642
+ justify-content: center;
643
+ flex-shrink: 0;
644
+ border-radius: 6px;
645
+ background: linear-gradient(135deg, #4d7ef0, #2b57c8);
646
+
647
+ i {
648
+ border-radius: 1.5px;
649
+ background: #fff;
650
+
651
+ &:nth-child(1) {
652
+ opacity: 0.95;
653
+ }
654
+
655
+ &:nth-child(2) {
656
+ opacity: 0.55;
657
+ }
658
+
659
+ &:nth-child(3) {
660
+ grid-column: span 2;
661
+ opacity: 0.76;
662
+ }
663
+ }
664
+ }
665
+
666
+ .oa-sidebar__titles {
667
+ display: flex;
668
+ flex-direction: column;
669
+ min-width: 0;
670
+
671
+ strong {
672
+ overflow: hidden;
673
+ color: #f0f5fd;
674
+ font-size: 12.5px;
675
+ font-weight: 650;
676
+ letter-spacing: 0.01em;
677
+ text-overflow: ellipsis;
678
+ white-space: nowrap;
679
+ }
680
+
681
+ span {
682
+ overflow: hidden;
683
+ margin-top: 1px;
684
+ color: #778aa1;
685
+ font-size: 9.5px;
686
+ text-overflow: ellipsis;
687
+ white-space: nowrap;
688
+ }
689
+ }
690
+
691
+ .oa-sidebar__env {
692
+ margin-left: auto;
693
+ padding: 1px 5px;
694
+ border: 1px solid rgba(255, 255, 255, 0.14);
695
+ border-radius: 3px;
696
+ color: #a7bad2;
697
+ font-size: 8.5px;
698
+ letter-spacing: 0.03em;
699
+ }
700
+
701
+ :deep(.oa-nav) {
702
+ flex: 1;
703
+ min-height: 0;
704
+ }
705
+
706
+ .oa-sidebar__footer {
707
+ flex-shrink: 0;
708
+ display: flex;
709
+ flex-direction: column;
710
+ gap: 4px;
711
+ padding: 11px 12px 14px;
712
+ border-top: 1px solid rgba(255, 255, 255, 0.06);
713
+ }
714
+
715
+ .oa-sidebar__status {
716
+ display: flex;
717
+ align-items: center;
718
+ gap: 7px;
719
+ padding: 5px 6px 8px;
720
+
721
+ strong {
722
+ display: block;
723
+ color: #8fa3bb;
724
+ font-size: 9.5px;
725
+ font-weight: 500;
726
+ }
727
+
728
+ small {
729
+ display: block;
730
+ margin-top: 1px;
731
+ color: #5e7188;
732
+ font-size: 8.5px;
733
+ }
734
+ }
735
+
736
+ .oa-sidebar__status-dot {
737
+ width: 5px;
738
+ height: 5px;
739
+ border-radius: 50%;
740
+ background: #3db98a;
741
+ box-shadow: 0 0 0 3px rgba(61, 185, 138, 0.09);
742
+ }
743
+
744
+ .oa-sidebar__action {
745
+ display: flex;
746
+ align-items: center;
747
+ gap: 7px;
748
+ width: 100%;
749
+ padding: 6px 8px;
750
+ border: none;
751
+ border-radius: 5px;
752
+ background: transparent;
753
+ color: #8499b1;
754
+ font-size: 10.5px;
755
+ text-align: left;
756
+ cursor: pointer;
757
+
758
+ &:hover {
759
+ background: rgba(255, 255, 255, 0.05);
760
+ color: #dfe9f7;
761
+ }
762
+ }
763
+
764
+ .oa-stage {
765
+ flex: 1;
766
+ min-width: 0;
767
+ display: flex;
768
+ flex-direction: column;
769
+ min-height: 0;
770
+ }
771
+
772
+ .oa-topbar {
773
+ position: relative;
774
+ z-index: 30;
775
+ flex-shrink: 0;
776
+ display: flex;
777
+ align-items: center;
778
+ gap: 18px;
779
+ height: 58px;
780
+ padding: 0 20px;
781
+ background: rgba(255, 255, 255, 0.96);
782
+ border-bottom: 1px solid var(--oa-line);
783
+ backdrop-filter: blur(12px);
784
+ }
785
+
786
+ .oa-topbar__menu {
787
+ display: none;
788
+ align-items: center;
789
+ justify-content: center;
790
+ width: 36px;
791
+ height: 36px;
792
+ flex-shrink: 0;
793
+ border: 1px solid var(--oa-line);
794
+ border-radius: 7px;
795
+ background: #fff;
796
+ color: var(--oa-muted);
797
+ font-size: 17px;
798
+ cursor: pointer;
799
+ }
800
+
801
+ .oa-topbar__crumb {
802
+ display: flex;
803
+ align-items: center;
804
+ gap: 6px;
805
+ flex-shrink: 0;
806
+ color: var(--oa-faint);
807
+ font-size: 11px;
808
+
809
+ .el-icon {
810
+ color: #c1cad7;
811
+ font-size: 10px;
812
+ }
813
+
814
+ strong {
815
+ color: var(--oa-ink);
816
+ font-size: 11.5px;
817
+ font-weight: 600;
818
+ }
819
+ }
820
+
821
+ .oa-search {
822
+ position: relative;
823
+ display: flex;
824
+ align-items: center;
825
+ gap: 7px;
826
+ width: min(380px, 36vw);
827
+ height: 34px;
828
+ padding: 0 9px;
829
+ border: 1px solid var(--oa-line);
830
+ border-radius: 7px;
831
+ background: #f7f9fc;
832
+ transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
833
+
834
+ &:focus-within,
835
+ &.is-open {
836
+ border-color: #bfd0ee;
837
+ background: #fff;
838
+ box-shadow: 0 0 0 3px rgba(36, 86, 214, 0.06);
839
+ }
840
+
841
+ input {
842
+ flex: 1;
843
+ min-width: 0;
844
+ border: none;
845
+ outline: none;
846
+ background: transparent;
847
+ color: var(--oa-ink);
848
+ font-size: 11.5px;
849
+
850
+ &::-webkit-search-cancel-button {
851
+ display: none;
852
+ }
853
+
854
+ &::placeholder {
855
+ color: #a3aebe;
856
+ }
857
+ }
858
+ }
859
+
860
+ .oa-search__icon {
861
+ flex-shrink: 0;
862
+ color: #9ba7b8;
863
+ font-size: 14px;
864
+ }
865
+
866
+ .oa-search__kbd {
867
+ flex-shrink: 0;
868
+ padding: 1px 5px;
869
+ border: 1px solid #e1e6ef;
870
+ border-radius: 3px;
871
+ background: #fff;
872
+ color: #a3aebe;
873
+ font-family: inherit;
874
+ font-size: 8.5px;
875
+ }
876
+
877
+ .oa-search__panel {
878
+ position: absolute;
879
+ top: calc(100% + 7px);
880
+ left: 0;
881
+ right: 0;
882
+ z-index: 50;
883
+ padding: 6px;
884
+ border: 1px solid var(--oa-line);
885
+ border-radius: 9px;
886
+ background: #fff;
887
+ box-shadow: 0 16px 45px rgba(15, 31, 55, 0.14);
888
+ }
889
+
890
+ .oa-search__group-label {
891
+ margin: 7px 8px 4px;
892
+ color: var(--oa-faint);
893
+ font-size: 9px;
894
+ font-weight: 600;
895
+ letter-spacing: 0.06em;
896
+ text-transform: uppercase;
897
+ }
898
+
899
+ .oa-search__result {
900
+ display: flex;
901
+ align-items: center;
902
+ gap: 8px;
903
+ width: 100%;
904
+ padding: 7px 8px;
905
+ border: none;
906
+ border-radius: 6px;
907
+ background: transparent;
908
+ text-align: left;
909
+ cursor: pointer;
910
+
911
+ &:hover {
912
+ background: #f6f9ff;
913
+ }
914
+ }
915
+
916
+ .oa-search__result-icon {
917
+ display: grid;
918
+ place-items: center;
919
+ width: 27px;
920
+ height: 27px;
921
+ flex-shrink: 0;
922
+ border-radius: 6px;
923
+ font-size: 13px;
924
+
925
+ &.is-instance {
926
+ background: var(--oa-primary-soft);
927
+ color: var(--oa-primary);
928
+ }
929
+
930
+ &.is-template {
931
+ background: #eef7f2;
932
+ color: var(--oa-success);
933
+ }
934
+ }
935
+
936
+ .oa-search__result-main {
937
+ display: flex;
938
+ flex-direction: column;
939
+ flex: 1;
940
+ min-width: 0;
941
+
942
+ strong {
943
+ overflow: hidden;
944
+ color: var(--oa-ink);
945
+ font-size: 11.5px;
946
+ font-weight: 600;
947
+ text-overflow: ellipsis;
948
+ white-space: nowrap;
949
+ }
950
+
951
+ small {
952
+ overflow: hidden;
953
+ margin-top: 1px;
954
+ color: var(--oa-faint);
955
+ font-size: 9.5px;
956
+ text-overflow: ellipsis;
957
+ white-space: nowrap;
958
+ }
959
+ }
960
+
961
+ .oa-search__result-arrow {
962
+ color: #c1cad7;
963
+ font-size: 11px;
964
+ }
965
+
966
+ .oa-search__empty {
967
+ display: flex;
968
+ align-items: center;
969
+ justify-content: center;
970
+ gap: 6px;
971
+ padding: 26px 10px;
972
+ color: var(--oa-faint);
973
+ font-size: 11px;
974
+ }
975
+
976
+ .oa-search__foot {
977
+ display: flex;
978
+ align-items: center;
979
+ justify-content: space-between;
980
+ margin-top: 4px;
981
+ padding: 7px 8px 2px;
982
+ border-top: 1px solid #f0f3f8;
983
+ color: var(--oa-faint);
984
+ font-size: 9px;
985
+ }
986
+
987
+ .oa-topbar__actions {
988
+ display: flex;
989
+ align-items: center;
990
+ gap: 8px;
991
+ margin-left: auto;
992
+ flex-shrink: 0;
993
+ }
994
+
995
+ .oa-topbar__create {
996
+ min-height: 32px;
997
+ padding: 6px 12px;
998
+ font-size: 11.5px;
999
+ }
1000
+
1001
+ .oa-topbar__icon {
1002
+ display: grid;
1003
+ place-items: center;
1004
+ width: 34px;
1005
+ height: 34px;
1006
+ border: 1px solid var(--oa-line);
1007
+ border-radius: 7px;
1008
+ background: #fff;
1009
+ color: var(--oa-muted);
1010
+ font-size: 16px;
1011
+ cursor: pointer;
1012
+ transition: border-color 0.15s ease, color 0.15s ease;
1013
+
1014
+ &:hover {
1015
+ border-color: #cbd8ef;
1016
+ color: var(--oa-ink);
1017
+ }
1018
+
1019
+ :deep(.el-badge__content) {
1020
+ top: 1px;
1021
+ right: 4px;
1022
+ height: 14px;
1023
+ padding: 0 4px;
1024
+ font-size: 9px;
1025
+ }
1026
+ }
1027
+
1028
+ .oa-identity {
1029
+ display: flex;
1030
+ align-items: center;
1031
+ gap: 7px;
1032
+ padding: 2px 6px 2px 2px;
1033
+ border: 1px solid transparent;
1034
+ border-radius: 7px;
1035
+ background: transparent;
1036
+ cursor: pointer;
1037
+
1038
+ &:hover {
1039
+ border-color: var(--oa-line);
1040
+ background: #f9fbfe;
1041
+ }
1042
+ }
1043
+
1044
+ .oa-identity__text {
1045
+ display: flex;
1046
+ flex-direction: column;
1047
+ align-items: flex-start;
1048
+ min-width: 0;
1049
+
1050
+ strong {
1051
+ max-width: 80px;
1052
+ overflow: hidden;
1053
+ color: var(--oa-ink);
1054
+ font-size: 11px;
1055
+ font-weight: 600;
1056
+ line-height: 1.3;
1057
+ text-overflow: ellipsis;
1058
+ white-space: nowrap;
1059
+ }
1060
+
1061
+ small {
1062
+ max-width: 88px;
1063
+ overflow: hidden;
1064
+ color: var(--oa-faint);
1065
+ font-size: 9px;
1066
+ line-height: 1.3;
1067
+ text-overflow: ellipsis;
1068
+ white-space: nowrap;
1069
+ }
1070
+ }
1071
+
1072
+ .oa-identity__arrow {
1073
+ color: #a3aebe;
1074
+ font-size: 10px;
1075
+ }
1076
+
1077
+ .oa-content {
1078
+ flex: 1;
1079
+ min-height: 0;
1080
+ overflow: auto;
1081
+ background: var(--oa-bg);
1082
+ }
1083
+
1084
+ .oa-no-permission {
1085
+ padding: 80px 24px;
1086
+ }
1087
+
1088
+ .oa-mobile-nav {
1089
+ display: none;
1090
+ }
1091
+
1092
+ .oa-mobile-drawer__inner {
1093
+ display: flex;
1094
+ flex-direction: column;
1095
+ height: 100%;
1096
+ background: var(--oa-sidebar);
1097
+ }
1098
+
1099
+ .oa-mobile-drawer__inner :deep(.oa-nav) {
1100
+ flex: 1;
1101
+ min-height: 0;
1102
+ }
1103
+
1104
+ .oa-user-menu {
1105
+ min-width: 320px;
1106
+ max-width: 340px;
1107
+ max-height: 440px;
1108
+ overflow-y: auto;
1109
+ }
1110
+
1111
+ .oa-user-menu__head {
1112
+ display: flex;
1113
+ flex-direction: column;
1114
+ padding: 8px 12px 9px;
1115
+
1116
+ strong {
1117
+ color: var(--oa-ink);
1118
+ font-size: 12px;
1119
+ font-weight: 650;
1120
+ }
1121
+
1122
+ span {
1123
+ margin-top: 1px;
1124
+ color: var(--oa-faint);
1125
+ font-size: 9.5px;
1126
+ }
1127
+ }
1128
+
1129
+ .oa-user-menu__label {
1130
+ margin: 2px 0 4px;
1131
+ padding: 6px 12px 0;
1132
+ border-top: 1px solid var(--oa-line);
1133
+ color: var(--oa-faint);
1134
+ font-size: 9px;
1135
+ font-weight: 600;
1136
+ letter-spacing: 0.04em;
1137
+ }
1138
+
1139
+ .oa-user-menu__user {
1140
+ display: flex;
1141
+ align-items: center;
1142
+ gap: 8px;
1143
+ width: 100%;
1144
+ min-width: 0;
1145
+
1146
+ > .oa-avatar {
1147
+ flex: 0 0 auto;
1148
+ }
1149
+ }
1150
+
1151
+ .oa-user-menu__text {
1152
+ display: flex;
1153
+ flex-direction: column;
1154
+ flex: 1;
1155
+ min-width: 0;
1156
+
1157
+ strong {
1158
+ overflow: hidden;
1159
+ color: var(--oa-ink);
1160
+ font-size: 11.5px;
1161
+ font-weight: 600;
1162
+ text-overflow: ellipsis;
1163
+ white-space: nowrap;
1164
+ }
1165
+
1166
+ small {
1167
+ overflow: hidden;
1168
+ color: var(--oa-faint);
1169
+ font-size: 9.5px;
1170
+ text-overflow: ellipsis;
1171
+ white-space: nowrap;
1172
+ }
1173
+ }
1174
+
1175
+ .oa-user-menu__pending {
1176
+ display: inline-grid;
1177
+ place-items: center;
1178
+ min-width: 16px;
1179
+ height: 16px;
1180
+ padding: 0 4px;
1181
+ border-radius: 8px;
1182
+ background: var(--oa-primary-soft);
1183
+ color: var(--oa-primary);
1184
+ font-size: 9px;
1185
+ font-style: normal;
1186
+ font-weight: 600;
1187
+ }
1188
+
1189
+ :deep(.el-dropdown-menu__item.is-current) {
1190
+ background: var(--oa-primary-soft);
1191
+ }
1192
+
1193
+ @media (max-width: 1180px) {
1194
+ .oa-topbar__create {
1195
+ display: none;
1196
+ }
1197
+
1198
+ .oa-search {
1199
+ width: min(320px, 30vw);
1200
+ }
1201
+ }
1202
+
1203
+ @media (max-width: 960px) {
1204
+ .oa-sidebar {
1205
+ display: none;
1206
+ }
1207
+
1208
+ .oa-topbar {
1209
+ gap: 10px;
1210
+ height: 54px;
1211
+ padding: 0 12px;
1212
+ }
1213
+
1214
+ .oa-topbar__menu {
1215
+ display: inline-flex;
1216
+ }
1217
+
1218
+ .oa-topbar__crumb {
1219
+ display: none;
1220
+ }
1221
+
1222
+ .oa-search {
1223
+ flex: 1;
1224
+ width: auto;
1225
+ min-width: 0;
1226
+ }
1227
+
1228
+ .oa-search__kbd {
1229
+ display: none;
1230
+ }
1231
+
1232
+ .oa-search__panel {
1233
+ position: fixed;
1234
+ top: 60px;
1235
+ left: 10px;
1236
+ right: 10px;
1237
+ }
1238
+
1239
+ .oa-identity__text,
1240
+ .oa-identity__arrow {
1241
+ display: none;
1242
+ }
1243
+
1244
+ .oa-identity {
1245
+ padding: 2px;
1246
+ }
1247
+
1248
+ .oa-content {
1249
+ padding-bottom: 0;
1250
+ }
1251
+
1252
+ .oa-shell.is-mobile-detail .oa-mobile-nav {
1253
+ display: none;
1254
+ }
1255
+
1256
+ .oa-mobile-nav {
1257
+ position: fixed;
1258
+ right: 0;
1259
+ bottom: 0;
1260
+ left: 0;
1261
+ z-index: 40;
1262
+ display: grid;
1263
+ grid-template-columns: repeat(5, minmax(0, 1fr));
1264
+ padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
1265
+ border-top: 1px solid var(--oa-line);
1266
+ background: rgba(255, 255, 255, 0.97);
1267
+ backdrop-filter: blur(12px);
1268
+
1269
+ button {
1270
+ display: flex;
1271
+ flex-direction: column;
1272
+ align-items: center;
1273
+ justify-content: center;
1274
+ gap: 2px;
1275
+ min-height: 48px;
1276
+ border: none;
1277
+ border-radius: 7px;
1278
+ background: transparent;
1279
+ color: #8b97a9;
1280
+ font-size: 9px;
1281
+ cursor: pointer;
1282
+
1283
+ .el-icon {
1284
+ font-size: 18px;
1285
+ }
1286
+
1287
+ &.is-active {
1288
+ color: var(--oa-primary);
1289
+
1290
+ .el-icon {
1291
+ transform: translateY(-1px);
1292
+ }
1293
+ }
1294
+ }
1295
+ }
1296
+
1297
+ .oa-mobile-nav__badge {
1298
+ :deep(.el-badge__content) {
1299
+ top: 2px;
1300
+ right: 2px;
1301
+ height: 13px;
1302
+ padding: 0 3px;
1303
+ font-size: 8px;
1304
+ }
1305
+ }
1306
+
1307
+ .oa-no-permission {
1308
+ padding: 60px 20px;
1309
+ }
1310
+ }
1311
+ </style>
1312
+
1313
+ <style lang="scss">
1314
+ .oa-detail-drawer.el-drawer {
1315
+ max-width: 1080px;
1316
+ }
1317
+
1318
+ .oa-detail-drawer .el-drawer__body {
1319
+ padding: 0;
1320
+ overflow: hidden;
1321
+ }
1322
+
1323
+ .oa-mobile-drawer .el-drawer__body {
1324
+ padding: 0;
1325
+ }
1326
+
1327
+ .oa-user-popper {
1328
+ padding: 4px;
1329
+ }
1330
+
1331
+ .oa-user-popper .el-dropdown-menu__item {
1332
+ padding: 6px 8px;
1333
+ border-radius: 6px;
1334
+ }
1335
+
1336
+ @media (max-width: 960px) {
1337
+ .oa-detail-drawer.el-drawer {
1338
+ max-width: 100%;
1339
+ }
1340
+ }
1341
+ </style>