deason 6 years ago
parent
commit
2ef3a9b5ff

+ 0 - 7
src/modules/print/constants/constants.js

@@ -3,13 +3,6 @@ import Vue from "vue";
 /* 印刷平台-API */
 export const PRINT_API = "/api/ecs_prt";
 
-/* 试题类型-客观题 */
-export const questionTypeList = [
-  { value: "SINGLE_ANSWER_QUESTION", label: "单选" },
-  { value: "MULTIPLE_ANSWER_QUESTION", label: "多选" },
-  { value: "BOOL_ANSWER_QUESTION", label: "判断" }
-];
-
 /* 单独备份袋设置-归集类型 */
 export const groupTypeList = [
   { value: "LEARN_CENTER", label: "学习中心" },

+ 1 - 14
src/modules/print/view/CourseStatistic.vue

@@ -1,19 +1,6 @@
 <template>
-  <section class="content" style="margin-top: -18px;">
+  <section class="content" style="margin-top: 20px;">
     <div class="box box-info">
-      <!-- 头信息 -->
-      <div
-        class="box-header with-border"
-        style="background-color:#d3dce6;margin-bottom:20px;"
-      >
-        <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>
-          </button>
-        </div>
-      </div>
-
       <!-- 正文信息 -->
       <div class="box-body">
         <el-form

+ 404 - 31
src/modules/print/view/ExamStructure.vue

@@ -1,19 +1,6 @@
 <template>
-  <section class="content" style="margin-top: -18px;">
+  <section class="content" style="margin-top: 20px;">
     <div class="box box-info">
-      <!-- 头信息 -->
-      <div
-        class="box-header with-border"
-        style="background-color:#d3dce6;margin-bottom:20px;"
-      >
-        <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>
-          </button>
-        </div>
-      </div>
-
       <!-- 正文信息 -->
       <div class="box-body">
         <el-form
@@ -41,7 +28,6 @@
           <el-form-item label="考试">
             <el-select
               v-model="formSearch.examId"
-              @change="searchRecords"
               placeholder="请选择"
               clearable
             >
@@ -68,8 +54,8 @@
               type="primary"
               icon="el-icon-plus"
               :disabled="!hasPermit"
-              v-show="formSearch.examId != ''"
-              @click="addStructure"
+              v-show="!isEmptyNumber(formSearch.orgId)"
+              @click="openAddStructureDialog"
               >新增
             </el-button>
           </el-form-item>
@@ -98,7 +84,7 @@
               <el-button
                 size="mini"
                 icon="el-icon-menu"
-                @click="cloneStructure(scope.row);"
+                @click="openCloneStructureDialog(scope.row);"
                 :disabled="!hasPermit"
                 >复用
               </el-button>
@@ -126,6 +112,171 @@
           ></el-pagination>
         </div>
       </div>
+
+      <!-- 新增考试结构弹窗 -->
+      <el-dialog
+        title="新增考试结构"
+        width="400px"
+        :visible.sync="addStructureDialog"
+        @close="closeAddStructureDialog"
+      >
+        <el-form
+          :model="addStructureForm"
+          ref="addStructureForm"
+          :rules="rules"
+          label-position="right"
+          label-width="100px"
+        >
+          <el-form-item label="学校名称" prop="orgId">
+            <el-select
+              v-model="addStructureForm.orgId"
+              placeholder="请选择"
+              :disabled="true"
+              class="w220"
+            >
+              <el-option
+                v-for="item in orgList"
+                :label="item.orgName"
+                :value="item.orgId"
+                :key="item.orgId"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+
+          <el-form-item label="考试名称" prop="examId">
+            <el-select
+              v-model="addStructureForm.examId"
+              placeholder="请选择"
+              class="w220"
+            >
+              <el-option
+                v-for="item in examList"
+                :label="item.examName"
+                :value="item.examId"
+                :key="item.examId"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+
+          <el-form-item label="单选题数量" prop="singleChoiceTotal">
+            <el-input
+              v-model="addStructureForm.questionStructure.singleChoiceTotal"
+              class="w220"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item label="多选题数量" prop="multipleChoiceTotal">
+            <el-input
+              v-model="addStructureForm.questionStructure.multipleChoiceTotal"
+              class="w220"
+            ></el-input>
+          </el-form-item>
+
+          <el-form-item label="判断题数量" prop="boolQuestionTotal">
+            <el-input
+              v-model="addStructureForm.questionStructure.boolQuestionTotal"
+              class="w220"
+            ></el-input>
+          </el-form-item>
+
+          <div style="text-align: center">
+            <el-button type="primary" @click="addStructure">确 定</el-button>
+            <el-button @click="closeAddStructureDialog">取 消</el-button>
+          </div>
+        </el-form>
+      </el-dialog>
+
+      <!-- 复用考试结构弹窗 -->
+      <el-dialog
+        title="复用考试结构"
+        width="450px"
+        :visible.sync="cloneStructureDialog"
+        @close="closeCloneStructureDialog"
+      >
+        <el-form
+          :model="cloneStructureForm"
+          ref="cloneStructureForm"
+          :rules="rules"
+          label-position="right"
+          label-width="80px"
+        >
+          <el-tabs v-model="sourceTab">
+            <el-tab-pane label="原结构信息" name="first">
+              <el-form-item label="学校名称" prop="orgId">
+                <el-select
+                  v-model="cloneStructureForm.orgId"
+                  placeholder="请选择"
+                  :disabled="true"
+                  class="w220"
+                >
+                  <el-option
+                    v-for="item in orgList"
+                    :label="item.orgName"
+                    :value="item.orgId"
+                    :key="item.orgId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+
+              <el-form-item label="考试名称" prop="examId">
+                <el-select
+                  v-model="cloneStructureForm.examId"
+                  placeholder="请选择"
+                  :disabled="true"
+                  class="w220"
+                >
+                  <el-option
+                    v-for="item in examList"
+                    :label="item.examName"
+                    :value="item.examId"
+                    :key="item.examId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-tab-pane>
+          </el-tabs>
+
+          <el-tabs v-model="targetTab">
+            <el-tab-pane label="新结构信息" name="first">
+              <el-form-item label="学校名称" prop="newOrgId">
+                <el-select
+                  v-model="cloneStructureForm.newOrgId"
+                  @change="searchCloneExamList(cloneStructureForm.newOrgId);"
+                  placeholder="请选择"
+                  class="w220"
+                >
+                  <el-option
+                    v-for="item in orgList"
+                    :label="item.orgName"
+                    :value="item.orgId"
+                    :key="item.orgId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+
+              <el-form-item label="考试名称" prop="newExamId">
+                <el-select
+                  v-model="cloneStructureForm.newExamId"
+                  placeholder="请选择"
+                  class="w220"
+                >
+                  <el-option
+                    v-for="item in cloneExamList"
+                    :label="item.examName"
+                    :value="item.examId"
+                    :key="item.examId"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-tab-pane>
+          </el-tabs>
+
+          <div style="text-align: center">
+            <el-button type="primary" @click="cloneStructure">确 定</el-button>
+            <el-button @click="closeCloneStructureDialog">取 消</el-button>
+          </div>
+        </el-form>
+      </el-dialog>
     </div>
   </section>
 </template>
@@ -137,6 +288,42 @@ import { mapState } from "vuex";
 
 export default {
   data() {
+    let validateSingleChoiceTotal = (rule, value, callback) => {
+      if (
+        this.isEmptyNumber(
+          this.addStructureForm.questionStructure.singleChoiceTotal
+        )
+      ) {
+        callback(new Error("请输入正确的数值!"));
+        return;
+      }
+      callback();
+    };
+
+    let validateMultipleChoiceTotal = (rule, value, callback) => {
+      if (
+        this.isEmptyNumber(
+          this.addStructureForm.questionStructure.multipleChoiceTotal
+        )
+      ) {
+        callback(new Error("请输入正确的数值!"));
+        return;
+      }
+      callback();
+    };
+
+    let validateBoolChoiceTotal = (rule, value, callback) => {
+      if (
+        this.isEmptyNumber(
+          this.addStructureForm.questionStructure.boolQuestionTotal
+        )
+      ) {
+        callback(new Error("请输入正确的数值!"));
+        return;
+      }
+      callback();
+    };
+
     return {
       formSearch: {
         orgId: "",
@@ -151,7 +338,65 @@ export default {
       tableData: [],
       orgList: [],
       examList: [],
-      rules: {}
+      addStructureDialog: false,
+      addStructureForm: {
+        examId: "",
+        examName: "",
+        orgId: "",
+        orgName: "",
+        questionStructure: {
+          singleChoiceTotal: 0,
+          multipleChoiceTotal: 0,
+          boolQuestionTotal: 0
+        }
+      },
+      cloneStructureDialog: false,
+      cloneExamList: [],
+      sourceTab: "first",
+      targetTab: "first",
+      cloneStructureForm: {
+        examId: "",
+        orgId: "",
+        newExamId: "",
+        newExamName: "",
+        newOrgId: "",
+        newOrgName: ""
+      },
+      rules: {
+        orgId: [
+          { required: true, message: "学校不能为空!", trigger: "change" }
+        ],
+        examId: [
+          { required: true, message: "考试不能为空!", trigger: "change" }
+        ],
+        newOrgId: [
+          { required: true, message: "学校不能为空!", trigger: "change" }
+        ],
+        newExamId: [
+          { required: true, message: "考试不能为空!", trigger: "change" }
+        ],
+        singleChoiceTotal: [
+          {
+            required: true,
+            validator: validateSingleChoiceTotal,
+            trigger: "change"
+          }
+        ],
+        multipleChoiceTotal: [
+          {
+            required: true,
+            validator: validateMultipleChoiceTotal,
+            trigger: "change"
+          }
+        ],
+        boolQuestionTotal: [
+          {
+            required: true,
+            validator: validateBoolChoiceTotal,
+            trigger: "change"
+          }
+        ]
+      }
     };
   },
   methods: {
@@ -198,28 +443,156 @@ export default {
         });
       }
     },
+    searchCloneExamList(orgId) {
+      /* 查询考试列表 */
+      this.cloneStructureForm.newExamId = "";
+      this.cloneExamList = [];
+
+      if (!this.isEmptyNumber(orgId)) {
+        let url = PRINT_API + "/printing/project/exam/list?orgId=" + orgId;
+        this.$http.post(url).then(response => {
+          this.cloneExamList = response.data;
+        });
+      }
+    },
+    openAddStructureDialog() {
+      /* 打开考试结构弹窗 */
+      this.addStructureDialog = true;
+      this.addStructureForm.orgId = this.formSearch.orgId;
+      this.addStructureForm.examId = this.formSearch.examId;
+      this.addStructureForm.questionStructure.singleChoiceTotal = 0;
+      this.addStructureForm.questionStructure.multipleChoiceTotal = 0;
+      this.addStructureForm.questionStructure.boolQuestionTotal = 0;
+    },
+    closeAddStructureDialog() {
+      /* 关闭考试结构弹窗 */
+      this.addStructureDialog = false;
+    },
     addStructure() {
       /* 新增考试结构 */
-      this.$notify({
-        message: "Todo...",
-        type: "warning"
+      this.$refs.addStructureForm.validate(valid => {
+        if (!valid) {
+          return false;
+        }
+
+        this.addStructureForm.orgName = this.getOrgNameById(
+          this.orgList,
+          this.addStructureForm.orgId
+        );
+        this.addStructureForm.examName = this.getExamNameById(
+          this.examList,
+          this.addStructureForm.examId
+        );
+
+        let url = PRINT_API + "/examStructure/save";
+        this.$http.post(url, this.addStructureForm).then(
+          () => {
+            this.$notify({
+              message: "考试结构新增成功!",
+              type: "success"
+            });
+            this.addStructureDialog = false;
+            this.searchRecords();
+          },
+          () => {
+            this.$notify({
+              message: "考试结构新增失败!",
+              type: "error"
+            });
+          }
+        );
       });
     },
-    cloneStructure(row) {
+    openCloneStructureDialog(row) {
+      /* 打开复用考试结构弹窗 */
+      this.cloneStructureDialog = true;
+      this.cloneStructureForm.orgId = row.orgId;
+      this.cloneStructureForm.examId = row.examId;
+      this.cloneStructureForm.newOrgId = "";
+      this.cloneStructureForm.newExamId = "";
+    },
+    closeCloneStructureDialog() {
+      /* 关闭复用考试结构弹窗 */
+      this.cloneStructureDialog = false;
+    },
+    cloneStructure() {
       /* 复用考试结构 */
-      console.log(row);
-      this.$notify({
-        message: "Todo...",
-        type: "warning"
+      this.$refs.cloneStructureForm.validate(valid => {
+        if (!valid) {
+          return false;
+        }
+        this.cloneStructureForm.newOrgName = this.getOrgNameById(
+          this.orgList,
+          this.cloneStructureForm.newOrgId
+        );
+        this.cloneStructureForm.newExamName = this.getExamNameById(
+          this.cloneExamList,
+          this.cloneStructureForm.newExamId
+        );
+
+        let url = PRINT_API + "/examStructure/clone";
+        this.$http.post(url, this.cloneStructureForm).then(
+          () => {
+            this.$notify({
+              message: "考试结构复用成功!",
+              type: "success"
+            });
+            this.cloneStructureDialog = false;
+            this.searchRecords();
+          },
+          () => {
+            this.$notify({
+              message: "考试结构复用失败!",
+              type: "error"
+            });
+          }
+        );
       });
     },
     removeStructure(row) {
       /* 删除考试结构 */
-      console.log(row);
-      this.$notify({
-        message: "Todo...",
+      this.$confirm("确定删除当前结构吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
         type: "warning"
-      });
+      })
+        .then(() => {
+          let url = PRINT_API + "/examStructure/delete/" + row.id;
+          this.$http.post(url).then(
+            () => {
+              this.$notify({
+                type: "success",
+                message: "删除当前结构成功!"
+              });
+              this.searchRecords();
+            },
+            () => {
+              this.$notify({
+                type: "error",
+                message: "删除当前结构失败!"
+              });
+            }
+          );
+        })
+        .catch(() => {
+          /*ignore*/
+        });
+    },
+    getOrgNameById(orgList, orgId) {
+      for (let i = 0; i < orgList.length; i++) {
+        if (orgList[i].orgId == orgId) {
+          return orgList[i].orgName;
+        }
+      }
+      return "";
+    },
+    getExamNameById(examList, examId) {
+      for (let i = 0; i < examList.length; i++) {
+        if (examList[i].examId == examId) {
+          return examList[i].examName;
+        }
+      }
+      return "";
     }
   },
   computed: {

+ 1 - 14
src/modules/print/view/Project.vue

@@ -1,19 +1,6 @@
 <template>
-  <section class="content" style="margin-top: -18px;">
+  <section class="content" style="margin-top: 20px;">
     <div class="box box-info">
-      <!-- 头信息 -->
-      <div
-        class="box-header with-border"
-        style="background-color:#d3dce6;margin-bottom:20px;"
-      >
-        <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>
-          </button>
-        </div>
-      </div>
-
       <!-- 正文信息 -->
       <div class="box-body">
         <el-form

+ 2 - 15
src/modules/print/view/ProjectStatistic.vue

@@ -1,19 +1,6 @@
 <template>
-  <section class="content" style="margin-top: -18px;">
+  <section class="content" style="margin-top: 20px;">
     <div class="box box-info">
-      <!-- 头信息 -->
-      <div
-        class="box-header with-border"
-        style="background-color:#d3dce6;margin-bottom:20px;"
-      >
-        <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>
-          </button>
-        </div>
-      </div>
-
       <!-- 正文信息 -->
       <div class="box-body">
         <el-form
@@ -724,7 +711,7 @@ export default {
         type: "warning"
       })
         .then(() => {
-          var url = PRINT_API + "/project/other/setting/delete/" + row.id;
+          let url = PRINT_API + "/project/other/setting/delete/" + row.id;
           this.$http.post(url).then(
             () => {
               this.$notify({

+ 1 - 14
src/modules/print/view/ProjectTemplate.vue

@@ -1,19 +1,6 @@
 <template>
-  <section class="content" style="margin-top: -18px;">
+  <section class="content" style="margin-top: 20px;">
     <div class="box box-info">
-      <!-- 头信息 -->
-      <div
-        class="box-header with-border"
-        style="background-color:#d3dce6;margin-bottom:20px;"
-      >
-        <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>
-          </button>
-        </div>
-      </div>
-
       <!-- 正文信息 -->
       <div class="box-body">
         <el-form