Prechádzať zdrojové kódy

提交蓝图试卷结构代码

weiwenhai 6 rokov pred
rodič
commit
8a229020fe

+ 11 - 1
src/modules/questions/routes/routes.js

@@ -3,6 +3,8 @@ import PaperStructure from "../views/PaperStructure.vue";
 import InsertPaperStructure from "../views/InsertPaperStructure.vue";
 import InsertPaperStructureInfo from "../views/InsertPaperStructureInfo.vue";
 import BluePaperStructure from "../views/BluePaperStructure.vue";
+import InsertBluePaperStructure from "../views/InsertBluePaperStructure.vue";
+import InsertBluePaperStructureInfo from "../views/InsertBluePaperStructureInfo.vue";
 
 export default [
   {
@@ -19,12 +21,20 @@ export default [
         component: InsertPaperStructure
       },
       {
-        path: "insert_paper_structure_info/:id/:name/:detailId/:courseNo", //添加题型结构
+        path: "insert_paper_structure_info/:id/:name/:detailId/:courseNo", //精确试卷结构添加题型结构
         component: InsertPaperStructureInfo
       },
       {
         path: "blue_paper_structure/:isClear", //蓝图试卷结构列表
         component: BluePaperStructure
+      },
+      {
+        path: "insert_blue_paper_structure/:id", //蓝图试卷结构(新增/修改)
+        component: InsertBluePaperStructure
+      },
+      {
+        path: "insert_blue_paper_structure_info/:id/:paperStructId", //蓝图试卷结构添加题型结构
+        component: InsertBluePaperStructureInfo
       }
     ]
   }

+ 6 - 6
src/modules/questions/views/BluePaperStructure.vue

@@ -147,7 +147,7 @@
                   <el-button
                     size="mini"
                     type="danger"
-                    @click="deleteStruct(scope.$index, scope.row);"
+                    @click="deleteStruct(scope.row);"
                     >删除</el-button
                   >
                 </div>
@@ -200,7 +200,7 @@ export default {
         this.currentPage
       );
       this.$router.push({
-        path: "/index/insert_blue_paper_structure/add"
+        path: "/questions/insert_blue_paper_structure/add"
       });
     },
     //分页
@@ -214,8 +214,8 @@ export default {
       var url =
         Q_API + "/paperStruct/" + this.currentPage + "/" + this.pageSize;
       this.$http.get(url, { params: this.formSearch }).then(response => {
-        this.tableData = response.body.content;
-        this.total = response.body.totalElements;
+        this.tableData = response.data.content;
+        this.total = response.data.totalElements;
       });
       this.loading = false;
     },
