Jelajahi Sumber

Merge branch 'master' of http://git.qmth.com.cn/ExamCloud-3/examcloud-web-admin

chenken 6 tahun lalu
induk
melakukan
920ff55021

+ 68 - 92
src/modules/print/constants/constants.js

@@ -1,82 +1,37 @@
 import Vue from "vue";
 
+/* 基础信息平台-API */
 export const core_api = "/api/ecs_core";
-export const exam_work_api = "/api/ecs_exam_work";
-export const question_api = "/api/ecs_ques";
+/* 印刷平台-API */
 export const print_api = "/api/ecs_prt";
 
-export const groupTypeList = [
-  { value: "LEARN_CENTER", label: "学习中心" },
-  { value: "EXAM_SITE", label: "考点" }
-];
-
-export const coursePaperStatusList = [
-  { value: 0, label: "无" },
-  { value: 1, label: "未指定" },
-  { value: 2, label: "已有" }
-];
-
-export const projectStatisticTypeList = [
-  { value: "NORMAL", label: "常规" },
-  { value: "BACKUP", label: "备份" },
-  { value: "TOTAL", label: "合计" },
-  { value: "OTHER", label: "其他" }
-];
-
-export const templateTypeList = [
-  { id: 1, label: "考生数据表", value: "1", fileUrl: "" },
-  { id: 2, label: "考场数据表", value: "2", fileUrl: "" },
-  { id: 3, label: "卷袋贴模板", value: "3", fileUrl: "" },
-  { id: 4, label: "签到表模板", value: "4", fileUrl: "" },
-  { id: 5, label: "常规题卡模板", value: "5", fileUrl: "" },
-  { id: 6, label: "特殊题卡模板", value: "6", fileUrl: "" },
-  { id: 7, label: "备份卷贴模板", value: "7", fileUrl: "" },
-  { id: 8, label: "试卷袋样式", value: "8", fileUrl: "" }
-];
-
-export const questionTypes = [
-  { value: "SINGLE_ANSWER_QUESTION", label: "单选" },
-  { value: "MULTIPLE_ANSWER_QUESTION", label: "多选" },
-  { value: "BOOL_ANSWER_QUESTION", label: "判断" },
-  { value: "FILL_BLANK_QUESTION", label: "填空" },
-  { value: "TEXT_ANSWER_QUESTION", label: "问答" },
-  { value: "NESTED_ANSWER_QUESTION", label: "套题" }
-];
-
-Vue.filter("coursePaperStatusFilter", function(value) {
-  for (let status of coursePaperStatusList) {
-    if (status.value === value) {
-      return status.label;
-    }
-  }
-});
-
-Vue.filter("questionType", function(value) {
-  for (let questionType of questionTypes) {
-    if (questionType.value === value) {
-      return questionType.label;
-    }
+/* 是否为空字符串 */
+Vue.prototype.isEmptyStr = function(str) {
+  if (str == undefined || String(str).length < 1) {
+    return true;
   }
-});
+  return false;
+};
 
-Vue.prototype.checkUserRole = function(user) {
-  let roles = user.roleList;
-  for (let role of roles) {
-    if (role.roleCode == "PRINT_SUPER_LEADER") {
-      this.curUserRole.isSuperLeader = true;
-    } else if (role.roleCode == "PRINT_PROJECT_LEADER") {
-      this.curUserRole.isPM = true;
-    } else if (role.roleCode == "PRINT_SUPPLIER") {
-      this.curUserRole.isSupplier = true;
-    } else if (role.roleCode == "PRINT_SCHOOL_LEADER") {
-      this.curUserRole.isSchoolLeader = true;
-    } else {
-      this.curUserRole.isOther = true;
-    }
+/* 是否为空数字 */
+Vue.prototype.isEmptyNumber = function(number) {
+  let reg = /^[0-9]+$/;
+  if (!reg.test(number)) {
+    return true;
   }
-  console.log("userRole:", userRole);
+  return false;
 };
 
+/* 角色-印刷供应商 */
+export const role_print_supplier = "PRINT_SUPPLIER";
+/* 角色-印刷学校管理员 */
+export const role_print_school_leader = "PRINT_SCHOOL_LEADER";
+/* 角色-印刷总负责人 */
+export const role_print_super_leader = "PRINT_SUPER_LEADER";
+/* 角色-项目经理 */
+export const role_print_project_leader = "PRINT_PROJECT_LEADER";
+
+/* 用户角色信息 */
 export const userRole = {
   /* 是否为印刷总负责人 */
   isSuperLeader: false,
@@ -90,17 +45,56 @@ export const userRole = {
   isOther: false
 };
 
-Vue.prototype.loadPmInfo = function(user) {
+Vue.prototype.loadUserRole = function(loginUser) {
+  let roles = loginUser.roleList;
+  for (let role of roles) {
+    let roleCode = role.roleCode;
+    if (roleCode == role_print_supplier) {
+      this.curUserRole.isSupplier = true;
+    } else if (roleCode == role_print_school_leader) {
+      this.curUserRole.isSchoolLeader = true;
+    } else if (roleCode == role_print_super_leader) {
+      this.curUserRole.isSuperLeader = true;
+    } else if (roleCode == role_print_project_leader) {
+      this.curUserRole.isPM = true;
+    } else {
+      this.curUserRole.isOther = true;
+    }
+  }
+  console.log("curUserRole:", this.curUserRole);
+};
+
+/* 单独备份袋设置-归集类型 */
+export const groupTypeList = [
+  { value: "LEARN_CENTER", label: "学习中心" },
+  { value: "EXAM_SITE", label: "考点" }
+];
+
+/* 考试课程的试卷状态 */
+export const coursePaperStatusList = [
+  { value: 0, label: "无" },
+  { value: 1, label: "未指定" },
+  { value: 2, label: "已有" }
+];
+
+/* 试题类型-客观题 */
+export const questionTypeList = [
+  { value: "SINGLE_ANSWER_QUESTION", label: "单选" },
+  { value: "MULTIPLE_ANSWER_QUESTION", label: "多选" },
+  { value: "BOOL_ANSWER_QUESTION", label: "判断" }
+];
+
+Vue.prototype.loadPmInfo = function(loginUser) {
   this.pmList = [];
-  this.pmList.push({ id: user.userId, name: user.displayName });
+  this.pmList.push({ id: loginUser.userId, name: loginUser.displayName });
 };
 
-Vue.prototype.loadSupplierInfo = function(user) {
+Vue.prototype.loadSupplierInfo = function(loginUser) {
   this.supplierList = [];
-  this.supplierList.push({ id: user.userId, name: user.displayName });
+  this.supplierList.push({ id: loginUser.userId, name: loginUser.displayName });
 };
 
-Vue.prototype.searchOrgList = function() {
+Vue.prototype.loadOrgList = function() {
   var url = print_api + "/printing/project/org/list";
   this.$http.post(url).then(
     response => {
@@ -111,21 +105,3 @@ Vue.prototype.searchOrgList = function() {
     }
   );
 };
-
-Vue.prototype.isEmptyString = function(str) {
-  if (!str || str.length == 0) {
-    return true;
-  }
-  return false;
-};
-
-Vue.prototype.isEmptyNumber = function(number) {
-  if (!number && number != 0) {
-    return true;
-  }
-  let reg = /^[0-9]+$/;
-  if (!reg.test(number)) {
-    return true;
-  }
-  return false;
-};

+ 136 - 78
src/modules/print/view/CourseStatistic.vue

@@ -50,37 +50,34 @@
             </el-select>
           </el-form-item>
 
-          <el-form-item label="项目经理" class="pull-left">
+          <el-form-item label="试卷状态" class="pull-left">
             <el-select
-              v-model="formSearch.pmId"
-              placeholder="请选择"
-              filterable
+              v-model="formSearch.paperStatus"
               clearable
-              remote
-              :remote-method="searchPmList"
+              placeholder="请选择"
             >
               <el-option label="请选择" value=""></el-option>
               <el-option
-                v-for="item in pmList"
-                :label="item.name"
-                :value="item.id"
-                :key="item.id"
+                v-for="item in coursePaperStatusList"
+                :label="item.label"
+                :value="item.value"
+                :key="item.value"
               ></el-option>
             </el-select>
           </el-form-item>
 
-          <el-form-item label="印刷供应商" class="pull-left">
+          <el-form-item label="课程名称" class="pull-left">
             <el-select
-              v-model="formSearch.supplierId"
+              v-model="formSearch.courseId"
               placeholder="请选择"
               filterable
               clearable
               remote
-              :remote-method="searchSupplierList"
+              :remote-method="searchCourseList"
             >
               <el-option label="请选择" value=""></el-option>
               <el-option
-                v-for="item in supplierList"
+                v-for="item in courseList"
                 :label="item.name"
                 :value="item.id"
                 :key="item.id"
@@ -88,14 +85,50 @@
             </el-select>
           </el-form-item>
 
+          <el-form-item label="试卷名称" class="pull-left">
+            <el-input v-model="formSearch.paperName"></el-input>
+          </el-form-item>
+
           <el-form-item class="pull-right">
             <el-button
               size="small"
               type="primary"
-              icon="search"
+              icon="el-icon-search"
               @click="searchRecords"
               >查询
             </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-setting"
+              @click="openAllotPaperModel"
+              >分配待指定试卷
+            </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-download"
+              @click="openExportAllModel"
+              >整体导出
+            </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-download"
+              @click="openExportBatchModel"
+              >批量导出
+            </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-refresh"
+              @click="refreshStatistic"
+              >刷新
+            </el-button>
           </el-form-item>
         </el-form>
 
@@ -107,30 +140,37 @@
           style="width:100%;"
           border
         >
-          <el-table-column width="200" label="学校名称" prop="orgName" />
-          <el-table-column label="考试名称" prop="examName" />
-          <el-table-column width="200" label="印刷供应商" prop="supplierName" />
-          <el-table-column width="150" label="项目经理" prop="pmName" />
-
-          <el-table-column width="100" label="项目统计">
+          <el-table-column type="selection" width="55"> </el-table-column>
+          <el-table-column label="课程名称" prop="courseName" />
+          <el-table-column width="150" label="课程代码" prop="courseCode" />
+          <el-table-column width="80" label="试卷类型" prop="paperType" />
+          <el-table-column width="80" label="试卷状态">
             <template slot-scope="scope">
-              <a
-                href="javascript:void(0)"
-                @click="gotoProjectStatistic(scope.row);"
-                >查看
-              </a>
+              {{ scope.row.paperStatusName }}
             </template>
           </el-table-column>
+          <el-table-column width="200" label="试卷名称" prop="paperName" />
+          <el-table-column width="80" label="试卷P数" prop="paperP" />
+          <el-table-column width="100" label="考生人数" prop="totalStudent" />
 
-          <el-table-column width="100" label="操作" :context="_self">
+          <el-table-column width="180" label="操作" :context="_self">
             <template slot-scope="scope">
               <el-button
                 size="mini"
                 type="primary"
-                @click="editProjectSetting(scope.row);"
-                :disabled="!hasPermit"
-              >
-                <i class="el-icon-edit"></i> 项目设置
+                icon="el-icon-document"
+                v-show="scope.row.paperStatus == '2'"
+                @click="preview(scope.row);"
+                >预览
+              </el-button>
+
+              <el-button
+                size="mini"
+                type="primary"
+                icon="el-icon-download"
+                v-show="scope.row.paperStatus == '2'"
+                @click="download(scope.row);"
+                >下载
               </el-button>
             </template>
           </el-table-column>
@@ -152,7 +192,12 @@
 </template>
 
 <script>
-import { core_api, print_api, userRole } from "../constants/constants.js";
+import {
+  print_api,
+  core_api,
+  userRole,
+  coursePaperStatusList
+} from "../constants/constants.js";
 import { mapState } from "vuex";
 
 export default {
@@ -161,8 +206,9 @@ export default {
       formSearch: {
         orgId: "",
         examId: "",
-        pmId: "",
-        supplierId: "",
+        courseId: "",
+        paperStatus: "",
+        paperName: "",
         pageNo: 1,
         pageSize: 10
       },
@@ -173,8 +219,8 @@ export default {
       tableData: [],
       orgList: [],
       examList: [],
-      pmList: [],
-      supplierList: [],
+      courseList: [],
+      coursePaperStatusList: coursePaperStatusList,
       rules: {}
     };
   },
@@ -187,7 +233,7 @@ export default {
     searchRecords() {
       /* 查询记录列表 */
       let orgId = this.formSearch.orgId;
-      if (!orgId || orgId == "") {
+      if (this.isEmptyNumber(orgId)) {
         this.$notify({
           message: "请选择学校!",
           type: "warning"
@@ -196,7 +242,7 @@ export default {
       }
 
       let examId = this.formSearch.examId;
-      if (!examId || examId == "") {
+      if (this.isEmptyNumber(examId)) {
         this.$notify({
           message: "请选择考试!",
           type: "warning"
@@ -205,7 +251,7 @@ export default {
       }
 
       this.loading = true;
-      let url = print_api + "/printing/project/list";
+      let url = print_api + "/course/statistic/list";
       this.$http.post(url, this.formSearch).then(
         response => {
           this.tableData = response.data.content;
@@ -223,65 +269,81 @@ export default {
       this.formSearch.examId = "";
       this.examList = [];
 
-      if (orgId && orgId != "") {
+      if (!this.isEmptyNumber(orgId)) {
         let url = print_api + "/printing/project/exam/list?orgId=" + orgId;
         this.$http.post(url).then(response => {
           this.examList = response.data;
         });
       }
     },
-    searchPmList(query) {
-      /* 查询项目经理列表 */
-      this.pmList = [];
-      let url =
-        core_api +
-        "/user/query?rootOrgIdNull=true&roleCode=PRINT_PROJECT_LEADER";
-      if (query && query != "") {
+    searchCourseList(query) {
+      /* 查询课程列表 */
+      this.courseList = [];
+      let url = core_api + "/course/query?enable=true";
+
+      if (!this.isEmptyStr(query)) {
         url += "&name=" + query;
       }
+
       this.$http.get(url).then(response => {
-        this.pmList = response.data;
+        this.courseList = response.data;
       });
     },
-    searchSupplierList(query) {
-      /* 查询印刷供应商列表 */
-      this.supplierList = [];
-      let url =
-        core_api + "/user/query?rootOrgIdNull=true&roleCode=PRINT_SUPPLIER";
-      if (query && query != "") {
-        url += "&name=" + query;
-      }
-      this.$http.get(url).then(response => {
-        this.supplierList = response.data;
+    refreshStatistic() {
+      /* 刷新当前统计信息 */
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
       });
     },
-    gotoProjectStatistic(row) {
-      /* 查看项目统计 */
-      let url = "/print/project/statistic/" + row.orgId + "/" + row.examId;
-      this.$router.push({ path: url });
+    openAllotPaperModel() {
+      /* 分配待指定试卷 */
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    openExportBatchModel() {
+      /* 批量导出 */
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
     },
-    editProjectSetting(row) {
+    openExportAllModel() {
+      /* 整体导出 */
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    preview(row) {
+      /* 预览试卷PDF */
       console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    download(row) {
+      /* 下载试卷结构 */
+      console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
     }
   },
   computed: {
     ...mapState({ user: state => state.user })
   },
   created() {
-    this.searchOrgList();
+    this.loadOrgList();
 
-    this.checkUserRole(this.user);
+    this.loadUserRole(this.user);
 
-    if (this.curUserRole.isSuperLeader) {
-      this.hasPermit = true;
-      this.searchPmList();
-      this.searchSupplierList();
-    } else if (this.curUserRole.isPM) {
+    if (this.curUserRole.isSuperLeader || this.curUserRole.isPM) {
       this.hasPermit = true;
-      this.loadPmInfo(this.user);
-    } else if (this.curUserRole.isSupplier) {
-      this.hasPermit = false;
-      this.loadSupplierInfo(this.user);
     } else {
       this.hasPermit = false;
     }
@@ -293,8 +355,4 @@ export default {
 .page {
   margin-top: 10px;
 }
-
-.el-table th > .cell {
-  text-align: center;
-}
 </style>

+ 53 - 104
src/modules/print/view/ExamStructure.vue

@@ -50,52 +50,23 @@
             </el-select>
           </el-form-item>
 
-          <el-form-item label="项目经理" class="pull-left">
-            <el-select
-              v-model="formSearch.pmId"
-              placeholder="请选择"
-              filterable
-              clearable
-              remote
-              :remote-method="searchPmList"
-            >
-              <el-option label="请选择" value=""></el-option>
-              <el-option
-                v-for="item in pmList"
-                :label="item.name"
-                :value="item.id"
-                :key="item.id"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-
-          <el-form-item label="印刷供应商" class="pull-left">
-            <el-select
-              v-model="formSearch.supplierId"
-              placeholder="请选择"
-              filterable
-              clearable
-              remote
-              :remote-method="searchSupplierList"
-            >
-              <el-option label="请选择" value=""></el-option>
-              <el-option
-                v-for="item in supplierList"
-                :label="item.name"
-                :value="item.id"
-                :key="item.id"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-
           <el-form-item class="pull-right">
             <el-button
               size="small"
               type="primary"
-              icon="search"
+              icon="el-icon-search"
               @click="searchRecords"
               >查询
             </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              :disabled="!hasPermit"
+              @click="addStructure"
+              >新增
+            </el-button>
           </el-form-item>
         </el-form>
 
@@ -107,30 +78,34 @@
           style="width:100%;"
           border
         >
-          <el-table-column width="200" label="学校名称" prop="orgName" />
+          <el-table-column label="学校名称" prop="orgName" />
           <el-table-column label="考试名称" prop="examName" />
-          <el-table-column width="200" label="印刷供应商" prop="supplierName" />
-          <el-table-column width="150" label="项目经理" prop="pmName" />
-
-          <el-table-column width="100" label="项目统计">
+          <el-table-column width="220" label="题数">
             <template slot-scope="scope">
-              <a
-                href="javascript:void(0)"
-                @click="gotoProjectStatistic(scope.row);"
-                >查看
-              </a>
+              单选:{{ scope.row.questionStructure.singleChoiceTotal }}<br />
+              多选:{{ scope.row.questionStructure.multipleChoiceTotal }}<br />
+              判断:{{ scope.row.questionStructure.boolQuestionTotal }}
             </template>
           </el-table-column>
 
-          <el-table-column width="100" label="操作" :context="_self">
+          <el-table-column width="200" label="操作" :context="_self">
             <template slot-scope="scope">
               <el-button
                 size="mini"
                 type="primary"
-                @click="editProjectSetting(scope.row);"
+                icon="el-icon-setting"
+                @click="cloneStructure(scope.row);"
+                :disabled="!hasPermit"
+                >复用
+              </el-button>
+
+              <el-button
+                size="mini"
+                type="danger"
+                icon="el-icon-delete"
+                @click="removeStructure(scope.row);"
                 :disabled="!hasPermit"
-              >
-                <i class="el-icon-edit"></i> 项目设置
+                >删除
               </el-button>
             </template>
           </el-table-column>
@@ -152,7 +127,7 @@
 </template>
 
 <script>
-import { core_api, print_api, userRole } from "../constants/constants.js";
+import { print_api, userRole } from "../constants/constants.js";
 import { mapState } from "vuex";
 
 export default {
@@ -161,8 +136,6 @@ export default {
       formSearch: {
         orgId: "",
         examId: "",
-        pmId: "",
-        supplierId: "",
         pageNo: 1,
         pageSize: 10
       },
@@ -173,8 +146,6 @@ export default {
       tableData: [],
       orgList: [],
       examList: [],
-      pmList: [],
-      supplierList: [],
       rules: {}
     };
   },
@@ -187,7 +158,7 @@ export default {
     searchRecords() {
       /* 查询记录列表 */
       let orgId = this.formSearch.orgId;
-      if (!orgId || orgId == "") {
+      if (this.isEmptyNumber(orgId)) {
         this.$notify({
           message: "请选择学校!",
           type: "warning"
@@ -196,7 +167,7 @@ export default {
       }
 
       let examId = this.formSearch.examId;
-      if (!examId || examId == "") {
+      if (this.isEmptyNumber(examId)) {
         this.$notify({
           message: "请选择考试!",
           type: "warning"
@@ -205,7 +176,7 @@ export default {
       }
 
       this.loading = true;
-      let url = print_api + "/printing/project/list";
+      let url = print_api + "/examStructure/list";
       this.$http.post(url, this.formSearch).then(
         response => {
           this.tableData = response.data.content;
@@ -223,65 +194,47 @@ export default {
       this.formSearch.examId = "";
       this.examList = [];
 
-      if (orgId && orgId != "") {
+      if (!this.isEmptyNumber(orgId)) {
         let url = print_api + "/printing/project/exam/list?orgId=" + orgId;
         this.$http.post(url).then(response => {
           this.examList = response.data;
         });
       }
     },
-    searchPmList(query) {
-      /* 查询项目经理列表 */
-      this.pmList = [];
-      let url =
-        core_api +
-        "/user/query?rootOrgIdNull=true&roleCode=PRINT_PROJECT_LEADER";
-      if (query && query != "") {
-        url += "&name=" + query;
-      }
-      this.$http.get(url).then(response => {
-        this.pmList = response.data;
+    addStructure() {
+      /* 新增考试结构 */
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
       });
     },
-    searchSupplierList(query) {
-      /* 查询印刷供应商列表 */
-      this.supplierList = [];
-      let url =
-        core_api + "/user/query?rootOrgIdNull=true&roleCode=PRINT_SUPPLIER";
-      if (query && query != "") {
-        url += "&name=" + query;
-      }
-      this.$http.get(url).then(response => {
-        this.supplierList = response.data;
+    cloneStructure(row) {
+      /* 复用考试结构 */
+      console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
       });
     },
-    gotoProjectStatistic(row) {
-      /* 查看项目统计 */
-      let url = "/print/project/statistic/" + row.orgId + "/" + row.examId;
-      this.$router.push({ path: url });
-    },
-    editProjectSetting(row) {
+    removeStructure(row) {
+      /* 删除考试结构 */
       console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
     }
   },
   computed: {
     ...mapState({ user: state => state.user })
   },
   created() {
-    this.searchOrgList();
+    this.loadOrgList();
 
-    this.checkUserRole(this.user);
+    this.loadUserRole(this.user);
 
-    if (this.curUserRole.isSuperLeader) {
-      this.hasPermit = true;
-      this.searchPmList();
-      this.searchSupplierList();
-    } else if (this.curUserRole.isPM) {
+    if (this.curUserRole.isSuperLeader || this.curUserRole.isPM) {
       this.hasPermit = true;
-      this.loadPmInfo(this.user);
-    } else if (this.curUserRole.isSupplier) {
-      this.hasPermit = false;
-      this.loadSupplierInfo(this.user);
     } else {
       this.hasPermit = false;
     }
@@ -293,8 +246,4 @@ export default {
 .page {
   margin-top: 10px;
 }
-
-.el-table th > .cell {
-  text-align: center;
-}
 </style>

+ 23 - 19
src/modules/print/view/Project.vue

@@ -92,7 +92,7 @@
             <el-button
               size="small"
               type="primary"
-              icon="search"
+              icon="el-icon-search"
               @click="searchRecords"
               >查询
             </el-button>
@@ -107,12 +107,12 @@
           style="width:100%;"
           border
         >
-          <el-table-column width="200" label="学校名称" prop="orgName" />
+          <el-table-column width="220" label="学校名称" prop="orgName" />
           <el-table-column label="考试名称" prop="examName" />
           <el-table-column width="200" label="印刷供应商" prop="supplierName" />
           <el-table-column width="150" label="项目经理" prop="pmName" />
 
-          <el-table-column width="100" label="项目统计">
+          <el-table-column width="120" label="项目统计">
             <template slot-scope="scope">
               <a
                 href="javascript:void(0)"
@@ -122,15 +122,15 @@
             </template>
           </el-table-column>
 
-          <el-table-column width="100" label="操作" :context="_self">
+          <el-table-column width="120" label="操作" :context="_self">
             <template slot-scope="scope">
               <el-button
                 size="mini"
                 type="primary"
+                icon="el-icon-setting"
                 @click="editProjectSetting(scope.row);"
                 :disabled="!hasPermit"
-              >
-                <i class="el-icon-edit"></i> 项目设置
+                >项目设置
               </el-button>
             </template>
           </el-table-column>
@@ -152,7 +152,7 @@
 </template>
 
 <script>
-import { core_api, print_api, userRole } from "../constants/constants.js";
+import { print_api, core_api, userRole } from "../constants/constants.js";
 import { mapState } from "vuex";
 
 export default {
@@ -223,7 +223,7 @@ export default {
       this.formSearch.examId = "";
       this.examList = [];
 
-      if (orgId && orgId != "") {
+      if (!this.isEmptyNumber(orgId)) {
         let url = print_api + "/printing/project/exam/list?orgId=" + orgId;
         this.$http.post(url).then(response => {
           this.examList = response.data;
@@ -234,11 +234,12 @@ export default {
       /* 查询项目经理列表 */
       this.pmList = [];
       let url =
-        core_api +
-        "/user/query?rootOrgIdNull=true&roleCode=PRINT_PROJECT_LEADER";
-      if (query && query != "") {
+        core_api + "/user/query?rootOrgCode=qmth&roleCode=PRINT_PROJECT_LEADER";
+
+      if (!this.isEmptyStr(query)) {
         url += "&name=" + query;
       }
+
       this.$http.get(url).then(response => {
         this.pmList = response.data;
       });
@@ -247,10 +248,12 @@ export default {
       /* 查询印刷供应商列表 */
       this.supplierList = [];
       let url =
-        core_api + "/user/query?rootOrgIdNull=true&roleCode=PRINT_SUPPLIER";
-      if (query && query != "") {
+        core_api + "/user/query?rootOrgCode=qmth-print&roleCode=PRINT_SUPPLIER";
+
+      if (!this.isEmptyStr(query)) {
         url += "&name=" + query;
       }
+
       this.$http.get(url).then(response => {
         this.supplierList = response.data;
       });
@@ -261,16 +264,21 @@ export default {
       this.$router.push({ path: url });
     },
     editProjectSetting(row) {
+      /* 项目设置 */
       console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
     }
   },
   computed: {
     ...mapState({ user: state => state.user })
   },
   created() {
-    this.searchOrgList();
+    this.loadOrgList();
 
-    this.checkUserRole(this.user);
+    this.loadUserRole(this.user);
 
     if (this.curUserRole.isSuperLeader) {
       this.hasPermit = true;
@@ -293,8 +301,4 @@ export default {
 .page {
   margin-top: 10px;
 }
-
-.el-table th > .cell {
-  text-align: center;
-}
 </style>

+ 171 - 28
src/modules/print/view/ProjectStatistic.vue

@@ -24,6 +24,7 @@
         >
           <el-form-item label="学校" class="pull-left">
             <el-select
+              :disabled="showGoBack"
               v-model="formSearch.orgId"
               placeholder="请选择"
               filterable
@@ -40,7 +41,11 @@
           </el-form-item>
 
           <el-form-item label="考试" class="pull-left">
-            <el-select v-model="formSearch.examId" placeholder="请选择">
+            <el-select
+              :disabled="showGoBack"
+              v-model="formSearch.examId"
+              placeholder="请选择"
+            >
               <el-option
                 v-for="item in examList"
                 :label="item.examName"
@@ -54,10 +59,38 @@
             <el-button
               size="small"
               type="primary"
-              icon="search"
+              icon="el-icon-search"
               @click="searchRecords"
               >查询
             </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              :disabled="!hasPermit"
+              @click="addOtherSetting"
+              >新增其他事项
+            </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-refresh"
+              :disabled="!hasPermit"
+              v-show="formSearch.examId != ''"
+              @click="refreshStatistic"
+              >刷新
+            </el-button>
+
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-arrow-left"
+              v-show="showGoBack"
+              @click="goBack"
+              >返回
+            </el-button>
           </el-form-item>
         </el-form>
 
@@ -69,27 +102,48 @@
           style="width:100%;"
           border
         >
-          <el-table-column width="100" label="类型" prop="type" />
-          <el-table-column width="100" label="人科次" prop="totalExamStudent" />
+          <el-table-column width="60" label="类型" prop="type" />
+          <el-table-column width="100" label="人科次" prop="totalStudent" />
           <el-table-column width="100" label="课程数量" prop="totalCourse" />
           <el-table-column width="100" label="试卷数量" prop="totalPaper" />
-          <el-table-column width="120" label="印刷数量A3" prop="a3" />
-          <el-table-column width="120" label="印刷数量A3" prop="a4" />
-          <el-table-column width="120" label="总数(A3)" prop="a3Number" />
-          <el-table-column width="100" label="试卷袋数" prop="totalPkg" />
-          <el-table-column width="150" label="事项说明" prop="remark" />
-          <el-table-column width="150" label="印刷供应商" prop="supplierName" />
+          <el-table-column width="100" label="印刷数量A3" prop="A3" />
+          <el-table-column width="100" label="印刷数量A4" prop="A4" />
+          <el-table-column width="100" label="总数(A3)" prop="sumA3" />
+          <el-table-column width="80" label="试卷袋数" prop="totalPkg" />
+          <el-table-column label="事项说明" prop="remark" />
+          <el-table-column width="100" label="印刷供应商" prop="supplierName" />
           <el-table-column width="100" label="项目经理" prop="pmName" />
 
-          <el-table-column width="100" label="操作" :context="_self">
+          <el-table-column width="180" label="操作" :context="_self">
             <template slot-scope="scope">
               <el-button
                 size="mini"
                 type="primary"
+                icon="el-icon-setting"
+                v-if="scope.row.btnType == 'BACKUP'"
                 @click="editBackupSetting(scope.row);"
                 :disabled="!hasPermit"
-              >
-                <i class="el-icon-edit"></i> 备份设置
+                >备份设置
+              </el-button>
+
+              <el-button
+                size="mini"
+                type="primary"
+                icon="el-icon-edit"
+                v-if="scope.row.btnType == 'OTHER'"
+                @click="editOtherSetting(scope.row);"
+                :disabled="!hasPermit"
+                >修改
+              </el-button>
+
+              <el-button
+                size="mini"
+                type="danger"
+                icon="el-icon-delete"
+                v-if="scope.row.btnType == 'OTHER'"
+                @click="removeOtherSetting(scope.row);"
+                :disabled="!hasPermit"
+                >删除
               </el-button>
             </template>
           </el-table-column>
@@ -113,10 +167,11 @@ export default {
       curUserRole: userRole,
       hasPermit: false,
       loading: false,
+      showGoBack: false,
       tableData: [],
+      projectId: "",
       orgList: [],
       examList: [],
-      projectId: "",
       rules: {}
     };
   },
@@ -142,18 +197,15 @@ export default {
       }
 
       this.loading = true;
-
       let url =
-        print_api +
-        "/printing/project/statistic/" +
-        this.formSearch.orgId +
-        "/" +
-        this.formSearch.examId;
+        print_api + "/printing/project/statistic/" + orgId + "/" + examId;
 
       this.$http.post(url, this.formSearch).then(
         response => {
-          this.tableData.push(response.data);
+          this.tableData = [];
           this.projectId = response.data.projectId;
+          this.renderTableColumns(response.data);
+          this.loadOtherSetting(this.projectId);
           this.loading = false;
         },
         error => {
@@ -162,29 +214,124 @@ export default {
         }
       );
     },
+    renderTableColumns(data) {
+      let normalColumn = {
+        type: "常规",
+        A3: data.normalA3,
+        A4: data.normalA4,
+        sumA3: data.summary,
+        totalStudent: data.totalStudent,
+        totalCourse: data.totalCourse,
+        totalPaper: data.totalPaper,
+        totalPkg: data.totalPkg,
+        supplierName: data.supplierName,
+        pmName: data.pmName
+      };
+      this.tableData.push(normalColumn);
+
+      let backupColumn = {
+        type: "备份",
+        A3: data.backupA3,
+        A4: data.backupA4,
+        sumA3: data.backupSummary,
+        btnType: "BACKUP"
+      };
+      this.tableData.push(backupColumn);
+
+      let totalColumn = {
+        type: "合计",
+        A3: data.totalA3,
+        A4: data.totalA4,
+        sumA3: data.totalSummary
+      };
+      this.tableData.push(totalColumn);
+    },
     searchExamList(orgId) {
       /* 查询考试列表 */
       this.formSearch.examId = "";
       this.examList = [];
 
-      if (orgId && orgId != "") {
+      if (!this.isEmptyNumber(orgId)) {
         let url = print_api + "/printing/project/exam/list?orgId=" + orgId;
         this.$http.post(url).then(response => {
           this.examList = response.data;
         });
       }
     },
+    refreshStatistic() {
+      /* 刷新当前统计信息 */
+      console.log(this.projectId);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
     editBackupSetting(row) {
+      /* 备份设置 */
       console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    loadOtherSetting(projectId) {
+      /* 查询其它事项列表 */
+      let url =
+        print_api + "/project/other/setting/list?projectId=" + projectId;
+
+      this.$http.post(url).then(
+        response => {
+          let list = response.data;
+          if (!list || list.length < 1) {
+            return;
+          }
+          for (let obj of list) {
+            obj.type = "其它";
+            obj.btnType = "OTHER";
+            this.tableData.push(obj);
+          }
+        },
+        error => {
+          console.log(error);
+          this.loading = false;
+        }
+      );
+    },
+    addOtherSetting() {
+      /* 新增其它事项 */
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    editOtherSetting(row) {
+      /* 修改某个其它事项 */
+      console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    removeOtherSetting(row) {
+      /* 删除某个其它事项 */
+      console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
+    },
+    goBack() {
+      /* 返回上级界面 */
+      this.$router.push({ path: "/print/project/list" });
     }
   },
   computed: {
     ...mapState({ user: state => state.user })
   },
   created() {
-    this.searchOrgList();
+    this.loadOrgList();
 
-    this.checkUserRole(this.user);
+    this.loadUserRole(this.user);
 
     if (this.curUserRole.isSuperLeader || this.curUserRole.isPM) {
       this.hasPermit = true;
@@ -199,8 +346,4 @@ export default {
 .page {
   margin-top: 10px;
 }
-
-.el-table th > .cell {
-  text-align: center;
-}
 </style>

+ 55 - 130
src/modules/print/view/ProjectTemplate.vue

@@ -50,49 +50,11 @@
             </el-select>
           </el-form-item>
 
-          <el-form-item label="项目经理" class="pull-left">
-            <el-select
-              v-model="formSearch.pmId"
-              placeholder="请选择"
-              filterable
-              clearable
-              remote
-              :remote-method="searchPmList"
-            >
-              <el-option label="请选择" value=""></el-option>
-              <el-option
-                v-for="item in pmList"
-                :label="item.name"
-                :value="item.id"
-                :key="item.id"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-
-          <el-form-item label="印刷供应商" class="pull-left">
-            <el-select
-              v-model="formSearch.supplierId"
-              placeholder="请选择"
-              filterable
-              clearable
-              remote
-              :remote-method="searchSupplierList"
-            >
-              <el-option label="请选择" value=""></el-option>
-              <el-option
-                v-for="item in supplierList"
-                :label="item.name"
-                :value="item.id"
-                :key="item.id"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-
           <el-form-item class="pull-right">
             <el-button
               size="small"
               type="primary"
-              icon="search"
+              icon="el-icon-search"
               @click="searchRecords"
               >查询
             </el-button>
@@ -107,52 +69,49 @@
           style="width:100%;"
           border
         >
-          <el-table-column width="200" label="学校名称" prop="orgName" />
-          <el-table-column label="考试名称" prop="examName" />
-          <el-table-column width="200" label="印刷供应商" prop="supplierName" />
-          <el-table-column width="150" label="项目经理" prop="pmName" />
-
-          <el-table-column width="100" label="项目统计">
+          <el-table-column type="selection" width="55"></el-table-column>
+          <el-table-column label="类别" prop="typeName" />
+          <el-table-column label="上传">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="default"
+                icon="el-icon-upload"
+                @click="upload(scope.row);"
+                >上传
+              </el-button>
+            </template>
+          </el-table-column>
+          <el-table-column label="下载">
             <template slot-scope="scope">
-              <a
-                href="javascript:void(0)"
-                @click="gotoProjectStatistic(scope.row);"
-                >查看
-              </a>
+              <el-button
+                size="mini"
+                type="default"
+                icon="el-icon-download"
+                @click="download(scope.row);"
+                >下载
+              </el-button>
             </template>
           </el-table-column>
-
-          <el-table-column width="100" label="操作" :context="_self">
+          <el-table-column label="预览">
             <template slot-scope="scope">
               <el-button
                 size="mini"
-                type="primary"
-                @click="editProjectSetting(scope.row);"
-                :disabled="!hasPermit"
-              >
-                <i class="el-icon-edit"></i> 项目设置
+                type="default"
+                icon="el-icon-document"
+                @click="preview(scope.row);"
+                >预览
               </el-button>
             </template>
           </el-table-column>
         </el-table>
-
-        <!-- 分页 -->
-        <div class="page pull-left">
-          <el-pagination
-            @current-change="handlePager"
-            :current-page="formSearch.pageNo"
-            :page-size="formSearch.pageSize"
-            :total="totalElements"
-            layout="total, prev, pager, next, jumper"
-          ></el-pagination>
-        </div>
       </div>
     </div>
   </section>
 </template>
 
 <script>
-import { core_api, print_api, userRole } from "../constants/constants.js";
+import { print_api, userRole } from "../constants/constants.js";
 import { mapState } from "vuex";
 
 export default {
@@ -160,34 +119,22 @@ export default {
     return {
       formSearch: {
         orgId: "",
-        examId: "",
-        pmId: "",
-        supplierId: "",
-        pageNo: 1,
-        pageSize: 10
+        examId: ""
       },
       curUserRole: userRole,
       hasPermit: false,
-      totalElements: 0,
       loading: false,
       tableData: [],
       orgList: [],
       examList: [],
-      pmList: [],
-      supplierList: [],
       rules: {}
     };
   },
   methods: {
-    handlePager(current) {
-      /* 处理分页 */
-      this.formSearch.pageNo = current;
-      this.searchRecords();
-    },
     searchRecords() {
       /* 查询记录列表 */
       let orgId = this.formSearch.orgId;
-      if (!orgId || orgId == "") {
+      if (this.isEmptyNumber(orgId)) {
         this.$notify({
           message: "请选择学校!",
           type: "warning"
@@ -196,7 +143,7 @@ export default {
       }
 
       let examId = this.formSearch.examId;
-      if (!examId || examId == "") {
+      if (this.isEmptyNumber(examId)) {
         this.$notify({
           message: "请选择考试!",
           type: "warning"
@@ -205,11 +152,10 @@ export default {
       }
 
       this.loading = true;
-      let url = print_api + "/printing/project/list";
+      let url = print_api + "/project/template/" + orgId + "/" + examId;
       this.$http.post(url, this.formSearch).then(
         response => {
-          this.tableData = response.data.content;
-          this.totalElements = response.data.totalElements;
+          this.tableData = response.data;
           this.loading = false;
         },
         error => {
@@ -223,65 +169,48 @@ export default {
       this.formSearch.examId = "";
       this.examList = [];
 
-      if (orgId && orgId != "") {
+      if (!this.isEmptyNumber(orgId)) {
         let url = print_api + "/printing/project/exam/list?orgId=" + orgId;
         this.$http.post(url).then(response => {
           this.examList = response.data;
         });
       }
     },
-    searchPmList(query) {
-      /* 查询项目经理列表 */
-      this.pmList = [];
-      let url =
-        core_api +
-        "/user/query?rootOrgIdNull=true&roleCode=PRINT_PROJECT_LEADER";
-      if (query && query != "") {
-        url += "&name=" + query;
-      }
-      this.$http.get(url).then(response => {
-        this.pmList = response.data;
+    upload(row) {
+      /* 上传模板 */
+      console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
       });
     },
-    searchSupplierList(query) {
-      /* 查询印刷供应商列表 */
-      this.supplierList = [];
-      let url =
-        core_api + "/user/query?rootOrgIdNull=true&roleCode=PRINT_SUPPLIER";
-      if (query && query != "") {
-        url += "&name=" + query;
-      }
-      this.$http.get(url).then(response => {
-        this.supplierList = response.data;
+    preview(row) {
+      /* 预览模板 */
+      console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
       });
     },
-    gotoProjectStatistic(row) {
-      /* 查看项目统计 */
-      let url = "/print/project/statistic/" + row.orgId + "/" + row.examId;
-      this.$router.push({ path: url });
-    },
-    editProjectSetting(row) {
+    download(row) {
+      /* 下载模板 */
       console.log(row);
+      this.$notify({
+        message: "Todo...",
+        type: "warning"
+      });
     }
   },
   computed: {
     ...mapState({ user: state => state.user })
   },
   created() {
-    this.searchOrgList();
+    this.loadOrgList();
 
-    this.checkUserRole(this.user);
+    this.loadUserRole(this.user);
 
-    if (this.curUserRole.isSuperLeader) {
-      this.hasPermit = true;
-      this.searchPmList();
-      this.searchSupplierList();
-    } else if (this.curUserRole.isPM) {
+    if (this.curUserRole.isSuperLeader || this.curUserRole.isPM) {
       this.hasPermit = true;
-      this.loadPmInfo(this.user);
-    } else if (this.curUserRole.isSupplier) {
-      this.hasPermit = false;
-      this.loadSupplierInfo(this.user);
     } else {
       this.hasPermit = false;
     }
@@ -293,8 +222,4 @@ export default {
 .page {
   margin-top: 10px;
 }
-
-.el-table th > .cell {
-  text-align: center;
-}
 </style>