Bläddra i källkod

提交题库新前段代码

weiwenhai 6 år sedan
förälder
incheckning
2dc69bf0d8

+ 7 - 2
src/modules/questions/routes/routes.js

@@ -2,6 +2,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";
+import BluePaperStructure from "../views/BluePaperStructure.vue";
 
 export default [
   {
@@ -10,16 +11,20 @@ export default [
     component: Home,
     children: [
       {
-        path: "paper_structure/:isClear", //精确结构列表
+        path: "paper_structure/:isClear", //精确试卷结构列表
         component: PaperStructure
       },
       {
-        path: "insert_paper_structure/:id", //精确结构(新增/修改)
+        path: "insert_paper_structure/:id", //精确试卷结构(新增/修改)
         component: InsertPaperStructure
       },
       {
         path: "insert_paper_structure_info/:id/:name/:detailId/:courseNo", //添加题型结构
         component: InsertPaperStructureInfo
+      },
+      {
+        path: "blue_paper_structure/:isClear", //蓝图试卷结构列表
+        component: BluePaperStructure
       }
     ]
   }

+ 394 - 0
src/modules/questions/views/BluePaperStructure.vue

@@ -0,0 +1,394 @@
+<template>
+  <div>
+    <section class="content">
+      <div class="box box-info">
+        <!-- 头信息 -->
+        <div class="box-header with-border">
+          <h3 class="box-title">蓝图试卷结构预设</h3>
+          <div class="box-tools pull-right">
+            <button
+              type="button"
+              class="btn btn-box-tool"
+              data-widget="collapse"
+            >
+              <i class="fa fa-minus"></i>
+            </button>
+          </div>
+        </div>
+        <!-- 正文信息 -->
+        <div class="box-body">
+          <el-form
+            :inline="true"
+            :model="formSearch"
+            label-position="right"
+            label-width="90px"
+          >
+            <el-row :gutter="10">
+              <el-col :xs="7" :sm="7" :md="7" :lg="8">
+                <el-form-item label="结构名称" class="pull-left">
+                  <el-input
+                    placeholder="请输入结构名称"
+                    v-model="formSearch.name"
+                  ></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :xs="7" :sm="7" :md="7" :lg="8">
+                <el-form-item label="制定课程">
+                  <el-select
+                    v-model="formSearch.courseNo"
+                    style="width:180px;"
+                    filterable
+                    :remote-method="getCourses"
+                    remote
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in courseInfoSelect"
+                      :label="item.courseInfo"
+                      :value="item.courseNo"
+                      :key="item.courseNo"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :xs="7" :sm="7" :md="7" :lg="8">
+                <el-form-item class="pull-right">
+                  <el-button
+                    size="small"
+                    type="primary"
+                    icon="search"
+                    @click="searchAll"
+                    >查询</el-button
+                  >
+                  <el-button
+                    size="small"
+                    type="primary"
+                    icon="plus"
+                    @click="insertStruct"
+                    >新增</el-button
+                  >
+                  <el-button size="small" type="danger" @click="deleteStructs">
+                    <i class="el-icon-delete"></i> 删除
+                  </el-button>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+
+          <!-- 页面列表 -->
+          <el-table
+            :data="tableData"
+            v-loading="loading"
+            element-loading-text="拼命加载中"
+            border
+            style="width: 100%;text-align:center;"
+            @selection-change="selectionChange"
+          >
+            <el-table-column type="selection"></el-table-column>
+            <el-table-column label="蓝图试卷结构名称" width="200">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.name }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="关联课程" width="200">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.courseName }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="课程代码" width="110">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.courseNo }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="类型" width="110">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ getType(scope.row.genPaperType) }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="大题数" width="80">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.detailCount }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="难度" width="110">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ getDifficulty(scope.row.difficulty) }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="总分" width="70">
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.row.totalScore }}</span>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="140">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    size="mini"
+                    type="info"
+                    @click="editStruct(scope.row);"
+                    >修改</el-button
+                  >
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    @click="deleteStruct(scope.$index, scope.row);"
+                    >删除</el-button
+                  >
+                </div>
+              </template>
+            </el-table-column>
+          </el-table>
+          <div class="page pull-right">
+            <el-pagination
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              :page-size="pageSize"
+              layout="total, prev, pager, next, jumper"
+              :total="total"
+            ></el-pagination>
+          </div>
+        </div>
+      </div>
+    </section>
+  </div>
+</template>
+<script>
+import { CORE_API, Q_API } from "../constants/constants";
+export default {
+  data() {
+    return {
+      formSearch: {
+        name: "",
+        courseNo: "",
+        type: "BLUEPRINT"
+      },
+      currentPage: 1,
+      pageSize: 10,
+      total: 10,
+      courseList: [],
+      loading: false,
+      tableData: [],
+      selectedList: [],
+      isClear: 0
+    };
+  },
+  methods: {
+    //新增
+    insertStruct() {
+      sessionStorage.setItem(
+        "blue_paper_stucture",
+        JSON.stringify(this.formSearch)
+      );
+      sessionStorage.setItem(
+        "blue_paper_stucture_currentPage",
+        this.currentPage
+      );
+      this.$router.push({
+        path: "/index/insert_blue_paper_structure/add"
+      });
+    },
+    //分页
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      this.searchAll();
+    },
+    //查询所有
+    searchAll() {
+      this.loading = true;
+      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.loading = false;
+    },
+    //删除多个试卷结构
+    deleteStructs() {
+      var selectedList = this.selectedList;
+      if (selectedList.length === 0) {
+        this.$notify({
+          type: "error",
+          message: "请选择要删除的试卷结构"
+        });
+      } else {
+        this.$confirm("是否删除试卷结构?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "error"
+        }).then(() => {
+          this.loading = true;
+          var url = Q_API + "/paperStruct/" + this.selectedIds;
+          this.$http
+            .delete(url)
+            .then(() => {
+              this.$notify({
+                type: "success",
+                message: "删除成功!"
+              });
+              this.searchAll();
+              this.selectedList = [];
+            })
+            .catch(() => {
+              this.$notify({
+                type: "error",
+                message: "删除失败!"
+              });
+              this.selectedList = [];
+            });
+        });
+      }
+      this.loading = false;
+    },
+    //得到难度
+    getDifficulty(val) {
+      if (parseFloat(val) >= 0.8 && parseFloat(val) <= 1.0) {
+        return val + "(易)";
+      }
+      if (parseFloat(val) >= 0.4 && parseFloat(val) <= 0.7) {
+        return val + "(中)";
+      } else {
+        return val + "(难)";
+      }
+    },
+    //修改
+    editStruct(row) {
+      sessionStorage.setItem(
+        "blue_paper_stucture",
+        JSON.stringify(this.formSearch)
+      );
+      sessionStorage.setItem(
+        "blue_paper_stucture_currentPage",
+        this.currentPage
+      );
+      sessionStorage.setItem("blueStruct", JSON.stringify(row));
+      this.$router.push({
+        path: "/index/insert_blue_paper_structure/" + row.id
+      });
+    },
+    deleteStruct(row) {
+      this.$confirm("是否删除试卷结构?", "提示", {
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        this.$http
+          .delete(Q_API + "/paperStruct/" + row.id)
+          .then(() => {
+            this.$notify({
+              message: "删除成功",
+              type: "success"
+            });
+            this.searchAll();
+          })
+          .catch(() => {
+            this.$notify({
+              type: "error",
+              message: "删除失败"
+            });
+          });
+      });
+      this.loading = false;
+    },
+    //清理缓存试卷结构
+    removeItem() {
+      sessionStorage.removeItem("blueStruct");
+    },
+    //全选
+    selectionChange(val) {
+      this.selectedList = [];
+      var selectedList = this.selectedList;
+      val.forEach(element => {
+        selectedList.push(element.id);
+      });
+      this.selectedList = selectedList;
+    },
+    //查询所有课程
+    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.body;
+              this.courseLoading = false;
+            });
+        }
+      } else {
+        this.courseList = [];
+      }
+    },
+    getType(val) {
+      if (val == "ENSEMBLE") {
+        return "宏观结构";
+      }
+      return "微观结构";
+    }
+  },
+  computed: {
+    selectedIds() {
+      var selectedIdsStr = "";
+      for (let id of this.selectedList) {
+        if (!selectedIdsStr) {
+          selectedIdsStr += id;
+        } else {
+          selectedIdsStr += "," + id;
+        }
+      }
+      return selectedIdsStr;
+    },
+    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.isClear = this.$route.params.isClear;
+    if (this.isClear == 0 || !this.isClear) {
+      sessionStorage.removeItem("blue_paper_stucture");
+      sessionStorage.removeItem("blue_paper_stucture_currentPage");
+    } else {
+      this.formSearch = JSON.parse(
+        sessionStorage.getItem("blue_paper_stucture")
+      );
+      this.currentPage = parseInt(
+        sessionStorage.getItem("blue_paper_stucture_currentPage")
+      );
+      if (!this.formSearch) {
+        this.formSearch = {
+          name: "",
+          courseNo: "",
+          type: "BLUEPRINT"
+        };
+      }
+      if (!this.currentPage) {
+        this.currentPage = 1;
+      }
+    }
+    this.removeItem();
+    this.searchAll();
+  }
+};
+</script>

