deason 6 роки тому
батько
коміт
02dd5d0ba6
1 змінених файлів з 382 додано та 29 видалено
  1. 382 29
      src/modules/print/view/CourseStatistic.vue

+ 382 - 29
src/modules/print/view/CourseStatistic.vue

@@ -6,7 +6,7 @@
         class="box-header with-border"
         style="background-color:#d3dce6;margin-bottom:20px;"
       >
-        <h3 class="box-title">课程统计</h3>
+        <h2 class="box-title">课程统计</h2>
         <div class="box-tools pull-right">
           <button type="button" class="btn btn-box-tool" data-widget="collapse">
             <i class="fa fa-minus"></i>
@@ -108,7 +108,7 @@
               size="small"
               type="primary"
               icon="el-icon-menu"
-              @click="openAllotPaperModel"
+              @click="openAllotAllDialog"
               >分配待指定试卷
             </el-button>
 
@@ -116,7 +116,7 @@
               size="small"
               type="primary"
               icon="el-icon-download"
-              @click="openExportAllModel"
+              @click="openExportAllDialog"
               >整体导出
             </el-button>
 
@@ -124,7 +124,7 @@
               size="small"
               type="primary"
               icon="el-icon-download"
-              @click="openExportBatchModel"
+              @click="openExportDialog"
               >批量导出
             </el-button>
 
@@ -152,7 +152,11 @@
           <el-table-column width="80" label="试卷类型" prop="paperType" />
           <el-table-column width="80" label="试卷状态">
             <template slot-scope="scope">
-              {{ scope.row.paperStatusName }}
+              <span
+                @click="openAllotDialog(scope.row);"
+                style="cursor: pointer"
+                >{{ scope.row.paperStatusName }}</span
+              >
             </template>
           </el-table-column>
           <el-table-column width="200" label="试卷名称" prop="paperName" />
@@ -164,7 +168,7 @@
               <el-button
                 size="mini"
                 icon="el-icon-view"
-                v-show="scope.row.paperStatus == '2'"
+                v-show="scope.row.paperStatus > 1"
                 @click="preview(scope.row);"
                 >预览
               </el-button>
@@ -172,7 +176,7 @@
               <el-button
                 size="mini"
                 icon="el-icon-download"
-                v-show="scope.row.paperStatus == '2'"
+                v-show="scope.row.paperStatus > 1"
                 @click="download(scope.row);"
                 >下载
               </el-button>
@@ -191,6 +195,235 @@
           ></el-pagination>
         </div>
       </div>
