af-mobile-client-vue3 1.4.59 → 1.4.60

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 (42) hide show
  1. package/__dummy__ +9 -9
  2. package/build/vite/optimize.ts +36 -36
  3. package/package.json +3 -2
  4. package/public/favicon.svg +4 -4
  5. package/scripts/verifyCommit.js +19 -19
  6. package/src/components/common/MateChat/components/MateChatContent.vue +274 -274
  7. package/src/components/common/MateChat/components/MateChatHeader.vue +337 -337
  8. package/src/components/common/MateChat/index.vue +444 -444
  9. package/src/components/common/MateChat/types.ts +247 -247
  10. package/src/components/data/FilePreview/index.vue +141 -0
  11. package/src/components/data/UserDetail/types.ts +1 -1
  12. package/src/components/data/XOlMap/types.ts +1 -1
  13. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  14. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  15. package/src/components/data/XTag/index.vue +10 -10
  16. package/src/components/layout/TabBarLayout/index.vue +40 -40
  17. package/src/hooks/useCommon.ts +9 -9
  18. package/src/plugins/AppData.ts +38 -38
  19. package/src/router/invoiceRoutes.ts +33 -33
  20. package/src/router/routes.ts +6 -0
  21. package/src/services/api/common.ts +109 -109
  22. package/src/services/api/manage.ts +8 -8
  23. package/src/services/api/search.ts +16 -16
  24. package/src/services/restTools.ts +56 -56
  25. package/src/utils/authority-utils.ts +84 -84
  26. package/src/utils/crypto.ts +39 -39
  27. package/src/utils/runEvalFunction.ts +13 -13
  28. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  29. package/src/views/component/FilePreviewView/index.vue +28 -0
  30. package/src/views/component/MateChat/MateChatView.vue +10 -10
  31. package/src/views/component/XCellDetailView/index.vue +217 -217
  32. package/src/views/component/XCellListView/index.vue +2 -78
  33. package/src/views/component/XFormView/index.vue +13 -28
  34. package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -118
  35. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  36. package/src/views/component/XReportFormView/index.vue +13 -13
  37. package/src/views/component/XSignatureView/index.vue +50 -50
  38. package/src/views/component/index.vue +5 -1
  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/index.vue +22 -22