+ 409 - 361
src/modules/questions/views/InsertPaperStructureInfo.vue

@@ -31,18 +31,13 @@
                   :label="item.label"
                   :value="item.value"
                   :key="item.value"
-                >
-                </el-option>
+                ></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-button @click="propertyDialog = true;">
+                {{ paperUnitForm.count }}
+              </el-button>
             </el-form-item>
             <el-form-item label="每题分值" class="pull-left" prop="score">
               <el-input
@@ -68,8 +63,7 @@
                   :label="item.name"
                   :value="item.code"
                   :key="item.code"
-                >
-                </el-option>
+                ></el-option>
               </el-select>
             </el-form-item>
             <el-form-item class="pull-right">
@@ -101,9 +95,11 @@
             style="width: 100%;text-align:center;"
           >
             <el-table-column label="大题名称" width="100">
-              <div>
-                <span>{{ detailName }}</span>
-              </div>
+              <template slot-scope="scope">
+                <div>
+                  <span>{{ scope.detailName }}</span>
+                </div>
+              </template>
             </el-table-column>
             <el-table-column label="题型结构" width="100">
               <template slot-scope="scope">
@@ -189,9 +185,8 @@
                     size="mini"
                     type="info"
                     @click="openPaperDetailUnitStructDialog(scope.row.id);"
