【修改】 wps出题页面

This commit is contained in:
MSI\letre
2025-07-07 21:30:32 +08:00
committed by 陆光LG
parent 6f4b46cee6
commit 743fdfb519
3 changed files with 258 additions and 144 deletions

View File

@@ -16,10 +16,14 @@
<el-input v-model="formData.specialtyName" placeholder="请输入专业" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText">
<el-input v-model="formData.chapteridDictTextVo" placeholder="请输入章节名称" disabled />
<el-input
v-model="formData.chapteridDictTextVo"
placeholder="请输入章节名称"
disabled
/>
</el-form-item>
</el-col>
</el-row>
@@ -30,20 +34,16 @@
</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
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-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>
@@ -278,15 +278,47 @@
</div>
<!-- 表单弹窗添加/修改 -->
<FileForm ref="FileRef" @success="handleUploadSuccess" />
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="400px">
<el-skeleton :rows="5" animated v-if="wordPointsList.length < 0 && isLoading" />
<el-tree
style="max-width: 600px"
:data="wordPointsList"
:props="defaultProps"
:expand-on-click-node="false"
@node-click="handleNodelClick"
/>
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="70%">
<div style="height: 400px; overflow: hidden; display: flex; gap: 16px">
<div style="flex: 0.5; overflow: auto; border: 1px solid #eee; padding: 8px">
<h3>考点</h3>
<el-tree
style="max-width: 600px"
:data="wordPointsList"
:props="defaultProps"
:expand-on-click-node="false"
@node-click="handleNodelClick"
/>
</div>
<div style="flex: 1.5; overflow: auto; border: 1px solid #eee; padding: 8px">
<h3>考点详情</h3>
<el-table :data="list" style="width: 100%">
<el-table-column prop="contentIn" label="值" width="500px" />
<el-table-column prop="scoreRate" label="权值" width="100">
<template #default="{ row }">
<el-input v-model="row.scoreRate" size="small" style="width: 40px" />
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ row }">
<span
@click="removePoint(row)"
style="cursor: pointer; font-weight: bold; font-size: 18px"
title="点击删除"
></span
>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- <el-skeleton :rows="5" animated v-if="wordPointsList.length < 0 && isLoading" />
-->
</el-dialog>
<el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px">
<el-tree
@@ -304,16 +336,14 @@
</el-dialog>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { FormRules } from 'element-plus'
import * as QuestionApi from '@/api/paper/question'
import * as WordApi from '@/api/wps/word'
import FileForm from './components/FileForm.vue'
import WordInfo from './components/WordInfo.vue'
import WordInfos from './components/WordInfos.vue'
import * as SpecialtyApi from '@/api/points'
import * as WordApi from '@/api/wps/word'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { defaultProps, handleTree } from '@/utils/tree'
import { FormRules } from 'element-plus'
import { cloneDeep } from 'lodash-es'
import FileForm from './components/FileForm.vue'
defineOptions({ name: 'WpsWordFrom' })
const wordPointsList = ref<Tree[]>([]) // 树形结构
@@ -329,8 +359,8 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref({
pointNamesVo:'',
chapteridDictTextVo:'',
pointNamesVo: '',
chapteridDictTextVo: '',
content: '',
specialtyName: '',
courseName: '',
@@ -388,7 +418,9 @@ const wordPoints = ref({
isExam: ''
})
let wordPointsInfosList: (typeof wordPoints)[] = []
const removePoint = (index: number) => {
list.value.splice(index, 1)
}
function fileTypeFormatter(row, column, cellValue) {
if (cellValue === '0') return '素材文件(上传ZIP)'
if (cellValue === '1') return '考试文件'
@@ -454,7 +486,7 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
wordPoints.value.isboo = data.isboo
wordPoints.value.type = data.type
wordPoints.value.unit = data.unit
wordPoints.value.isExam = "0"
wordPoints.value.isExam = '0'
wordPointsInfosList.push(cloneDeep(wordPoints.value))
}
console.log(data, checked, indeterminate)
@@ -468,9 +500,9 @@ const addWordInfo = async () => {
}
}
// http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
if (filePath == '' || filePath == null) {
return
}
// if (filePath == '' || filePath == null) {
// return
// }
dialogFormVisibleWordInfo.value = true
isLoading.value = true
if (wordPointsList.value.length <= 0) {
@@ -519,7 +551,6 @@ const submitWordPoints = async () => {
unit: '',
isExam: ''
}
let index = 0
wordPointsInfosList = []
for (let i = 0; i < res.length; i++) {
var indexFlag = false
@@ -530,14 +561,13 @@ const submitWordPoints = async () => {
}
}
if (!indexFlag) {
index += 1;
res[i].sort = index;
res[i].sort = list.value.length + 1
list.value.push(res[i])
}
}
dialogFormVisibleWordInfo.value = false
// dialogFormVisibleWordInfo.value = false
dialogFormVisibleWordInfos.value = false
wordPointsList.value = []
// wordPointsList.value = []
}
const formRules = reactive<FormRules>({
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
@@ -643,10 +673,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.pointNamesVo
formData.value.pointNamesVo=queryParams.pointNames
formData.value.chapteridDictText=queryParams.chapteridDictTextVo
formData.value.chapteridDictTextVo=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 方法,用于打开弹窗
@@ -758,13 +788,11 @@ const resetForm = () => {
formRef.value?.resetFields()
}
const dialogVisiblePoints = ref(false)
// 添加层级信息
const handleTreeWithLevel = (list, level = 1) => {
return list.map(item => {
return list.map((item) => {
const node = { ...item, level }
if (item.children && item.children.length > 0) {
node.children = handleTreeWithLevel(item.children, level + 1)
@@ -795,23 +823,18 @@ const handleNodeClick = (data, node) => {
}
}
const deptList = ref<Tree[]>([]) // 树形结构
/** 获得部门树 */
const getTree = async () => {
const res = await SpecialtyApi.listPoints()
const tree = handleTree(res)
deptList.value = []
deptList.value = handleTreeWithLevel(tree)
const tree = handleTree(res)
deptList.value = []
deptList.value = handleTreeWithLevel(tree)
}
const openPoints = async () => {
await getTree();
dialogVisiblePoints.value = true;
await getTree()
dialogVisiblePoints.value = true
}
</script>
<style lang="scss" scoped>
.edit-dialog {
@@ -955,4 +978,4 @@ const openPoints = async () => {
}
}
}
</style>
</style>