Bladeren bron

课程属性

xiatian 4 jaren geleden
bovenliggende
commit
7babc95e47
1 gewijzigde bestanden met toevoegingen van 18 en 14 verwijderingen
  1. 18 14
      src/modules/questions/views/EditPaper.vue

+ 18 - 14
src/modules/questions/views/EditPaper.vue

@@ -586,7 +586,7 @@
                       type="primary"
                       @close="handleClose(content)"
                     >
-                      {{ content.coursePropertyName }}
+                      {{ content.courseProperty.name }}
                     </el-tag>
                   </span>
                 </el-tooltip>
@@ -598,7 +598,7 @@
             <el-col :span="6">
               <el-form-item label="属性名" label-width="60px">
                 <el-select
-                  v-model="coursePropertyName"
+                  v-model="coursePropertyId"
                   placeholder="属性名"
                   class="property_with"
                   :disabled="updatePorperty"
@@ -607,9 +607,9 @@
                   <el-option label="请选择" value=""></el-option>
                   <el-option
                     v-for="item in coursePropertyList"
-                    :key="item.name"
+                    :key="item.id"
                     :label="item.name"
-                    :value="item.name"
+                    :value="item.id"
                   >
                   </el-option>
                 </el-select>
@@ -1064,7 +1064,7 @@ export default {
         { label: "复用", value: 2 },
       ],
       coursePropertyList: [],
-      coursePropertyName: "", //课程属性名
+      coursePropertyId: "", //课程属性名
       firstPropertyList: [], //一级属性集合
       firstPropertyId: "", //一级属性id
       secondPropertyList: [], //二级属性集合
@@ -1509,7 +1509,7 @@ export default {
     //编辑题目
     editQues(paperDetailUnit, question) {
       console.log("question:", question);
-      this.coursePropertyName = "";
+      this.coursePropertyId = "";
       this.firstPropertyId = "";
       this.secondPropertyId = "";
       this.editPaperDetailUnit = paperDetailUnit;
@@ -1602,9 +1602,9 @@ export default {
       this.firstPropertyId = "";
       this.secondPropertyId = "";
       this.secondPropertyList = [];
-      if (this.coursePropertyName) {
+      if (this.coursePropertyId) {
         for (let courseProperty of this.coursePropertyList) {
-          if (courseProperty.name == this.coursePropertyName) {
+          if (courseProperty.id == this.coursePropertyId) {
             this.$http
               .get(QUESTION_API + "/property/first/" + courseProperty.id)
               .then((response) => {
@@ -1632,7 +1632,7 @@ export default {
       }
       var quesProperty = {
         id: "",
-        coursePropertyName: "",
+        courseProperty: {},
         firstProperty: {},
         secondProperty: {},
       };
@@ -1644,13 +1644,13 @@ export default {
       }
       if (this.secondPropertyId) {
         quesProperty.id =
-          this.coursePropertyName +
+          this.coursePropertyId +
           "-" +
           this.firstPropertyId +
           "-" +
           this.secondPropertyId;
       } else {
-        quesProperty.id = this.coursePropertyName + "-" + this.firstPropertyId;
+        quesProperty.id = this.coursePropertyId + "-" + this.firstPropertyId;
       }
       for (let quesPro of this.quesModel.quesProperties) {
         if (quesPro.id == quesProperty.id) {
@@ -1661,7 +1661,11 @@ export default {
           return false;
         }
       }
-      quesProperty.coursePropertyName = this.coursePropertyName;
+      for (let courseProperty of this.coursePropertyList) {
+        if (courseProperty.id == this.coursePropertyId) {
+          quesProperty.courseProperty = courseProperty;
+        }
+      }
       //取到一级属性对象
       for (let property of this.firstPropertyList) {
         if (property.id == this.firstPropertyId) {
@@ -1690,7 +1694,7 @@ export default {
       this.quesModel.quesProperties.push(quesProperty);
       this.quesModel = Object.assign({}, this.quesModel);
       //清空下拉框
-      this.coursePropertyName = "";
+      this.coursePropertyId = "";
       this.firstPropertyId = "";
       this.secondPropertyId = "";
       this.firstPropertyList = [];
@@ -1698,7 +1702,7 @@ export default {
     },
     //新增属性验证
     checkInsertPro() {
-      if (!this.coursePropertyName) {
+      if (!this.coursePropertyId) {
         this.$notify({
           message: "请选择属性",
           type: "error",