+                    >编辑</el-button
                   >
-                    编辑
-                  </el-button>
                   <el-button
                     size="mini"
                     type="danger"
@@ -202,10 +197,10 @@
               </template>
             </el-table-column>
           </el-table>
+          <!-- 小题信息 -->
           <el-dialog
             title="小题信息"
-            v-model="paperDetailUnitStructDialog"
-            size="small"
+            :visible.sync="paperDetailUnitStructDialog"
           >
             <div>
               <el-form
@@ -213,8 +208,6 @@
                 :model="paperUnitForm2"
                 :rules="rules"
                 ref="paperUnitForm2"
-                label-position="right"
-                label-width="90px"
               >
                 <el-row :gutter="45">
                   <el-col :span="12">
@@ -273,167 +266,188 @@
                     </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 :gutter="20">
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">公开(简单)</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">公开(中等)</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">公开(困难)</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">公开总数</div>
+                  </el-col>
+                </el-row>
+                <!-- 第二列 -->
+                <el-row :gutter="20">
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.publicSimple"
+                        @change="
+                          unitCount(
+                            paperUnitForm2.publicSimple,
+                            'publicSimple',
+                            paperUnitForm2
+                          );
+                        "
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.publicMedium"
+                        @change="
+                          unitCount(
+                            paperUnitForm2.publicMedium,
+                            'publicMedium',
+                            paperUnitForm2
+                          );
+                        "
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.publicDifficulty"
+                        @change="
+                          unitCount(
+                            paperUnitForm2.publicDifficulty,
+                            'publicDifficulty',
+                            paperUnitForm2
+                          );
+                        "
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.publicSum"
+                        :disabled="true"
+                      ></el-input>
+                    </div>
+                  </el-col>
+                </el-row>
+                <el-row :gutter="20">
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">非公开(简单)</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">非公开(中等)</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">非公开(困难)</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">非公开总数</div>
+                  </el-col>
+                </el-row>
+                <!-- 第四列 -->
+                <el-row :gutter="20">
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.noPublicSimple"
+                        @change="
+                          unitCount(
+                            paperUnitForm2.noPublicSimple,
+                            'noPublicSimple',
+                            paperUnitForm2
+                          );
+                        "
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.noPublicMedium"
+                        @change="
+                          unitCount(
+                            paperUnitForm2.noPublicMedium,
+                            'noPublicMedium',
+                            paperUnitForm2
+                          );
+                        "
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.noPublicDifficulty"
+                        @change="
+                          unitCount(
+                            paperUnitForm2.noPublicDifficulty,
+                            'noPublicDifficulty',
+                            paperUnitForm2
+                          );
+                        "
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.noPublicSum"
+                        :disabled="true"
+                      ></el-input>
+                    </div>
+                  </el-col>
+                </el-row>
+                <el-row :gutter="20">
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">简单总数</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">中等总数</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">困难总数</div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">总数</div>
+                  </el-col>
+                </el-row>
+                <!-- 第六列 -->
+                <el-row :gutter="20">
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.simpleSum"
+                        :disabled="true"
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.mediumSum"
+                        :disabled="true"
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.difficultySum"
+                        :disabled="true"
+                      ></el-input>
+                    </div>
+                  </el-col>
+                  <el-col :span="6">
+                    <div class="grid-content bg-purple">
+                      <el-input
+                        v-model="paperUnitForm2.count"
+                        :disabled="true"
+                      ></el-input>
+                    </div>
+                  </el-col>
                 </el-row>
                 <el-row>
                   <div>