@@ -1,247 +1,247 @@
1
- /**
2
- * MateChat 提示项接口
3
- */
4
- export interface MateChatPromptItem {
5
- value: string
6
- label: string
7
- iconConfig?: {
8
- name: string
9
- color?: string
10
- }
11
- desc?: string
12
- }
13
-
14
- /**
15
- * MateChat 配置接口
16
- */
17
- export interface MateChatConfig {
18
- /**
19
- * 可选密码,如果存在则需要密码验证
20
- */
21
- password?: string
22
- /**
23
- * FastGPT 应用 ID
24
- */
25
- appId: string
26
- /**
27
- * FastGPT API Key
28
- */
29
- appKey: string
30
- /**
31
- * 介绍文案
32
- */
33
- description: string[]
34
- /**
35
- * 首屏推荐问题列表
36
- */
37
- introPrompt: MateChatPromptItem[]
38
- /**
39
- * 底部快捷问题列表
40
- */
41
- simplePrompt: MateChatPromptItem[]
42
- /**
43
- * 客服名称
44
- */
45
- serviceName: string
46
- /**
47
- * 是否使用流式对话
48
- */
49
- useStream: boolean
50
- /**
51
- * 背景渐变颜色(CSS linear-gradient 字符串)
52
- * 如果不提供,使用默认蓝白渐变
53
- */
54
- backgroundGradient?: string
55
- }
56
-
57
- /**
58
- * 配置中心返回的多个配置对象
59
- * key 为配置名称,value 为 MateChatConfig
60
- */
61
- export type MateChatConfigs = Record<string, MateChatConfig>
62
-
63
- // ==================== API 相关类型定义 ====================
64
-
65
- /**
66
- * 聊天消息接口
67
- */
68
- export interface ChatMessage {
69
- role: 'user' | 'assistant' | 'system'
70
- content: string
71
- }
72
-
73
- /**
74
- * 聊天请求参数接口
75
- */
76
- export interface ChatCompletionsRequest {
77
- chatId: string
78
- stream: boolean
79
- detail: boolean
80
- messages: ChatMessage[]
81
- customUid?: string
82
- }
83
-
84
- /**
85
- * 聊天响应使用情况接口
86
- */
87
- export interface ChatUsage {
88
- prompt_tokens: number
89
- completion_tokens: number
90
- total_tokens: number
91
- }
92
-
93
- /**
94
- * 聊天响应选择项接口
95
- */
96
- export interface ChatChoice {
97
- message: {
98
- role: 'assistant'
99
- content: string
100
- }
101
- finish_reason: string
102
- index: number
103
- }
104
-
105
- /**
106
- * 聊天响应接口
107
- */
108
- export interface ChatCompletionsResponse {
109
- id: string
110
- model: string
111
- usage: ChatUsage
112
- choices: ChatChoice[]
113
- }
114
-
115
- /**
116
- * 业务层聊天结果
117
- */
118
- export interface ChatBizResult {
119
- /**
120
- * normal: 普通回复
121
- * transfer: 转人工
122
- */
123
- type: 'normal' | 'transfer'
124
- /**
125
- * 大模型原始返回内容
126
- */
127
- content: string
128
- }
129
-
130
- /**
131
- * 流式对话回调
132
- */
133
- export interface ChatStreamCallbacks {
134
- /**
135
- * 每次收到 FastGPT SSE 的增量内容时触发
136
- */
137
- onMessage?: (chunk: string) => void
138
- /**
139
- * 流结束时触发(包括收到 [DONE] 或正常读取结束)
140
- */
141
- onComplete?: () => void
142
- /**
143
- * 请求或解析发生异常时触发
144
- */
145
- onError?: (error: unknown) => void
146
- }
147
-
148
- /**
149
- * 历史会话项接口
150
- */
151
- export interface ChatHistoryItem {
152
- chatId: string
153
- updateTime: string
154
- appId: string
155
- customTitle: string
156
- title: string
157
- top: boolean
158
- [key: string]: any
159
- }
160
-
161
- /**
162
- * 历史会话查询请求参数接口
163
- */
164
- export interface GetHistoriesRequest {
165
- appId: string
166
- outLinkUid: string
167
- offset: number
168
- pageSize: number
169
- source: string
170
- }
171
-
172
- /**
173
- * 历史会话查询响应接口
174
- */
175
- export interface GetHistoriesResponse {
176
- code: number
177
- statusText: string
178
- message: string
179
- data: {
180
- list: ChatHistoryItem[]
181
- total: number
182
- }
183
- }
184
-
185
- /**
186
- * 历史会话记录项接口
187
- */
188
- export interface ChatRecordItem {
189
- _id: string
190
- dataId: string
191
- hideInUI: boolean
192
- obj: 'Human' | 'AI'
193
- value: Array<{
194
- type: string
195
- text: {
196
- content: string
197
- }
198
- }>
199
- customFeedbacks: any[]
200
- time: string
201
- durationSeconds?: number
202
- llmModuleAccount?: number
203
- totalQuoteList?: any[]
204
- historyPreviewLength?: number
205
- [key: string]: any
206
- }
207
-
208
- /**
209
- * 获取历史会话记录请求参数接口
210
- */
211
- export interface GetPaginationRecordsRequest {
212
- appId: string
213
- chatId: string
214
- offset: number
215
- pageSize: number
216
- loadCustomFeedbacks: boolean
217
- }
218
-
219
- /**
220
- * 获取历史会话记录响应接口
221
- */
222
- export interface GetPaginationRecordsResponse {
223
- code: number
224
- statusText: string
225
- message: string
226
- data: {
227
- list: ChatRecordItem[]
228
- total: number
229
- }
230
- }
231
-
232
- // ==================== MateChat 组件内部类型 ====================
233
-
234
- /**
235
- * MateChat 组件内部使用的消息结构
236
- */
237
- export interface MateChatMessage {
238
- from: 'user' | 'model' | 'service'
239
- content: string
240
- loading?: boolean
241
- /**
242
- * 是否启用打字机效果
243
- * - true: 启用打字机
244
- * - false 或未定义: 不启用打字机
245
- */
246
- typing?: boolean
247
- }
1
+ /**
2
+ * MateChat 提示项接口
3
+ */
4
+ export interface MateChatPromptItem {
5
+ value: string
6
+ label: string
7
+ iconConfig?: {
8
+ name: string
9
+ color?: string
10
+ }
11
+ desc?: string
12
+ }
13
+
14
+ /**
15
+ * MateChat 配置接口
16
+ */
17
+ export interface MateChatConfig {
18
+ /**
19
+ * 可选密码,如果存在则需要密码验证
20
+ */
21
+ password?: string
22
+ /**
23
+ * FastGPT 应用 ID
24
+ */
25
+ appId: string
26
+ /**
27
+ * FastGPT API Key
28
+ */
29
+ appKey: string
30
+ /**
31
+ * 介绍文案
32
+ */
33
+ description: string[]
34
+ /**
35
+ * 首屏推荐问题列表
36
+ */
37
+ introPrompt: MateChatPromptItem[]
38
+ /**
39
+ * 底部快捷问题列表
40
+ */
41
+ simplePrompt: MateChatPromptItem[]
42
+ /**
43
+ * 客服名称
44
+ */
45
+ serviceName: string
46
+ /**
47
+ * 是否使用流式对话
48
+ */
49
+ useStream: boolean
50
+ /**
51
+ * 背景渐变颜色(CSS linear-gradient 字符串)
52
+ * 如果不提供,使用默认蓝白渐变
53
+ */
54
+ backgroundGradient?: string
55
+ }
56
+
57
+ /**
58
+ * 配置中心返回的多个配置对象
59
+ * key 为配置名称,value 为 MateChatConfig
60
+ */
61
+ export type MateChatConfigs = Record<string, MateChatConfig>
62
+
63
+ // ==================== API 相关类型定义 ====================
64
+
65
+ /**
66
+ * 聊天消息接口
67
+ */
68
+ export interface ChatMessage {
69
+ role: 'user' | 'assistant' | 'system'
70
+ content: string
71
+ }
72
+
73
+ /**
74
+ * 聊天请求参数接口
75
+ */
76
+ export interface ChatCompletionsRequest {
77
+ chatId: string
78
+ stream: boolean
79
+ detail: boolean
80
+ messages: ChatMessage[]
81
+ customUid?: string
82
+ }
83
+
84
+ /**
85
+ * 聊天响应使用情况接口
86
+ */
87
+ export interface ChatUsage {
88
+ prompt_tokens: number
89
+ completion_tokens: number
90
+ total_tokens: number
91
+ }
92
+
93
+ /**
94
+ * 聊天响应选择项接口
95
+ */
96
+ export interface ChatChoice {
97
+ message: {
98
+ role: 'assistant'
99
+ content: string
100
+ }
101
+ finish_reason: string
102
+ index: number
103
+ }
104
+
105
+ /**
106
+ * 聊天响应接口
107
+ */
108
+ export interface ChatCompletionsResponse {
109
+ id: string
110
+ model: string
111
+ usage: ChatUsage
112
+ choices: ChatChoice[]
113
+ }
114
+
115
+ /**
116
+ * 业务层聊天结果
117
+ */
118
+ export interface ChatBizResult {
119
+ /**
120
+ * normal: 普通回复
121
+ * transfer: 转人工
122
+ */
123
+ type: 'normal' | 'transfer'
124
+ /**
125
+ * 大模型原始返回内容
126
+ */
127
+ content: string
128
+ }
129
+
130
+ /**
131
+ * 流式对话回调
132
+ */
133
+ export interface ChatStreamCallbacks {
134
+ /**
135
+ * 每次收到 FastGPT SSE 的增量内容时触发
136
+ */
137
+ onMessage?: (chunk: string) => void
138
+ /**
139
+ * 流结束时触发(包括收到 [DONE] 或正常读取结束)
140
+ */
141
+ onComplete?: () => void
142
+ /**
143
+ * 请求或解析发生异常时触发
144
+ */
145
+ onError?: (error: unknown) => void
146
+ }
147
+
148
+ /**
149
+ * 历史会话项接口
150
+ */
151
+ export interface ChatHistoryItem {
152
+ chatId: string
153
+ updateTime: string
154
+ appId: string
155
+ customTitle: string
156
+ title: string
157
+ top: boolean
158
+ [key: string]: any
159
+ }
160
+
161
+ /**
162
+ * 历史会话查询请求参数接口
163
+ */
164
+ export interface GetHistoriesRequest {
165
+ appId: string
166
+ outLinkUid: string
167
+ offset: number
168
+ pageSize: number
169
+ source: string
170
+ }
171
+
172
+ /**
173
+ * 历史会话查询响应接口
174
+ */
175
+ export interface GetHistoriesResponse {
176
+ code: number
177
+ statusText: string
178
+ message: string
179
+ data: {
180
+ list: ChatHistoryItem[]
181
+ total: number
182
+ }
183
+ }
184
+
185
+ /**
186
+ * 历史会话记录项接口
187
+ */
188
+ export interface ChatRecordItem {
189
+ _id: string
190
+ dataId: string
191
+ hideInUI: boolean
192
+ obj: 'Human' | 'AI'
193
+ value: Array<{
194
+ type: string
195
+ text: {
196
+ content: string
197
+ }
198
+ }>
199
+ customFeedbacks: any[]
200
+ time: string
201
+ durationSeconds?: number
202
+ llmModuleAccount?: number
203
+ totalQuoteList?: any[]
204
+ historyPreviewLength?: number
205
+ [key: string]: any
206
+ }
207
+
208
+ /**
209
+ * 获取历史会话记录请求参数接口
210
+ */
211
+ export interface GetPaginationRecordsRequest {
212
+ appId: string
213
+ chatId: string
214
+ offset: number
215
+ pageSize: number
216
+ loadCustomFeedbacks: boolean
217
+ }
218
+
219
+ /**
220
+ * 获取历史会话记录响应接口
221
+ */
222
+ export interface GetPaginationRecordsResponse {
223
+ code: number
224
+ statusText: string
225
+ message: string
226
+ data: {
227
+ list: ChatRecordItem[]
228
+ total: number
229
+ }
230
+ }
231
+
232
+ // ==================== MateChat 组件内部类型 ====================
233
+
234
+ /**
235
+ * MateChat 组件内部使用的消息结构
236
+ */
237
+ export interface MateChatMessage {
238
+ from: 'user' | 'model' | 'service'
239
+ content: string
240
+ loading?: boolean
241
+ /**
242
+ * 是否启用打字机效果
243
+ * - true: 启用打字机
244
+ * - false 或未定义: 不启用打字机
245
+ */
246
+ typing?: boolean
247
+ }
@@ -0,0 +1,141 @@
1
+ <script setup lang="ts">
2
+ import { getConfigByNameAsync } from '@af-mobile-client-vue3/services/api/common'
3
+ import { Base64 } from 'js-base64'
4
+ import { ref } from 'vue'
5
+
6
+ interface FilePreviewInitOptions {
7
+ /** 预览文件完整路径(含后缀) */
8
+ path: string
9
+ }
10
+
11
+ const IMAGE_SUFFIX_ARRAY = ['xbm', 'tif', 'pjp', 'svgz', 'jpg', 'jpeg', 'ico', 'tiff', 'gif', 'svg', 'jfif', 'webp', 'png', 'bmp', 'pjpeg', 'avif']
12
+ const VIDEO_SUFFIX_ARRAY = ['avi', 'wmv', 'mpeg', 'mp4', 'm4v', 'mov', 'asf', 'flv', 'f4v', 'rmvb', 'rm', '3gp', 'vob']
13
+
14
+ const previewDocService = ref('')
15
+ const fileServer = ref('')
16
+ const previewDocLoading = ref(true)
17
+ const previewDocUrl = ref('')
18
+ const previewMode = ref<'doc' | 'image' | 'video'>('doc')
19
+ const previewImageSrc = ref('')
20
+ const previewVideoSrc = ref('')
21
+ const pathError = ref(false)
22
+
23
+ async function preview(path: string) {
24
+ if (!path) {
25
+ pathError.value = true
26
+ return
27
+ }
28
+ pathError.value = false
29
+
30
+ try {
31
+ const res: any = await getConfigByNameAsync('previewDocServiceConfig')
32
+ if (!res?.fileServer)
33
+ throw new Error('文件预览服务配置错误')
34
+ previewDocService.value = res.previewDocService
35
+ fileServer.value = res.fileServer
36
+ }
37
+ catch (error) {
38
+ console.warn('获取文件预览服务配置失败,使用默认配置', error)
39
+ }
40
+ previewGen(path)
41
+ }
42
+
43
+ function previewGen(path: string) {
44
+ previewDocLoading.value = true
45
+ if (isImage(path)) {
46
+ previewImageSrc.value = path
47
+ previewMode.value = 'image'
48
+ return
49
+ }
50
+
51
+ if (isVideo(path)) {
52
+ previewVideoSrc.value = path
53
+ previewMode.value = 'video'
54
+ return
55
+ }
56
+
57
+ previewMode.value = 'doc'
58
+ const previewUrl = `${previewDocService.value}${encodeURIComponent(Base64.encode(`${fileServer.value}${path}`))}`
59
+ if (previewDocUrl.value !== previewUrl) {
60
+ previewDocLoading.value = true
61
+ previewDocUrl.value = previewUrl
62
+ }
63
+ else {
64
+ previewDocLoading.value = false
65
+ }
66
+ }
67
+
68
+ function isImage(path: string) {
69
+ const suffix = path.toLowerCase().split('.').pop()
70
+ return suffix ? IMAGE_SUFFIX_ARRAY.includes(suffix) : false
71
+ }
72
+
73
+ function isVideo(path: string) {
74
+ const suffix = path.toLowerCase().split('.').pop()
75
+ return suffix ? VIDEO_SUFFIX_ARRAY.includes(suffix) : false
76
+ }
77
+
78
+ async function init(options: FilePreviewInitOptions) {
79
+ await preview(options.path)
80
+ }
81
+
82
+ defineExpose({
83
+ init,
84
+ })
85
+ </script>
86
+
87
+ <template>
88
+ <div v-if="!pathError">
89
+ <div v-if="previewMode === 'doc'" class="preview-doc-container">
90
+ <a-spin size="large" :spinning="previewDocLoading" />
91
+ <iframe
92
+ v-show="!previewDocLoading"
93
+ :src="previewDocUrl"
94
+ width="100%"
95
+ height="100%"
96
+ frameborder="0"
97
+ @load="previewDocLoading = false"
98
+ />
99
+ </div>
100
+ <div v-else-if="previewMode === 'image'" class="preview-image-wrapper">
101
+ <img :src="previewImageSrc" alt="image" class="preview-image">
102
+ </div>
103
+ <div v-else-if="previewMode === 'video'" class="preview-video-wrapper">
104
+ <video
105
+ class="preview-video"
106
+ controls
107
+ :src="previewVideoSrc"
108
+ />
109
+ </div>
110
+ </div>
111
+ <a-empty v-else description="文件路径为空" />
112
+ </template>
113
+
114
+ <style scoped>
115
+ .preview-doc-container {
116
+ height: calc(100vh - 60px);
117
+ padding-top: 20px;
118
+ }
119
+
120
+ .preview-image-wrapper,
121
+ .preview-video-wrapper {
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: center;
125
+ height: calc(100vh - 60px);
126
+ padding: 20px;
127
+ background: #000000;
128
+ }
129
+
130
+ .preview-image {
131
+ max-width: 100%;
132
+ max-height: 100%;
133
+ }
134
+
135
+ .preview-video {
136
+ width: 100%;
137
+ max-height: 100%;
138
+ border: none;
139
+ background: #000;
140
+ }
141
+ </style>
@@ -23,4 +23,4 @@ export interface ConfigItem {
23
23
  format?: (value: string | number) => string
24
24
  template?: string
25
25
  condition?: (data: any) => boolean
26
- }
26
+ }
@@ -188,4 +188,4 @@ export interface PolygonLayerConfig {
188
188
  onClick?: (polygon: PolygonData, event: any) => void
189
189
  /** 多边形数据提供者 */
190
190
  dataProvider?: () => PolygonData[] | Promise<PolygonData[]>
191
- }
191
+ }
@@ -7,4 +7,4 @@ export default {
7
7
  install(app: App) {
8
8
  app.component('XAddReport', XAddReport)
9
9
  },
10
- }
10
+ }
@@ -7,4 +7,4 @@ export default {
7
7
  install(app: App) {
8
8
  app.component('XReportDrawer', XReportDrawer)
9
9
  },
10
- }
10
+ }
@@ -1,10 +1,10 @@
1
- <script setup lang="ts">
2
- </script>
3
-
4
- <template>
5
- <VanTag />
6
- </template>
7
-
8
- <style scoped lang="less">
9
-
10
- </style>
1
+ <script setup lang="ts">
2
+ </script>
3
+
4
+ <template>
5
+ <VanTag />
6
+ </template>
7
+
8
+ <style scoped lang="less">
9
+
10
+ </style>