af-mobile-client-vue3 1.4.53 → 1.4.55

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 (58) hide show
  1. package/build/vite/optimize.ts +36 -36
  2. package/package.json +1 -1
  3. package/public/favicon.svg +4 -4
  4. package/scripts/verifyCommit.js +19 -19
  5. package/src/App.vue +14 -2
  6. package/src/components/common/MateChat/apiService.ts +285 -0
  7. package/src/components/common/MateChat/assets/035-avatar-13.svg +1 -0
  8. package/src/components/common/MateChat/components/MateChatContent.vue +281 -0
  9. package/src/components/common/MateChat/components/MateChatHeader.vue +298 -0
  10. package/src/components/common/MateChat/components/PasswordDialog.vue +97 -0
  11. package/src/components/common/MateChat/components/PromptList/PromptList.vue +189 -0
  12. package/src/components/common/MateChat/components/PromptList/index.ts +1 -0
  13. package/src/components/common/MateChat/composables/useChatHistoryCache.ts +117 -0
  14. package/src/components/common/MateChat/composables/useChatMessagesCache.ts +72 -0
  15. package/src/components/common/MateChat/composables/useMateChat.ts +372 -0
  16. package/src/components/common/MateChat/composables/usePasswordManager.ts +38 -0
  17. package/src/components/common/MateChat/index.vue +429 -0
  18. package/src/components/common/MateChat/types.ts +236 -0
  19. package/src/components/common/otherCharge/ChargePrintSelectorAndRemarks.vue +137 -137
  20. package/src/components/common/otherCharge/CodePayment.vue +357 -357
  21. package/src/components/common/otherCharge/FileUploader.vue +602 -602
  22. package/src/components/common/otherCharge/GridFileUploader.vue +846 -846
  23. package/src/components/common/otherCharge/PaymentMethodSelector.vue +202 -202
  24. package/src/components/common/otherCharge/PaymentMethodSelectorCard.vue +45 -45
  25. package/src/components/common/otherCharge/ReceiptModal.vue +273 -273
  26. package/src/components/common/otherCharge/index.ts +43 -43
  27. package/src/components/data/OtherCharge/OtherChargeItemModal.vue +547 -547
  28. package/src/components/data/UserDetail/types.ts +1 -1
  29. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  30. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  31. package/src/components/data/XTag/index.vue +10 -10
  32. package/src/components/layout/TabBarLayout/index.vue +40 -40
  33. package/src/hooks/useCommon.ts +9 -9
  34. package/src/plugins/AppData.ts +38 -38
  35. package/src/router/invoiceRoutes.ts +33 -33
  36. package/src/services/api/common.ts +109 -109
  37. package/src/services/api/manage.ts +8 -8
  38. package/src/services/api/search.ts +16 -16
  39. package/src/services/restTools.ts +56 -56
  40. package/src/utils/authority-utils.ts +84 -84
  41. package/src/utils/crypto.ts +39 -39
  42. package/src/utils/queryFormDefaultRangePicker.ts +57 -57
  43. package/src/utils/runEvalFunction.ts +13 -13
  44. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  45. package/src/views/component/MateChat/MateChatView.vue +10 -254
  46. package/src/views/component/XCellDetailView/index.vue +217 -217
  47. package/src/views/component/XCellListView/index.vue +107 -138
  48. package/src/views/component/XFormGroupView/index.vue +78 -82
  49. package/src/views/component/XFormView/index.vue +41 -46
  50. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  51. package/src/views/component/XReportFormView/index.vue +13 -13
  52. package/src/views/component/XSignatureView/index.vue +50 -50
  53. package/src/views/component/notice.vue +46 -46
  54. package/src/views/component/topNav.vue +36 -36
  55. package/src/views/invoiceShow/index.vue +61 -61
  56. package/src/views/user/login/index.vue +22 -22
  57. package/vite.config.ts +2 -1
  58. package/src/views/component/MateChat/apiService.ts +0 -104