@@ -447,176 +461,196 @@
               </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-dialog title="题目数量" :visible.sync="propertyDialog">
+            <el-row :gutter="20">
+              <el-col :span="6">
+                <div class="grid-content bg-purple">公开(简单)</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">公开(中等)</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">公开(困难)</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">公开总数</div>
+              </el-col>
+            </el-row>
+            <!-- 第二列 -->
+            <el-row :gutter="20">
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
+                  <el-input
+                    v-model="paperUnitForm.publicSimple"
+                    @change="
+                      unitCount(
+                        paperUnitForm.publicSimple,
+                        'publicSimple',
+                        paperUnitForm
+                      );
+                    "
+                  ></el-input>
+                </div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
+                  <el-input
+                    v-model="paperUnitForm.publicMedium"
+                    @change="
+                      unitCount(
+                        paperUnitForm.publicMedium,
+                        'publicMedium',
+                        paperUnitForm
+                      );
+                    "
+                  ></el-input>
+                </div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
+                  <el-input
+                    v-model="paperUnitForm.publicDifficulty"
+                    @change="
+                      unitCount(
+                        paperUnitForm.publicDifficulty,
+                        'publicDifficulty',
+                        paperUnitForm
+                      );
+                    "
+                  ></el-input>
+                </div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
                   <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-col>
+            </el-row>
+            <el-row :gutter="20">
+              <el-col :span="6">
+                <div class="grid-content bg-purple">非公开(简单)</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">非公开(中等)</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">非公开(困难)</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">非公开总数</div>
+              </el-col>
+            </el-row>
+            <!-- 第四列 -->
+            <el-row :gutter="20">
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
+                  <el-input
+                    v-model="paperUnitForm.noPublicSimple"
+                    @change="
+                      unitCount(
+                        paperUnitForm.noPublicSimple,
+                        'noPublicSimple',
+                        paperUnitForm
+                      );
+                    "
+                  ></el-input>
+                </div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
+                  <el-input
+                    v-model="paperUnitForm.noPublicMedium"
+                    @change="
+                      unitCount(
+                        paperUnitForm.noPublicMedium,
+                        'noPublicMedium',
+                        paperUnitForm
+                      );
+                    "
+                  ></el-input>
+                </div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
+                  <el-input
+                    v-model="paperUnitForm.noPublicDifficulty"
+                    @change="
+                      unitCount(
+                        paperUnitForm.noPublicDifficulty,
+                        'noPublicDifficulty',
+                        paperUnitForm
+                      );
+                    "
+                  ></el-input>
+                </div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
                   <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-col>
