af-mobile-client-vue3 1.4.65 → 1.4.68

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 (43) hide show
  1. package/__dummy__ +9 -9
  2. package/build/vite/optimize.ts +36 -36
  3. package/package.json +121 -120
  4. package/pnpm-lock.yaml +11070 -0
  5. package/public/favicon.svg +4 -4
  6. package/scripts/verifyCommit.js +19 -19
  7. package/src/components/common/MateChat/components/MateChatContent.vue +274 -274
  8. package/src/components/common/MateChat/components/MateChatHeader.vue +337 -337
  9. package/src/components/common/MateChat/index.vue +444 -444
  10. package/src/components/common/MateChat/types.ts +247 -247
  11. package/src/components/data/UserDetail/types.ts +1 -1
  12. package/src/components/data/XFormGroup/doc/DeviceForm.vue +1 -1
  13. package/src/components/data/XFormGroup/doc/UserForm.vue +1 -1
  14. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  15. package/src/components/data/XReportGrid/XReportDemo.vue +33 -33
  16. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  17. package/src/components/data/XReportGrid/print.js +184 -184
  18. package/src/components/data/XTag/index.vue +10 -10
  19. package/src/components/layout/TabBarLayout/index.vue +40 -40
  20. package/src/hooks/useCommon.ts +9 -9
  21. package/src/plugins/AppData.ts +38 -38
  22. package/src/router/invoiceRoutes.ts +33 -33
  23. package/src/services/api/common.ts +109 -109
  24. package/src/services/api/manage.ts +8 -8
  25. package/src/services/api/search.ts +16 -16
  26. package/src/services/restTools.ts +56 -56
  27. package/src/stores/modules/user.ts +3 -0
  28. package/src/utils/authority-utils.ts +84 -84
  29. package/src/utils/crypto.ts +39 -39
  30. package/src/utils/runEvalFunction.ts +13 -13
  31. package/src/utils/timeUtil.ts +27 -27
  32. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  33. package/src/views/component/MateChat/MateChatView.vue +10 -10
  34. package/src/views/component/XCellDetailView/index.vue +217 -217
  35. package/src/views/component/XFormView/index.vue +2 -2
  36. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  37. package/src/views/component/XReportFormView/index.vue +13 -13
  38. package/src/views/component/XSignatureView/index.vue +50 -50
  39. package/src/views/component/notice.vue +46 -46
  40. package/src/views/component/topNav.vue +36 -36
  41. package/src/views/invoiceShow/index.vue +61 -61
  42. package/src/views/user/login/LoginForm.vue +0 -1
  43. package/src/views/user/login/index.vue +22 -22
