【修改】 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-input v-model="formData.specialtyName" placeholder="请输入专业" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText"> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -30,20 +34,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="题型难度" prop="quLevel"> <el-form-item label="题型难度" prop="quLevel">
<el-select <el-select v-model="formData.quLevel" placeholder="请选择题型难度" clearable>
v-model="formData.quLevel" <el-option
placeholder="请选择题型难度" v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
clearable :key="dict.value"
> :label="dict.label"
<el-option :value="dict.value"
v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)" />
:key="dict.value" </el-select>
:label="dict.label" </el-form-item>
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@@ -278,17 +278,47 @@
</div> </div>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<FileForm ref="FileRef" @success="handleUploadSuccess" /> <FileForm ref="FileRef" @success="handleUploadSuccess" />
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="400px"> <el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="70%">
<el-skeleton :rows="5" animated v-if="wordPointsList.length < 0 && isLoading" /> <div style="height: 400px; overflow: hidden; display: flex; gap: 16px">
<el-tree <div style="flex: 0.8; overflow: auto; border: 1px solid #eee; padding: 8px">
style="max-width: 600px" <h3>考点</h3>
:data="wordPointsList" <el-table :data="listPoint" style="width: 100%">
:props="defaultProps" <el-table-column prop="contentIn" label="值" width="500px">
:expand-on-click-node="false" <template #default="{ row }">
@node-click="handleNodelClick" <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>
<el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px"> <!-- <el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px">
<el-tree <el-tree
style="max-width: 600px" style="max-width: 600px"
:data="wordPointsInfoList" :data="wordPointsInfoList"
@@ -301,7 +331,7 @@
<el-button type="primary" @click="submitWordPoints"> </el-button> <el-button type="primary" @click="submitWordPoints"> </el-button>
<el-button @click="dialogFormVisibleWordInfos = false"> </el-button> <el-button @click="dialogFormVisibleWordInfos = false"> </el-button>
</template> </template>
</el-dialog> </el-dialog> -->
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
@@ -320,6 +350,7 @@ const wordPointsList = ref<Tree[]>([]) // 树形结构
const wordPointsInfoList = ref<Tree[]>([]) // 树形结构 const wordPointsInfoList = ref<Tree[]>([]) // 树形结构
const list = ref([]) // 列表的数 const list = ref([]) // 列表的数
const listPoint = ref([]) // 列表的数
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗 const message = useMessage() // 消息弹窗
const loading = ref(false) // 列表的加载中 const loading = ref(false) // 列表的加载中
@@ -329,8 +360,8 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用 const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formType = ref('') // 表单的类型create - 新增update - 修改 const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref({ const formData = ref({
pointNamesVo:'', pointNamesVo: '',
chapteridDictTextVo:'', chapteridDictTextVo: '',
content: '', content: '',
specialtyName: '', specialtyName: '',
courseName: '', courseName: '',
@@ -388,7 +419,9 @@ const wordPoints = ref({
isExam: '' isExam: ''
}) })
let wordPointsInfosList: (typeof wordPoints)[] = [] let wordPointsInfosList: (typeof wordPoints)[] = []
const removePoint = (index: number) => {
list.value.splice(index, 1)
}
function fileTypeFormatter(row, column, cellValue) { function fileTypeFormatter(row, column, cellValue) {
if (cellValue === '0') return '素材文件(上传ZIP)' if (cellValue === '0') return '素材文件(上传ZIP)'
if (cellValue === '1') return '考试文件' if (cellValue === '1') return '考试文件'
@@ -424,13 +457,27 @@ const filePath = ref('')
const upFilePath = ref('') const upFilePath = ref('')
const functionList = ref<string[]>([]) const functionList = ref<string[]>([])
const xlsxPoints = reactive({
contentIn: '',
content: '',
image: '',
scoreRate: '',
sort: 0
})
const wordData = reactive({ const wordData = reactive({
chineseName: '', chineseName: '',
englishName: '', englishName: '',
filePath: '', filePath: '',
function: [] as string[] 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) => { const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean) => {
// if (checked || indeterminate) { // if (checked || indeterminate) {
// wordPoints.value.belongTo = data.belongTo // wordPoints.value.belongTo = data.belongTo
@@ -454,7 +501,7 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
wordPoints.value.isboo = data.isboo wordPoints.value.isboo = data.isboo
wordPoints.value.type = data.type wordPoints.value.type = data.type
wordPoints.value.unit = data.unit wordPoints.value.unit = data.unit
wordPoints.value.isExam = "0" wordPoints.value.isExam = '0'
wordPointsInfosList.push(cloneDeep(wordPoints.value)) wordPointsInfosList.push(cloneDeep(wordPoints.value))
} }
console.log(data, checked, indeterminate) console.log(data, checked, indeterminate)
@@ -471,15 +518,16 @@ const addWordInfo = async () => {
if (filePath == '' || filePath == null) { if (filePath == '' || filePath == null) {
return return
} }
// dialogFormVisibleWordInfo.value = true
isLoading.value = true isLoading.value = true
// if (wordPointsList.value.length <= 0) { // if (wordPointsList.value.length <= 0) {
const res = await XlsxApi.getXlsxInfo(filePath) const res = await XlsxApi.getXlsxInfo(filePath)
list.value = res listPoint.value = res
// isLoading.value = false // isLoading.value = false
// wordPointsList.value = [] // wordPointsList.value = []
// wordPointsList.value.push(...handleTree(res)) // wordPointsList.value.push(...handleTree(res))
// } // }
dialogFormVisibleWordInfo.value = true
} }
const queryParams = reactive({ const queryParams = reactive({
nodeFunction: undefined nodeFunction: undefined
@@ -487,17 +535,17 @@ const queryParams = reactive({
const chineseName = ref('') const chineseName = ref('')
const nodeFunctions = ref('') const nodeFunctions = ref('')
const englishNames = ref('') const englishNames = ref('')
// const handleNodelClick = async (row: any) => { const handleNodelClick = async (row: any) => {
// queryParams.nodeFunction = row.selectName // queryParams.nodeFunction = row.selectName
// chineseName.value = '【' + row.name + '】' // chineseName.value = '【' + row.name + '】'
// filePath.value = row.filePath // filePath.value = row.filePath
// nodeFunctions.value = row.selectName // nodeFunctions.value = row.selectName
// englishNames.value = row.englishName // englishNames.value = row.englishName
// const res = await Xlsx.getWordInfos(queryParams) // const res = await Xlsx.getWordInfos(queryParams)
// wordPointsInfoList.value = [] // wordPointsInfoList.value = []
// wordPointsInfoList.value.push(...handleTree(res)) // wordPointsInfoList.value.push(...handleTree(res))
// dialogFormVisibleWordInfos.value = true // dialogFormVisibleWordInfos.value = true
// } }
const handleDelete = (row) => { const handleDelete = (row) => {
console.log(row) console.log(row)
for (let i = 0; i < list.value.length; i++) { 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.specialtyName = queryParams.specialtyName
formData.value.courseName = queryParams.courseName formData.value.courseName = queryParams.courseName
formData.value.subjectName = queryParams.subjectName formData.value.subjectName = queryParams.subjectName
formData.value.pointNames=queryParams.pointNamesVo formData.value.pointNames = queryParams.pointNamesVo
formData.value.pointNamesVo=queryParams.pointNames formData.value.pointNamesVo = queryParams.pointNames
formData.value.chapteridDictText=queryParams.chapteridDictTextVo formData.value.chapteridDictText = queryParams.chapteridDictTextVo
formData.value.chapteridDictTextVo=queryParams.chapteridDictText formData.value.chapteridDictTextVo = queryParams.chapteridDictText
} }
} }
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -759,13 +807,11 @@ const resetForm = () => {
formRef.value?.resetFields() formRef.value?.resetFields()
} }
const dialogVisiblePoints = ref(false) const dialogVisiblePoints = ref(false)
// 添加层级信息 // 添加层级信息
const handleTreeWithLevel = (list, level = 1) => { const handleTreeWithLevel = (list, level = 1) => {
return list.map(item => { return list.map((item) => {
const node = { ...item, level } const node = { ...item, level }
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
node.children = handleTreeWithLevel(item.children, level + 1) node.children = handleTreeWithLevel(item.children, level + 1)
@@ -796,23 +842,18 @@ const handleNodeClick = (data, node) => {
} }
} }
const deptList = ref<Tree[]>([]) // 树形结构 const deptList = ref<Tree[]>([]) // 树形结构
/** 获得部门树 */ /** 获得部门树 */
const getTree = async () => { const getTree = async () => {
const res = await SpecialtyApi.listPoints() const res = await SpecialtyApi.listPoints()
const tree = handleTree(res) const tree = handleTree(res)
deptList.value = [] deptList.value = []
deptList.value = handleTreeWithLevel(tree) deptList.value = handleTreeWithLevel(tree)
} }
const openPoints = async () => { const openPoints = async () => {
await getTree(); await getTree()
dialogVisiblePoints.value = true; dialogVisiblePoints.value = true
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-dialog { .edit-dialog {
@@ -956,4 +997,4 @@ const openPoints = async () => {
} }
} }
} }
</style> </style>

View File

@@ -277,7 +277,8 @@
</div> </div>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<FileForm ref="FileRef" @success="handleUploadSuccess" /> <FileForm ref="FileRef" @success="handleUploadSuccess" />
<el-dialog v-model="dialogFormVisiblePptxInfo" title="考点设置" width="400px">
<!-- <el-dialog v-model="dialogFormVisiblePptxInfo" title="考点设置" width="400px">
<el-tree <el-tree
style="max-width: 600px" style="max-width: 600px"
:data="pptxPointsList" :data="pptxPointsList"
@@ -285,6 +286,47 @@
:expand-on-click-node="false" :expand-on-click-node="false"
@node-click="handleNodelClick" @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>
<el-dialog v-model="dialogFormVisiblePptxInfos" :title="titles" width="300px"> <el-dialog v-model="dialogFormVisiblePptxInfos" :title="titles" width="300px">
<el-tree <el-tree
@@ -302,6 +344,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import draggable from 'vuedraggable'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import { FormRules } from 'element-plus' import { FormRules } from 'element-plus'
import * as QuestionApi from '@/api/paper/question' 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) { function fileTypeFormatter(row, column, cellValue) {
if (cellValue === '0') return '素材文件(上传ZIP)' if (cellValue === '0') return '素材文件(上传ZIP)'
if (cellValue === '1') return '考试文件' if (cellValue === '1') return '考试文件'
@@ -487,6 +532,7 @@ const handleNodelClick = async (row: any) => {
filePath.value = row.filePath filePath.value = row.filePath
paragraph.value = row.selectName paragraph.value = row.selectName
englishNames.value = row.englishName englishNames.value = row.englishName
console.log(row)
const res = await PptxApi.getPptxInfos(row.title) const res = await PptxApi.getPptxInfos(row.title)
pptxPointsInfoList.value = [] pptxPointsInfoList.value = []
pptxPointsInfoList.value.push(...handleTree(res)) pptxPointsInfoList.value.push(...handleTree(res))
@@ -497,23 +543,27 @@ const submitPptxPoints = async () => {
pptxPointsInfosList = [] pptxPointsInfosList = []
console.log(list.value) console.log(list.value)
var indexFlag = false var indexFlag = false
let index = 0
for (let i = 0; i < res.length; i++) { console.log(res)
for (let x = 0; x < list.value.length; x++) { if (res != null) {
if (res[i].contentIn == list.value[x].contentIn) { for (let i = 0; i < res.length; i++) {
// 如果存在相同的数据话 不进入 for (let x = 0; x < list.value.length; x++) {
indexFlag = true 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 dialogFormVisiblePptxInfos.value = false
pptxPointsList.value = [] // pptxPointsList.value = []
} }
const formRules = reactive<FormRules>({ const formRules = reactive<FormRules>({
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }] 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-input v-model="formData.specialtyName" placeholder="请输入专业" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="章节名称" prop="chapteridDictText"> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -30,20 +34,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="题型难度" prop="quLevel"> <el-form-item label="题型难度" prop="quLevel">
<el-select <el-select v-model="formData.quLevel" placeholder="请选择题型难度" clearable>
v-model="formData.quLevel" <el-option
placeholder="请选择题型难度" v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
clearable :key="dict.value"
> :label="dict.label"
<el-option :value="dict.value"
v-for="dict in getIntDictOptions(DICT_TYPE.EXAM_QUE_DIFF)" />
:key="dict.value" </el-select>
:label="dict.label" </el-form-item>
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@@ -278,15 +278,47 @@
</div> </div>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<FileForm ref="FileRef" @success="handleUploadSuccess" /> <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-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="70%">
<el-tree <div style="height: 400px; overflow: hidden; display: flex; gap: 16px">
style="max-width: 600px" <div style="flex: 0.5; overflow: auto; border: 1px solid #eee; padding: 8px">
:data="wordPointsList" <h3>考点</h3>
:props="defaultProps" <el-tree
:expand-on-click-node="false" style="max-width: 600px"
@node-click="handleNodelClick" :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>
<el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px"> <el-dialog v-model="dialogFormVisibleWordInfos" :title="titles" width="300px">
<el-tree <el-tree
@@ -304,16 +336,14 @@
</el-dialog> </el-dialog>
</template> </template>
<script lang="ts" setup> <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 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 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 { defaultProps, handleTree } from '@/utils/tree'
import { FormRules } from 'element-plus'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import FileForm from './components/FileForm.vue'
defineOptions({ name: 'WpsWordFrom' }) defineOptions({ name: 'WpsWordFrom' })
const wordPointsList = ref<Tree[]>([]) // 树形结构 const wordPointsList = ref<Tree[]>([]) // 树形结构
@@ -329,8 +359,8 @@ const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用 const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formType = ref('') // 表单的类型create - 新增update - 修改 const formType = ref('') // 表单的类型create - 新增update - 修改
const formData = ref({ const formData = ref({
pointNamesVo:'', pointNamesVo: '',
chapteridDictTextVo:'', chapteridDictTextVo: '',
content: '', content: '',
specialtyName: '', specialtyName: '',
courseName: '', courseName: '',
@@ -388,7 +418,9 @@ const wordPoints = ref({
isExam: '' isExam: ''
}) })
let wordPointsInfosList: (typeof wordPoints)[] = [] let wordPointsInfosList: (typeof wordPoints)[] = []
const removePoint = (index: number) => {
list.value.splice(index, 1)
}
function fileTypeFormatter(row, column, cellValue) { function fileTypeFormatter(row, column, cellValue) {
if (cellValue === '0') return '素材文件(上传ZIP)' if (cellValue === '0') return '素材文件(上传ZIP)'
if (cellValue === '1') return '考试文件' if (cellValue === '1') return '考试文件'
@@ -454,7 +486,7 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
wordPoints.value.isboo = data.isboo wordPoints.value.isboo = data.isboo
wordPoints.value.type = data.type wordPoints.value.type = data.type
wordPoints.value.unit = data.unit wordPoints.value.unit = data.unit
wordPoints.value.isExam = "0" wordPoints.value.isExam = '0'
wordPointsInfosList.push(cloneDeep(wordPoints.value)) wordPointsInfosList.push(cloneDeep(wordPoints.value))
} }
console.log(data, checked, indeterminate) 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 // http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
if (filePath == '' || filePath == null) { // if (filePath == '' || filePath == null) {
return // return
} // }
dialogFormVisibleWordInfo.value = true dialogFormVisibleWordInfo.value = true
isLoading.value = true isLoading.value = true
if (wordPointsList.value.length <= 0) { if (wordPointsList.value.length <= 0) {
@@ -519,7 +551,6 @@ const submitWordPoints = async () => {
unit: '', unit: '',
isExam: '' isExam: ''
} }
let index = 0
wordPointsInfosList = [] wordPointsInfosList = []
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
var indexFlag = false var indexFlag = false
@@ -530,14 +561,13 @@ const submitWordPoints = async () => {
} }
} }
if (!indexFlag) { if (!indexFlag) {
index += 1; res[i].sort = list.value.length + 1
res[i].sort = index;
list.value.push(res[i]) list.value.push(res[i])
} }
} }
dialogFormVisibleWordInfo.value = false // dialogFormVisibleWordInfo.value = false
dialogFormVisibleWordInfos.value = false dialogFormVisibleWordInfos.value = false
wordPointsList.value = [] // wordPointsList.value = []
} }
const formRules = reactive<FormRules>({ const formRules = reactive<FormRules>({
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }] 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.specialtyName = queryParams.specialtyName
formData.value.courseName = queryParams.courseName formData.value.courseName = queryParams.courseName
formData.value.subjectName = queryParams.subjectName formData.value.subjectName = queryParams.subjectName
formData.value.pointNames=queryParams.pointNamesVo formData.value.pointNames = queryParams.pointNamesVo
formData.value.pointNamesVo=queryParams.pointNames formData.value.pointNamesVo = queryParams.pointNames
formData.value.chapteridDictText=queryParams.chapteridDictTextVo formData.value.chapteridDictText = queryParams.chapteridDictTextVo
formData.value.chapteridDictTextVo=queryParams.chapteridDictText formData.value.chapteridDictTextVo = queryParams.chapteridDictText
} }
} }
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -758,13 +788,11 @@ const resetForm = () => {
formRef.value?.resetFields() formRef.value?.resetFields()
} }
const dialogVisiblePoints = ref(false) const dialogVisiblePoints = ref(false)
// 添加层级信息 // 添加层级信息
const handleTreeWithLevel = (list, level = 1) => { const handleTreeWithLevel = (list, level = 1) => {
return list.map(item => { return list.map((item) => {
const node = { ...item, level } const node = { ...item, level }
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
node.children = handleTreeWithLevel(item.children, level + 1) node.children = handleTreeWithLevel(item.children, level + 1)
@@ -795,23 +823,18 @@ const handleNodeClick = (data, node) => {
} }
} }
const deptList = ref<Tree[]>([]) // 树形结构 const deptList = ref<Tree[]>([]) // 树形结构
/** 获得部门树 */ /** 获得部门树 */
const getTree = async () => { const getTree = async () => {
const res = await SpecialtyApi.listPoints() const res = await SpecialtyApi.listPoints()
const tree = handleTree(res) const tree = handleTree(res)
deptList.value = [] deptList.value = []
deptList.value = handleTreeWithLevel(tree) deptList.value = handleTreeWithLevel(tree)
} }
const openPoints = async () => { const openPoints = async () => {
await getTree(); await getTree()
dialogVisiblePoints.value = true; dialogVisiblePoints.value = true
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-dialog { .edit-dialog {
@@ -955,4 +978,4 @@ const openPoints = async () => {
} }
} }
} }
</style> </style>