Accept Merge Request #107: (hyc -> master)

Merge Request: 【修改】优化选择题、wps知识点等其它前端字段

Created By: @华允传
Accepted By: @华允传
URL: https://g-iswv8783.coding.net/p/education/d/pengchen-ui-exam-vue3/git/merge/107?initial=true
This commit is contained in:
华允传
2025-06-09 13:31:23 +08:00
committed by Coding
3 changed files with 306 additions and 73 deletions

View File

@@ -16,45 +16,46 @@
<el-input v-model="formData.specialtyName" placeholder="请输入专业" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="试题名称" prop="quBankName">
<el-input v-model="formData.quBankName" placeholder="请试题名称" />
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText">
<el-input v-model="formData.chapteridDictTextVo" placeholder="请输入章节名称" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="题库" prop="required">
<el-input v-model="formData.required" placeholder="请选择题库" />
</el-form-item>
</el-col> -->
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="课程" prop="courseName">
<el-input v-model="formData.courseName" placeholder="请输入课程" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="题库" prop="required">
<el-input v-model="formData.required" placeholder="请选择题库" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="题型难度" prop="quLevel">
<el-input v-model="formData.quLevel" placeholder="请输入题型难度" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText">
<el-input v-model="formData.chapteridDictText" placeholder="请输入章节名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="知识点" prop="pointNames">
<el-input v-model="formData.pointNames" placeholder="请输入知识点" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核状态" prop="audit">
<el-input v-model="formData.audit" placeholder="请输入审核状态" />
<el-select
v-model="formData.quLevel"
placeholder="请选择题型难度"
clearable
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
@@ -64,6 +65,38 @@
<el-input v-model="formData.subjectName" placeholder="请输入题型" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="知识点" prop="pointNames">
<el-input
v-model="formData.pointNamesVo"
placeholder="请选择知识点"
readonly
@click="openPoints()"
/>
</el-form-item>
</el-col>
<el-dialog v-model="dialogVisiblePoints" title="选择知识点" width="30%">
<el-tree
ref="treeRef"
:data="deptList"
node-key="id"
:props="{ label: 'name', children: 'children' }"
highlight-current
default-expand-all
@node-click="handleNodeClick"
/>
</el-dialog>
<!-- <el-col :span="12">
<el-form-item label="审核状态" prop="audit">
<el-input v-model="formData.audit" placeholder="请输入审核状态" />
</el-form-item>
</el-col> -->
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="启用状态" prop="status">
<el-radio-group v-model="formData.status">
@@ -73,13 +106,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-row>
<el-col :span="12">
<el-form-item label="来源" prop="resourceValue">
<el-input v-model="formData.resourceValue" placeholder="请输入来源" />
</el-form-item>
</el-col>
</el-row>
</el-row> -->
</el-form>
<div class="edit-bottom">
<div class="edit-left bottom-common">
@@ -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<Tree[]>([]) // 树形结构
/** 获得部门树 */
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
})
}
</script>
<style lang="scss" scoped>
.edit-dialog {

View File

@@ -17,8 +17,12 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="知识点" prop="pointNames">
<el-input v-model="formData.pointNames" placeholder="请输入知识点" disabled />
<el-form-item label="章节名称" prop="chapteridDictText">
<el-input
v-model="formData.chapteridDictTextVo"
placeholder="请输入章节名称"
disabled
/>
</el-form-item>
</el-col>
</el-row>
@@ -30,9 +34,13 @@
</el-col>
<el-col :span="12">
<el-form-item label="题型难度" prop="quLevel">
<el-select v-model="formData.quLevel" placeholder="请选择题型难度">
<el-select
v-model="formData.quLevel"
placeholder="请选择题型难度"
clearable
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@@ -48,14 +56,27 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText">
<el-form-item label="知识点" prop="pointNames">
<el-input
v-model="formData.chapteridDictText"
placeholder="请输入章节名称"
disabled
v-model="formData.pointNamesVo"
placeholder="请选择知识点"
readonly
@click="openPoints()"
/>
</el-form-item>
</el-col>
<el-dialog v-model="dialogVisiblePoints" title="选择知识点" width="30%">
<el-tree
ref="treeRef"
:data="deptList"
node-key="id"
:props="{ label: 'name', children: 'children' }"
highlight-current
default-expand-all
@node-click="handleNodeClick"
/>
</el-dialog>
</el-row>
<el-row>
<el-col :span="12">
@@ -66,7 +87,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="审核状态" prop="audit">
<el-select v-model="formData.audit" placeholder="请选择审核状态">
<el-option
@@ -77,7 +98,7 @@
/>
</el-select>
</el-form-item>
</el-col>
</el-col> -->
</el-row>
</el-form>
<div class="edit-bottom">
@@ -293,7 +314,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<Tree[]>([]) // 树形结构
const pptxPointsInfoList = ref<Tree[]>([]) // 树形结构
@@ -307,6 +328,8 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref({
pointNamesVo:'',
chapteridDictTextVo:'',
content: '',
specialtyName: '',
courseName: '',
@@ -314,7 +337,7 @@ const formData = ref({
required: '',
chapteridDictText: '',
analysis: '',
quLevel: '',
quLevel: 0,
pointNames: '',
audit: '',
subjectName: '',
@@ -631,7 +654,7 @@ const resetForm = () => {
required: '',
chapteridDictText: '',
analysis: '',
quLevel: '',
quLevel: 0,
pointNames: '',
audit: '',
subjectName: '',
@@ -689,6 +712,56 @@ const resetForm = () => {
list.value = []
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<Tree[]>([]) // 树形结构
/** 获得部门树 */
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
})
}
</script>
<style lang="scss" scoped>
.edit-dialog {

View File

@@ -16,11 +16,18 @@
<el-input v-model="formData.specialtyName" placeholder="请输入专业" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="知识点" prop="pointNames">
<el-input v-model="formData.pointNames" placeholder="请输入知识点" disabled />
<el-form-item label="章节名称" prop="chapteridDictText">
<el-input
v-model="formData.chapteridDictTextVo"
placeholder="请输入章节名称"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
@@ -29,21 +36,21 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="题型难度" prop="quLevel">
<!-- <el-select v-model="formData.quLevel" placeholder="请选择题型难度" clearable>
<el-option label="简单" :value="'0'" />
<el-option label="一般" :value="'1'" />
<el-option label="困难" :value="'2'" />
</el-select> -->
<el-select v-model="formData.quLevel" placeholder="请选择题型难度">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="题型难度" prop="quLevel">
<el-select
v-model="formData.quLevel"
placeholder="请选择题型难度"
clearable
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
@@ -53,14 +60,28 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText">
<el-form-item label="知识点" prop="pointNames">
<el-input
v-model="formData.chapteridDictText"
placeholder="请输入章节名称"
disabled
v-model="formData.pointNamesVo"
placeholder="请选择知识点"
readonly
@click="openPoints()"
/>
</el-form-item>
</el-col>
<el-dialog v-model="dialogVisiblePoints" title="选择知识点" width="30%">
<el-tree
ref="treeRef"
:data="deptList"
node-key="id"
:props="{ label: 'name', children: 'children' }"
highlight-current
default-expand-all
@node-click="handleNodeClick"
/>
</el-dialog>
</el-row>
<el-row>
<el-col :span="12">
@@ -71,7 +92,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="审核状态" prop="audit">
<el-select v-model="formData.audit" placeholder="请选择审核状态">
<el-option
@@ -82,7 +103,7 @@
/>
</el-select>
</el-form-item>
</el-col>
</el-col> -->
</el-row>
</el-form>
<div class="edit-bottom">
@@ -300,7 +321,7 @@ import WordInfo from './components/WordInfo.vue'
import WordInfos from './components/WordInfos.vue'
import { defaultProps, handleTree } from '@/utils/tree'
import { cloneDeep } from 'lodash-es'
import * as SpecialtyApi from '@/api/points'
defineOptions({ name: 'WpsWordFrom' })
const wordPointsList = ref<Tree[]>([]) // 树形结构
const wordPointsInfoList = ref<Tree[]>([]) // 树形结构
@@ -315,6 +336,8 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref({
pointNamesVo:'',
chapteridDictTextVo:'',
content: '',
specialtyName: '',
courseName: '',
@@ -322,7 +345,7 @@ const formData = ref({
required: '',
chapteridDictText: '',
analysis: '',
quLevel: '',
quLevel: 0,
pointNames: '',
audit: '',
subjectName: '',
@@ -440,6 +463,54 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
}
console.log(data, checked, indeterminate)
}
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<Tree[]>([]) // 树形结构
/** 获得部门树 */
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
})
}
const addWordInfo = async () => {
var filePath = ''
@@ -620,8 +691,10 @@ const open = async (queryParams: any, type: string, id?: number) => {
formData.value.specialtyName = queryParams.specialtyName
formData.value.courseName = queryParams.courseName
formData.value.subjectName = queryParams.subjectName
formData.value.pointNames = queryParams.pointNames
formData.value.chapteridDictText = queryParams.chapteridDictText
formData.value.pointNames=queryParams.pointNamesVo
formData.value.pointNamesVo=queryParams.pointNames
formData.value.chapteridDictText=queryParams.chapteridDictTextVo
formData.value.chapteridDictTextVo=queryParams.chapteridDictText
}
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -675,7 +748,7 @@ const resetForm = () => {
required: '',
chapteridDictText: '',
analysis: '',
quLevel: '',
quLevel: 0,
pointNames: '',
audit: '',
subjectName: '',