From ef44f43a71cb78851515955eb48fda91bf5bad8b Mon Sep 17 00:00:00 2001 From: wangchengming <15110151257@163.com> Date: Sun, 20 Jul 2025 01:34:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E7=99=BE=E7=A7=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/databaseLibary.js | 44 ++ src/components/TEditor/index.vue | 58 ++- src/router/index.js | 2 +- src/views/databaseLibary/components/card.vue | 42 +- .../databaseLibary/components/libaryForm.vue | 409 +++++++++++------- src/views/databaseLibary/components/list.vue | 182 +++----- .../components/myFileUpload.vue | 204 +++++++++ src/views/databaseLibary/index.vue | 167 +++++-- .../safetyReview/dashboard/detailForm.vue | 26 +- src/views/safetyReview/dashboard/index.vue | 4 +- .../safetyReview/examinerTasks/taskForm.vue | 4 +- 11 files changed, 799 insertions(+), 343 deletions(-) create mode 100644 src/api/databaseLibary.js create mode 100644 src/views/databaseLibary/components/myFileUpload.vue diff --git a/src/api/databaseLibary.js b/src/api/databaseLibary.js new file mode 100644 index 0000000..26fea8c --- /dev/null +++ b/src/api/databaseLibary.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 获取百科数据库分页列表 +export function getBusEncyclopediaDatabasePage(query) { + return request({ + url: '/admin/busEncyclopediaDatabase/getBusEncyclopediaDatabasePage', + method: 'post', + data: query + }) +} + +// 添加百科数据库 +export function addBusEncyclopediaDatabase(query) { + return request({ + url: '/admin/busEncyclopediaDatabase/addBusEncyclopediaDatabase', + method: 'post', + data: query + }) +} + +// 修改百科数据库 +export function updateBusEncyclopediaDatabase(query) { + return request({ + url: '/admin/busEncyclopediaDatabase/updateBusEncyclopediaDatabase', + method: 'post', + data: query + }) +} + + +// 获取百科数据库详情 +export function getBusEncyclopediaDatabase(Id) { + return request({ + url: '/admin/busEncyclopediaDatabase/getBusEncyclopediaDatabase/' + Id, + method: 'post' + }) +} +// 删除百科数据库 +export function deleteBusEncyclopediaDatabase(Id) { + return request({ + url: '/admin/busEncyclopediaDatabase/deleteBusEncyclopediaDatabase/' + Id, + method: 'post' + }) +} \ No newline at end of file diff --git a/src/components/TEditor/index.vue b/src/components/TEditor/index.vue index d2a8362..ecaf914 100644 --- a/src/components/TEditor/index.vue +++ b/src/components/TEditor/index.vue @@ -1,6 +1,6 @@ @@ -162,7 +162,7 @@ const init = reactive({ // 图片本地上传方法 点击上传后执行的事件 images_upload_handler: async (blobInfo, progress) => { return new Promise(async (resolve, reject) => { - try { + try { const formData = new FormData(); formData.append('file', blobInfo.blob(), blobInfo.filename()); @@ -171,15 +171,15 @@ const init = reactive({ if (res.code === 200) { const successUrl = baseUrl + res.fileName; - resolve(successUrl); + resolve(successUrl); } else { reject('上传失败: ' + (res.msg || '服务器错误')); } } catch (error) { console.error('上传错误:', error); reject('上传失败: ' + (error.message || '网络错误')); - - } + + } }); }, file_picker_callback: function (callback, value, meta) { @@ -233,23 +233,9 @@ const myValue = computed({ }, }); -const handleImgUpload = (blobInfo, progress) => { - // const base64 = "data:image/png;base64," + blobInfo.base64(); - // // 编辑器的上传图片内容被处理为 - // success(base64); - //调用接口上传 - var formData = new FormData(); - formData.append('file', blobInfo.blob()); - uploadFile(formData).then(res => { - if (res.code == 200) { - const successUrl = baseUrl + res.fileName - success(successUrl) - } - }) + -} - -//监听富文本中的数据变化 +// 监听富文本中的数据变化 watch( () => myValue.value, () => { @@ -286,7 +272,7 @@ window.onresize = function temp() { // editorId就是给editor传的id let editor = tinymce.get(tinymceId.value); // editor.getContainer()拿到的是编辑器整个大容器 - editor.getContainer().setAttribute("style", `height: ${props.height}px;`); + editor?.getContainer().setAttribute("style", `height: ${props.height}px;`); }; // 设置值 @@ -300,8 +286,34 @@ const handleGetContent = () => { }; const updateModelValue = (val) => { - emits('update:modelValue', myValue.value) + nextTick(() => { + const editor = tinymce.get(tinymceId.value) + if (!editor) return + + const content = editor.getContent() + const isEmpty = checkEmptyContent(editor) + + // 更新绑定值 + myValue.value = content + emits('update:modelValue', content) + + if (isEmpty) { + console.warn('编辑器内容为空') + // 执行空内容处理逻辑 + } + }) } +const checkEmptyContent = (editor) => { + const plainText = editor.getContent({ format: 'text' }).trim() + const htmlContent = editor.getContent() + + // 检测常见空内容情况 + return plainText === '' || + htmlContent === '' || + htmlContent === '


' || + htmlContent === '

 

' +} + defineExpose({ handleSetContent, diff --git a/src/router/index.js b/src/router/index.js index 4ef452b..91320c4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -427,7 +427,7 @@ export const dynamicRoutes = [ { path: ':Id(\\d+)?', component: () => import('@/views/ppeTool/toolForm'), - name: 'escTaskForm', + name: 'ppeToolForm', meta: { title: 'ppeTool表单', activeMenu: '/ppeTool' } } ] diff --git a/src/views/databaseLibary/components/card.vue b/src/views/databaseLibary/components/card.vue index 70c09ab..6b41ac7 100644 --- a/src/views/databaseLibary/components/card.vue +++ b/src/views/databaseLibary/components/card.vue @@ -9,10 +9,10 @@ -
-
+
+
- +
@@ -21,9 +21,8 @@
-
- -
XXXX组织架构图XXXX组织架构图
+
+
{{ item.title }}
@@ -36,15 +35,46 @@
\ No newline at end of file diff --git a/src/views/databaseLibary/index.vue b/src/views/databaseLibary/index.vue index 72ecd88..517f780 100644 --- a/src/views/databaseLibary/index.vue +++ b/src/views/databaseLibary/index.vue @@ -17,17 +17,50 @@ -
+
二级类目
- 全部 - - {{ item.lable }} + + {{ dict.label }} + + {{ dict.dependencyName }} + + {{ dict.label }} + + {{ dict.label }} + + {{ dict.label }} + + + {{ dict.label }} + + {{ dict.label }}
@@ -36,7 +69,7 @@
其他选项
-
@@ -48,58 +81,140 @@