diff --git a/src/views/paper/question/WpsPptxForm.vue b/src/views/paper/question/WpsPptxForm.vue index bb676b3..08aa857 100644 --- a/src/views/paper/question/WpsPptxForm.vue +++ b/src/views/paper/question/WpsPptxForm.vue @@ -17,8 +17,8 @@ - - + + @@ -30,9 +30,13 @@ - + - + + + + + @@ -66,7 +83,7 @@ - +
@@ -293,7 +310,7 @@ import * as PptxApi from '@/api/wps/pptx' import FileForm from './components/FileForm.vue' import { defaultProps, handleTree } from '@/utils/tree' import { cloneDeep } from 'lodash-es' - +import * as SpecialtyApi from '@/api/points' defineOptions({ name: 'WpsPptxFrom' }) const pptxPointsList = ref([]) // 树形结构 const pptxPointsInfoList = ref([]) // 树形结构 @@ -307,6 +324,8 @@ const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formData = ref({ + pointNamesVo:'', + chapteridDictTextVo:'', content: '', specialtyName: '', courseName: '', @@ -314,9 +333,8 @@ const formData = ref({ required: '', chapteridDictText: '', analysis: '', - quLevel: '', + quLevel: 0, pointNames: '', - audit: '', subjectName: '', status: ' ', resourceValue: '', @@ -633,9 +651,8 @@ const resetForm = () => { required: '', chapteridDictText: '', analysis: '', - quLevel: '', + quLevel: 0, pointNames: '', - audit: '', subjectName: '', status: '0', resourceValue: '', @@ -691,6 +708,60 @@ const resetForm = () => { list.value = [] formRef.value?.resetFields() } + + +const dialogVisiblePoints = ref(false) + +// 添加层级信息 +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 + }) +} + +// 只允许点击第三级节点 +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 openPoints = async () => { + await getTree(); + dialogVisiblePoints.value = true; +} +