Browse Source

提交题库前段代码

weiwenhai 6 years ago
parent
commit
809da2d650

+ 1 - 0
package.json

@@ -12,6 +12,7 @@
   "dependencies": {
     "axios": "^0.18.0",
     "element-ui": "^2.4.9",
+    "lodash": "^4.17.11",
     "moment": "^2.22.2",
     "rasterizehtml": "^1.3.0",
     "register-service-worker": "^1.0.0",

+ 3 - 0
src/modules/questions/component/ckeditor.vue

@@ -0,0 +1,3 @@
+<template>
+  <div>CKeditor</div>
+</template>

+ 5 - 2
src/modules/questions/constants/constants.js

@@ -1,4 +1,5 @@
 import Vue from "vue";
+import _ from "lodash";
 export const CORE_API = "/api/ecs_core"; //基础信息API
 export const EXAM_WORK_API = "/api/ecs_exam_work"; //考务信息API
 export const Q_API = "/api/ecs_ques"; //题库API
@@ -8,7 +9,7 @@ export const LEVEL_TYPE = [
   { label: "高起本", value: "GQB" },
   { label: "不限", value: "ALL" }
 ];
-export const questionTypes = [
+export const QUESTION_TYPES = [
   { value: "SINGLE_ANSWER_QUESTION", label: "单选" },
   { value: "MULTIPLE_ANSWER_QUESTION", label: "多选" },
   { value: "BOOL_ANSWER_QUESTION", label: "判断" },
@@ -22,7 +23,7 @@ Vue.filter("optionOrderWordFilter", function(value) {
 });
 //题型过滤器
 Vue.filter("questionType", function(value) {
-  for (let questionType of questionTypes) {
+  for (let questionType of QUESTION_TYPES) {
     if (questionType.value === value) {
       return questionType.label;
     }
@@ -55,6 +56,8 @@ Vue.filter("exportTypesFilter", function(value) {
   }
 });
 
+Vue.prototype._ = _;
+
 // Vue.directive("questionAudio", {
 //   bind: function(el, binding, vnode) {
 //     addAudio(el, binding, vnode);

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

@@ -1,5 +1,7 @@
 import Home from "../../portal/views/home/Home.vue";
 import PaperStructure from "../views/PaperStructure.vue";
+import InsertPaperStructure from "../views/InsertPaperStructure.vue";
+import InsertPaperStructureInfo from "../views/InsertPaperStructureInfo.vue";
 
 export default [
   {
@@ -8,8 +10,16 @@ export default [
     component: Home,
     children: [
       {
-        path: "paper_structure/:isClear", //试卷结构
+        path: "paper_structure/:isClear", //精确结构列表
         component: PaperStructure
+      },
+      {
+        path: "insert_paper_structure/:id", //精确结构(新增/修改)
+        component: InsertPaperStructure
+      },
+      {
+        path: "insert_paper_structure_info/:id/:name/:detailId/:courseNo", //添加题型结构
+        component: InsertPaperStructureInfo
       }
     ]
   }

+ 557 - 0
src/modules/questions/views/InsertPaperStructure.vue

@@ -0,0 +1,557 @@
+<template>
+  <div>
+    <section class="content">
+      <div>
+        <!-- 头信息 -->
+        <div><h3 class="box-title">精确结构创建-->创建大题</h3></div>
+        <!-- 正文信息 -->
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="paperStruct"
+            ref="paperStruct"
+            :rules="rules2"
+          >
+            <el-row>
+              <el-form-item label="精确结构名称" prop="name">
+                <el-input
+                  v-model="paperStruct.name"
+                  auto-complete="off"
+                  placeholder="试卷结构名称"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="总分" prop="score">
+                <el-input
+                  v-model.number="paperStruct.totalScore"
+                  auto-complete="off"
+                  placeholder="请输入总分"
+                ></el-input>
+              </el-form-item>
+              <el-form-item label="制定课程">
+                <el-select
+                  v-model="paperStruct.courseNo"
+                  filterable
+                  :remote-method="getCourses"
+                  remote
+                  clearable
+                  placeholder="请选择"
+                >
+                  <el-option label="请选择" value="ALL" key="ALL"></el-option>
+                  <el-option label="公用" value="" key=""></el-option>
+                  <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>
+                <el-button
+                  size="small"
+                  type="success"
+                  :disabled="button_disabled"
+                  @click="savePaperStruct();"
+                >
+                  <i class="fa fa-floppy-o"></i>保 存</el-button
+                >
+                <el-button
+                  size="small"
+                  type="primary"
+                  icon="plus"
+                  :disabled="button_disabled"
+                  @click="insert();"
+                  >添加大题</el-button
+                >
+                <el-button
+                  size="small"
+                  type="primary"
+                  icon="caret-left"
+                  @click="back"
+                  >返 回</el-button
+                >
+              </el-form-item>
+            </el-row>
+            <el-row>
+              <el-form-item label="考试说明">
+                <div style="width:550px;">
+                  <ckeditor v-model="paperStruct.examRemark"></ckeditor>
+                </div>
+              </el-form-item>
+            </el-row>
+          </el-form>
+
+          <!-- 添加大题弹出框 -->
+          <el-dialog
+            title="大题信息"
+            :visible.sync="paperDetailStructDialog"
+            size="tiny"
+          >
+            <el-form
+              :inline="true"
+              :model="paperDetailStructForm"
+              ref="paperDetailStructForm"
+              :rules="rules"
+              label-position="right"
+              label-width="90px"
+            >
+              <el-row>
+                <el-form-item label="大题名称" label-width="120px" prop="name">
+                  <el-input
+                    v-model="paperDetailStructForm.name"
+                    auto-complete="off"
+                    placeholder="请输入题型名称"
+                  ></el-input>
+                </el-form-item>
+              </el-row>
+              <el-row>
+                <el-form-item
+                  label="题型描述"
+                  label-width="120px"
+                  prop="remark"
+                >
+                  <el-input
+                    type="textarea"
+                    :rows="2"
+                    v-model="paperDetailStructForm.remark"
+                    auto-complete="off"
+                    placeholder="请输入题型描述"
+                  ></el-input>
+                </el-form-item>
+              </el-row>
+              <el-row>
+                <span v-if="dialogType == 'ADD'">
+                  <el-button
+                    type="primary"
+                    @click="submitForm('paperDetailStructForm');"
+                    >保 存</el-button
+                  >
+                </span>
+                <span v-else>
+                  <el-button
+                    type="primary"
+                    @click="submitEditForm('paperDetailStructForm');"
+                    >保 存</el-button
+                  >
+                </span>
+                <el-button type="danger" @click="resetForm();">重 置</el-button>
+              </el-row>
+            </el-form>
+          </el-dialog>
+
+          <!-- 页面列表 -->
+          <el-table :data="paperDetailStructs" border>
+            <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 :context="_self" label="操作">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    size="mini"
+                    type="primary"
+                    @click="insertTopicStruct(scope.row);"
+                    >添加小题</el-button
+                  >
+                  <el-button
+                    size="mini"
+                    type="info"
+                    @click="editPaperDetail(scope.row.id);"
+                  >
+                    编辑
+                  </el-button>
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    @click="deletePaperDetail(scope.row.id);"
+                    >删除</el-button
+                  >
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+    </section>
+  </div>
+</template>
+
+<script>
+import { CORE_API, Q_API } from "../constants/constants";
+import ckeditor from "../component/ckeditor.vue";
+export default {
+  components: { ckeditor },
+  data() {
+    return {
+      loading: false,
+      courseList: [],
+      paperDetailStructForm: {
+        id: "",
+        number: "",
+        name: "",
+        remark: "",
+        totalScore: "",
+        detailCount: "",
+        unitStructs: []
+      },
+      paperStruct: {
+        name: "",
+        totalScore: "",
+        paperDetailStructs: [],
+        courseNo: "ALL",
+        type: "EXACT", //试卷结构类型
+        genPaperType: "COMMON", //组卷类型
+        examRemark: ""
+      },
+      paperDetailStructs: [],
+      paperDeatilId: "",
+      rules: {
+        name: [{ required: true, message: "请输入名称", trigger: "blur" }],
+        remark: [{ required: true, message: "请输入题型描述", trigger: "blur" }]
+      },
+      rules2: {
+        name: [
+          { required: true, message: "请输入试卷结构名称", trigger: "blur" }
+        ]
+      },
+      paperStructId: "",
+      paperDetailStructDialog: false,
+      dialogType: ""
+    };
+  },
+
+  methods: {
+    //查询列表集合
+    searchForm() {
+      this.loading = true;
+      var paperStructStorge = sessionStorage.getItem("paperStruct");
+      if (typeof paperStructStorge == "string") {
+        var paperStruct = JSON.parse(paperStructStorge);
+        console.log(paperStruct);
+        this.paperStruct = paperStruct;
+        this.paperDetailStructs = paperStruct.paperDetailStructs;
+      }
+      this.loading = false;
+    },
+    //保存
+    savePaperStruct() {
+      if (this.paperStruct.name.trim().length == 0) {
+        this.$notify({
+          message: "结构名称不能为空格",
+          type: "error"
+        });
+        return false;
+      }
+      if (!this.checkPaperStruct()) {
+        return false;
+      }
+      if (this.paperStruct.courseNo == "ALL") {
+        this.$notify({
+          message: "请选择课程",
+          type: "error"
+        });
+        return false;
+      }
+      this.loading = true;
+      var url = Q_API + "/paperStruct";
+      console.log(this.paperStructId);
+      if (this.paperStructId != "add") {
+        //假如没ID就是新增
+        this.$http
+          .put(url, this.paperStruct)
+          .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.paperStruct)
+          .then(() => {
+            this.$notify({
+              message: "保存成功",
+              type: "success"
+            });
+            this.loading = false;
+            this.removeItem();
+            this.back();
+          })
+          .catch(() => {
+            this.loading = false;
+            this.$notify({
+              type: "error",
+              message: "试卷结构名称重复,请重新命名"
+            });
+          });
+      }
+    },
+    checkPaperStruct() {
+      if (
+        !(
+          this.paperStruct.paperDetailStructs &&
+          this.paperStruct.paperDetailStructs.length > 0
+        )
+      ) {
+        this.$notify({
+          message: "请添加大题",
+          type: "error"
+        });
+        return false;
+      }
+      for (let paperDetailStruct of this.paperStruct.paperDetailStructs) {
+        if (
+          !(
+            paperDetailStruct.unitStructs &&
+            paperDetailStruct.unitStructs.length > 0
+          )
+        ) {
+          this.$notify({
+            message: "请添加大题下的题型",
+            type: "error"
+          });
+          return false;
+        }
+      }
+      if (this.paperStruct.totalScore != this.totalScore) {
+        this.$notify({
+          message: "大题总分与结构满分不一致",
+          type: "error"
+        });
+        return false;
+      }
+      return true;
+    },
+    //保存大题
+    submitForm(formData) {
+      //校验大题名称
+      if (
+        !this.paperDetailStructForm.name ||
+        this.paperDetailStructForm.name.trim().length == 0
+      ) {
+        this.$notify({
+          message: "大题名称不能为空",
+          type: "error"
+        });
+        return;
+      }
+      this.loading = true;
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          var ids = [];
+          for (let paperDetailStruct of this.paperDetailStructs) {
+            ids.push(paperDetailStruct.id);
+          }
+          ids.sort();
+          var maxId;
+          if (ids.length == 0) {
+            maxId = 1;
+          } 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.paperDetailStructDialog = false;
+          this.paperDetailStructForm = { name: "", remark: "" };
+          this.paperStruct.paperDetailStructs = this.paperDetailStructs;
+          sessionStorage.setItem(
+            "paperStruct",
+            JSON.stringify(this.paperStruct)
+          );
+        } else {
+          return false;
+        }
+      });
+      this.loading = false;
+    },
+    submitEditForm(formData) {
+      //校验大题名称
+      if (
+        !this.paperDetailStructForm.name ||
+        this.paperDetailStructForm.name.trim().length == 0
+      ) {
+        this.$notify({
+          message: "大题名称不能为空",
+          type: "error"
+        });
+        return;
+      }
+      this.loading = true;
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          var paperDetailStructs = this.paperDetailStructs;
+          for (let i = paperDetailStructs.length - 1; i >= 0; i--) {
+            if (paperDetailStructs[i].id == this.paperDeatilId) {
+              paperDetailStructs[i].remark = this.paperDetailStructForm.remark;
+              paperDetailStructs[i].name = this.paperDetailStructForm.name;
+            }
+          }
+          this.paperDetailStructDialog = false;
+          this.paperDetailStructForm = { name: "", remark: "" };
+          this.paperStruct.paperDetailStructs = paperDetailStructs;
+          sessionStorage.setItem(
+            "paperStruct",
+            JSON.stringify(this.paperStruct)
+          );
+        } else {
+          return false;
+        }
+      });
+      this.loading = false;
+    },
+    deletePaperDetail(id) {
+      var paperDetailStructs = this.paperDetailStructs;
+      for (let i = paperDetailStructs.length - 1; i >= 0; i--) {
+        if (paperDetailStructs[i].id == id) {
+          paperDetailStructs.splice(i, 1);
+        }
+      }
+      this.paperStruct.paperDetailStructs = paperDetailStructs;
+      sessionStorage.setItem("paperStruct", JSON.stringify(this.paperStruct));
+      console.log(sessionStorage.getItem("paperStruct"));
+    },
+    setPaperStruct() {
+      var paperStruct = sessionStorage.getItem("paperStruct");
+      this.paperStruct = JSON.parse(paperStruct);
+    },
+    removeItem() {
+      sessionStorage.removeItem("paperStruct");
+    },
+    //重置
+    resetForm() {
+      this.paperDetailStructForm = {
+        name: "",
+        remark: ""
+      };
+    },
+
+    //添加大题型
+    insert() {
+      this.dialogType = "ADD";
+      this.paperDetailStructForm.remark = "";
+      this.paperDetailStructForm.name = "";
+      this.paperDetailStructDialog = true;
+    },
+    editPaperDetail(paperDeatilId) {
+      this.dialogType = "EDIT";
+      this.paperDeatilId = paperDeatilId;
+      var paperDetailStructs = this.paperDetailStructs;
+      for (let i = paperDetailStructs.length - 1; i >= 0; i--) {
+        if (paperDetailStructs[i].id == this.paperDeatilId) {
+          this.paperDetailStructForm.remark = paperDetailStructs[i].remark;
+          this.paperDetailStructForm.name = paperDetailStructs[i].name;
+        }
+      }
+      this.paperDetailStructDialog = true;
+    },
+    //添加小题
+    insertTopicStruct(row) {
+      let courseNo =
+        this.paperStruct.courseNo === "" ? "all" : this.paperStruct.courseNo;
+      sessionStorage.setItem("paperStruct", JSON.stringify(this.paperStruct));
+      this.$router.push({
+        path:
+          "/questions/insert_paper_structure_info/" +
+          this.paperStructId +
+          "/" +
+          row.name +
+          "/" +
+          row.id +
+          "/" +
+          courseNo
+      });
+    },
+    //返回
+    back() {
+      this.$router.push({
+        path: "/questions/paper_structure/1"
+      });
+    },
+    //查询所有课程
+    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;
+            });
+        }
+      } else {
+        this.courseList = [];
+      }
+    }
+  },
+  computed: {
+    button_disabled: function() {
+      //var reg = /^[-\+]?\d+(\.\d+)?$/; //正小数
+      var reg = /^\d+(?=\.{0,1}\d+$|$)/;
+      if (
+        reg.test(this.paperStruct.totalScore) &&
+        this.paperStruct.totalScore > 0 &&
+        this.paperStruct.name
+      ) {
+        return false;
+      } else {
+        return true;
+      }
+    },
+    totalScore() {
+      var sum = 0.0;
+      for (let paperDetailStruct of this.paperDetailStructs) {
+        sum += paperDetailStruct.totalScore;
+      }
+      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;
+    }
+  },
+  created() {
+    this.paperStructId = this.$route.params.id;
+    this.searchForm();
+  }
+};
+</script>