@@ -279,7 +279,7 @@ export default {
       );
       sessionStorage.setItem("blueStruct", JSON.stringify(row));
       this.$router.push({
-        path: "/index/insert_blue_paper_structure/" + row.id
+        path: "/questions/insert_blue_paper_structure/" + row.id
       });
     },
     deleteStruct(row) {
@@ -327,7 +327,7 @@ export default {
           this.$http
             .get(CORE_API + "/course/query?name=" + query + "&enable=true")
             .then(response => {
-              this.courseList = response.body;
+              this.courseList = response.data;
               this.courseLoading = false;
             });
         }

+ 629 - 0
src/modules/questions/views/InsertBluePaperStructure.vue

@@ -0,0 +1,629 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <!-- 头信息 -->
+        <div class="box-header with-border">
+          <h3 class="box-title">蓝图试卷结构-->创建大题</h3>
+        </div>
+        <!-- 正文信息 -->
+        <div
+          class="box-body"
+          v-loading.body="loading"
+          element-loading-text="正在保存,请稍后..."
+        >
+          <el-form :inline="true" :model="blueStruct">
+            <el-row>
+              <el-form-item label="结构名称">
+                <el-input
+                  class="pull_length_sm"
+                  v-model="blueStruct.name"
+                  auto-complete="off"
+                  placeholder="试卷结构名称"
+                  style="width: 220px;"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="设置类型">
+                <el-select
+                  v-model="blueStruct.genPaperType"
+                  class="form_width"
+                  filterable
+                  disabled
+                >
+                  <el-option label="细节组卷" value="SPECIFIC"> </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="总 分">
+                <el-input
+                  class="pull_length_sm"
+                  v-model.number="blueStruct.totalScore"
+                  auto-complete="off"
+                  placeholder="请输入总分"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="制定课程">
+                <el-select
+                  v-model="blueStruct.courseNo"
+                  class="form_width"
+                  :disabled="showcoursePropertyId"
+                  filterable
+                  :remote-method="getCourses"
+                  remote
+                  clearable
+                  @change="clearCourseProperty"
+                >
+                  <el-option
+                    v-for="item in courseInfoSelect"
+                    :label="item.courseInfo"
+                    :value="item.courseNo"
+                    :key="item.courseNo"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="课程属性">
+                <el-select
+                  v-model="blueStruct.coursePropertyId"
+                  class="form_width"
+                  filterable
+                  @change="getCoursePropertyName"
+                  :disabled="showcoursePropertyId"
+                >
+                  <el-option
+                    v-for="item in coursePropertyList"
+                    :label="item.name"
+                    :value="item.id"
+                    :key="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item class="pull-right">
+                <el-button size="small" type="success" @click="saveBlueStruct">
+                  <i class="fa fa-floppy-o"></i>保 存</el-button
+                >
+                <el-button
+                  size="small"
+                  type="primary"
+                  icon="plus"
+                  @click="insertDetail"
+                  >添加大题</el-button
+                >
+                <el-button
+                  size="small"
+                  type="primary"
+                  icon="caret-left"
+                  @click="back"
+                  >返 回</el-button
+                >
+              </el-form-item>
+            </el-row>
+            <el-form-item label="考试说明">
+              <div style="width:550px;">
+                <ckeditor v-model="blueStruct.examRemark"></ckeditor>
+              </div>
+            </el-form-item>
+          </el-form>
+
+          <!-- 添加大题弹出框 -->
+          <el-dialog title="大题信息" :visible.sync="detailDialog" size="tiny">
+            <el-form
+              :inline="true"
+              :model="paperDetailStructForm"
+              label-position="right"
+              label-width="90px"
+            >
+              <el-row>
+                <el-form-item label="大题名称" label-width="120px">
+                  <el-input
+                    class="pull_length"
+                    v-model="paperDetailStructForm.name"
+                    auto-complete="off"
+                    placeholder="请输入题型名称"
+                  ></el-input>
+                </el-form-item>
+              </el-row>
+              <el-row>
+                <el-form-item label="题型描述" label-width="120px">
+                  <el-input
+                    type="textarea"
+                    :rows="2"
+                    class="pull_length"
+                    v-model="paperDetailStructForm.remark"
+                    auto-complete="off"
+                    placeholder="请输入题型描述"
+                  ></el-input>
+                </el-form-item>
+              </el-row>
+              <el-row style="margin-left: 120px;">
+                <span v-if="dialogType == 'ADD'">
+                  <el-button type="primary" @click="saveDetail"
+                    >保 存</el-button
+                  >
+                </span>
+                <span v-else>
+                  <el-button type="primary" @click="saveEditDetail"
+                    >保 存</el-button
+                  >
+                </span>
+                <el-button type="danger" @click="closeDialog">取 消</el-button>
+              </el-row>
+            </el-form>
+          </el-dialog>
+
+          <!-- 页面列表 -->
+          <el-table
+            :data="paperDetailStructs"
+            border
+            style="width: 100%;text-align:center;"
+          >
+            <el-table-column label="大题名称">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="小题数">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.detailCount }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="大题分数">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.totalScore }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="题型">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ getTpye(scope.row.questionType) }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column :context="_self" label="操作">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    size="mini"
+                    type="primary"
+                    icon="plus"
+                    @click="detailInfo(scope.row);"
+                    >大题详情</el-button
+                  >
+                  <el-button
+                    size="mini"
+                    type="info"
+                    @click="editDetail(scope.row);"
+                    >编辑</el-button
+                  >
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    @click="deleteDetail(scope.row);"
+                    >删除</el-button
+                  >
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+    </section>
+  </div>
+</template>
+<script>
+import { CORE_API, Q_API, QUESTION_TYPES } from "../constants/constants";
+import ckeditor from "../component/ckeditor.vue";
+export default {
+  components: { ckeditor },
+  data() {
+    return {
+      blueStruct: {
+        name: "",
+        totalScore: 0, //结构总分
+        courseNo: "", //课程
+        coursePropertyId: "", //课程属性
+        coursePropertyName: "", //课程属性名称
+        paperDetailStructs: [],
+        type: "BLUEPRINT", //试卷结构类型
+        genPaperType: "SPECIFIC", //组卷类型
+        examRemark: ""
+      },
+      detailDialog: false,
+      dialogType: "",
+      paperDetailStructForm: {
+        id: "",
+        number: "",
+        name: "", //大题名称
+        questionType: "", //题型
+        detailCount: 0, //小题总数
+        score: 0, //每题分数
+        totalScore: 0, //大题分数
+        quesNames: [], //来源大题
+        publicSimpleCount: 0, //公开简单
+        publicMediumCount: 0, //公开中等
+        publicDifficultyCount: 0, //公开困难
+        noPublicSimpleCount: 0, //非公开简单
+        noPublicMediumCount: 0, //非公开中等
+        noPublicDifficultyCount: 0, //非公开困难
+        courseProperties: [], //课程属性列表
+        remark: "", //备注
+        coursePropertyNumberDtos: [] //
+      },
+      quesTypes: QUESTION_TYPES,
+      paperDetailStructs: [],
+      courseList: [],
+      loading: false,
+      coursePropertyList: []
+    };
+  },
+  methods: {
+    //查询大题结合
+    searchForm() {
+      this.loading = true;
+      var blueStructStorge = sessionStorage.getItem("blueStruct");
+      if (typeof blueStructStorge == "string") {
+        var blueStruct = JSON.parse(blueStructStorge);
+        this.blueStruct = blueStruct;
+        this.$http
+          .get(Q_API + "/courseProperty/enable/" + this.blueStruct.courseNo)
+          .then(response => {
+            this.coursePropertyList = response.data;
+            if (this.coursePropertyList && this.coursePropertyList.length > 0) {
+              for (let objCouPro of this.coursePropertyList) {
+                if (objCouPro.id == this.blueStruct.coursePropertyId) {
+                  this.blueStruct.coursePropertyName = objCouPro.name;
+                  console.log("blueStruct", blueStruct);
+                }
+              }
+            }
+          });
+        this.paperDetailStructs = blueStruct.paperDetailStructs;
+      }
+      this.loading = false;
+    },
+    getProperties() {
+      for (var course of this.courseList) {
+        if (this.blueStruct.courseNo == course.code) {
+          var courseId = course.id;
+          this.$http
+            .get(Q_API + "/courseProperty/all/" + courseId)
+            .then(response => {
+              this.coursePropertyList = response.data;
+              console.log("this.coursePropertyList:", this.coursePropertyList);
+            });
+        }
+      }
+    },
+    //查询课程下的课程属性
+    getCoursePropertyList() {
+      this.$http
+        .get(Q_API + "/courseProperty/enable/" + this.blueStruct.courseNo)
+        .then(response => {
+          this.coursePropertyList = response.data;
+          console.log("this.coursePropertyList:", this.coursePropertyList);
+          if (this.coursePropertyList && this.coursePropertyList.length == 0) {
+            this.blueStruct.coursePropertyId = "";
+          }
+        });
+    },
+    checkPaperStruct() {
+      if (!this.blueStruct.name) {
+        this.$notify({
+          message: "请填写试卷结构名称",
+          type: "error"
+        });
+        return false;
+      }
+      let curPropertyId = this.blueStruct.coursePropertyId;
+      if (!curPropertyId || curPropertyId.length < 1) {
+        this.$notify({
+          type: "error",
+          message: "选择课程属性"
+        });
+        return false;
+      }
+      if (
+        !(
+          this.blueStruct.paperDetailStructs &&
+          this.blueStruct.paperDetailStructs.length > 0
+        )
+      ) {
+        this.$notify({
+          message: "请添加大题",
+          type: "error"
+        });
+        return false;
+      }
+      for (let paperDetailStruct of this.blueStruct.paperDetailStructs) {
+        if (!(paperDetailStruct.detailCount > 0)) {
+          this.$notify({
+            message: "请添加大题下的小题数量",
+            type: "error"
+          });
+          return false;
+        }
+      }
+      return true;
+    },
+    //验证总分
+    checkTotalScore() {
+      var totalScore = 0;
+      for (let paperDetailStruct of this.blueStruct.paperDetailStructs) {
+        totalScore = parseInt(paperDetailStruct.totalScore) + totalScore;
+      }
+      if (totalScore != this.blueStruct.totalScore) {
+        return false;
+      } else {
+        return true;
+      }
+    },
+    //保存试卷结构
+    saveBlueStruct() {
+      if (this.blueStruct.name.trim().length == 0) {
+        this.$notify({
+          type: "error",
+          message: "结构名称不能为空格"
+        });
+        return false;
+      }
+      if (!this.checkPaperStruct()) {
+        return false;
+      }
+      if (!this.checkTotalScore()) {
+        this.$notify({
+          type: "error",
+          message: "试卷结构总分与大题总分不一致"
+        });
+        return false;
+      }
+      this.loading = true;
+      var url = Q_API + "/paperStruct";
+      if (this.paperStructId != "add") {
+        //假如没ID就是新增
+        this.$http
+          .put(url, this.blueStruct)
+          .then(() => {
+            this.$notify({
+              message: "保存成功",
+              type: "success"
+            });
+            this.loading = false;
+            this.removeItem();
+            this.back();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "试卷结构名称重复,请重新命名"
+            });
+            this.loading = false;
+          });
+      } else {
+        this.$http
+          .post(url, this.blueStruct)
+          .then(() => {
+            this.$notify({
+              message: "保存成功",
+              type: "success"
+            });
+            this.loading = false;
+            this.removeItem();
+            this.back();
+          })
+          .catch(() => {
+            this.loading = false;
+            this.$notify({
+              type: "error",
+              message: "试卷结构名称重复,请重新命名"
+            });
+          });
+      }
+    },
+    //添加大题
+    insertDetail() {
+      this.dialogType = "ADD";
+      this.paperDetailStructForm.name = "";
+      this.paperDetailStructForm.remark = "";
+      this.detailDialog = true;
+    },
+    //保存新增大题
+    saveDetail() {
+      //校验大题名称
+      if (
+        !this.paperDetailStructForm.name ||
+        this.paperDetailStructForm.name.trim().length == 0
+      ) {
+        this.$notify({
+          type: "error",
+          message: "大题名称为空,请输入大题名称"
+        });
+        return;
+      }
+      //定义一个id的集合,用来id自加
+      var ids = [];
+      for (let paperDetailStruct of this.paperDetailStructs) {
+        ids.push(paperDetailStruct.id);
+      }
+      ids.sort();
+      var maxId;
+      if (ids.length == 0) {
+        maxId = 0;
+      } else {
+        maxId = ids[ids.length - 1];
+      }
+      var paperDetailStruct = Object.assign({}, this.paperDetailStructForm);
+      paperDetailStruct.id = maxId + 1;
+      paperDetailStruct.number = this.paperDetailStructs.length + 1;
+      this.paperDetailStructs.push(paperDetailStruct);
+      this.detailDialog = false;
+      this.blueStruct.paperDetailStructs = this.paperDetailStructs;
+      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+    },
+    //删除大题
+    deleteDetail(row) {
+      for (var i = 0; i < this.paperDetailStructs.length; i++) {
+        if (row.id === this.paperDetailStructs[i].id) {
+          this.paperDetailStructs.splice(i, 1);
+        }
+      }
+      this.blueStruct.paperDetailStructs = this.paperDetailStructs;
+      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+    },
+    //修改大题
+    editDetail(row) {
+      this.dialogType = "EDIT";
+      for (let paperDetailStruct of this.paperDetailStructs) {
+        if (row.id === paperDetailStruct.id) {
+          this.paperDetailStructForm.name = paperDetailStruct.name;
+          this.paperDetailStructForm.remark = paperDetailStruct.remark;
+          this.paperDetailStructForm.id = row.id;
+        }
+      }
+      this.detailDialog = true;
+    },
+    //保存修改大题
+    saveEditDetail() {
+      //校验大题名称
+      if (
+        !this.paperDetailStructForm.name ||
+        this.paperDetailStructForm.name.trim().length == 0
+      ) {
+        this.$notify({
+          type: "error",
+          message: "大题名称为空,请输入大题名称"
+        });
+        return;
+      }
+      for (let paperDetailStruct of this.paperDetailStructs) {
+        if (this.paperDetailStructForm.id === paperDetailStruct.id) {
+          console.log("paperDetailStruct", paperDetailStruct);
+          paperDetailStruct.name = this.paperDetailStructForm.name;
+          paperDetailStruct.remark = this.paperDetailStructForm.remark;
+        }
+      }
+      this.paperDetailStructForm = { name: "", remark: "", id: "" };
+      this.blueStruct.paperDetailStructs = this.paperDetailStructs;
+      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+      this.detailDialog = false;
+    },
+    //返回
+    back() {
+      this.$router.push({
+        path: "/questions/blue_paper_structure/1"
+      });
+    },
+    //关闭窗口
+    closeDialog() {
+      this.paperDetailStructForm.name = "";
+      this.paperDetailStructForm.remark = "";
+      this.detailDialog = false;
+    },
+    //得到题型
+    getTpye(val) {
+      //console.log(val);
+      for (var ques of this.quesTypes) {
+        if (val === ques.value) {
+          return ques.label;
+        }
+      }
+    },
+    //大题详情
+    detailInfo(row) {
+      if (!this.blueStruct.coursePropertyId) {
+        this.$notify({
+          type: "error",
+          message: "请选择课程属性"
+        });
+        return false;
+      }
+      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+      this.$router.push({
+        path:
+          "/questions/insert_blue_paper_structure_info/" +
+          row.id +
+          "/" +
+          this.paperStructId
+      });
+    },
+    //清空
+    removeItem() {
+      sessionStorage.removeItem("blueStruct");
+    },
+    getCoursePropertyName() {
+      if (this.blueStruct.coursePropertyId) {
+        for (let objCouPro of this.coursePropertyList) {
+          if (objCouPro.id == this.blueStruct.coursePropertyId) {
+            this.blueStruct.coursePropertyName = objCouPro.name;
+          }
+        }
+      } else {
+        this.blueStruct.coursePropertyName = "";
+      }
+    },
+    //查询所有课程
+    getCourses(query) {
+      query = query.trim();
+      if (query) {
+        if (!(query.indexOf("(") > -1 && query.indexOf(")") > -1)) {
+          this.courseLoading = true;
+          this.$http
+            .get(CORE_API + "/course/query?name=" + query + "&enable=true")
+            .then(response => {
+              this.courseList = response.data;
+              this.courseLoading = false;
+              if (this.blueStruct.courseNo) {
+                this.getCoursePropertyList();
+              }
+            });
+        } else {
+          this.getCoursePropertyList();
+        }
+      } else {
+        this.courseList = [];
+      }
+    },
+    clearCourseProperty() {
+      this.blueStruct.coursePropertyId = "";
+      this.coursePropertyList = [];
+    }
+  },
+  computed: {
+    totalScore() {
+      var sum = 0.0;
+      for (let paperDetailStruct of this.paperDetailStructs) {
+        sum += paperDetailStruct.score;
+      }
+      return sum;
+    },
+    courseInfoSelect() {
+      var courseList = [];
+      for (let course of this.courseList) {
+        var courseInfo = course.name + "(" + course.code + ")";
+        var courseNo = course.code;
+        courseList.push({ courseNo: courseNo, courseInfo: courseInfo });
+      }
+      return courseList;
+    },
+    showcoursePropertyId() {
+      if (this.blueStruct.paperDetailStructs.length > 0) {
+        for (let paperDetailStruct of this.blueStruct.paperDetailStructs) {
+          if (paperDetailStruct.detailCount > 0) {
+            return true;
+          }
+        }
+      }
+      return false;
+    }
+  },
+  created() {
+    this.paperStructId = this.$route.params.id;
+    this.searchForm();
+  }
+};
+</script>

