zhangjie %!s(int64=2) %!d(string=hai) anos
pai
achega
d51e295ab4

+ 7 - 0
src/assets/styles/pages.scss

@@ -800,3 +800,10 @@
     }
   }
 }
+// property-popover
+.property-popover {
+  min-height: 300px;
+  max-height: 600px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}

+ 6 - 0
src/constants/constants.js

@@ -127,3 +127,9 @@ export const PAPER_AUDIT_STATUS = [
   { code: "NOT_PASS", name: "审核未通过" },
   { code: "PASS", name: "审核通过" },
 ];
+
+export const DIFFICULTY_LEVEL_ENUM = {
+  HARD: "难",
+  MEDIUM: "中",
+  EASY: "易",
+};

+ 90 - 22
src/modules/questions/views/SelectQuestion.vue

@@ -15,13 +15,7 @@
           >
         </div>
       </div>
-      <el-form
-        :inline="true"
-        :model="formSearch"
-        label-position="right"
-        label-width="90px"
-        class="part-filter-form"
-      >
+      <el-form :inline="true" :model="formSearch" class="part-filter-form">
         <el-form-item label="课程">
           <el-select v-model="courseId" :disabled="true" placeholder="请选择">
             <el-option
@@ -64,6 +58,47 @@
             </el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="难度" style="width: 160px">
+          <el-select
+            v-model="formSearch.difficult"
+            placeholder="选择难度"
+            clearable
+          >
+            <el-option
+              v-for="(val, key) in DIFFICULTY_LEVEL_ENUM"
+              :key="key"
+              :value="key"
+              :label="val"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="属性">
+          <el-popover
+            placement="bottom"
+            width="400"
+            trigger="hover"
+            popper-class="property-popover"
+            visible-arrow
+          >
+            <el-input
+              slot="reference"
+              placeholder="选择属性"
+              readonly
+            ></el-input>
+            <el-tree
+              ref="PropertyTreeRef"
+              :data="propertyTree"
+              show-checkbox
+              default-expand-all
+              node-key="questionPropertyId"
+              :props="defaultProps"
+              check-on-click-node
+              :expand-on-click-node="false"
+              @check-change="checkChange"
+            >
+            </el-tree>
+          </el-popover>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="searchQuestionPaper"
             >查询</el-button
@@ -128,7 +163,7 @@
   </section>
 </template>
 <script>
-import { QUESTION_API } from "@/constants/constants";
+import { QUESTION_API, DIFFICULTY_LEVEL_ENUM } from "@/constants/constants";
 import { QUESTION_TYPES } from "../constants/constants";
 import { mapState } from "vuex";
 import QuestionPreview from "./QuestionPreview";
@@ -142,6 +177,14 @@ export default {
         questionType: "",
         quesBody: "",
         quesName: "",
+        difficult: "",
+        propertyIdList: [],
+      },
+      DIFFICULTY_LEVEL_ENUM,
+      propertyTree: [],
+      defaultProps: {
+        label: "questionPropertyName",
+        children: "childrenProperty",
       },
       course: "",
       paperId: "",
@@ -194,6 +237,7 @@ export default {
       });
     this.searchQuestionPaper();
     this.getQuesNames();
+    this.getPropertyTree();
   },
   mounted() {
     setTimeout(() => {
@@ -215,6 +259,31 @@ export default {
 
       this.quesNameList = res.data || [];
     },
+    async getPropertyTree() {
+      const url = QUESTION_API + "/courseProperty/tree";
+      const res = await this.$http.post(
+        url,
+        {},
+        {
+          params: {
+            courseId: this.courseId,
+          },
+        }
+      );
+
+      const resData = res.data || [];
+      this.propertyTree = resData.map((item) => {
+        let nitem = {};
+        nitem.questionPropertyId = `c${item.coursePropertyId}`;
+        nitem.questionPropertyName = item.coursePropertyName;
+        nitem.childrenProperty = item.questionPropertyTrees;
+        return nitem;
+      });
+    },
+    checkChange() {
+      this.formSearch.propertyIdList =
+        this.$refs.PropertyTreeRef.getCheckedKeys(true);
+    },
     quesTypeChange() {
       this.formSearch.quesName = "";
       this.getQuesNames();
@@ -222,21 +291,20 @@ export default {
     //查询列表
     searchQuestionPaper() {
       this.loading = true;
+      const url = `${QUESTION_API}/paper/listQuestion/${this.paperId}/${this.currentPage}/${this.pageSize}`;
       this.$http
-        .get(
-          QUESTION_API +
-            "/paper/listQuestion/" +
-            this.paperId +
-            "/" +
-            this.currentPage +
-            "/" +
-            this.pageSize +
-            "?quesType=" +
-            this.formSearch.questionType +
-            "&quesBody=" +
-            this.formSearch.quesBody +
-            "&quesName=" +
-            this.formSearch.quesName
+        .post(
+          url,
+          {},
+          {
+            params: {
+              quesType: this.formSearch.questionType,
+              quesBody: this.formSearch.quesBody,
+              quesName: this.formSearch.quesName,
+              difficult: this.formSearch.difficult,
+              propertyIdList: this.formSearch.propertyIdList.join(),
+            },
+          }
         )
         .then((response) => {
           this.tableData = response.data.content;