+ 1096 - 0
src/modules/questions/views/InsertPaperStructureInfo.vue

@@ -0,0 +1,1096 @@
+<template>
+  <div>
+    <section class="content">
+      <div>
+        <!-- 头信息 -->
+        <div>
+          <h3 class="box-title">题型创建->{{ detailName }}</h3>
+        </div>
+        <!-- 正文信息 -->
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="paperUnitForm"
+            :rules="rules"
+            ref="paperUnitForm"
+            label-position="right"
+            label-width="90px"
+          >
+            <el-form-item
+              label="题型结构"
+              class="pull-left"
+              prop="questionType"
+            >
+              <el-select
+                @change="getQuesNameList"
+                v-model="paperUnitForm.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="题目数量" prop="count">
+              <el-input
+                v-model.number="paperUnitForm.count"
+                @change="muli"
+                placeholder="请点击"
+                :disabled="true"
+                @focus="openDialog"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="每题分值" class="pull-left" prop="score">
+              <el-input
+                v-model.number="paperUnitForm.score"
+                @change="muli"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="题型总分" class="pull-left" prop="totalScore">
+              <el-input
+                v-model="paperUnitForm.totalScore"
+                :disabled="true"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="来源大题" class="pull-left" prop="quesNames">
+              <el-select
+                multiple
+                v-model="paperUnitForm.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 class="pull-right">
+              <el-button
+                size="small"
+                type="primary"
+                @click="submitForm('paperUnitForm');"
+                >保 存</el-button
+              >
+              <el-button
+                size="small"
+                type="danger"
+                @click="resetForm('paperUnitForm');"
+                >重 置</el-button
+              >
+              <el-button
+                size="small"
+                type="primary"
+                icon="caret-left"
+                @click="back"
+                >返 回</el-button
+              >
+            </el-form-item>
+          </el-form>
+          <!-- 页面列表 -->
+          <el-table
+            :data="unitStructs"
+            border
+            style="width: 100%;text-align:center;"
+          >
+            <el-table-column label="大题名称" width="100">
+              <div>
+                <span>{{ detailName }}</span>
+              </div>
+            </el-table-column>
+            <el-table-column label="题型结构" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ getQuesTypeName(scope.row.questionType) }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="题目总数" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.count }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="公开(简单)" width="130">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.publicSimple }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="公开(中等)" width="130">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.publicMedium }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="公开(困难)" width="130">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.publicDifficulty }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="非公开(简单)" width="140">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.noPublicSimple }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="非公开(中等)" width="140">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.noPublicMedium }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="非公开(困难)" width="140">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.noPublicDifficulty }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="每题分值" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.score }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="题型总分" width="100">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.totalScore }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="来源大题" width="150">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ getQuesNames(scope.row.quesNames) }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="140">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    size="mini"
+                    type="info"
+                    @click="openPaperDetailUnitStructDialog(scope.row.id);"
+                  >
+                    编辑
+                  </el-button>
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    @click="deleteUnit(scope.row.id);"
+                    >删除</el-button
+                  >
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-dialog
+            title="小题信息"
+            v-model="paperDetailUnitStructDialog"
+            size="small"
+          >
+            <div>
+              <el-form
+                :inline="true"
+                :model="paperUnitForm2"
+                :rules="rules"
+                ref="paperUnitForm2"
+                label-position="right"
+                label-width="90px"
+              >
+                <el-row :gutter="45">
+                  <el-col :span="12">
+                    <el-form-item label="题型结构" prop="questionType">
+                      <el-select
+                        @change="getQuesNameList"
+                        v-model="paperUnitForm2.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-col>
+                  <el-col :span="12">
+                    <el-form-item
+                      label="每题分值"
+                      class="pull-left"
+                      prop="score"
+                    >
+                      <el-input
+                        v-model.number="paperUnitForm2.score"
+                        @change="muli2"
+                        placeholder="请输入"
+                      ></el-input>
+                    </el-form-item>
+                  </el-col>
+                </el-row>
+                <el-row :gutter="45">
+                  <el-col :span="12">
+                    <el-form-item label="题型总分" prop="totalScore">
+                      <el-input
+                        v-model="paperUnitForm2.totalScore"
+                        :disabled="true"
+                      ></el-input>
+                    </el-form-item>
+                  </el-col>
+                  <el-col :span="12">
+                    <el-form-item label="来源大题" prop="quesNames">
+                      <el-select
+                        multiple
+                        v-model="paperUnitForm2.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-col>
+                </el-row>
+                <el-row>
+                  <el-table :data="paperUnitForms" border>
+                    <el-table-column label="公开(简单)">
+                      <template slot-scope="scope">
+                        <div>
+                          <el-input
+                            v-model="scope.row.publicSimple"
+                            @change="
+                              unitCount(
+                                scope.row,
+                                scope.row.publicSimple,
+                                'publicSimple',
+                                paperUnitForm2
+                              );
+                            "
+                          ></el-input>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="公开(中等)">
+                      <template slot-scope="scope">
+                        <div>
+                          <el-input
+                            v-model="scope.row.publicMedium"
+                            @change="
+                              unitCount(
+                                scope.row,
+                                scope.row.publicMedium,
+                                'publicMedium',
+                                paperUnitForm2
+                              );
+                            "
+                          ></el-input>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="公开(困难)">
+                      <template slot-scope="scope">
+                        <div>
+                          <el-input
+                            v-model="scope.row.publicDifficulty"
+                            @change="
+                              unitCount(
+                                scope.row,
+                                scope.row.publicDifficulty,
+                                'publicDifficulty',
+                                paperUnitForm2
+                              );
+                            "
+                          ></el-input>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="公开总数">
+                      <div>
+                        <el-input
+                          v-model="paperUnitForm2.publicSum"
+                          :disabled="true"
+                        ></el-input>
+                      </div>
+                    </el-table-column>
+                  </el-table>
+
+                  <el-table :data="paperUnitForms" border>
+                    <el-table-column label="非公开(简单)">
+                      <template slot-scope="scope">
+                        <div>
+                          <el-input
+                            v-model="row.noPublicSimple"
+                            @change="
+                              unitCount(
+                                scope.row,
+                                scope.row.noPublicSimple,
+                                'noPublicSimple',
+                                paperUnitForm2
+                              );
+                            "
+                          ></el-input>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="非公开(中等)">
+                      <template slot-scope="scope">
+                        <div>
+                          <el-input
+                            v-model="row.noPublicMedium"
+                            @change="
+                              unitCount(
+                                scope.row,
+                                scope.row.noPublicMedium,
+                                'noPublicMedium',
+                                paperUnitForm2
+                              );
+                            "
+                            :disabled="scope.row.disable"
+                          ></el-input>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="非公开(困难)">
+                      <template slot-scope="scope">
+                        <div>
+                          <el-input
+                            v-model="scope.row.noPublicDifficulty"
+                            @change="
+                              unitCount(
+                                scope.row,
+                                scope.row.noPublicDifficulty,
+                                'noPublicDifficulty',
+                                paperUnitForm2
+                              );
+                            "
+                            :disabled="scope.row.disable"
+                          ></el-input>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="非公开总数">
+                      <div>
+                        <el-input
+                          v-model="paperUnitForm2.noPublicSum"
+                          :disabled="true"
+                        ></el-input>
+                      </div>
+                    </el-table-column>
+                  </el-table>
+
+                  <el-table :data="paperUnitForms" border>
+                    <el-table-column label="简单总数">
+                      <div>
+                        <el-input
+                          v-model="paperUnitForm2.simpleSum"
+                          :disabled="true"
+                        ></el-input>
+                      </div>
+                    </el-table-column>
+                    <el-table-column label="中等总数">
+                      <div>
+                        <el-input
+                          v-model="paperUnitForm2.mediumSum"
+                          :disabled="true"
+                        ></el-input>
+                      </div>
+                    </el-table-column>
+                    <el-table-column label="困难总数">
+                      <div>
+                        <el-input
+                          v-model="paperUnitForm2.difficultySum"
+                          :disabled="true"
+                        ></el-input>
+                      </div>
+                    </el-table-column>
+                    <el-table-column label="总数">
+                      <div>
+                        <el-input
+                          v-model="paperUnitForm2.count"
+                          :disabled="true"
+                        ></el-input>
+                      </div>
+                    </el-table-column>
+                  </el-table>
+                </el-row>
+                <el-row>
+                  <div>
+                    <el-button
+                      type="primary"
+                      @click="editSubmitForm('paperUnitForm2');"
+                      >保 存</el-button
+                    >
+                  </div>
+                </el-row>
+              </el-form>
+            </div>
+          </el-dialog>
+
+          <el-dialog title="题目数量" v-model="propertyDialog" size="small">
+            <el-table :data="paperUnitForms" border>
+              <el-table-column label="公开(简单)">
+                <template slot-scope="scope">
+                  <div>
+                    <el-input
+                      v-model="scope.row.publicSimple"
+                      @change="
+                        unitCount(
+                          scope.row,
+                          scope.row.publicSimple,
+                          'publicSimple',
+                          paperUnitForm
+                        );
+                      "
+                    ></el-input>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="公开(中等)">
+                <template slot-scope="scope">
+                  <div>
+                    <el-input
+                      v-model="scope.row.publicMedium"
+                      @change="
+                        unitCount(
+                          scope.row,
+                          scope.row.publicMedium,
+                          'publicMedium',
+                          paperUnitForm
+                        );
+                      "
+                    ></el-input>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="公开(困难)">
+                <template slot-scope="scope">
+                  <div>
+                    <el-input
+                      v-model="scope.row.publicDifficulty"
+                      @change="
+                        unitCount(
+                          scope.row,
+                          scope.row.publicDifficulty,
+                          'publicDifficulty',
+                          paperUnitForm
+                        );
+                      "
+                    ></el-input>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="公开总数">
+                <div>
+                  <el-input
+                    v-model="paperUnitForm.publicSum"
+                    :disabled="true"
+                  ></el-input>
+                </div>
+              </el-table-column>
+            </el-table>
+
+            <el-table
+              :data="paperUnitForms"
+              border
+              style="width: 100%;text-align:center;"
+            >
+              <el-table-column label="非公开(简单)">
+                <template slot-scope="scope">
+                  <div>
+                    <el-input
+                      v-model="scope.row.noPublicSimple"
+                      @change="
+                        unitCount(
+                          scope.row,
+                          scope.row.noPublicSimple,
+                          'noPublicSimple',
+                          paperUnitForm
+                        );
+                      "
+                    ></el-input>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="非公开(中等)">
+                <template slot-scope="scope">
+                  <div>
+                    <el-input
+                      v-model="row.noPublicMedium"
+                      @change="
+                        unitCount(
+                          scope.row,
+                          scope.row.noPublicMedium,
+                          'noPublicMedium',
+                          paperUnitForm
+                        );
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="非公开(困难)">
+                <template slot-scope="scope">
+                  <div>
+                    <el-input
+                      v-model="scope.row.noPublicDifficulty"
+                      @change="
+                        unitCount(
+                          scope.row,
+                          scope.row.noPublicDifficulty,
+                          'noPublicDifficulty',
+                          paperUnitForm
+                        );
+                      "
+                      :disabled="scope.row.disable"
+                    ></el-input>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="非公开总数">
+                <div>
+                  <el-input
+                    v-model="paperUnitForm.noPublicSum"
+                    :disabled="true"
+                  ></el-input>
+                </div>
+              </el-table-column>
+            </el-table>
+
+            <el-table :data="paperUnitForms" border>
+              <el-table-column label="简单总数">
+                <div>
+                  <el-input
+                    v-model="paperUnitForm.simpleSum"
+                    :disabled="true"
+                  ></el-input>
+                </div>
+              </el-table-column>
+              <el-table-column label="中等总数">
+                <div>
+                  <el-input
+                    v-model="paperUnitForm.mediumSum"
+                    :disabled="true"
+                  ></el-input>
+                </div>
+              </el-table-column>
+              <el-table-column label="困难总数">
+                <div>
+                  <el-input
+                    v-model="paperUnitForm.difficultySum"
+                    :disabled="true"
+                  ></el-input>
+                </div>
+              </el-table-column>
+              <el-table-column label="总数">
+                <div>
+                  <el-input
+                    v-model="paperUnitForm.count"
+                    :disabled="true"
+                  ></el-input>
+                </div>
+              </el-table-column>
+            </el-table>
+
+            <div style="margin-top:20px;margin-left:42%">
+              <el-button type="primary" @click="saveCount">保 存</el-button>
+              <el-button type="primary" icon="caret-left" @click="close"
+                >返 回</el-button
+              >
+            </div>
+          </el-dialog>
+        </div>
+      </div>
+    </section>
+  </div>
+</template>
+
+<script>
+import { Q_API, QUESTION_TYPES } from "../constants/constants";
+import _ from "lodash";
+export default {
+  data() {
+    var checkIntegerNumber = (rule, value, callback) => {
+      if (!value) {
+        return callback(new Error("数值不能为空"));
+      }
+      setTimeout(() => {
+        if (!Number.isInteger(value)) {
+          callback(new Error("请输入整数"));
+        } else {
+          if (value < 0) {
+            callback(new Error("必须大于0"));
+          } else {
+            callback();
+          }
+        }
+      }, 100);
+    };
+    var checkDoubleNumber = (rule, value, callback) => {
+      //var reg = /^[-\+]?\d+(\.\d+)?$/;
+      var reg = /^\d+(?=\.{0,1}\d+$|$)/;
+      if (!value) {
+        return callback(new Error("数值不能为空"));
+      }
+      setTimeout(() => {
+        if (!reg.test(value)) {
+          callback(new Error("请输入数值"));
+        } else {
+          if (value < 0) {
+            callback(new Error("必须大于等于0"));
+          } else {
+            callback();
+          }
+        }
+      }, 100);
+    };
+    var validateQuesNames = (rule, value, callback) => {
+      if (Array.isArray(value) && value.length == 0) {
+        callback(new Error("请选择来源大题"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      quesTypes: QUESTION_TYPES,
+      courseNo: "",
+      quesNameList: [],
+      paperUnitForm: {
+        id: "",
+        questionType: "",
+        count: 0,
+        score: "",
+        totalScore: "",
+        quesNames: [],
+        publicSimple: 0,
+        publicMedium: 0,
+        publicDifficulty: 0,
+        noPublicSimple: 0,
+        noPublicMedium: 0,
+        noPublicDifficulty: 0,
+        publicSum: 0,
+        noPublicSum: 0,
+        simpleSum: 0,
+        mediumSum: 0,
+        difficultySum: 0
+      },
+      paperUnitForm2: {
+        id: "",
+        questionType: "",
+        count: "",
+        score: "",
+        totalScore: "",
+        quesNames: [],
+        publicSimple: 0,
+        publicMedium: 0,
+        publicDifficulty: 0,
+        noPublicSimple: 0,
+        noPublicMedium: 0,
+        noPublicDifficulty: 0,
+        publicSum: 0,
+        noPublicSum: 0,
+        simpleSum: 0,
+        mediumSum: 0,
+        difficultySum: 0
+      },
+      unitId: "",
+      detailName: "",
+      detailId: "",
+      paperStructId: "",
+      paperStruct: {},
+      unitStructs: [],
+      paperUnitForms: [],
+      paperDetailUnitStructDialog: false,
+      propertyDialog: false,
+      rules: {
+        questionType: [
+          { required: true, message: "题型不能为空", trigger: "change" }
+        ],
+        count: [
+          { validator: checkIntegerNumber, required: true, trigger: "blur" }
+        ],
+        score: [
+          { required: true, validator: checkDoubleNumber, trigger: "blur" }
+        ],
+        quesNames: [{ validator: validateQuesNames, trigger: "change" }]
+      }
+    };
+  },
+  methods: {
+    //查询来源大题名称
+    getQuesNameList(quesType) {
+      if (quesType && quesType.length > 0) {
+        var quesTypeObj = {};
+        var url = Q_API + "/paperStruct/quesNames";
+        if (this.courseNo !== "all") {
+          quesTypeObj = {
+            quesType: quesType,
+            courseNo: this.courseNo
+          };
+        } else {
+          quesTypeObj = {
+            quesType: quesType
+          };
+        }
+        this.$http.get(url, { params: quesTypeObj }).then(response => {
+          console.log(response);
+          this.quesNameList = response.data;
+          this.initQuesNames();
+        });
+      }
+    },
+    initQuesNames() {
+      var arr1 = _.difference(this.paperUnitForm.quesNames, this.quesNames);
+      if (arr1.length > 0) {
+        this.paperUnitForm.quesNames = [];
+      }
+      var arr2 = _.difference(this.paperUnitForm2.quesNames, this.quesNames);
+      if (arr2.length > 0) {
+        this.paperUnitForm2.quesNames = [];
+      }
+    },
+    getQuesNames(quesNameList) {
+      var quesNameStr = "";
+      if (!Array.isArray(quesNameList)) {
+        return quesNameStr;
+      }
+      for (let quesName of quesNameList) {
+        if (quesNameStr === "") {
+          quesNameStr += quesName;
+        } else {
+          quesNameStr += "," + quesName;
+        }
+      }
+      return quesNameStr;
+    },
+    //查询列表集合
+    searchForm() {
+      this.loading = true;
+      var paperStructStorge = sessionStorage.getItem("paperStruct");
+      if (typeof paperStructStorge === "string") {
+        var paperStruct = JSON.parse(paperStructStorge);
+        this.paperStruct = paperStruct;
+        this.unitStructs = this.getUnits();
+      }
+    },
+    //保存
+    submitForm(formData) {
+      this.loading = true;
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          var unitStruct = Object.assign({}, this.paperUnitForm);
+          var ids = [];
+          for (let unitStruct of this.unitStructs) {
+            ids.push(unitStruct.id);
+          }
+          ids.sort();
+          var maxId;
+          if (ids.length == 0) {
+            maxId = 1;
+          } else {
+            maxId = ids[ids.length - 1];
+          }
+
+          unitStruct.id = maxId + 1;
+          this.unitStructs.push(unitStruct);
+          this.resetForm();
+          this.setUnits();
+          sessionStorage.setItem(
+            "paperStruct",
+            JSON.stringify(this.paperStruct)
+          );
+        } else {
+          return false;
+        }
+      });
+    },
+
+    editSubmitForm(formData) {
+      this.$refs[formData].validate(valid => {
+        if (valid) {
+          for (let unitStruct of this.unitStructs) {
+            if (unitStruct.id == this.paperUnitForm2.id) {
+              unitStruct.questionType = this.paperUnitForm2.questionType;
+              unitStruct.count = this.paperUnitForm2.count;
+              unitStruct.score = this.paperUnitForm2.score;
+              unitStruct.totalScore = this.paperUnitForm2.totalScore;
+              unitStruct.quesNames = this.paperUnitForm2.quesNames;
+              unitStruct.publicSimple = this.paperUnitForm2.publicSimple;
+              unitStruct.publicMedium = this.paperUnitForm2.publicMedium;
+              unitStruct.publicDifficulty = this.paperUnitForm2.publicDifficulty;
+              unitStruct.noPublicSimple = this.paperUnitForm2.noPublicSimple;
+              unitStruct.noPublicMedium = this.paperUnitForm2.noPublicMedium;
+              unitStruct.noPublicDifficulty = this.paperUnitForm2.noPublicDifficulty;
+              unitStruct.publicSum = this.paperUnitForm2.publicSum;
+              unitStruct.noPublicSum = this.paperUnitForm2.noPublicSum;
+              unitStruct.simpleSum = this.paperUnitForm2.simpleSum;
+              unitStruct.mediumSum = this.paperUnitForm2.mediumSum;
+              unitStruct.difficultySum = this.paperUnitForm2.difficultySum;
+              this.setUnits();
+              this.paperDetailUnitStructDialog = false;
+              sessionStorage.setItem(
+                "paperStruct",
+                JSON.stringify(this.paperStruct)
+              );
+            }
+          }
+        }
+      });
+    },
+    //重置
+    resetForm() {
+      this.paperUnitForm = {
+        id: "",
+        questionType: "",
+        count: 0,
+        score: "",
+        totalScore: "",
+        quesNames: [],
+        publicSimple: 0,
+        publicMedium: 0,
+        publicDifficulty: 0,
+        noPublicSimple: 0,
+        noPublicMedium: 0,
+        noPublicDifficulty: 0,
+        publicSum: 0,
+        noPublicSum: 0,
+        simpleSum: 0,
+        mediumSum: 0,
+        difficultySum: 0
+      };
+    },
+    //返回
+    back() {
+      this.$router.push({
+        path: "/questions/insert_paper_structure/" + this.paperStructId
+      });
+    },
+    muli() {
+      this.paperUnitForm.totalScore =
+        this.paperUnitForm.count * this.paperUnitForm.score;
+    },
+    muli2() {
+      this.paperUnitForm2.totalScore =
+        this.paperUnitForm2.count * this.paperUnitForm2.score;
+    },
+    getUnits() {
+      var unitStructs = [];
+      for (let paperDetailStruct of this.paperStruct.paperDetailStructs) {
+        if (parseInt(paperDetailStruct.id) == this.detailId) {
+          if (paperDetailStruct.unitStructs) {
+            return paperDetailStruct.unitStructs;
+          }
+        }
+      }
+      return unitStructs;
+    },
+    setUnits() {
+      for (let paperDetailStruct of this.paperStruct.paperDetailStructs) {
+        if (parseInt(paperDetailStruct.id) == this.detailId) {
+          paperDetailStruct.unitStructs = this.unitStructs;
+          paperDetailStruct.totalScore = this.totalScore;
+          paperDetailStruct.detailCount = this.detailCount;
+        }
+      }
+    },
+    getQuesTypeName(value) {
+      for (let quesType of this.quesTypes) {
+        if (value == quesType.value) {
+          return quesType.label;
+        }
+      }
+    },
+
+    openPaperDetailUnitStructDialog(id) {
+      this.unitId = id;
+      for (let unitStruct of this.unitStructs) {
+        if (unitStruct.id == id) {
+          this.paperUnitForm2.id = id;
+          this.paperUnitForm2.questionType = unitStruct.questionType;
+          this.paperUnitForm2.count = unitStruct.count;
+          this.paperUnitForm2.score = unitStruct.score;
+          this.paperUnitForm2.totalScore = unitStruct.totalScore;
+          this.paperUnitForm2.quesNames = unitStruct.quesNames;
+          this.paperUnitForm2.publicSimple = unitStruct.publicSimple;
+          this.paperUnitForm2.publicMedium = unitStruct.publicMedium;
+          this.paperUnitForm2.publicDifficulty = unitStruct.publicDifficulty;
+          this.paperUnitForm2.noPublicSimple = unitStruct.noPublicSimple;
+          this.paperUnitForm2.noPublicMedium = unitStruct.noPublicMedium;
+          this.paperUnitForm2.noPublicDifficulty =
+            unitStruct.noPublicDifficulty;
+          //实时计算,不存数据库
+          this.paperUnitForm2.publicSum =
+            this.paperUnitForm2.publicSimple +
+            this.paperUnitForm2.publicMedium +
+            this.paperUnitForm2.publicDifficulty;
+          this.paperUnitForm2.noPublicSum =
+            this.paperUnitForm2.noPublicSimple +
+            this.paperUnitForm2.noPublicMedium +
+            this.paperUnitForm2.noPublicDifficulty;
+          this.paperUnitForm2.simpleSum =
+            this.paperUnitForm2.publicSimple +
+            this.paperUnitForm2.noPublicSimple;
+          this.paperUnitForm2.mediumSum =
+            this.paperUnitForm2.publicMedium +
+            this.paperUnitForm2.noPublicMedium;
+          this.paperUnitForm2.difficultySum =
+            this.paperUnitForm2.publicDifficulty +
+            this.paperUnitForm2.noPublicDifficulty;
+        }
+      }
+      this.getQuesNameList(this.paperUnitForm2.questionType);
+      this.paperDetailUnitStructDialog = true;
+      this.paperUnitForms = [];
+      this.paperUnitForms.push(this.paperUnitForm2);
+    },
+    deleteUnit(id) {
+      var unitStructs = this.unitStructs;
+      for (let i = unitStructs.length - 1; i >= 0; i--) {
+        if (unitStructs[i].id == id) {
+          unitStructs.splice(i, 1);
+        }
+      }
+      this.unitStructs = unitStructs;
+      this.setUnits();
+      sessionStorage.setItem("paperStruct", JSON.stringify(this.paperStruct));
+      console.log(sessionStorage.getItem("paperStruct"));
+    },
+    openDialog() {
+      console.log("aaa");
+      //this.propertyDialog = true;
+      //this.paperUnitForms = [];
+      //this.paperUnitForms.push(this.paperUnitForm);
+    },
+    //判断是否为正整数
+    isPositiveInteger(s) {
+      //是否为正整数
+      var re = /^[0-9]+$/;
+      return re.test(s);
+    },
+    unitCount(row, data, rowType, paperUnitForm) {
+      //计算前校验正整数
+      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);
+        }
+      }
+      setTimeout(function() {
+        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);
+        //公开总数
+        paperUnitForm.publicSum =
+          parseInt(row.publicSimple) +
+          parseInt(row.publicMedium) +
+          parseInt(row.publicDifficulty);
+        //非公开总数
+        paperUnitForm.noPublicSum =
+          parseInt(row.noPublicSimple) +
+          parseInt(row.noPublicMedium) +
+          parseInt(row.noPublicDifficulty);
+        //简单总数
+        paperUnitForm.simpleSum =
+          parseInt(row.publicSimple) + parseInt(row.noPublicSimple);
+        //中等总数
+        paperUnitForm.mediumSum =
+          parseInt(row.publicMedium) + parseInt(row.noPublicMedium);
+        //困难总数
+        paperUnitForm.difficultySum =
+          parseInt(row.publicDifficulty) + parseInt(row.noPublicDifficulty);
+        //总数
+        paperUnitForm.count =
+          paperUnitForm.publicSum + paperUnitForm.noPublicSum;
+        //分数
+        paperUnitForm.totalScore = paperUnitForm.count * paperUnitForm.score;
+      }, 5);
+    },
+    close() {
+      console.log("close");
+      this.propertyDialog = false;
+      this.paperUnitForms = [];
+    },
+    saveCount() {
+      this.propertyDialog = false;
+      this.paperUnitForms = [];
+    }
+  },
+  computed: {
+    totalScore() {
+      var sum = 0.0;
+      for (let unitStruct of this.unitStructs) {
+        sum += unitStruct.totalScore;
+      }
+      return sum;
+    },
+    detailCount() {
+      var count = 0.0;
+      for (let unitStruct of this.unitStructs) {
+        count += unitStruct.count;
+      }
+      return count;
+    },
+    quesNames() {
+      var quesNames = [];
+      for (let quesName of this.quesNameList) {
+        quesNames.push(quesName.code);
+      }
+      return quesNames;
+    }
+  },
+  //初始化查询
+  created() {
+    this.paperStructId = this.$route.params.id;
+    this.detailName = this.$route.params.name;
+    this.detailId = this.$route.params.detailId;
+    this.courseNo = this.$route.params.courseNo;
+    this.searchForm();
+  }
+};
+</script>

