刘洋 2 years ago
parent
commit
5dd393d08e

+ 1 - 1
src/modules/basic/view/data_previllege_add_org.vue

@@ -116,7 +116,7 @@ export default {
     async search() {
       var param = new URLSearchParams({
         ...this.form,
-        rootOrgId: this.rootOrgId,
+        parentId: this.rootOrgId,
       });
       var url =
         CORE_API +

+ 115 - 17
src/modules/questions/views/AddPaperSelect.vue

@@ -102,6 +102,7 @@
               </el-form-item>
               <el-table
                 ref="table2"
+                v-loading="tableLoading2"
                 :data="tableData2"
                 border
                 @selection-change="handleSelectionChange"
@@ -121,6 +122,46 @@
                 >
                 </el-table-column>
               </el-table>
+              <div class="page pull-right">
+                <el-pagination
+                  :current-page="curSelect"
+                  :page-size="pageSize"
+                  layout="total, prev, pager, next, jumper"
+                  :total="totalSelect"
+                  @current-change="selectCurrentChange"
+                >
+                </el-pagination>
+              </div>
+              <div style="clear: both; margin-top: 5px"></div>
+
+              <el-form
+                :inline="true"
+                label-position="right"
+                label-width="100px"
+              >
+                <el-form-item label="选中列表" class="form-item"></el-form-item>
+              </el-form>
+              <el-table :data="tempPapers" border>
+                <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="操作">
+                  <template slot-scope="scope">
+                    <div>
+                      <el-button
+                        type="danger"
+                        size="mini"
+                        @click="removeSelected(scope.row.id)"
+                        >移除</el-button
+                      >
+                    </div>
+                  </template>
+                </el-table-column>
+              </el-table>
             </div>
             <div style="width: 60%; padding-left: 20px">
               <div style="color: #606266; font-size: 14px; line-height: 32px">
@@ -186,6 +227,7 @@
 </template>
 <script>
 import qs from "qs";
+import { cloneDeep } from "lodash";
 import { mapState } from "vuex";
 import { QUESTION_API } from "@/constants/constants";
 import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
@@ -194,6 +236,11 @@ export default {
   components: { LinkTitlesCustom },
   data() {
     return {
+      tempPapers: [],
+      tempPaperIds: [],
+      curSelect: 1,
+      totalSelect: 10,
+      pageSize: 10,
       hasError: false,
       form: {
         paperStructType: "EXACT",
@@ -231,6 +278,7 @@ export default {
       lastRequestKey: "",
       tableLoading3: false,
       tableLoading1: false,
+      tableLoading2: false,
       checked: false,
       initSelectedRows: [],
     };
@@ -280,6 +328,10 @@ export default {
     }
   },
   methods: {
+    selectCurrentChange(val) {
+      this.curSelect = val;
+      this.getTable2();
+    },
     paperStructTypeChange() {
       this.form.paperStructId = "";
       this.getStruct();
@@ -390,16 +442,26 @@ export default {
       });
     },
     getTable2(bool) {
+      this.tableLoading2 = true;
       let apiUrl =
         this.form.paperType === "IMPORT"
-          ? "/api/ecs_ques/importPaper/huoge/1/10000"
-          : "/api/ecs_ques/genPaper/huoge/1/10000";
+          ? "/api/ecs_ques/importPaper/huoge"
+          : "/api/ecs_ques/genPaper/huoge";
       this.$http
-        .get(apiUrl, {
-          params: { courseNo: this.$route.query.courseNo, ids: "" },
-        })
+        .get(
+          apiUrl +
+            `/${this.curSelect}/${this.pageSize}?courseNo=${this.$route.query.courseNo}&ids=${this.tempPaperIds}`,
+          {
+            // params: {
+            //   courseNo: this.$route.query.courseNo,
+            //   ids: this.tempPaperIds,
+            // },
+          }
+        )
         .then((res) => {
           this.tableData2 = res.data.content || [];
+          this.totalSelect = res.data.totalElements;
+          // this.curSelect = res.data.number + 1;
           if (bool) {
             this.tableData2.forEach((item) => {
               if (this.paperIdsArr.includes(item.id)) {
@@ -412,21 +474,52 @@ export default {
               });
             }, 0);
           }
+          this.tableLoading2 = false;
         });
     },
-    changePaperType(bool) {
-      if (bool === true) {
-        this.handleSelectionChange([]);
-        this.$refs.table2.clearSelection();
-      } else {
-        this.tableData2 = [];
-        this.multipleSelection = [];
-        this.getTable2();
+    removeSelected(id) {
+      for (let [index, paper] of this.tempPapers.entries()) {
+        if (id == paper.id) {
+          this.tempPapers.splice(index, 1);
+          this.tableData2.push(paper);
+          break;
+        }
       }
+      for (var i = 0; i < this.tempPaperIds.length; i++) {
+        if (this.tempPaperIds[i] == id) {
+          this.tempPaperIds.splice(i, 1);
+          break;
+        }
+      }
+      this.getTable2();
+    },
+    changePaperType() {
+      this.tempPapers = [];
+      this.tempPaperIds = [];
+      this.tableData2 = [];
+      this.tableData3 = [];
+      this.multipleSelection = [];
+      this.curSelect = 1;
+      this.getTable2();
+      // if (bool === true) {
+      //   // this.handleSelectionChange([]);
+      //   this.tempPapers = [];
+      //   this.tempPaperIds = [];
+      //   // this.$refs.table2.clearSelection();
+      //   this.getTable3();
+      // } else {
+      //   this.tableData2 = [];
+      //   this.tempPapers = [];
+      //   this.tempPaperIds = [];
+      //   this.multipleSelection = [];
+      //   this.curSelect = 1;
+      //   this.getTable2();
+      // }
     },
     getTable3() {
-      let paperIds = this.multipleSelection.map((item) => item.id);
-      if (!paperIds.length) {
+      // let paperIds = this.multipleSelection.map((item) => item.id);
+      // if (!paperIds.length) {
+      if (!this.tempPaperIds.length) {
         this.tableData3 = [];
         this.tableLoading3 = false;
         return false;
@@ -438,7 +531,7 @@ export default {
         .post(
           "/api/ecs_ques/randompaper/struct/question/view/info",
           qs.stringify({
-            paperIds: paperIds.join(","),
+            paperIds: this.tempPaperIds.join(","),
             structId: this.form.paperStructId,
           }),
           {
@@ -454,7 +547,12 @@ export default {
         });
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
+      // this.multipleSelection = val;
+      val.forEach((element) => {
+        this.tempPapers.push(cloneDeep(element));
+        this.tempPaperIds.push(element.id);
+      });
+      this.getTable2();
       this.getTable3();
     },
     hasNumError(row) {

+ 21 - 0
src/modules/questions/views/ExtractPaperTemplate.vue

@@ -40,6 +40,9 @@
         </el-select>
       </el-form-item>
       <el-button type="primary" @click="search(1)">查询</el-button>
+      <el-button type="primary" @click="toAddPaperSelect"
+        ><i class="el-icon-plus"></i>随机抽卷模板</el-button
+      >
     </el-form>
 
     <el-table :data="tableData" style="margin-top: 20px">
@@ -186,6 +189,24 @@ export default {
           this.total = res.data.totalElements;
         });
     },
+    toAddPaperSelect() {
+      var courseId = this.searchParams.courseId;
+      if (!courseId) {
+        this.$notify({
+          title: "警告",
+          message: "请选择课程",
+          type: "warning",
+        });
+        return false;
+      }
+      let course = this.allCourseList.find((item) => item.id == courseId);
+      let courseName = course.name;
+      let courseNo = course.code;
+      this.$router.push({
+        path: "/questions/add_paper_select",
+        query: { courseNo, courseName, courseId },
+      });
+    },
   },
 };
 </script>

+ 15 - 21
src/modules/questions/views/GenPaper.vue

@@ -11,11 +11,11 @@
         label-width="70px"
       >
         <el-row>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="课程名称">
               <el-select
                 v-model="formSearch.courseNo"
-                class="search_width_130px"
+                class="search_width"
                 filterable
                 :remote-method="getCourses"
                 remote
@@ -34,21 +34,21 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="试卷名称">
               <el-input
                 v-model="formSearch.name"
-                class="search_width_130px"
+                class="search_width"
                 placeholder="试卷名称"
                 size="small"
               ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="层次">
               <el-select
                 v-model="formSearch.level"
-                class="search_width_130px"
+                class="search_width"
                 clearable
                 placeholder="请选择"
                 size="small"
@@ -63,11 +63,11 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="录入人">
               <el-input
                 v-model="formSearch.creator"
-                class="search_width_130px"
+                class="search_width"
                 placeholder="录入人"
                 size="small"
               ></el-input>
@@ -75,21 +75,21 @@
           </el-col>
         </el-row>
         <el-row>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="修改人">
               <el-input
                 v-model="formSearch.lastModifyName"
-                class="search_width_130px"
+                class="search_width"
                 placeholder="修改人"
                 size="small"
               ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="调用状态">
               <el-select
                 v-model="formSearch.inUse"
-                class="search_width_130px"
+                class="search_width"
                 clearable
                 placeholder="请选择"
                 size="small"
@@ -99,11 +99,11 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="5">
+          <el-col :span="6">
             <el-form-item label="审核状态">
               <el-select
                 v-model="formSearch.auditStatus"
-                class="search_width_130px"
+                class="search_width"
                 clearable
                 placeholder="请选择"
                 size="small"
@@ -113,7 +113,7 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="9">
+          <el-col :span="6">
             <div class="search_down">
               <el-button size="small" type="primary" @click="searchFrom"
                 ><i class="el-icon-search"></i> 查 询</el-button
@@ -124,12 +124,6 @@
               <el-button size="small" type="primary" @click="genPaperDetail"
                 ><i class="el-icon-plus"></i> 组卷</el-button
               >
-              <el-button
-                size="small"
-                type="primary"
-                @click="toAddPaperSelect(0)"
-                ><i class="el-icon-plus"></i>随机抽卷模板</el-button
-              >
             </div>
           </el-col>
         </el-row>