jinxia.mo 1 месяц назад
Родитель
Сommit
a948ebd405

+ 184 - 24
back-ui/src/views/learn/questions/index.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="app-container">
         <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
-            <el-form-item label="ID" prop="题目ID">
+            <el-form-item label="题目ID" prop="id">
                 <el-input v-model="queryParams.id" placeholder="请输入题目ID" clearable
                           @keyup.enter="handleQuery"/>
             </el-form-item>
@@ -17,12 +17,12 @@
                 </el-select>
             </el-form-item>
             <el-form-item label="科目" prop="subjectId">
-                <el-select v-model="queryParams.subjectId" clearable @change="handleQuery" style="width: 172px">
+                <el-select v-model="queryParams.subjectId" clearable @change="handleSubjectChange" style="width: 172px">
                     <el-option v-for="s in subjectList" :label="s.subjectName" :value="s.subjectId"/>
                 </el-select>
             </el-form-item>
             <el-form-item label="知识点" prop="knowledgeId">
-                <el-tree-select node-key="id" v-model="queryParams.knowledgeId" :data="knowledgeTreeList" check-strictly
+                <el-tree-select node-key="id" v-model="queryParams.knowledgeId" :data="filteredKnowledgeTreeList" check-strictly
                                 :render-after-expand="false" style="" :props="{ label: 'name', children: 'children' }"
                                 placeholder="请选择知识点" class="w-[172px]!" @change="handleQuery"/>
             </el-form-item>
@@ -32,17 +32,17 @@
             <!-- <el-form-item label="相似度" prop="similarity">
               <el-input v-model="queryParams.similarity" placeholder="请输入试题在题库中的相似度" clearable @keyup.enter="handleQuery" />
             </el-form-item> -->
-            <el-form-item label="试题年份" prop="year">
+            <!-- <el-form-item label="试题年份" prop="year">
                 <el-input v-model="queryParams.year" placeholder="请输入试题年份" clearable @keyup.enter="handleQuery"/>
-            </el-form-item>
+            </el-form-item> -->
             <!-- <el-form-item label="试题类型" prop="paperTpye">
               <el-select v-model="queryParams.paperTpye" clearable @change="handleQuery" style="width: 172px">
                 <el-option v-for="p in paper_type" :label="p.label" :value="p.value" />
               </el-select>
             </el-form-item> -->
-            <el-form-item label="来源" prop="source">
+            <!-- <el-form-item label="来源" prop="source">
                 <el-input v-model="queryParams.source" placeholder="请输入来源" clearable @keyup.enter="handleQuery"/>
-            </el-form-item>
+            </el-form-item> -->
             <!-- <el-form-item label="试题来源" prop="fromSite">
                 <el-input v-model="queryParams.fromSite" placeholder="请输入试题来源" clearable
                           @keyup.enter="handleQuery"/>
@@ -88,7 +88,7 @@
 
         <el-table v-loading="loading" :data="questionsList" @selection-change="handleSelectionChange">
             <el-table-column type="selection" width="55" align="center" fixed="left"/>
-            <el-table-column label="ID" align="center" prop="id" fixed="left" />
+            <el-table-column label="题目ID" align="center" prop="id" fixed="left" />
             <el-table-column label="试题-题干" align="left" prop="title" min-width="350" header-align="center"
                              show-overflow-tooltip fixed="left"/>
             <el-table-column label="题型" align="center" prop="qtpye"/>
@@ -101,13 +101,55 @@
                 </template>
             </el-table-column>
             <el-table-column label="知识点" align="center" prop="knowledgeId"/>
-            <el-table-column label="选项A" align="center" prop="optionA" show-overflow-tooltip/>
-            <el-table-column label="选项B" align="center" prop="optionB" show-overflow-tooltip/>
-            <el-table-column label="选项C" align="center" prop="optionC" show-overflow-tooltip/>
-            <el-table-column label="选项D" align="center" prop="optionD" show-overflow-tooltip/>
-            <el-table-column label="选项E" align="center" prop="optionE" show-overflow-tooltip/>
-            <el-table-column label="选项F" align="center" prop="optionF" show-overflow-tooltip/>
-            <el-table-column label="选项G" align="center" prop="optionG" show-overflow-tooltip/>
+            <el-table-column label="选项" align="center" prop="optionA" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionA || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column>
+            <!-- <el-table-column label="选项B" align="center" prop="optionB" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionB || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column>
+            <el-table-column label="选项C" align="center" prop="optionC" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionC || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column>
+            <el-table-column label="选项D" align="center" prop="optionD" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionD || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column>
+            <el-table-column label="选项E" align="center" prop="optionE" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionE || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column>
+            <el-table-column label="选项F" align="center" prop="optionF" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionF || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column>
+            <el-table-column label="选项G" align="center" prop="optionG" show-overflow-tooltip>
+                <template #default="scope">
+                    <el-link type="primary" @click="handleShowOptions(scope.row)" :underline="false">
+                        {{ scope.row.optionG || '-' }}
+                    </el-link>
+                </template>
+            </el-table-column> -->
             <el-table-column label="标准答案" align="center" prop="answer1" show-overflow-tooltip/>
             <el-table-column label="答案2" align="center" prop="answer2" show-overflow-tooltip/>
             <!-- <el-table-column label="试卷Id" align="center" prop="paperId"/> -->