@@ -0,0 +1,189 @@
1
+ <script setup lang="ts">
2
+ import { Icon } from 'vant'
3
+ import 'vant/es/icon/style'
4
+
5
+ // 定义 props 接口
6
+ interface IconConfig {
7
+ name: string
8
+ color?: string
9
+ }
10
+
11
+ interface PromptItem {
12
+ value: string
13
+ label: string
14
+ iconConfig?: IconConfig
15
+ desc?: string
16
+ }
17
+
18
+ interface Props {
19
+ list: PromptItem[]
20
+ direction?: 'horizontal' | 'vertical'
21
+ }
22
+
23
+ // 定义 emits
24
+ interface Emits {
25
+ (e: 'itemClick', item: PromptItem): void
26
+ }
27
+
28
+ const props = withDefaults(defineProps<Props>(), {
29
+ direction: 'vertical',
30
+ })
31
+
32
+ const emit = defineEmits<Emits>()
33
+
34
+ // 处理点击事件
35
+ function handleItemClick(item: PromptItem) {
36
+ emit('itemClick', item)
37
+ }
38
+
39
+ // 将 icon-info-o 等图标名称转换为 Vant 图标名称
40
+ function getVantIconName(iconName: string): string {
41
+ const iconMap: Record<string, string> = {
42
+ 'icon-info-o': 'info-o',
43
+ 'icon-star': 'star',
44
+ 'icon-priority': 'fire',
45
+ }
46
+ return iconMap[iconName] || iconName.replace('icon-', '')
47
+ }
48
+ </script>
49
+
50
+ <template>
51
+ <div class="prompt-list" :class="[`prompt-list--${direction}`]">
52
+ <div
53
+ v-for="item in list"
54
+ :key="item.value"
55
+ class="prompt-item"
56
+ @click="handleItemClick(item)"
57
+ >
58
+ <div v-if="item.iconConfig" class="prompt-item__icon">
59
+ <Icon
60
+ :name="getVantIconName(item.iconConfig.name)"
61
+ :color="item.iconConfig.color"
62
+ size="20"
63
+ />
64
+ </div>
65
+ <div class="prompt-item__content">
66
+ <div class="prompt-item__label">
67
+ {{ item.label }}
68
+ </div>
69
+ <div v-if="item.desc" class="prompt-item__desc">
70
+ {{ item.desc }}
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </template>
76
+
77
+ <style scoped lang="less">
78
+ .prompt-list {
79
+ display: flex;
80
+ gap: 12px;
81
+ width: 100%;
82
+
83
+ &--horizontal {
84
+ flex-direction: row;
85
+ flex-wrap: wrap;
86
+ }
87
+
88
+ &--vertical {
89
+ flex-direction: column;
90
+ }
91
+ }
92
+
93
+ .prompt-item {
94
+ display: flex;
95
+ align-items: flex-start;
96
+ gap: 12px;
97
+ padding: 16px;
98
+ background: linear-gradient(135deg, rgba(94, 124, 224, 0.05) 0%, rgba(58, 194, 149, 0.05) 100%);
99
+ border-radius: 12px;
100
+ border: 1px solid rgba(94, 124, 224, 0.1);
101
+ cursor: pointer;
102
+ transition: all 0.3s ease;
103
+ flex: 1;
104
+ min-width: 0;
105
+
106
+ &:hover {
107
+ background: linear-gradient(135deg, rgba(94, 124, 224, 0.1) 0%, rgba(58, 194, 149, 0.1) 100%);
108
+ border-color: rgba(94, 124, 224, 0.2);
109
+ transform: translateY(-2px);
110
+ box-shadow: 0 4px 12px rgba(94, 124, 224, 0.15);
111
+ }
112
+
113
+ &:active {
114
+ transform: translateY(0);
115
+ }
116
+
117
+ &__icon {
118
+ flex-shrink: 0;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ width: 32px;
123
+ height: 32px;
124
+ background: rgba(255, 255, 255, 0.8);
125
+ border-radius: 8px;
126
+ }
127
+
128
+ &__content {
129
+ flex: 1;
130
+ min-width: 0;
131
+ }
132
+
133
+ &__label {
134
+ font-size: 14px;
135
+ font-weight: 500;
136
+ color: #252b3a;
137
+ line-height: 20px;
138
+ margin-bottom: 4px;
139
+ }
140
+
141
+ &__desc {
142
+ font-size: 12px;
143
+ color: #71757f;
144
+ line-height: 16px;
145
+ }
146
+ }
147
+
148
+ // 水平方向时的特殊样式
149
+ .prompt-list--horizontal {
150
+ .prompt-item {
151
+ flex: 1;
152
+ min-width: 140px;
153
+
154
+ &__content {
155
+ display: flex;
156
+ flex-direction: column;
157
+ }
158
+ }
159
+ }
160
+
161
+ // 垂直方向时的特殊样式
162
+ .prompt-list--vertical {
163
+ .prompt-item {
164
+ width: 100%;
165
+ }
166
+ }
167
+
168
+ // 简化版样式(用于快捷提示)
169
+ .shortcut-prompt {
170
+ .prompt-item {
171
+ padding: 10px 14px;
172
+ min-width: auto;
173
+
174
+ &__icon {
175
+ width: 24px;
176
+ height: 24px;
177
+ }
178
+
179
+ &__label {
180
+ font-size: 13px;
181
+ margin-bottom: 0;
182
+ }
183
+
184
+ &__desc {
185
+ display: none;
186
+ }
187
+ }
188
+ }
189
+ </style>
@@ -0,0 +1 @@
1
+ export { default as PromptList } from './PromptList.vue'
@@ -0,0 +1,117 @@
1
+ import type { ChatHistoryItem } from '@af-mobile-client-vue3/components/common/MateChat/types'
2
+ import { ref } from 'vue'
3
+
4
+ /**
5
+ * 历史会话缓存项
6
+ */
7
+ interface HistoryCacheItem {
8
+ list: ChatHistoryItem[]
9
+ timestamp: number
10
+ }
11
+
12
+ /**
13
+ * 历史会话缓存管理
14
+ * 使用 Map 存储不同 appId 的缓存数据
15
+ */
16
+ const historyCache = ref<Map<string, HistoryCacheItem>>(new Map())
17
+
18
+ /**
19
+ * 缓存过期时间(毫秒),默认 5 分钟
20
+ */
21
+ const CACHE_EXPIRY_TIME = 5 * 60 * 1000
22
+
23
+ /**
24
+ * 生成缓存 key
25
+ */
26
+ function getCacheKey(appId: string, appKey: string): string {
27
+ return `${appId}_${appKey}`
28
+ }
29
+
30
+ /**
31
+ * 检查缓存是否有效
32
+ */
33
+ function isCacheValid(cacheItem: HistoryCacheItem | undefined): boolean {
34
+ if (!cacheItem) {
35
+ return false
36
+ }
37
+ const now = Date.now()
38
+ return now - cacheItem.timestamp < CACHE_EXPIRY_TIME
39
+ }
40
+
41
+ /**
42
+ * 历史会话缓存管理组合式函数
43
+ */
44
+ export function useChatHistoryCache() {
45
+ /**
46
+ * 获取缓存的历史会话列表
47
+ * @param appId FastGPT 应用 ID
48
+ * @param appKey FastGPT API Key
49
+ * @returns 缓存的历史会话列表,如果缓存不存在或已过期则返回 null
50
+ */
51
+ function getCachedHistory(appId: string, appKey: string): ChatHistoryItem[] | null {
52
+ const key = getCacheKey(appId, appKey)
53
+ const cacheItem = historyCache.value.get(key)
54
+
55
+ if (isCacheValid(cacheItem)) {
56
+ return cacheItem!.list
57
+ }
58
+
59
+ // 缓存无效,清除
60
+ if (cacheItem) {
61
+ historyCache.value.delete(key)
62
+ }
63
+
64
+ return null
65
+ }
66
+
67
+ /**
68
+ * 设置历史会话列表缓存
69
+ * @param appId FastGPT 应用 ID
70
+ * @param appKey FastGPT API Key
71
+ * @param list 历史会话列表
72
+ */
73
+ function setCachedHistory(appId: string, appKey: string, list: ChatHistoryItem[]): void {
74
+ const key = getCacheKey(appId, appKey)
75
+ historyCache.value.set(key, {
76
+ list,
77
+ timestamp: Date.now(),
78
+ })
79
+ }
80
+
81
+ /**
82
+ * 清除指定应用的历史会话缓存
83
+ * @param appId FastGPT 应用 ID
84
+ * @param appKey FastGPT API Key
85
+ */
86
+ function clearCache(appId: string, appKey: string): void {
87
+ const key = getCacheKey(appId, appKey)
88
+ historyCache.value.delete(key)
89
+ }
90
+
91
+ /**
92
+ * 清除所有历史会话缓存
93
+ */
94
+ function clearAllCache(): void {
95
+ historyCache.value.clear()
96
+ }
97
+
98
+ /**
99
+ * 检查是否有有效的缓存
100
+ * @param appId FastGPT 应用 ID
101
+ * @param appKey FastGPT API Key
102
+ * @returns 是否有有效缓存
103
+ */
104
+ function hasValidCache(appId: string, appKey: string): boolean {
105
+ const key = getCacheKey(appId, appKey)
106
+ const cacheItem = historyCache.value.get(key)
107
+ return isCacheValid(cacheItem)
108
+ }
109
+
110
+ return {
111
+ getCachedHistory,
112
+ setCachedHistory,
113
+ clearCache,
114
+ clearAllCache,
115
+ hasValidCache,
116
+ }
117
+ }
@@ -0,0 +1,72 @@
1
+ import type { MateChatMessage } from '@af-mobile-client-vue3/components/common/MateChat/types'
2
+ import { ref } from 'vue'
3
+
4
+ /**
5
+ * 会话消息缓存管理
6
+ * 使用 Map 存储每个 chatId 的消息列表
7
+ */
8
+ const messagesCache = ref<Map<string, MateChatMessage[]>>(new Map())
9
+
10
+ /**
11
+ * 会话消息缓存管理组合式函数
12
+ */
13
+ export function useChatMessagesCache() {
14
+ /**
15
+ * 获取缓存的消息列表
16
+ * @param chatId 会话 ID
17
+ * @returns 缓存的消息列表,如果缓存不存在则返回 null
18
+ */
19
+ function getCachedMessages(chatId: string): MateChatMessage[] | null {
20
+ const cached = messagesCache.value.get(chatId)
21
+ return cached || null
22
+ }
23
+
24
+ /**
25
+ * 设置缓存的消息列表
26
+ * @param chatId 会话 ID
27
+ * @param messages 消息列表
28
+ */
29
+ function setCachedMessages(chatId: string, messages: MateChatMessage[]): void {
30
+ messagesCache.value.set(chatId, messages)
31
+ }
32
+
33
+ /**
34
+ * 追加新消息到缓存
35
+ * @param chatId 会话 ID
36
+ * @param newMessages 要追加的新消息列表
37
+ */
38
+ function appendMessages(chatId: string, newMessages: MateChatMessage[]): void {
39
+ const existing = messagesCache.value.get(chatId)
40
+ if (existing) {
41
+ // 如果缓存存在,追加新消息
42
+ messagesCache.value.set(chatId, [...existing, ...newMessages])
43
+ }
44
+ else {
45
+ // 如果缓存不存在,创建新缓存
46
+ messagesCache.value.set(chatId, [...newMessages])
47
+ }
48
+ }
49
+
50
+ /**
51
+ * 清除指定会话的缓存
52
+ * @param chatId 会话 ID
53
+ */
54
+ function clearCache(chatId: string): void {
55
+ messagesCache.value.delete(chatId)
56
+ }
57
+
58
+ /**
59
+ * 清除所有会话的消息缓存
60
+ */
61
+ function clearAllCache(): void {
62
+ messagesCache.value.clear()
63
+ }
64
+
65
+ return {
66
+ getCachedMessages,
67
+ setCachedMessages,
68
+ appendMessages,
69
+ clearCache,
70
+ clearAllCache,
71
+ }
72
+ }