+            </el-row>
+            <el-row :gutter="20">
+              <el-col :span="6">
+                <div class="grid-content bg-purple">简单总数</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">中等总数</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">困难总数</div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">总数</div>
+              </el-col>
+            </el-row>
+            <!-- 第六列 -->
+            <el-row :gutter="20">
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
                   <el-input
                     v-model="paperUnitForm.simpleSum"
                     :disabled="true"
                   ></el-input>
                 </div>
-              </el-table-column>
-              <el-table-column label="中等总数">
-                <div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
                   <el-input
                     v-model="paperUnitForm.mediumSum"
                     :disabled="true"
                   ></el-input>
                 </div>
-              </el-table-column>
-              <el-table-column label="困难总数">
-                <div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
                   <el-input
                     v-model="paperUnitForm.difficultySum"
                     :disabled="true"
                   ></el-input>
                 </div>
-              </el-table-column>
-              <el-table-column label="总数">
-                <div>
+              </el-col>
+              <el-col :span="6">
+                <div class="grid-content bg-purple">
                   <el-input
                     v-model="paperUnitForm.count"
                     :disabled="true"
                   ></el-input>
                 </div>
-              </el-table-column>
-            </el-table>
-
+              </el-col>
+            </el-row>
             <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 type="primary" @click="propertyDialog = false;"
+                >保 存</el-button
+              >
+              <el-button type="primary" @click="propertyDialog = false;"
                 >返 回</el-button
               >
             </div>
