【修改】 wps出题页面

This commit is contained in:
MSI\letre
2025-07-07 21:30:32 +08:00
parent ed732dec9a
commit 2780cea5ab
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,17 +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.8; overflow: auto; border: 1px solid #eee; padding: 8px">
<h3>考点</h3>
<el-table :data="listPoint" style="width: 100%">
<el-table-column prop="contentIn" label="值" width="500px">
<template #default="{ row }">
<span @click="addPoints(row)" style="cursor: pointer; color: black">
{{ row.contentIn }}
</span>
</template>
</el-table-column>
</el-table>
</div>
<div style="flex: 1.2; overflow: auto; border: 1px solid #eee; padding: 8px">
<h3>考点详情</h3>
<el-table :data="list" style="width: 100%">
<el-table-column prop="contentIn" label="值" width="400px" />
<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-dialog>
<el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px">
<!-- <el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px">
<el-tree
style="max-width: 600px"
:data="wordPointsInfoList"
@@ -301,7 +331,7 @@
<el-button type="primary" @click="submitWordPoints"> </el-button>
<el-button @click="dialogFormVisibleWordInfos = false"> </el-button>
</template>
</el-dialog>
</el-dialog> -->
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
@@ -320,6 +350,7 @@ const wordPointsList = ref<Tree[]>([]) // 树形结构
const wordPointsInfoList = ref<Tree[]>([]) // 树形结构
const list = ref([]) // 列表的数
const listPoint = ref([]) // 列表的数
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const loading = ref(false) // 列表的加载中
@@ -329,8 +360,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 +419,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 '考试文件'
@@ -424,13 +457,27 @@ const filePath = ref('')
const upFilePath = ref('')
const functionList = ref<string[]>([])
const xlsxPoints = reactive({
contentIn: '',
content: '',
image: '',
scoreRate: '',
sort: 0
})
const wordData = reactive({
chineseName: '',
englishName: '',
filePath: '',
function: [] as string[]
})
const addPoints = (row: any) => {
xlsxPoints.contentIn = row.contentIn
xlsxPoints.content = row.content
xlsxPoints.image = row.image
xlsxPoints.scoreRate = row.scoreRate
xlsxPoints.sort = list.value.length + 1
list.value.push(cloneDeep(xlsxPoints))
}
const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean) => {
// if (checked || indeterminate) {
// wordPoints.value.belongTo = data.belongTo
@@ -454,7 +501,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)
@@ -471,15 +518,16 @@ const addWordInfo = async () => {
if (filePath == '' || filePath == null) {
return
}
// dialogFormVisibleWordInfo.value = true
isLoading.value = true
// if (wordPointsList.value.length <= 0) {
const res = await XlsxApi.getXlsxInfo(filePath)
list.value = res
// isLoading.value = false
// wordPointsList.value = []
// wordPointsList.value.push(...handleTree(res))
const res = await XlsxApi.getXlsxInfo(filePath)
listPoint.value = res
// isLoading.value = false
// wordPointsList.value = []
// wordPointsList.value.push(...handleTree(res))
// }
dialogFormVisibleWordInfo.value = true
}
const queryParams = reactive({
nodeFunction: undefined
@@ -487,17 +535,17 @@ const queryParams = reactive({
const chineseName = ref('')
const nodeFunctions = ref('')
const englishNames = ref('')
// const handleNodelClick = async (row: any) => {
// queryParams.nodeFunction = row.selectName
// chineseName.value = '【' + row.name + '】'
// filePath.value = row.filePath
// nodeFunctions.value = row.selectName
// englishNames.value = row.englishName
// const res = await Xlsx.getWordInfos(queryParams)
// wordPointsInfoList.value = []
// wordPointsInfoList.value.push(...handleTree(res))
// dialogFormVisibleWordInfos.value = true
// }
const handleNodelClick = async (row: any) => {
// queryParams.nodeFunction = row.selectName
// chineseName.value = '【' + row.name + '】'
// filePath.value = row.filePath
// nodeFunctions.value = row.selectName
// englishNames.value = row.englishName
// const res = await Xlsx.getWordInfos(queryParams)
// wordPointsInfoList.value = []
// wordPointsInfoList.value.push(...handleTree(res))
// dialogFormVisibleWordInfos.value = true
}
const handleDelete = (row) => {
console.log(row)
for (let i = 0; i < list.value.length; i++) {
@@ -644,10 +692,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 方法,用于打开弹窗
@@ -759,13 +807,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)
@@ -796,23 +842,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 {
@@ -956,4 +997,4 @@ const openPoints = async () => {
}
}
}
</style>
</style>

View File

@@ -277,7 +277,8 @@
</div>
<!-- 表单弹窗添加/修改 -->
<FileForm ref="FileRef" @success="handleUploadSuccess" />
<el-dialog v-model="dialogFormVisiblePptxInfo" title="考点设置" width="400px">
<!-- <el-dialog v-model="dialogFormVisiblePptxInfo" title="考点设置" width="400px">
<el-tree
style="max-width: 600px"
:data="pptxPointsList"
@@ -285,6 +286,47 @@
:expand-on-click-node="false"
@node-click="handleNodelClick"
/>
</el-dialog> -->
<el-dialog v-model="dialogFormVisiblePptxInfo" 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="pptxPointsList"
: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="dialogFormVisiblePptxInfos" :title="titles" width="300px">
<el-tree
@@ -302,6 +344,7 @@
</el-dialog>
</template>
<script lang="ts" setup>
import draggable from 'vuedraggable'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { FormRules } from 'element-plus'
import * as QuestionApi from '@/api/paper/question'
@@ -393,7 +436,9 @@ const handleDelete = (row) => {
}
}
}
const removePoint = (index: number) => {
list.value.splice(index, 1)
}
function fileTypeFormatter(row, column, cellValue) {
if (cellValue === '0') return '素材文件(上传ZIP)'
if (cellValue === '1') return '考试文件'
@@ -487,6 +532,7 @@ const handleNodelClick = async (row: any) => {
filePath.value = row.filePath
paragraph.value = row.selectName
englishNames.value = row.englishName
console.log(row)
const res = await PptxApi.getPptxInfos(row.title)
pptxPointsInfoList.value = []
pptxPointsInfoList.value.push(...handleTree(res))
@@ -497,23 +543,27 @@ const submitPptxPoints = async () => {
pptxPointsInfosList = []
console.log(list.value)
var indexFlag = false
let index = 0
for (let i = 0; i < res.length; i++) {
for (let x = 0; x < list.value.length; x++) {
if (res[i].contentIn == list.value[x].contentIn) {
// 如果存在相同的数据话 不进入
indexFlag = true
console.log(res)
if (res != null) {
for (let i = 0; i < res.length; i++) {
for (let x = 0; x < list.value.length; x++) {
if (res[i].contentIn == list.value[x].contentIn) {
// 如果存在相同的数据话 不进入
indexFlag = true
}
}
if (!indexFlag) {
// 排序,使用已经存在考点的数组的长度+1
res[i].sort = list.value.length + 1
list.value.push(res[i])
}
}
if (!indexFlag) {
index += 1;
res[i].sort = index;
list.value.push(res[i])
}
}
dialogFormVisiblePptxInfo.value = false
// dialogFormVisiblePptxInfo.value = false
dialogFormVisiblePptxInfos.value = false
pptxPointsList.value = []
// pptxPointsList.value = []
}
const formRules = reactive<FormRules>({
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
@@ -904,4 +954,4 @@ const openPoints = async () => {
}
}
}
</style>
</style>

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>