+ 20 - 27
src/modules/questions/views/PaperStructure.vue

@@ -1,8 +1,3 @@
-<style>
-.form_width {
-  width: 180px;
-}
-</style>
 <template>
   <div>
     <section class="content">
@@ -38,7 +33,6 @@
                 <el-form-item label="制定课程">
                   <el-select
                     v-model="formSearch.courseNo"
-                    class="form_width"
                     filterable
                     :remote-method="getCourses"
                     remote
@@ -149,22 +143,24 @@
               </template>
             </el-table-column>
             <el-table-column :context="_self" label="操作" width="140">
-              <div>
-                <el-button
-                  size="mini"
-                  type="info"
-                  @click="editPaperStruct(row);"
-                >
-                  修改
-                </el-button>
-                <el-button
-                  size="mini"
-                  type="danger"
-                  @click="deletePaper($index, row);"
-                >
-                  删除
-                </el-button>
-              </div>
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    size="mini"
+                    type="info"
+                    @click="editPaperStruct(scope.row);"
+                  >
+                    修改
+                  </el-button>
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    @click="deletePaper(scope.$index, scope.row);"
+                  >
+                    删除
+                  </el-button>
+                </div>
+              </template>
             </el-table-column>
           </el-table>
           <div class="page pull-right">
@@ -213,7 +209,6 @@ export default {
       var url =
         Q_API + "/paperStruct/" + this.currentPage + "/" + this.pageSize;
       this.$http.get(url, { params: this.formSearch }).then(response => {
-        console.log("response:", response);
         this.tableData = response.data.content;
         this.total = response.data.totalElements;
       });
@@ -306,7 +301,7 @@ export default {
       sessionStorage.setItem("paper_stucture", JSON.stringify(this.formSearch));
       sessionStorage.setItem("paper_stucture_currentPage", this.currentPage);
       this.$router.push({
-        path: "/index/insert_paper_structure/add"
+        path: "/questions/insert_paper_structure/add"
       });
     },
 
@@ -321,7 +316,6 @@ export default {
     },
     //查询所有课程
     getCourses(query) {
-      console.log("query:", query);
       query = query.trim();
       if (query) {
         if (!(query.indexOf("(") > -1 && query.indexOf(")") > -1)) {
@@ -329,7 +323,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;
             });
         }
@@ -390,7 +384,6 @@ export default {
     }
     this.removeItem();
     this.searchPaperStructs();
-    //this.getCourses();
   }
 };
 </script>