@@ -721,7 +755,6 @@ export default {
       paperStructId: "",
       paperStruct: {},
       unitStructs: [],
-      paperUnitForms: [],
       paperDetailUnitStructDialog: false,
       propertyDialog: false,
       rules: {
@@ -812,7 +845,6 @@ export default {
           } else {
             maxId = ids[ids.length - 1];
           }
-
           unitStruct.id = maxId + 1;
           this.unitStructs.push(unitStruct);
           this.resetForm();
@@ -962,8 +994,6 @@ export default {
       }
       this.getQuesNameList(this.paperUnitForm2.questionType);
       this.paperDetailUnitStructDialog = true;
-      this.paperUnitForms = [];
-      this.paperUnitForms.push(this.paperUnitForm2);
     },
     deleteUnit(id) {
       var unitStructs = this.unitStructs;
@@ -977,88 +1007,81 @@ export default {
       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) {
+    //计算数量
+    unitCount(data, rowType, paperUnitForm) {
       //计算前校验正整数
       if (!this.isPositiveInteger(data)) {
         if (rowType === "publicSimple") {
           setTimeout(function() {
-            row.publicSimple = 0;
+            paperUnitForm.publicSimple = 0;
           }, 1);
         } else if (rowType === "publicMedium") {
           setTimeout(function() {
-            row.publicMedium = 0;
+            paperUnitForm.publicMedium = 0;
           }, 1);
         } else if (rowType === "publicDifficulty") {
           setTimeout(function() {
-            row.publicDifficulty = 0;
+            paperUnitForm.publicDifficulty = 0;
           }, 1);
         } else if (rowType === "noPublicSimple") {
           setTimeout(function() {
-            row.noPublicSimple = 0;
+            paperUnitForm.noPublicSimple = 0;
           }, 1);
         } else if (rowType === "noPublicMedium") {
           setTimeout(function() {
-            row.noPublicMedium = 0;
+            paperUnitForm.noPublicMedium = 0;
           }, 1);
         } else if (rowType === "noPublicDifficulty") {
           setTimeout(function() {
-            row.noPublicDifficulty = 0;
+            paperUnitForm.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.publicSimple = parseInt(paperUnitForm.publicSimple);
+        paperUnitForm.publicMedium = parseInt(paperUnitForm.publicMedium);
+        paperUnitForm.publicDifficulty = parseInt(
+          paperUnitForm.publicDifficulty
+        );
+        paperUnitForm.noPublicSimple = parseInt(paperUnitForm.noPublicSimple);
+        paperUnitForm.noPublicMedium = parseInt(paperUnitForm.noPublicMedium);
+        paperUnitForm.noPublicDifficulty = parseInt(
+          paperUnitForm.noPublicDifficulty
+        );
         //公开总数
         paperUnitForm.publicSum =
-          parseInt(row.publicSimple) +
-          parseInt(row.publicMedium) +
-          parseInt(row.publicDifficulty);
+          parseInt(paperUnitForm.publicSimple) +
+          parseInt(paperUnitForm.publicMedium) +
+          parseInt(paperUnitForm.publicDifficulty);
         //非公开总数
         paperUnitForm.noPublicSum =
-          parseInt(row.noPublicSimple) +
-          parseInt(row.noPublicMedium) +
-          parseInt(row.noPublicDifficulty);
+          parseInt(paperUnitForm.noPublicSimple) +
+          parseInt(paperUnitForm.noPublicMedium) +
+          parseInt(paperUnitForm.noPublicDifficulty);
         //简单总数
         paperUnitForm.simpleSum =
-          parseInt(row.publicSimple) + parseInt(row.noPublicSimple);
+          parseInt(paperUnitForm.publicSimple) +
+          parseInt(paperUnitForm.noPublicSimple);
         //中等总数
         paperUnitForm.mediumSum =
-          parseInt(row.publicMedium) + parseInt(row.noPublicMedium);
+          parseInt(paperUnitForm.publicMedium) +
+          parseInt(paperUnitForm.noPublicMedium);
         //困难总数
         paperUnitForm.difficultySum =
-          parseInt(row.publicDifficulty) + parseInt(row.noPublicDifficulty);
+          parseInt(paperUnitForm.publicDifficulty) +
+          parseInt(paperUnitForm.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: {
@@ -1094,3 +1117,28 @@ export default {
   }
 };
 </script>
+<style scoped>
+.el-row {
+  margin-bottom: 20px;
+}
+.el-col {
+  border-radius: 4px;
+}
+.bg-purple-dark {
+  background: #dcdfe6;
+}
+.bg-purple {
+  background: #dcdfe6;
+}
+.bg-purple-light {
+  background: #f9fafc;
+}
+.grid-content {
+  border-radius: 4px;
+  min-height: 36px;
+}
+.row-bg {
+  padding: 10px 0;
+  background-color: #f9fafc;
+}
+</style>

+ 10 - 14
src/modules/questions/views/PaperStructure.vue

@@ -40,14 +40,13 @@
                     placeholder="请选择"
                   >
                     <el-option label="请选择" value="ALL" key="ALL"></el-option>
-                    <el-option label="公用" value="" key=""></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-option>
                   </el-select>
                 </el-form-item>
               </el-col>
@@ -69,9 +68,9 @@
                   @click="addPaperStruct"
                   >新增</el-button
                 >
-                <el-button size="small" type="danger" @click="deletePapers"
-                  ><i class="el-icon-delete"></i> 删除</el-button
-                >
+                <el-button size="small" type="danger" @click="deletePapers">
+                  <i class="el-icon-delete"></i> 删除
+                </el-button>
               </el-form-item>
             </el-row>
           </el-form>
@@ -85,7 +84,7 @@
             style="width: 100%;text-align:center;"
             @selection-change="selectionChange"
           >
-            <el-table-column type="selection"> </el-table-column>
+            <el-table-column type="selection"></el-table-column>
             <el-table-column label="预设精确结构名称" width="200">
               <template slot-scope="scope">
                 <div>
@@ -149,16 +148,14 @@
                     size="mini"
                     type="info"
                     @click="editPaperStruct(scope.row);"
+                    >修改</el-button
                   >
-                    修改
-                  </el-button>
                   <el-button
                     size="mini"
                     type="danger"
                     @click="deletePaper(scope.$index, scope.row);"
+                    >删除</el-button
                   >
-                    删除
-                  </el-button>
                 </div>
               </template>
             </el-table-column>
@@ -170,8 +167,7 @@
               :page-size="pageSize"
               layout="total, prev, pager, next, jumper"
               :total="total"
-            >
-            </el-pagination>
+            ></el-pagination>
           </div>
         </div>
       </div>
@@ -228,7 +224,7 @@ export default {
       sessionStorage.setItem("paper_stucture_currentPage", this.currentPage);
       sessionStorage.setItem("paperStruct", JSON.stringify(row));
       this.$router.push({
-        path: "/index/insert_paper_structure/" + row.id
+        path: "/questions/insert_paper_structure/" + row.id
       });
     },
     //删除单条数据