@@ -122,22 +164,22 @@
             <!-- <el-table-column label="试题类型" align="center" prop="paperTpye"/> -->
             <el-table-column label="来源" align="center" prop="source"/>
             <!-- <el-table-column label="试题来源" align="center" prop="fromSite"/> -->
-            <el-table-column label="图片水印" align="center" prop="isSub"/>
-            <el-table-column label="常规题" align="center" prop="isNormal"/>
+            <!-- <el-table-column label="图片水印" align="center" prop="isSub"/> -->
+            <!-- <el-table-column label="常规题" align="center" prop="isNormal"/> -->
             <el-table-column label="匹配知识点" align="center" prop="isKonw" min-width="120"/>
             <el-table-column label="tiid" align="center" prop="tiid" min-width="100"/>
             <!-- <el-table-column label="试题题干的md5值" align="center" prop="md5" /> -->
-            <el-table-column label="是否唯一" align="center" prop="isunique"/>
+            <!-- <el-table-column label="是否唯一" align="center" prop="isunique"/> -->
             <!-- <el-table-column label="md52" align="center" prop="md52" /> -->
             <el-table-column label="分值" align="center" prop="score"/>
-            <el-table-column label="选项" align="center" prop="options"/>
+            <!-- <el-table-column label="选项" align="center" prop="options"/> -->
+            <!-- <el-table-column label="选项" align="center" prop="options0"/> -->
             <!-- <el-table-column label="number" align="center" prop="number" /> -->
             <!-- <el-table-column label="paperTypeTitle" align="center" prop="paperTypeTitle" /> -->
-            <el-table-column label="选项" align="center" prop="options0"/>
-            <el-table-column label="试题-材料题题干" align="center" prop="title0" min-width="130" show-overflow-tooltip/>
-            <el-table-column label="试题-材料题题干" align="center" prop="title1" min-width="130" show-overflow-tooltip/>
-            <el-table-column label="试题解析" align="left" prop="parse0" header-align="center" show-overflow-tooltip/>
-            <el-table-column label="answer0" align="center" prop="answer0"/>
+            <!-- <el-table-column label="试题-材料题题干" align="center" prop="title0" min-width="130" show-overflow-tooltip/> -->
+            <!-- <el-table-column label="试题-材料题题干" align="center" prop="title1" min-width="130" show-overflow-tooltip/> -->
+            <!-- <el-table-column label="试题解析" align="left" prop="parse0" header-align="center" show-overflow-tooltip/> -->
+            <!-- <el-table-column label="answer0" align="center" prop="answer0"/> -->
             <el-table-column label="是否更新" align="center" prop="isUpdate">
                 <template #default="scope">
                     <dict-tag :options="bool_values" :value="scope.row.isUpdate" />
@@ -312,6 +354,49 @@
                 </div>
             </template>
         </el-dialog>
+        
+        <!-- 选项详情弹窗 -->
+        <el-dialog v-model="showOptionsDialog" title="选项详情" width="600px" append-to-body>
+            <div class="options-detail">
+                <div class="option-item" v-if="currentRow.optionA">
+                    <div class="option-label">选项A:</div>
+                    <div class="option-content">{{ currentRow.optionA }}</div>
+                </div>
+                <div class="option-item" v-if="currentRow.optionB">
+                    <div class="option-label">选项B:</div>
+                    <div class="option-content">{{ currentRow.optionB }}</div>
+                </div>
+                <div class="option-item" v-if="currentRow.optionC">
+                    <div class="option-label">选项C:</div>
+                    <div class="option-content">{{ currentRow.optionC }}</div>
+                </div>
+                <div class="option-item" v-if="currentRow.optionD">
+                    <div class="option-label">选项D:</div>
+                    <div class="option-content">{{ currentRow.optionD }}</div>
+                </div>
+                <div class="option-item" v-if="currentRow.optionE">
+                    <div class="option-label">选项E:</div>
+                    <div class="option-content">{{ currentRow.optionE }}</div>
+                </div>
+                <div class="option-item" v-if="currentRow.optionF">
+                    <div class="option-label">选项F:</div>
+                    <div class="option-content">{{ currentRow.optionF }}</div>
+                </div>
+                <div class="option-item" v-if="currentRow.optionG">
+                    <div class="option-label">选项G:</div>
+                    <div class="option-content">{{ currentRow.optionG }}</div>
+                </div>
+                <div v-if="!currentRow.optionA && !currentRow.optionB && !currentRow.optionC && !currentRow.optionD && !currentRow.optionE && !currentRow.optionF && !currentRow.optionG" class="no-options">
+                    暂无选项内容
+                </div>
+            </div>
+            <template #footer>
+                <div class="dialog-footer">
+                    <el-button @click="showOptionsDialog = false">关 闭</el-button>
+                </div>
+            </template>
+        </el-dialog>
+        
         <el-dialog v-model="showTypeDialog" title="修改题型" show-close width="500px" append-to-body>
             <div class="text-content">题号:{{typeForm.ids}}</div>
             <div class="mt-2 mb-2">共<el-text type="primary">{{typeForm.ids.length}}</el-text>项</div>