+
+      <el-dialog
+        title="试卷指定"
+        width="380px"
+        :visible.sync="allotDialog"
+        @close="closeAllotDialog"
+      >
+        <el-form
+          :model="allotForm"
+          ref="allotForm"
+          :rules="rules"
+          label-position="right"
+          label-width="80px"
+        >
+          <el-form-item label="课程名称" prop="courseName">
+            <el-input
+              v-model="allotForm.courseName"
+              :disabled="true"
+              class="w220"
+            >
+              {{ allotForm.courseName }}</el-input
+            >
+          </el-form-item>
+
+          <el-form-item label="试卷类型" prop="paperType">
+            <el-input
+              v-model="allotForm.paperType"
+              :disabled="true"
+              class="w220"
+            >
+              {{ allotForm.paperType }}</el-input
+            >
+          </el-form-item>
+
+          <el-form-item label="试卷名称" prop="coursePaperId">
+            <el-select
+              v-model="allotForm.coursePaperId"
+              placeholder="请选择"
+              class="w220"
+            >
+              <el-option
+                v-for="item in coursePaperList"
+                :value="item.coursePaperId"
+                :key="item.coursePaperId"
+                :label="item.paperName"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+
+          <div style="text-align: center">
+            <el-button type="primary" @click="saveAllot">确 定</el-button>
+            <el-button @click="closeAllotDialog">取 消</el-button>
+          </div>
+        </el-form>
+      </el-dialog>
+
+      <el-dialog title="试卷整体分配" :visible.sync="allotAllDialog">
+        <el-form
+          :model="allotAllForm"
+          label-position="right"
+          label-width="100px"
+        >
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="学校名称">
+                <el-select
+                  v-model="allotAllForm.orgId"
+                  @change="searchExamList(allotAllForm.orgId, 2);"
+                >
+                  <el-option label="请选择" value></el-option>
+                  <el-option
+                    v-for="item in orgList"
+                    :label="item.orgName"
+                    :value="item.orgId"
+                    :key="item.orgId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="考试名称">
+                <el-select v-model="allotAllForm.examId">
+                  <el-option label="请选择" value></el-option>
+                  <el-option
+                    v-for="item in examList"
+                    :label="item.examName"
+                    :value="item.examId"
+                    :key="item.examId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :span="20">
+              <el-form-item>
+                <span style="font-size:20px;color: red;"
+                  >警告!确定后,选中考试中待指定的课程会在推送试卷中随机选取一套试卷,是否确定执行?</span
+                >
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col
+              :span="24"
+              class="text-center"
+              style="border-top: 2px solid;padding-top: 10px;"
+            >
+              <el-button
+                type="primary"
+                :disabled="
+                  allotAllForm.orgId === '' || allotAllForm.examId === ''
+                "
+                @click="saveAllotAll"
+                >确定</el-button
+              >
+            </el-col>
+          </el-row>
+        </el-form>
+      </el-dialog>
+
+      <el-dialog title="导出" :visible.sync="exportDialog">
+        <el-form :model="exportForm" label-position="right" label-width="80px">
+          <el-checkbox-group v-model="exportForm.types">
+            <el-checkbox label="1">试卷</el-checkbox>
+            <el-checkbox label="2">答案</el-checkbox>
+            <el-checkbox label="3">试卷结构</el-checkbox>
+          </el-checkbox-group>
+          <div style="text-align: center">
+            <el-button type="primary" @click="doExport">确定导出</el-button>
+            <el-button @click="closeExportDialog">取 消</el-button>
+          </div>
+        </el-form>
+      </el-dialog>
+
+      <el-dialog title="试卷整体导出" :visible.sync="exportAllDialog">
+        <el-form
+          :model="exportAllForm"
+          label-position="right"
+          label-width="100px"
+        >
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="学校名称">
+                <el-select
+                  v-model="exportAllForm.orgId"
+                  @change="searchExamList(exportAllForm.orgId, 3);"
+                >
+                  <el-option label="请选择" value></el-option>
+                  <el-option
+                    v-for="item in orgList"
+                    :label="item.orgName"
+                    :value="item.orgId"
+                    :key="item.orgId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="考试名称">
+                <el-select
+                  v-model="exportAllForm.examId"
+                  @change="searchExamCoursePaperTotal"
+                >
+                  <el-option label="请选择" value></el-option>
+                  <el-option
+                    v-for="item in examList"
+                    :label="item.examName"
+                    :value="item.examId"
+                    :key="item.examId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="试卷总数">{{
+                exportAllForm.allNum
+              }}</el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="已有试卷数">{{
+                exportAllForm.existNum
+              }}</el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="缺少试卷数">{{
+                exportAllForm.missNum
+              }}</el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row :gutter="10">
+            <el-col :md="20">
+              <el-form-item label="导出内容">
+                <el-checkbox-group v-model="exportAllForm.types">
+                  <el-checkbox label="1">试卷</el-checkbox>
+                  <el-checkbox label="2">答案</el-checkbox>
+                  <el-checkbox label="3">试卷结构</el-checkbox>
+                </el-checkbox-group>
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row :gutter="10">
+            <el-col
+              :span="24"
+              class="text-center"
+              style="border-top: 2px solid;padding-top: 10px;"
+            >
+              <el-button
+                type="primary"
+                :disabled="exportAllForm.existNum == 0"
+                @click="doExportAll"
+                >确定导出</el-button
+              >
+            </el-col>
+          </el-row>
+        </el-form>
+      </el-dialog>
     </div>
   </section>
 </template>
