技术监督新增查看功能

This commit is contained in:
GGJ
2024-10-31 15:47:02 +08:00
parent 1df2b26b04
commit 0645462ab8
19 changed files with 921 additions and 148 deletions

View File

@@ -12,8 +12,24 @@ import { getAccessToken, getTenantId } from '@/utils/auth'
import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { useAdminInfo } from '@/stores/adminInfo'
import { Boot, IEditorConfig, IToolbarConfig } from '@wangeditor/editor'
import formulaModule from '@wangeditor/plugin-formula'
let isFormulaModuleLoaded = false;
// 注册。要在创建编辑器之前注册,且只能注册一次,不可重复注册。
if (!isFormulaModuleLoaded) {
isFormulaModuleLoaded = true;
}
try {
Boot.registerModule(formulaModule)
} catch (error) {
}
// 编辑器实例,必须用 shallowRef
const editorRef = shallowRef()
const adminInfo = useAdminInfo()
// 内容 HTML
const valueHtml = ref('<p>hello</p>')
@@ -25,8 +41,16 @@ onMounted(() => {
}, 1500)
})
const toolbarConfig = {
excludeKeys: ['fullScreen', 'emotion','insertFormula']
const toolbarConfig: Partial<IToolbarConfig> = {
// excludeKeys: ['fullScreen', 'emotion']
insertKeys: {
index: 0,
keys: [
'insertFormula', // “插入公式”菜单
// 'editFormula' // “编辑公式”菜单
],
},
}
let sever = '/api/system-boot/file/upload'
// 本地加api
@@ -34,7 +58,7 @@ let sever = '/api/system-boot/file/upload'
// sever = '/api' + sever
// }
type InsertFnType = (url: string, alt: string, href: string) => void
const editorConfig = {
const editorConfig: Partial<IEditorConfig> = {
placeholder: '请输入内容...',
MENU_CONF: {
uploadImage: {
@@ -44,11 +68,11 @@ const editorConfig = {
compress: true,
uploadFileName: 'file',
withCredentials: true,
headers: {
Accept: '*',
Authorization: adminInfo.getToken(),
Authorization: adminInfo.getToken(),
},
meta: { path: '/supervision/' },
timeout: 0,
@@ -58,16 +82,17 @@ const editorConfig = {
}
},
hoverbarKeys: {
formula: {
menuKeys: ['editFormula'], // “编辑公式”菜单
formula: {
menuKeys: ['editFormula'], // “编辑公式”菜单
},
},
},
}
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
const editor = editorRef.value
if (editor == null) return
editor.destroy()
})