@@ -1,337 +1,337 @@
1
- <script setup lang="ts">
2
- import type { ChatHistoryItem } from '@af-mobile-client-vue3/components/common/MateChat/types'
3
- import { getHistories } from '@af-mobile-client-vue3/components/common/MateChat/apiService'
4
- import { useChatHistoryCache } from '@af-mobile-client-vue3/components/common/MateChat/composables/useChatHistoryCache'
5
- import { Empty, Icon, Loading, Popup, Popover as VanPopover } from 'vant'
6
- import { ref } from 'vue'
7
- import 'vant/es/popup/style'
8
- import 'vant/es/empty/style'
9
- import 'vant/es/loading/style'
10
- import 'vant/es/icon/style'
11
- import 'vant/es/popover/style'
12
-
13
- interface Props {
14
- /**
15
- * 头部左侧 Logo 图片
16
- */
17
- logoImage: string
18
- /**
19
- * 头部标题文案
20
- */
21
- title: string
22
- /**
23
- * 历史对话弹层标题
24
- */
25
- historyTitle?: string
26
- /**
27
- * FastGPT 应用 ID
28
- */
29
- appId: string
30
- /**
31
- * FastGPT API Key
32
- */
33
- appKey: string
34
- /**
35
- * 是否显示标题
36
- */
37
- showTitle: boolean
38
- }
39
-
40
- interface SessionItem {
41
- chatId: string
42
- title: string
43
- lastTime: string
44
- }
45
-
46
- interface Emits {
47
- /**
48
- * 选择某条历史会话
49
- */
50
- (e: 'selectSession', session: SessionItem): void
51
- /**
52
- * 新建对话
53
- */
54
- (e: 'newConversation'): void
55
- }
56
-
57
- const props = withDefaults(defineProps<Props>(), {
58
- historyTitle: '对话历史',
59
- })
60
-
61
- const emit = defineEmits<Emits>()
62
-
63
- const showHistory = ref(false)
64
- const isLoading = ref(false)
65
- const sessionList = ref<SessionItem[]>([])
66
- const showMenu = ref(false)
67
-
68
- const menuActions: { text: string, key: 'new' | 'history', icon: string }[] = [
69
- { text: '新对话', key: 'new', icon: 'add-o' },
70
- { text: '历史对话', key: 'history', icon: 'clock-o' },
71
- ]
72
-
73
- // 使用历史会话缓存
74
- const { getCachedHistory, setCachedHistory } = useChatHistoryCache()
75
-
76
- function handleOpenHistory() {
77
- showHistory.value = true
78
- fetchSessions()
79
- }
80
-
81
- function handleSelectSession(session: SessionItem) {
82
- emit('selectSession', session)
83
- showHistory.value = false
84
- }
85
-
86
- /**
87
- * 处理下拉菜单点击
88
- */
89
- function handleMenuSelect(action: { text: string, key: 'new' | 'history', icon?: string }) {
90
- showMenu.value = false
91
- if (action.key === 'new') {
92
- emit('newConversation')
93
- return
94
- }
95
- if (action.key === 'history') {
96
- handleOpenHistory()
97
- }
98
- }
99
-
100
- /**
101
- * 格式化时间字符串为日期时间字符串
102
- */
103
- function formatDateTime(timeString: string): string {
104
- try {
105
- const date = new Date(timeString)
106
- const year = date.getFullYear()
107
- const month = String(date.getMonth() + 1).padStart(2, '0')
108
- const day = String(date.getDate()).padStart(2, '0')
109
- const hours = String(date.getHours()).padStart(2, '0')
110
- const minutes = String(date.getMinutes()).padStart(2, '0')
111
- return `${year}-${month}-${day} ${hours}:${minutes}`
112
- }
113
- catch {
114
- return timeString
115
- }
116
- }
117
-
118
- /**
119
- * 将接口返回的历史会话数据转换为组件需要的格式
120
- */
121
- function transformHistoryItem(item: ChatHistoryItem): SessionItem {
122
- return {
123
- chatId: item.chatId || '',
124
- title: item.title || item.customTitle || '未命名会话',
125
- lastTime: item.updateTime ? formatDateTime(item.updateTime) : '',
126
- }
127
- }
128
-
129
- async function fetchSessions() {
130
- // 先检查缓存
131
- const cachedList = getCachedHistory(props.appId, props.appKey)
132
- if (cachedList) {
133
- // 使用缓存数据
134
- sessionList.value = cachedList.map(transformHistoryItem)
135
- return
136
- }
137
-
138
- // 缓存不存在或已过期,从服务器获取
139
- isLoading.value = true
140
- try {
141
- const response = await getHistories(props.appId, props.appKey, 0, 5)
142
-
143
- // 转换数据格式
144
- if (response.data?.list && Array.isArray(response.data.list)) {
145
- // 缓存数据
146
- setCachedHistory(props.appId, props.appKey, response.data.list)
147
- sessionList.value = response.data.list.map(transformHistoryItem)
148
- }
149
- else {
150
- sessionList.value = []
151
- // 缓存空数组,避免重复请求
152
- setCachedHistory(props.appId, props.appKey, [])
153
- }
154
- }
155
- catch (error) {
156
- console.error('获取历史会话失败:', error)
157
- sessionList.value = []
158
- }
159
- finally {
160
- isLoading.value = false
161
- }
162
- }
163
- </script>
164
-
165
- <template>
166
- <div class="matechat-header-wrapper">
167
- <McHeader
168
- :logo-img="showTitle ? props.logoImage : ''"
169
- :title="showTitle ? props.title : ''"
170
- :logo-clickable="false"
171
- >
172
- <template #operationArea>
173
- <VanPopover
174
- v-model:show="showMenu"
175
- placement="bottom-end"
176
- :actions="menuActions"
177
- @select="handleMenuSelect"
178
- >
179
- <template #reference>
180
- <div class="matechat-header-history-btn">
181
- <Icon name="ellipsis" size="16" />
182
- </div>
183
- </template>
184
- </VanPopover>
185
- </template>
186
- </McHeader>
187
-
188
- <Popup
189
- v-model:show="showHistory"
190
- position="center"
191
- round
192
- :overlay="true"
193
- class="matechat-history-popup"
194
- >
195
- <div class="matechat-history-card">
196
- <div class="matechat-history-card__header">
197
- <span class="matechat-history-card__title">
198
- {{ props.historyTitle }}
199
- </span>
200
- </div>
201
- <div class="matechat-history-card__content">
202
- <div v-if="isLoading" class="matechat-history-card__loading">
203
- <Loading size="24px" />
204
- </div>
205
- <template v-else>
206
- <div
207
- v-if="sessionList.length"
208
- class="matechat-history-card__list"
209
- >
210
- <div
211
- v-for="session in sessionList"
212
- :key="session.chatId"
213
- class="matechat-history-card__item"
214
- @click="handleSelectSession(session)"
215
- >
216
- <div class="matechat-history-card__item-title">
217
- {{ session.title }}
218
- </div>
219
- <div class="matechat-history-card__item-time">
220
- {{ session.lastTime }}
221
- </div>
222
- </div>
223
- </div>
224
- <div v-else class="matechat-history-card__empty">
225
- <Empty description="无数据" />
226
- </div>
227
- </template>
228
- </div>
229
- </div>
230
- </Popup>
231
- </div>
232
- </template>
233
-
234
- <style scoped lang="less">
235
- .matechat-header-wrapper {
236
- position: relative;
237
- }
238
-
239
- .matechat-header-history-btn {
240
- display: inline-flex;
241
- align-items: center;
242
- justify-content: center;
243
- width: 32px;
244
- height: 32px;
245
- border-radius: 8px;
246
- background-color: rgba(255, 255, 255, 0.9);
247
- border: 1px solid rgba(0, 0, 0, 0.08);
248
- box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
249
- cursor: pointer;
250
- transition: all 0.2s ease;
251
-
252
- &:hover {
253
- background-color: #ffffff;
254
- transform: translateY(-0.5px);
255
- box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
256
- }
257
- }
258
-
259
- .matechat-history-popup {
260
- .matechat-history-card {
261
- width: 320px;
262
- max-width: 80vw;
263
- background-color: #ffffff;
264
- box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
265
- padding: 16px 16px 12px;
266
- box-sizing: border-box;
267
-
268
- &__header {
269
- display: flex;
270
- align-items: center;
271
- justify-content: space-between;
272
- margin-bottom: 12px;
273
- }
274
-
275
- &__title {
276
- font-size: 16px;
277
- font-weight: 600;
278
- color: #252b3a;
279
- }
280
-
281
- &__content {
282
- min-height: 120px;
283
- max-height: 260px;
284
- overflow: auto;
285
- }
286
-
287
- &__loading {
288
- display: flex;
289
- align-items: center;
290
- justify-content: center;
291
- padding: 24px 0;
292
- }
293
-
294
- &__list {
295
- display: flex;
296
- flex-direction: column;
297
- gap: 8px;
298
- }
299
-
300
- &__item {
301
- padding: 10px 8px;
302
- border-radius: 0;
303
- cursor: pointer;
304
- transition: all 0.2s ease;
305
-
306
- &:hover {
307
- background-color: #f5f6f9;
308
- }
309
- }
310
-
311
- &__item-title {
312
- font-size: 14px;
313
- color: #252b3a;
314
- margin-bottom: 2px;
315
- }
316
-
317
- &__item-time {
318
- font-size: 12px;
319
- color: #a0a4af;
320
- }
321
-
322
- &__empty {
323
- padding: 16px 0 8px;
324
-
325
- :deep(.van-empty__image) {
326
- width: 80px;
327
- height: 80px;
328
- }
329
-
330
- :deep(.van-empty__description) {
331
- font-size: 13px;
332
- color: #a0a4af;
333
- }
334
- }
335
- }
336
- }
337
- </style>
1
+ <script setup lang="ts">
2
+ import type { ChatHistoryItem } from '@af-mobile-client-vue3/components/common/MateChat/types'
3
+ import { getHistories } from '@af-mobile-client-vue3/components/common/MateChat/apiService'
4
+ import { useChatHistoryCache } from '@af-mobile-client-vue3/components/common/MateChat/composables/useChatHistoryCache'
5
+ import { Empty, Icon, Loading, Popup, Popover as VanPopover } from 'vant'
6
+ import { ref } from 'vue'
7
+ import 'vant/es/popup/style'
8
+ import 'vant/es/empty/style'
9
+ import 'vant/es/loading/style'
10
+ import 'vant/es/icon/style'
11
+ import 'vant/es/popover/style'
12
+
13
+ interface Props {
14
+ /**
15
+ * 头部左侧 Logo 图片
16
+ */
17
+ logoImage: string
18
+ /**
19
+ * 头部标题文案
20
+ */
21
+ title: string
22
+ /**
23
+ * 历史对话弹层标题
24
+ */
25
+ historyTitle?: string
26
+ /**
27
+ * FastGPT 应用 ID
28
+ */
29
+ appId: string
30
+ /**
31
+ * FastGPT API Key
32
+ */
33
+ appKey: string
34
+ /**
35
+ * 是否显示标题
36
+ */
37
+ showTitle: boolean
38
+ }
39
+
40
+ interface SessionItem {
41
+ chatId: string
42
+ title: string
43
+ lastTime: string
44
+ }
45
+
46
+ interface Emits {
47
+ /**
48
+ * 选择某条历史会话
49
+ */
50
+ (e: 'selectSession', session: SessionItem): void
51
+ /**
52
+ * 新建对话
53
+ */
54
+ (e: 'newConversation'): void
55
+ }
56
+
57
+ const props = withDefaults(defineProps<Props>(), {
58
+ historyTitle: '对话历史',
59
+ })
60
+
61
+ const emit = defineEmits<Emits>()
62
+
63
+ const showHistory = ref(false)
64
+ const isLoading = ref(false)
65
+ const sessionList = ref<SessionItem[]>([])
66
+ const showMenu = ref(false)
67
+
68
+ const menuActions: { text: string, key: 'new' | 'history', icon: string }[] = [
69
+ { text: '新对话', key: 'new', icon: 'add-o' },
70
+ { text: '历史对话', key: 'history', icon: 'clock-o' },
71
+ ]
72
+
73
+ // 使用历史会话缓存
74
+ const { getCachedHistory, setCachedHistory } = useChatHistoryCache()
75
+
76
+ function handleOpenHistory() {
77
+ showHistory.value = true
78
+ fetchSessions()
79
+ }
80
+
81
+ function handleSelectSession(session: SessionItem) {
82
+ emit('selectSession', session)
83
+ showHistory.value = false
84
+ }
85
+
86
+ /**
87
+ * 处理下拉菜单点击
88
+ */
89
+ function handleMenuSelect(action: { text: string, key: 'new' | 'history', icon?: string }) {
90
+ showMenu.value = false
91
+ if (action.key === 'new') {
92
+ emit('newConversation')
93
+ return
94
+ }
95
+ if (action.key === 'history') {
96
+ handleOpenHistory()
97
+ }
98
+ }
99
+
100
+ /**
101
+ * 格式化时间字符串为日期时间字符串
102
+ */
103
+ function formatDateTime(timeString: string): string {
104
+ try {
105
+ const date = new Date(timeString)
106
+ const year = date.getFullYear()
107
+ const month = String(date.getMonth() + 1).padStart(2, '0')
108
+ const day = String(date.getDate()).padStart(2, '0')
109
+ const hours = String(date.getHours()).padStart(2, '0')
110
+ const minutes = String(date.getMinutes()).padStart(2, '0')
111
+ return `${year}-${month}-${day} ${hours}:${minutes}`
112
+ }
113
+ catch {
114
+ return timeString
115
+ }
116
+ }
117
+
118
+ /**
119
+ * 将接口返回的历史会话数据转换为组件需要的格式
120
+ */
121
+ function transformHistoryItem(item: ChatHistoryItem): SessionItem {
122
+ return {
123
+ chatId: item.chatId || '',
124
+ title: item.title || item.customTitle || '未命名会话',
125
+ lastTime: item.updateTime ? formatDateTime(item.updateTime) : '',
126
+ }
127
+ }
128
+
129
+ async function fetchSessions() {
130
+ // 先检查缓存
131
+ const cachedList = getCachedHistory(props.appId, props.appKey)
132
+ if (cachedList) {
133
+ // 使用缓存数据
134
+ sessionList.value = cachedList.map(transformHistoryItem)
135
+ return
136
+ }
137
+
138
+ // 缓存不存在或已过期,从服务器获取
139
+ isLoading.value = true
140
+ try {
141
+ const response = await getHistories(props.appId, props.appKey, 0, 5)
142
+
143
+ // 转换数据格式
144
+ if (response.data?.list && Array.isArray(response.data.list)) {
145
+ // 缓存数据
146
+ setCachedHistory(props.appId, props.appKey, response.data.list)
147
+ sessionList.value = response.data.list.map(transformHistoryItem)
148
+ }
149
+ else {
150
+ sessionList.value = []
151
+ // 缓存空数组,避免重复请求
152
+ setCachedHistory(props.appId, props.appKey, [])
153
+ }
154
+ }
155
+ catch (error) {
156
+ console.error('获取历史会话失败:', error)
157
+ sessionList.value = []
158
+ }
159
+ finally {
160
+ isLoading.value = false
161
+ }
162
+ }
163
+ </script>
164
+
165
+ <template>
166
+ <div class="matechat-header-wrapper">
167
+ <McHeader
168
+ :logo-img="showTitle ? props.logoImage : ''"
169
+ :title="showTitle ? props.title : ''"
170
+ :logo-clickable="false"
171
+ >
172
+ <template #operationArea>
173
+ <VanPopover
174
+ v-model:show="showMenu"
175
+ placement="bottom-end"
176
+ :actions="menuActions"
177
+ @select="handleMenuSelect"
178
+ >
179
+ <template #reference>
180
+ <div class="matechat-header-history-btn">
181
+ <Icon name="ellipsis" size="16" />
182
+ </div>
183
+ </template>
184
+ </VanPopover>
185
+ </template>
186
+ </McHeader>
187
+
188
+ <Popup
189
+ v-model:show="showHistory"
190
+ position="center"
191
+ round
192
+ :overlay="true"
193
+ class="matechat-history-popup"
194
+ >
195
+ <div class="matechat-history-card">
196
+ <div class="matechat-history-card__header">
197
+ <span class="matechat-history-card__title">
198
+ {{ props.historyTitle }}
199
+ </span>
200
+ </div>
201
+ <div class="matechat-history-card__content">
202
+ <div v-if="isLoading" class="matechat-history-card__loading">
203
+ <Loading size="24px" />
204
+ </div>
205
+ <template v-else>
206
+ <div
207
+ v-if="sessionList.length"
208
+ class="matechat-history-card__list"
209
+ >
210
+ <div
211
+ v-for="session in sessionList"
212
+ :key="session.chatId"
213
+ class="matechat-history-card__item"
214
+ @click="handleSelectSession(session)"
215
+ >
216
+ <div class="matechat-history-card__item-title">
217
+ {{ session.title }}
218
+ </div>
219
+ <div class="matechat-history-card__item-time">
220
+ {{ session.lastTime }}
221
+ </div>
222
+ </div>
223
+ </div>
224
+ <div v-else class="matechat-history-card__empty">
225
+ <Empty description="无数据" />
226
+ </div>
227
+ </template>
228
+ </div>
229
+ </div>
230
+ </Popup>
231
+ </div>
232
+ </template>
233
+
234
+ <style scoped lang="less">
235
+ .matechat-header-wrapper {
236
+ position: relative;
237
+ }
238
+
239
+ .matechat-header-history-btn {
240
+ display: inline-flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ width: 32px;
244
+ height: 32px;
245
+ border-radius: 8px;
246
+ background-color: rgba(255, 255, 255, 0.9);
247
+ border: 1px solid rgba(0, 0, 0, 0.08);
248
+ box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
249
+ cursor: pointer;
250
+ transition: all 0.2s ease;
251
+
252
+ &:hover {
253
+ background-color: #ffffff;
254
+ transform: translateY(-0.5px);
255
+ box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
256
+ }
257
+ }
258
+
259
+ .matechat-history-popup {
260
+ .matechat-history-card {
261
+ width: 320px;
262
+ max-width: 80vw;
263
+ background-color: #ffffff;
264
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
265
+ padding: 16px 16px 12px;
266
+ box-sizing: border-box;
267
+
268
+ &__header {
269
+ display: flex;
270
+ align-items: center;
271
+ justify-content: space-between;
272
+ margin-bottom: 12px;
273
+ }
274
+
275
+ &__title {
276
+ font-size: 16px;
277
+ font-weight: 600;
278
+ color: #252b3a;
279
+ }
280
+
281
+ &__content {
282
+ min-height: 120px;
283
+ max-height: 260px;
284
+ overflow: auto;
285
+ }
286
+
287
+ &__loading {
288
+ display: flex;
289
+ align-items: center;
290
+ justify-content: center;
291
+ padding: 24px 0;
292
+ }
293
+
294
+ &__list {
295
+ display: flex;
296
+ flex-direction: column;
297
+ gap: 8px;
298
+ }
299
+
300
+ &__item {
301
+ padding: 10px 8px;
302
+ border-radius: 0;
303
+ cursor: pointer;
304
+ transition: all 0.2s ease;
305
+
306
+ &:hover {
307
+ background-color: #f5f6f9;
308
+ }
309
+ }
310
+
311
+ &__item-title {
312
+ font-size: 14px;
313
+ color: #252b3a;
314
+ margin-bottom: 2px;
315
+ }
316
+
317
+ &__item-time {
318
+ font-size: 12px;
319
+ color: #a0a4af;
320
+ }
321
+
322
+ &__empty {
323
+ padding: 16px 0 8px;
324
+
325
+ :deep(.van-empty__image) {
326
+ width: 80px;
327
+ height: 80px;
328
+ }
329
+
330
+ :deep(.van-empty__description) {
331
+ font-size: 13px;
332
+ color: #a0a4af;
333
+ }
334
+ }
335
+ }
336
+ }
337
+ </style>