+ 815 - 0
src/modules/questions/views/InsertBluePaperStructureInfo.vue

@@ -0,0 +1,815 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <!-- 头信息 -->
+        <div class="box-header with-border">
+          <h3 class="box-title">大题详情</h3>
+        </div>
+        <!-- 正文信息 -->
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="paperDetailStruct"
+            label-position="right"
+            label-width="90px"
+          >
+            <el-form-item label="题型结构" class="pull-left">
+              <el-select
+                @change="getQuesNameList"
+                class="input_width"
+                v-model="paperDetailStruct.questionType"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in quesTypes"
+                  :label="item.label"
+                  :value="item.value"
+                  :key="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="题目数量" class="pull-left">
+              <el-input class="input_width" v-model="count" disabled></el-input>
+            </el-form-item>
+            <el-form-item label="每题分值" class="pull-left">
+              <el-input
+                class="input_width"
+                v-model="paperDetailStruct.score"
+                @change="muli(paperDetailStruct);"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="来源大题" class="pull-left">
+              <el-select
+                class="quesNames"
+                multiple
+                v-model="paperDetailStruct.quesNames"
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in quesNameList"
+                  :label="item.name"
+                  :value="item.code"
+                  :key="item.code"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="题型总分" class="pull-left">
+              <el-input
+                class="input_width_sm"
+                v-model="paperDetailStruct.totalScore"
+                disabled
+              ></el-input>
+            </el-form-item>
+            <el-form-item class="pull-right">
+              <el-button size="small" type="primary" @click="saveForm"
+                >保 存</el-button
+              >
+              <el-button
+                size="small"
+                type="primary"
+                icon="caret-left"
+                @click="back"
+                >返 回</el-button
+              >
+            </el-form-item>
+          </el-form>
+
+          <!-- 页面列表 -->
+          <el-table
+            :data="coursePropertyNumberDtos"
+            border
+            :row-class-name="tableRowClassName"
+          >
+            <el-table-column min-width="300" label="属性名称">
+              <template slot-scope="scope">
+                <div class="el_table_inner_left">
+                  <p
+                    class="class-a"
+                    :class="{ 'class-b': scope.row.propertyParentId != 0 }"
+                  >
+                    {{ scope.row.propertyName }}
+                  </p>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="数量">
+              <template slot-scope="scope">
+                <div class="el_table_inner_left">
+                  <el-input
+                    class="input_width_ss"
+                    v-model="scope.row.number"
+                    disabled
+                  ></el-input>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="公开(简单)">
+              <template slot-scope="scope">
+                <div
+                  class="el_table_inner_left"
+                  @mouseenter="showActiveIn(1, 1, scope.row);"
+                  @mouseleave="showActiveOff"
+                >
+                  <el-tooltip placement="top">
+                    <div slot="content">{{ message }}</div>
+                    <el-input
+                      class="input_width_ss"
+                      v-model="scope.row.publicSimple"
+                      @change="
+                        sum(scope.row, scope.row.publicSimple, 'publicSimple');
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </el-tooltip>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="公开(中等)">
+              <template slot-scope="scope">
+                <div
+                  class="el_table_inner_left"
+                  @mouseenter="showActiveIn(1, 2, scope.row);"
+                  @mouseleave="showActiveOff"
+                >
+                  <el-tooltip placement="top">
+                    <div slot="content">{{ message }}</div>
+                    <el-input
+                      class="input_width_ss"
+                      v-model="scope.row.publicMedium"
+                      @change="
+                        sum(scope.row, scope.row.publicMedium, 'publicMedium');
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </el-tooltip>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="公开(困难)">
+              <template slot-scope="scope">
+                <div
+                  class="el_table_inner_left"
+                  @mouseenter="showActiveIn(1, 3, scope.row);"
+                  @mouseleave="showActiveOff"
+                >
+                  <el-tooltip placement="top">
+                    <div slot="content">{{ message }}</div>
+                    <el-input
+                      class="input_width_ss"
+                      v-model="scope.row.publicDifficulty"
+                      @change="
+                        sum(
+                          scope.row,
+                          scope.row.publicDifficulty,
+                          'publicDifficulty'
+                        );
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </el-tooltip>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="非公开(简单)">
+              <template slot-scope="scope">
+                <div
+                  class="el_table_inner_left"
+                  @mouseenter="showActiveIn(0, 1, scope.row);"
+                  @mouseleave="showActiveOff"
+                >
+                  <el-tooltip placement="top">
+                    <div slot="content">{{ message }}</div>
+                    <el-input
+                      class="input_width_ss"
+                      v-model="scope.row.noPublicSimple"
+                      @change="
+                        sum(
+                          scope.row,
+                          scope.row.noPublicSimple,
+                          'noPublicSimple'
+                        );
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </el-tooltip>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="非公开(中等)">
+              <template slot-scope="scope">
+                <div
+                  class="el_table_inner_left"
+                  @mouseenter="showActiveIn(0, 2, scope.row);"
+                  @mouseleave="showActiveOff"
+                >
+                  <el-tooltip placement="top">
+                    <div slot="content">{{ message }}</div>
+                    <el-input
+                      class="input_width_ss"
+                      v-model="scope.row.noPublicMedium"
+                      @change="
+                        sum(
+                          scope.row,
+                          scope.row.noPublicMedium,
+                          'noPublicMedium'
+                        );
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </el-tooltip>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="非公开(困难)">
+              <template slot-scope="scope">
+                <div
+                  class="el_table_inner_left"
+                  @mouseenter="showActiveIn(0, 3, scope.row);"
+                  @mouseleave="showActiveOff"
+                >
+                  <el-tooltip placement="top">
+                    <div slot="content">{{ message }}</div>
+                    <el-input
+                      class="input_width_ss"
+                      v-model="scope.row.noPublicDifficulty"
+                      @change="
+                        sum(
+                          scope.row,
+                          scope.row.noPublicDifficulty,
+                          'noPublicDifficulty'
+                        );
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </el-tooltip>
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+
+          <div
+            style="margin-top: 20px;padding-top: 20px;"
+            class="grid-content bg-purple-light"
+          >
+            <el-form label-width="80px">
+              <el-row>
+                <el-col :span="6">
+                  <el-form-item label="公开"> </el-form-item>
+                </el-col>
+                <el-col :span="6">
+                  <el-form-item label="简单总数">
+                    <el-input
+                      v-model="publicSimpleCount"
+                      class="input_width_ss"
+                      disabled
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="6">
+                  <el-form-item label="中等总数">
+                    <el-input
+                      v-model="publicMediumCount"
+                      class="input_width_ss"
+                      disabled
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="6">
+                  <el-form-item label="困难总数">
+                    <el-input
+                      v-model="publicDifficultyCount"
+                      class="input_width_ss"
+                      disabled
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+              <el-row>
+                <el-col :span="6">
+                  <el-form-item label="非公开"> </el-form-item>
+                </el-col>
+                <el-col :span="6">
+                  <el-form-item label="简单总数">
+                    <el-input
+                      v-model="noPublicSimpleCount"
+                      class="input_width_ss"
+                      disabled
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="6">
+                  <el-form-item label="中等总数">
+                    <el-input
+                      v-model="noPublicMediumCount"
+                      class="input_width_ss"
+                      disabled
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="6">
+                  <el-form-item label="困难总数">
+                    <el-input
+                      v-model="noPublicDifficultyCount"
+                      class="input_width_ss"
+                      disabled
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </el-form>
+          </div>
+        </div>
+      </div>
+    </section>
+  </div>
+</template>
+<script>
+import { Q_API, QUESTION_TYPES } from "../constants/constants";
+export default {
+  data() {
+    return {
+      paperDetailStruct: {
+        id: "",
+        number: "",
+        name: "", //大题名称
+        questionType: "", //题型
+        detailCount: 0, //小题总数
+        score: 0, //每题分数
+        totalScore: 0, //大题分数
+        quesNames: [], //来源大题
+        publicSimpleCount: 0, //公开简单总数
+        publicMediumCount: 0, //公开中等总数
+        publicDifficultyCount: 0, //公开困难总数
+        noPublicSimpleCount: 0, //非公开简单总数
+        noPublicMediumCount: 0, //非公开中等总数
+        noPublicDifficultyCount: 0, //非公开困难总数
+        coursePropertyNumberDtos: [], //课程属性列表
+        remark: "" //备注
+      },
+      paperDetailStructId: "",
+      quesTypes: QUESTION_TYPES,
+      coursePropertyNumberDtos: [],
+      properties: [],
+      loading: false,
+      quesNameList: [],
+      blueStruct: "",
+      disable: false,
+      count: 0,
+      publicSimpleCount: 0,
+      publicMediumCount: 0,
+      publicDifficultyCount: 0,
+      noPublicSimpleCount: 0,
+      noPublicMediumCount: 0,
+      noPublicDifficultyCount: 0,
+      paperStructId: "",
+      message: "",
+      question: {
+        questionType: "",
+        courseNo: "",
+        coursePropertyName: "",
+        publicity: "",
+        firstPropertyId: "",
+        secondPropertyId: ""
+      }
+    };
+  },
+  methods: {
+    tableRowClassName(row) {
+      if (row.disable) {
+        return "positive-row";
+      }
+      return "";
+    },
+    //查询课程下的所有属性
+    searchPaperDetail() {
+      //this.loading = true;
+      var bluePaperStructStorge = sessionStorage.getItem("blueStruct");
+      if (typeof bluePaperStructStorge === "string") {
+        var blueStruct = JSON.parse(bluePaperStructStorge);
+        this.blueStruct = blueStruct;
+        var paperDetailStructs = blueStruct.paperDetailStructs;
+        for (let paperDetailStruct of paperDetailStructs) {
+          if (paperDetailStruct.id == this.paperDetailStructId) {
+            this.paperDetailStruct = paperDetailStruct;
+            //新增,做初始化查询
+            if (this.paperDetailStruct.coursePropertyNumberDtos.length == 0) {
+              //查询课程下的所有属性
+              this.$http
+                .get(Q_API + "/property/" + blueStruct.coursePropertyId)
+                .then(response => {
+                  this.properties = response.body;
+                  this.init();
+                });
+            } else {
+              //修改
+              this.coursePropertyNumberDtos = this.paperDetailStruct.coursePropertyNumberDtos;
+              this.count = paperDetailStruct.detailCount;
+              this.publicSimpleCount = paperDetailStruct.publicSimpleCount;
+              this.publicMediumCount = paperDetailStruct.publicMediumCount;
+              this.publicDifficultyCount =
+                paperDetailStruct.publicDifficultyCount;
+              this.noPublicSimpleCount = paperDetailStruct.noPublicSimpleCount;
+              this.noPublicMediumCount = paperDetailStruct.noPublicMediumCount;
+              this.noPublicDifficultyCount =
+                paperDetailStruct.noPublicDifficultyCount;
+              this.initQuesNameList();
+            }
+          }
+        }
+      }
+    },
+    //初始化方法
+    init() {
+      var i = 1;
+      for (let property of this.properties) {
+        var coursePropertyNumber = {
+          id: i,
+          propertyId: property.id,
+          propertyParentId: property.parentId,
+          propertyName: property.name,
+          number: 0,
+          publicSimple: 0,
+          publicMedium: 0,
+          publicDifficulty: 0,
+          noPublicSimple: 0,
+          noPublicMedium: 0,
+          noPublicDifficulty: 0,
+          disable: false
+        };
+        //判断父节点
+        if (property.parentId == 0) {
+          //判断父节点下面有没有  子节点
+          for (let propertySon of this.properties) {
+            //如果有子节点,就不能输入
+            if (propertySon.parentId == property.id) {
+              this.disable = true;
+            }
+          }
+          coursePropertyNumber.disable = this.disable;
+        }
+        this.coursePropertyNumberDtos.push(coursePropertyNumber);
+        this.disable = false;
+        i = i + 1;
+      }
+    },
+    //初始化来源大题名称
+    initQuesNameList() {
+      var url =
+        Q_API +
+        "/paperStruct/quesNames?quesType=" +
+        this.paperDetailStruct.questionType +
+        "&courseNo=" +
+        this.blueStruct.courseNo;
+      this.$http.get(url).then(response => {
+        this.quesNameList = response.body;
+      });
+    },
+    //查询来源大题名称
+    getQuesNameList(quesType) {
+      if (quesType && quesType.length > 0) {
+        var url =
+          Q_API +
+          "/paperStruct/quesNames?quesType=" +
+          quesType +
+          "&courseNo=" +
+          this.blueStruct.courseNo;
+        this.$http.get(url).then(response => {
+          this.quesNameList = response.body;
+        });
+      }
+      this.paperDetailStruct.quesNames = [];
+      //需要记录题型,查询题目数量
+    },
+    //判断是否为正整数
+    isPositiveInteger(s) {
+      //是否为正整数
+      var re = /^[0-9]+$/;
+      return re.test(s);
+    },
+    //计算数量
+    sum(row, data, rowType) {
+      //计算前校验正整数
+      if (!this.isPositiveInteger(data)) {
+        if (rowType === "publicSimple") {
+          setTimeout(function() {
+            row.publicSimple = 0;
+          }, 1);
+        } else if (rowType === "publicMedium") {
+          setTimeout(function() {
+            row.publicMedium = 0;
+          }, 1);
+        } else if (rowType === "publicDifficulty") {
+          setTimeout(function() {
+            row.publicDifficulty = 0;
+          }, 1);
+        } else if (rowType === "noPublicSimple") {
+          setTimeout(function() {
+            row.noPublicSimple = 0;
+          }, 1);
+        } else if (rowType === "noPublicMedium") {
+          setTimeout(function() {
+            row.noPublicMedium = 0;
+          }, 1);
+        } else if (rowType === "noPublicDifficulty") {
+          setTimeout(function() {
+            row.noPublicDifficulty = 0;
+          }, 1);
+        }
+      }
+      var _this = this;
+      setTimeout(function() {
+        //每行总和计算
+        console.log("row:", row);
+        row.publicSimple = parseInt(row.publicSimple);
+        row.publicMedium = parseInt(row.publicMedium);
+        row.publicDifficulty = parseInt(row.publicDifficulty);
+        row.noPublicSimple = parseInt(row.noPublicSimple);
+        row.noPublicMedium = parseInt(row.noPublicMedium);
+        row.noPublicDifficulty = parseInt(row.noPublicDifficulty);
+        var number = 0;
+        row.number =
+          parseInt(row.publicSimple) +
+          parseInt(row.publicMedium) +
+          parseInt(row.publicDifficulty) +
+          parseInt(row.noPublicSimple) +
+          parseInt(row.noPublicMedium) +
+          parseInt(row.noPublicDifficulty);
+        //父节点总和计算
+        if (row.propertyParentId != 0) {
+          var publicSimple = 0;
+          var publicMedium = 0;
+          var publicDifficulty = 0;
+          var noPublicSimple = 0;
+          var noPublicMedium = 0;
+          var noPublicDifficulty = 0;
+          //查询到父节点this
+          var coursePropertyNumber = _this.getCoursePropertyNumber(
+            row.propertyParentId
+          );
+          //查询所有子节点
+          var coursePropertyNumberSons = _this.getCoursePropertyNumberSons(
+            coursePropertyNumber.propertyId
+          );
+          for (let coursePropertyNumberSon of coursePropertyNumberSons) {
+            publicSimple =
+              parseInt(coursePropertyNumberSon.publicSimple) + publicSimple;
+            publicMedium =
+              parseInt(coursePropertyNumberSon.publicMedium) + publicMedium;
+            publicDifficulty =
+              parseInt(coursePropertyNumberSon.publicDifficulty) +
+              publicDifficulty;
+            noPublicSimple =
+              parseInt(coursePropertyNumberSon.noPublicSimple) + noPublicSimple;
+            noPublicMedium =
+              parseInt(coursePropertyNumberSon.noPublicMedium) + noPublicMedium;
+            noPublicDifficulty =
+              parseInt(coursePropertyNumberSon.noPublicDifficulty) +
+              noPublicDifficulty;
+          }
+          coursePropertyNumber.publicSimple = publicSimple;
+          coursePropertyNumber.publicMedium = publicMedium;
+          coursePropertyNumber.publicDifficulty = publicDifficulty;
+          coursePropertyNumber.noPublicSimple = noPublicSimple;
+          coursePropertyNumber.noPublicMedium = noPublicMedium;
+          coursePropertyNumber.noPublicDifficulty = noPublicDifficulty;
+          coursePropertyNumber.number =
+            coursePropertyNumber.publicSimple +
+            coursePropertyNumber.publicMedium +
+            coursePropertyNumber.publicDifficulty +
+            coursePropertyNumber.noPublicSimple +
+            coursePropertyNumber.noPublicMedium +
+            coursePropertyNumber.noPublicDifficulty;
+        }
+        //计算所有公开简单数量
+        var publicSimpleCount = 0;
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          if (coursePropertyNumber.disable != true) {
+            publicSimpleCount =
+              parseInt(coursePropertyNumber.publicSimple) + publicSimpleCount;
+          }
+        }
+        _this.publicSimpleCount = publicSimpleCount;
+        //计算所有公开中等数量
+        var publicMediumCount = 0;
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          if (coursePropertyNumber.disable != true) {
+            publicMediumCount =
+              parseInt(coursePropertyNumber.publicMedium) + publicMediumCount;
+          }
+        }
+        _this.publicMediumCount = publicMediumCount;
+        //计算所有公开困难数量
+        var publicDifficultyCount = 0;
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          if (coursePropertyNumber.disable != true) {
+            publicDifficultyCount =
+              parseInt(coursePropertyNumber.publicDifficulty) +
+              publicDifficultyCount;
+          }
+        }
+        _this.publicDifficultyCount = publicDifficultyCount;
+        //计算所有非公开简单数量
+        var noPublicSimpleCount = 0;
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          if (coursePropertyNumber.disable != true) {
+            noPublicSimpleCount =
+              parseInt(coursePropertyNumber.noPublicSimple) +
+              noPublicSimpleCount;
+          }
+        }
+        _this.noPublicSimpleCount = noPublicSimpleCount;
+        //计算所有非公开等单数量
+        var noPublicMediumCount = 0;
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          if (coursePropertyNumber.disable != true) {
+            noPublicMediumCount =
+              parseInt(coursePropertyNumber.noPublicMedium) +
+              noPublicMediumCount;
+          }
+        }
+        _this.noPublicMediumCount = noPublicMediumCount;
+        //计算所有非公开困难数量
+        var noPublicDifficultyCount = 0;
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          if (coursePropertyNumber.disable != true) {
+            noPublicDifficultyCount =
+              parseInt(coursePropertyNumber.noPublicDifficulty) +
+              noPublicDifficultyCount;
+          }
+        }
+        _this.noPublicDifficultyCount = noPublicDifficultyCount;
+        //计算总数
+        for (let coursePropertyNumber of _this.coursePropertyNumberDtos) {
+          //父节点相加即可
+          if (coursePropertyNumber.propertyParentId === 0) {
+            number = parseInt(coursePropertyNumber.number) + number;
+          }
+        }
+        _this.count = number;
+      }, 5);
+    },
+    //根据propertyId 取到对应的 coursePropertyNumber
+    getCoursePropertyNumber(propertyParentId) {
+      for (let coursePropertyNumber of this.coursePropertyNumberDtos) {
+        if (propertyParentId == coursePropertyNumber.propertyId) {
+          return coursePropertyNumber;
+        }
+      }
+    },
+    //根据父节点,找到子节点集合
+    getCoursePropertyNumberSons(propertyId) {
+      var coursePropertyNumberSons = [];
+      for (let coursePropertyNumber of this.coursePropertyNumberDtos) {
+        if (propertyId == coursePropertyNumber.propertyParentId) {
+          coursePropertyNumberSons.push(coursePropertyNumber);
+        }
+      }
+      return coursePropertyNumberSons;
+    },
+    //计算总分
+    muli(paperDetailStruct) {
+      if (isNaN(paperDetailStruct.score) || paperDetailStruct.score < 0) {
+        setTimeout(function() {
+          paperDetailStruct.score = 0;
+        }, 1);
+        this.paperDetailStruct.totalScore = 0;
+      } else {
+        this.paperDetailStruct.totalScore =
+          this.count * this.paperDetailStruct.score;
+      }
+    },
+    //保存
+    saveForm() {
+      if (!this.checkSave()) {
+        return false;
+      }
+      this.paperDetailStruct.detailCount = this.count;
+      this.paperDetailStruct.id = this.paperDetailStructId;
+      this.paperDetailStruct.coursePropertyNumberDtos = this.coursePropertyNumberDtos;
+      this.paperDetailStruct.publicSimpleCount = this.publicSimpleCount;
+      this.paperDetailStruct.publicMediumCount = this.publicMediumCount;
+      this.paperDetailStruct.publicDifficultyCount = this.publicDifficultyCount;
+      this.paperDetailStruct.noPublicSimpleCount = this.noPublicSimpleCount;
+      this.paperDetailStruct.noPublicMediumCount = this.noPublicMediumCount;
+      this.paperDetailStruct.noPublicDifficultyCount = this.noPublicDifficultyCount;
+      for (let paperDetailStruct of this.blueStruct.paperDetailStructs) {
+        if (this.paperDetailStruct.id == paperDetailStruct.id) {
+          paperDetailStruct = this.paperDetailStruct;
+        }
+      }
+      //保存蓝图试卷结构
+      sessionStorage.setItem("blueStruct", JSON.stringify(this.blueStruct));
+      this.back();
+    },
+    //返回
+    back() {
+      this.$router.push({
+        path: "/questions/insert_blue_paper_structure/" + this.paperStructId
+      });
+    },
+    //验证
+    checkSave() {
+      if (!this.paperDetailStruct.questionType) {
+        this.$notify({
+          type: "error",
+          message: "请选择题型结构"
+        });
+        return false;
+      }
+      if (this.paperDetailStruct.quesNames.length < 1) {
+        this.$notify({
+          type: "error",
+          message: "请选择来源大题"
+        });
+        return false;
+      }
+      if (this.paperDetailStruct.score == 0) {
+        this.$notify({
+          type: "error",
+          message: "分数不能为0"
+        });
+        return false;
+      }
+      if (this.count < 1) {
+        this.$notify({
+          type: "error",
+          message: "题目数量不能为0"
+        });
+        return false;
+      }
+      return true;
+    },
+    //鼠标悬浮事件
+    showActiveIn(publicity, difficulty, row) {
+      this.question.questionType = this.paperDetailStruct.questionType;
+      this.question.courseNo = this.blueStruct.courseNo;
+      this.question.coursePropertyName = this.blueStruct.coursePropertyName;
+      this.question.quesNames = this.paperDetailStruct.quesNames.join(",");
+      console.log("this.question:", this.question);
+      if (publicity == 0) {
+        this.question.publicity = false;
+      } else {
+        this.question.publicity = true;
+      }
+      if (difficulty == 1) {
+        this.question.difficulty = "易";
+      } else if (difficulty == 2) {
+        this.question.difficulty = "中";
+      } else {
+        this.question.difficulty = "难";
+      }
+      if (row.propertyParentId != 0) {
+        this.question.firstPropertyId = row.propertyParentId;
+        this.question.secondPropertyId = row.propertyId;
+      } else {
+        this.question.firstPropertyId = row.propertyId;
+        this.question.secondPropertyId = "";
+      }
+      //参数序列化
+      this.$http
+        .get(Q_API + "/question/count", { params: this.question })
+        .then(response => {
+          this.message = response.data;
+          console.log("this.message:", this.message);
+        });
+    },
+    //鼠标离开事件
+    showActiveOff() {
+      this.message = "";
+    }
+  },
+  computed: {},
+  watch: {
+    count() {
+      this.paperDetailStruct.totalScore =
+        this.count * this.paperDetailStruct.score;
+    }
+  },
+  //初始化查询
+  created() {
+    this.paperStructId = this.$route.params.paperStructId;
+    this.paperDetailStructId = this.$route.params.id;
+    this.searchPaperDetail();
+  }
+};
+</script>
+<style scoped>
+.bg-purple-light {
+  background: #e5e9d0;
+}
+.class-a {
+  white-space: nowrap;
+  margin-left: 5px;
+  text-align: left;
+}
+.class-b {
+  margin-left: 30px;
+}
+.el-table .positive-row {
+  background: #e2f0e4;
+}
+</style>