From 6b552c74076b7c4d7dec06ff4e79084c4a98e5f8 Mon Sep 17 00:00:00 2001 From: "YOHO\\20373" <2037305722@qq.com> Date: Mon, 9 Jun 2025 13:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=80=89=E6=8B=A9=E9=A2=98=E3=80=81wps=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E7=82=B9=E7=AD=89=E5=85=B6=E5=AE=83=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/paper/question/ChoiceForm.vue | 151 ++++++++++++++++++----- src/views/paper/question/WpsPptxForm.vue | 99 +++++++++++++-- src/views/paper/question/WpsWordForm.vue | 129 ++++++++++++++----- 3 files changed, 306 insertions(+), 73 deletions(-) diff --git a/src/views/paper/question/ChoiceForm.vue b/src/views/paper/question/ChoiceForm.vue index 65c1495..405a8fa 100644 --- a/src/views/paper/question/ChoiceForm.vue +++ b/src/views/paper/question/ChoiceForm.vue @@ -16,45 +16,46 @@ - + + + + + - + + + + + - - - - - - - + - - - - - - - - - - - - - - - - - - + + + @@ -64,6 +65,38 @@ + + + + + + + + + + + + + + + @@ -73,13 +106,13 @@ - +
@@ -278,7 +311,8 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { FormRules } from 'element-plus' import * as QuestionApi from '@/api/paper/question' - +import * as SpecialtyApi from '@/api/points' +import { defaultProps, handleTree } from '@/utils/tree' defineOptions({ name: 'ChoiceForm' }) const { t } = useI18n() // 国际化 @@ -289,6 +323,8 @@ const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formData = ref({ + pointNamesVo:'', + chapteridDictTextVo:'', content: '', specialtyName: '', courseName: '', @@ -296,7 +332,7 @@ const formData = ref({ required: '', chapteridDictText: '', analysis: '', - quLevel: '', + quLevel: 0, pointNames: '', audit: '', subjectName: '', @@ -466,7 +502,7 @@ const resetForm = () => { required: '', chapteridDictText: '', analysis: '', - quLevel: '', + quLevel: 0, pointNames: '', audit: '', subjectName: '', @@ -475,6 +511,57 @@ const resetForm = () => { } formRef.value?.resetFields() } + + +const dialogVisiblePoints = ref(false) +const openPoints = async () => { + await getTree(); + dialogVisiblePoints.value = true; +} +// 只允许点击第三级节点 +const treeRef = ref() // 引用 el-tree +const handleNodeClick = (data, node) => { + if (data.level === 3) { + formData.value.pointNames = data.id + formData.value.pointNamesVo = data.name + + // 获取父节点(章节名称) + const currentNode = treeRef.value.getNode(data) + const parentNode = currentNode.parent + if (parentNode && parentNode.data) { + formData.value.chapteridDictTextVo = parentNode.data.name + formData.value.chapteridDictText = parentNode.data.id + } else { + formData.value.chapteridDictText = '' + } + + dialogVisiblePoints.value = false + } else { + } +} +const deptList = ref([]) // 树形结构 +/** 获得部门树 */ +const getTree = async () => { + const res = await SpecialtyApi.listPoints() + const tree = handleTree(res) + deptList.value = [] + deptList.value = handleTreeWithLevel(tree) + + +} + + +// 添加层级信息 +const handleTreeWithLevel = (list, level = 1) => { + return list.map(item => { + const node = { ...item, level } + if (item.children && item.children.length > 0) { + node.children = handleTreeWithLevel(item.children, level + 1) + } + return node + }) +} +