diff --git a/build/vite/optimize.ts b/build/vite/optimize.ts index 9de496a3..2f4d2424 100644 --- a/build/vite/optimize.ts +++ b/build/vite/optimize.ts @@ -115,7 +115,8 @@ const include = [ '@element-plus/icons-vue', 'element-plus/es/components/footer/style/css', 'element-plus/es/components/empty/style/css', - 'element-plus/es/components/mention/style/css' + 'element-plus/es/components/mention/style/css', + 'element-plus/es/components/progress/style/css' ] const exclude = ['@iconify/json'] diff --git a/package.json b/package.json index 6bfaa958..35ba71d2 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@vueuse/core": "^10.9.0", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.10", + "@wangeditor/plugin-mention": "^1.0.0", "@zxcvbn-ts/core": "^3.0.4", "animate.css": "^4.1.1", "axios": "1.9.0", @@ -65,6 +66,7 @@ "pinia-plugin-persistedstate": "^3.2.1", "qrcode": "^1.5.3", "qs": "^6.12.0", + "snabbdom": "^3.6.2", "sortablejs": "^1.15.3", "steady-xml": "^0.1.0", "url": "^0.11.3", @@ -74,6 +76,7 @@ "vue-i18n": "9.10.2", "vue-router": "4.4.5", "vue-types": "^5.1.1", + "vue3-print-nb": "^0.1.4", "vue3-signature": "^0.2.4", "vuedraggable": "^4.1.0", "web-storage-cache": "^1.1.1", diff --git a/src/api/ai/chat/message/index.ts b/src/api/ai/chat/message/index.ts index a4c5b8d3..19bc25b0 100644 --- a/src/api/ai/chat/message/index.ts +++ b/src/api/ai/chat/message/index.ts @@ -70,7 +70,7 @@ export const ChatMessageApi = { conversationId, content, useContext: enableContext, - webSearch: enableWebSearch, + useSearch: enableWebSearch, attachmentUrls: attachmentUrls || [] }), onmessage: onMessage, diff --git a/src/api/bpm/processInstance/index.ts b/src/api/bpm/processInstance/index.ts index 6b792130..1e8f04da 100644 --- a/src/api/bpm/processInstance/index.ts +++ b/src/api/bpm/processInstance/index.ts @@ -108,3 +108,8 @@ export const getFormFieldsPermission = async (params: any) => { export const getProcessInstanceBpmnModelView = async (id: string) => { return await request.get({ url: '/bpm/process-instance/get-bpmn-model-view?id=' + id }) } + +// 获取流程实例打印数据 +export const getProcessInstancePrintData = async (id: string) => { + return await request.get({ url: '/bpm/process-instance/get-print-data?processInstanceId=' + id }) +} diff --git a/src/components/UploadFile/src/useUpload.ts b/src/components/UploadFile/src/useUpload.ts index 951b2397..2e9a51a6 100644 --- a/src/components/UploadFile/src/useUpload.ts +++ b/src/components/UploadFile/src/useUpload.ts @@ -1,5 +1,4 @@ import * as FileApi from '@/api/infra/file' -// import CryptoJS from 'crypto-js' import { UploadRawFile, UploadRequestOptions } from 'element-plus/es/components/upload/src/upload' import axios from 'axios' @@ -20,7 +19,7 @@ export const useUpload = (directory?: string) => { // 模式一:前端上传 if (isClientUpload) { // 1.1 生成文件名称 - const fileName = await generateFileName(options.file) + const fileName = options.file.name || options.filename // 1.2 获取文件预签名地址 const presignedInfo = await FileApi.getFilePresignedUrl(fileName, directory) // 1.3 上传文件(不能使用 ElUpload 的 ajaxUpload 方法的原因:其使用的是 FormData 上传,Minio 不支持) @@ -32,7 +31,7 @@ export const useUpload = (directory?: string) => { }) .then(() => { // 1.4. 记录文件信息到后端(异步) - createFile(presignedInfo, options.file) + createFile(presignedInfo, options.file, fileName) // 通知成功,数据格式保持与后端上传的返回结果一致 return { data: presignedInfo.url } }) @@ -64,15 +63,15 @@ export const useUpload = (directory?: string) => { /** * 创建文件信息 * @param vo 文件预签名信息 - * @param name 文件名称 * @param file 文件 + * @param fileName */ -function createFile(vo: FileApi.FilePresignedUrlRespVO, file: UploadRawFile) { +function createFile(vo: FileApi.FilePresignedUrlRespVO, file: UploadRawFile, fileName: string) { const fileVo = { configId: vo.configId, url: vo.url, path: vo.path, - name: file.name, + name: fileName, type: file.type, size: file.size } @@ -80,22 +79,6 @@ function createFile(vo: FileApi.FilePresignedUrlRespVO, file: UploadRawFile) { return fileVo } -/** - * 生成文件名称(使用算法SHA256) - * @param file 要上传的文件 - */ -async function generateFileName(file: UploadRawFile) { - // // 读取文件内容 - // const data = await file.arrayBuffer() - // const wordArray = CryptoJS.lib.WordArray.create(data) - // // 计算SHA256 - // const sha256 = CryptoJS.SHA256(wordArray).toString() - // // 拼接后缀 - // const ext = file.name.substring(file.name.lastIndexOf('.')) - // return `${sha256}${ext}` - return file.name -} - /** * 上传类型 */ diff --git a/src/main.ts b/src/main.ts index 874f7668..fcfd7809 100644 --- a/src/main.ts +++ b/src/main.ts @@ -42,6 +42,11 @@ import Logger from '@/utils/Logger' import VueDOMPurifyHTML from 'vue-dompurify-html' // 解决v-html 的安全隐患 +// wangEditor 插件注册 +import { setupWangEditorPlugin } from '@/views/bpm/model/form/PrintTemplate' + +import print from 'vue3-print-nb' // 打印插件 + // 创建实例 const setupAll = async () => { const app = createApp(App) @@ -62,10 +67,16 @@ const setupAll = async () => { setupAuth(app) setupMountedFocus(app) + // wangEditor 插件注册 + setupWangEditorPlugin() + await router.isReady() app.use(VueDOMPurifyHTML) + // 打印 + app.use(print) + app.mount('#app') } diff --git a/src/views/Profile/components/BasicInfo.vue b/src/views/Profile/components/BasicInfo.vue index f785affb..1492664f 100644 --- a/src/views/Profile/components/BasicInfo.vue +++ b/src/views/Profile/components/BasicInfo.vue @@ -78,6 +78,21 @@ const schema = reactive([ } ]) const formRef = ref() // 表单 Ref + +// 监听 userStore 中头像的变化,同步更新表单数据 +watch( + () => userStore.getUser.avatar, + (newAvatar) => { + if (newAvatar && formRef.value) { + // 直接更新表单模型中的头像字段 + const formModel = formRef.value.formModel + if (formModel) { + formModel.avatar = newAvatar + } + } + } +) + const submit = () => { const elForm = unref(formRef)?.getElFormRef() if (!elForm) return @@ -87,17 +102,19 @@ const submit = () => { await updateUserProfile(data) message.success(t('common.updateSuccess')) const profile = await init() - userStore.setUserNicknameAction(profile.nickname) + await userStore.setUserNicknameAction(profile.nickname) // 发送成功事件 emit('success') } }) } + const init = async () => { const res = await getUserProfile() unref(formRef)?.setValues(res) return res } + onMounted(async () => { await init() }) diff --git a/src/views/Profile/components/ProfileUser.vue b/src/views/Profile/components/ProfileUser.vue index 6282c3e0..e226af09 100644 --- a/src/views/Profile/components/ProfileUser.vue +++ b/src/views/Profile/components/ProfileUser.vue @@ -49,18 +49,31 @@ diff --git a/src/views/ai/chat/index/components/role/RoleList.vue b/src/views/ai/chat/index/components/role/RoleList.vue index 0dd14a0f..a1ecb353 100644 --- a/src/views/ai/chat/index/components/role/RoleList.vue +++ b/src/views/ai/chat/index/components/role/RoleList.vue @@ -1,6 +1,6 @@