Ver Fonte

题目搜索

jinxia.mo há 2 dias atrás
pai
commit
21c64d85bc

+ 11 - 2
back-ui/src/views/dz/papers/components/plugs/question-hand.vue

@@ -6,7 +6,10 @@
     <div class="flex flex-row items-center gap-3">
         <el-input v-model="keywordLocal" clearable prefix-icon="search" placeholder="输入题目关键字-回车触发搜索"
                   style="width: 250px" @keydown.enter="confirmKeyword" @clear="confirmKeyword"/>
-        <el-select v-model="qtpye" clearable style="width: 220px">
+        <el-input-number v-model="questionIdLocal" placeholder="输入题目ID"
+                         style="width: 120px" :min="1" :controls="false"
+                         @keydown.enter="confirmQuestionId" @change="confirmQuestionId"/>
+        <el-select v-model="qtpye" clearable placeholder="输入题型" style="width: 120px">
             <el-option v-for="t in qTypes" :value="t.dictValue" :label="t.dictLabel"></el-option>
         </el-select>
         <el-popover width="250">
@@ -80,6 +83,7 @@ const {knowledgeNode} = useInjectPaperKnowledgeCondition()
 const {loading: globalLoading} = useInjectGlobalLoading()
 const {
     keyword,
+    questionId,
     qtpye,
     qTypes,
     pageNum,
@@ -104,6 +108,11 @@ const questionLoading = computed(() => globalLoading.value)
 const keywordLocal = ref('')
 const confirmKeyword = (val) => keyword.value = keywordLocal.value
 
+const questionIdLocal = ref(null)
+const confirmQuestionId = () => {
+    questionId.value = questionIdLocal.value ? String(questionIdLocal.value) : ''
+}
+
 const buildPaper = function () {
     // validation
     if (!cart.value.length) return ElMessage.error('请将试题加入试题篮')
@@ -116,4 +125,4 @@ const buildPaper = function () {
 
 <style scoped>
 
-</style>
+</style>

+ 4 - 2
back-ui/src/views/dz/papers/hooks/usePaperQuestionCondition.js

@@ -10,6 +10,7 @@ const key = Symbol('PaperQuestionCondition')
 
 export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
     const keyword = ref('')
+    const questionId = ref('')
     const qtpye = ref('') // 历史遗留拼写错误
     const qTypes = ref([])
 
@@ -119,6 +120,7 @@ export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
         pageNum: pageNum.value,
         pageSize: pageSize.value,
         title: keyword.value,
+        id: questionId.value,
         qtpye: qtpye.value,
         knowledgeId: knowledgeId.value,
         knowledges: knowledgeIds.value.toString()
@@ -134,7 +136,7 @@ export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
             loading.value = false
         }
     }
-    watch([keyword, qtpye, knowledgeId, () => knowledgeIds.value.toString()], async ([title, qtpye, knowledgeId, knowledges]) => {
+    watch([keyword, questionId, qtpye, knowledgeId, () => knowledgeIds.value.toString()], async ([title, id, qtpye, knowledgeId, knowledges]) => {
         pageNum.value = 1
         questionList.value = []
         total.value = 0
@@ -144,7 +146,7 @@ export const useProvidePaperQuestionCondition = function (exactMode, handMode) {
     })
 
     const payload = {
-        keyword, qtpye, qTypes, pageNum, pageSize, total, questionList, getQuestionList,
+        keyword, questionId, qtpye, qTypes, pageNum, pageSize, total, questionList, getQuestionList,
         cart, currentSubject, groupedQuestions, subjectStat,
         hasQuestion, addQuestion, removeQuestion, removeQuestionGroup, clearCart
     }