@@ -337,6 +422,7 @@ import {listKnowledgeTree} from "@/api/learn/knowledgeTree"
 import {listAllSubject} from "@/api/dz/subject"
 import {ElMessage} from "element-plus";
 import DictTag from '@/components/DictTag/index.vue'
+import { computed } from 'vue'
 
 const {proxy} = getCurrentInstance()
 const {question_type} = proxy.useDict('question_type')
@@ -357,9 +443,39 @@ const typeForm = ref({
     type: ''
 })
 const showTypeDialog = ref(false)
+const showOptionsDialog = ref(false)
+const currentRow = ref({})
 
 const subjectList = ref([])
 const knowledgeTreeList = ref([])
+
+/** 根据subjectId过滤知识点树 */
+const filteredKnowledgeTreeList = computed(() => {
+    if (!queryParams.value.subjectId) {
+        return knowledgeTreeList.value
+    }
+    return filterKnowledgeTreeBySubjectId(knowledgeTreeList.value, queryParams.value.subjectId)
+})
+
+/** 递归过滤知识点树 */
+function filterKnowledgeTreeBySubjectId(tree, subjectId) {
+    if (!tree || !Array.isArray(tree)) {
+        return []
+    }
+    const result = []
+    for (const node of tree) {
+        // 如果当前节点的subjectId匹配,或者有子节点匹配,则保留该节点
+        const filteredChildren = node.children ? filterKnowledgeTreeBySubjectId(node.children, subjectId) : []
+        if (node.subjectId === subjectId || filteredChildren.length > 0) {
+            result.push({
+                ...node,
+                children: filteredChildren.length > 0 ? filteredChildren : (node.children || [])
+            })
+        }
+    }
+    return result
+}
+
 const data = reactive({
     form: {},
     queryParams: {
@@ -507,6 +623,13 @@ function reset() {
     proxy.resetForm("questionsRef")
 }
 
+/** 科目变化处理 */
+function handleSubjectChange() {
+    // 清空知识点选择,因为科目变化后知识点列表会变化
+    queryParams.value.knowledgeId = null
+    handleQuery()
+}
+
 /** 搜索按钮操作 */
 function handleQuery() {
     queryParams.value.pageNum = 1
@@ -599,7 +722,44 @@ async function handleUpdateType() {
     getList()
 }
 
+/** 显示选项详情 */
+function handleShowOptions(row) {
+    currentRow.value = row || {}
+    showOptionsDialog.value = true
+}
+
 getKnowledgeTreeList()
 getSubjectList()
 getList()
 </script>
+
+<style scoped>
+.options-detail {
+    padding: 10px 0;
+}
+
+.option-item {
+    margin-bottom: 15px;
+    display: flex;
+    align-items: flex-start;
+}
+
+.option-label {
+    font-weight: bold;
+    min-width: 60px;
+    color: #606266;
+}
+
+.option-content {
+    flex: 1;
+    word-break: break-word;
+    white-space: pre-wrap;
+    line-height: 1.6;
+}
+
+.no-options {
+    text-align: center;
+    color: #909399;
+    padding: 20px 0;
+}
+</style>

+ 4 - 4
ie-admin/src/main/java/com/ruoyi/web/service/CommService.java

@@ -79,9 +79,9 @@ public class CommService {
         for(LearnKnowledgeTree kt : ktList) {
             LearnTeacherService.TreeNode tn;
             if(null != knowCountMap && null != (counts = knowCountMap.get(kt.getId()))) {
-                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),  counts);
+                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),kt.getSubjectId(),  counts);
             } else {
-                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),  null);
+                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),kt.getSubjectId(),  null);
             }
             teMap.put(kt.getId(), tn);
         }
@@ -119,9 +119,9 @@ public class CommService {
         for(LearnKnowledgeCourse kt : ktList) {
             LearnTeacherService.TreeNode tn;
             if(null != knowCountMap && null != (counts = knowCountMap.get(kt.getId()))) {
-                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),  counts);
+                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),null,  counts);
             } else {
-                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),  null);
+                tn = new LearnTeacherService.TreeNode(kt.getId(), kt.getName(),null,  null);
             }
             teMap.put(kt.getId(), tn);
         }

+ 3 - 1
ie-admin/src/main/java/com/ruoyi/web/service/LearnTeacherService.java

@@ -536,12 +536,14 @@ public class LearnTeacherService {
         private Integer finishedCount;
         private Integer rightCount;
         private Double finishedRatio;
+        private Long subjectId;
 
         List<TreeNode> children = Lists.newArrayList();
-        public TreeNode(Long id, String name, Integer[] counts) {
+        public TreeNode(Long id, String name,Long subjectId, Integer[] counts) {
             this.id = id;
             this.name = name;
             this.status = 1;
+            this.subjectId = subjectId;
             this.questionCount = null != counts ? counts[0] : 0;
             this.finishedCount = null != counts ? counts[1] : 0;
             this.rightCount = null != counts ? counts[2] : 0;