@@ -220,11 +453,149 @@ export default {
       orgList: [],
       examList: [],
       courseList: [],
+      coursePaperList: [],
       coursePaperStatusList: coursePaperStatusList,
-      rules: {}
+      allotDialog: false,
+      allotForm: {
+        id: "",
+        coursePaperId: "",
+        courseName: "",
+        paperType: ""
+      },
+      allotAllDialog: false,
+      allotAllForm: {
+        orgId: "",
+        examId: ""
+      },
+      exportDialog: false,
+      exportForm: {
+        orgId: "",
+        examId: "",
+        courseCode: "",
+        courseName: "",
+        paperType: "",
+        coursePaperId: "",
+        courseId: "",
+        id: ""
+      },
+      exportAllDialog: false,
+      exportAllForm: {
+        orgId: "",
+        examId: "",
+        exportList: [],
+        allNum: 0,
+        existNum: 0,
+        missNum: 0,
+        types: []
+      },
+      rules: {
+        coursePaperId: [
+          { required: true, message: "试卷不能为空!", trigger: "change" }
+        ],
+        courseName: [
+          { required: true, message: "课程不能为空!", trigger: "change" }
+        ],
+        paperType: [
+          { required: true, message: "试卷类型不能为空!", trigger: "change" }
+        ]
+      }
     };
   },
   methods: {
+    searchExamCoursePaperTotal() {
+      /* xxx */
+    },
+    openAllotDialog(row) {
+      /* 试卷状态为"已有"时,打开试卷指定弹窗 */
+      if (row.paperStatus > 0) {
+        this.allotDialog = true;
+        this.allotForm.id = row.id;
+        this.allotForm.coursePaperId = row.coursePaperId;
+        this.allotForm.courseName = row.courseName;
+        this.allotForm.paperType = row.paperType;
+        let params = {
+          orgId: row.orgId,
+          examId: row.examId,
+          courseId: row.courseId
+        };
+        let url = PRINT_API + "/course/paper/list";
+        this.$http.post(url, params).then(
+          response => {
+            this.coursePaperList = response.data;
+          },
+          error => {
+            console.log(error);
+          }
+        );
+      }
+    },
+    closeAllotDialog() {
+      /* 关闭试卷指定弹窗 */
+      this.allotDialog = false;
+    },
+    saveAllot() {
+      /* 保存试卷指定 */
+      this.$refs.allotForm.validate(valid => {
+        if (!valid) {
+          return false;
+        }
+        let url =
+          PRINT_API +
+          "/course/paper/allot/" +
+          this.allotForm.id +
+          "/" +
+          this.allotForm.coursePaperId;
+        this.$http.post(url).then(
+          () => {
+            this.$notify({
+              message: "试卷指定成功!",
+              type: "success"
+            });
+            this.allotDialog = false;
+            this.searchRecords();
+          },
+          () => {
+            this.$notify({
+              message: "试卷指定失败!",
+              type: "error"
+            });
+          }
+        );
+      });
+    },
+    openAllotAllDialog() {
+      /* 打开分配待指定试卷弹窗 */
+      this.allotAllDialog = true;
+    },
+    closeAllotAllDialog() {
+      /* 关闭分配待指定试卷弹窗 */
+      this.allotAllDialog = false;
+    },
+    saveAllotAll() {
+      /* 保存分配待指定试卷 */
+    },
+    openExportDialog() {
+      /* 打开批量导出弹窗 */
+      this.exportDialog = true;
+    },
+    closeExportDialog() {
+      /* 关闭批量导出弹窗 */
+      this.exportDialog = false;
+    },
+    doExport() {
+      /* 批量导出 */
+    },
+    openExportAllDialog() {
+      /* 打开整体导出弹窗 */
+      this.exportAllDialog = true;
+    },
+    closeExportAllDialog() {
+      /* 关闭整体导出弹窗 */
+      this.exportAllDialog = false;
+    },
+    doExportAll() {
+      /* 整体导出 */
+    },
     handlePager(current) {
       /* 处理分页 */
       this.formSearch.pageNo = current;
@@ -297,27 +668,6 @@ export default {
         type: "warning"
       });
     },
-    openAllotPaperModel() {
-      /* 分配待指定试卷 */
-      this.$notify({
-        message: "Todo...",
-        type: "warning"
-      });
-    },
-    openExportBatchModel() {
-      /* 批量导出 */
-      this.$notify({
-        message: "Todo...",
-        type: "warning"
-      });
-    },
-    openExportAllModel() {
-      /* 整体导出 */
-      this.$notify({
-        message: "Todo...",
-        type: "warning"
-      });
-    },
     preview(row) {
       /* 预览试卷PDF */
       console.log(row);
@@ -362,4 +712,7 @@ export default {
 .pull-left {
   float: left;
 }
+.w220 {
+  width: 220px;
+}
 </style>