deason 6 years ago
parent
commit
43a341ae5c
2 changed files with 399 additions and 4 deletions
  1. 101 3
      src/modules/print/constants/constants.js
  2. 298 1
      src/modules/print/view/Project.vue

+ 101 - 3
src/modules/print/constants/constants.js

@@ -1,15 +1,113 @@
+import Vue from "vue";
+
 export const core_api = "/api/ecs_core";
 export const exam_work_api = "/api/ecs_exam_work";
 export const question_api = "/api/ecs_ques";
 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 groupTypeList = [
-  { value: "LEARN_CENTER", label: "学习中心" },
-  { value: "EXAM_SITE", 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.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;
+    }
+  }
+  console.log("userRole:", userRole);
+};
+
+export const userRole = {
+  /* 是否为印刷总负责人 */
+  isSuperLeader: false,
+  /* 是否为项目经理 */
+  isPM: false,
+  /* 是否为印刷供应商 */
+  isSupplier: false,
+  /* 是否为印刷学校管理员 */
+  isSchoolLeader: false,
+  /* 其它 */
+  isOther: false
+};
+
+Vue.prototype.loadPmInfo = function(user) {
+  this.pmList = [];
+  this.pmList.push({ id: user.userId, name: user.displayName });
+};
+
+Vue.prototype.loadSupplierInfo = function(user) {
+  this.supplierList = [];
+  this.supplierList.push({ id: user.userId, name: user.displayName });
+};
+
+Vue.prototype.searchOrgList = function() {
+  var url = print_api + "/printing/project/org/list";
+  this.$http.post(url).then(
+    response => {
+      this.orgList = response.data;
+    },
+    error => {
+      console.log(error);
+    }
+  );
+};

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

@@ -1,3 +1,300 @@
 <template>
-  <div><h1>todo 项目列表</h1></div>
+  <section class="content" style="margin-top: -18px;">
+    <div class="box box-info">
+      <!-- 头信息 -->
+      <div
+        class="box-header with-border"
+        style="background-color:#d3dce6;margin-bottom:20px;"
+      >
+        <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
+          :model="formSearch"
+          :inline="true"
+          label-position="right"
+          label-width="100px"
+        >
+          <el-form-item label="学校" class="pull-left">
+            <el-select
+              v-model="formSearch.orgId"
+              placeholder="请选择"
+              filterable
+              clearable
+              @change="searchExamList(formSearch.orgId);"
+            >
+              <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="考试" class="pull-left">
+            <el-select v-model="formSearch.examId" placeholder="请选择">
+              <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="项目经理" 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"
+              @click="searchRecords"
+              >查询
+            </el-button>
+          </el-form-item>
+        </el-form>
+
+        <!-- 数据列表 -->
+        <el-table
+          v-loading="loading"
+          :data="tableData"
+          element-loading-text="数据加载中"
+          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="项目统计">
+            <template slot-scope="scope">
+              <a
+                href="javascript:void(0)"
+                @click="gotoProjectStatistic(scope.row);"
+                >查看
+              </a>
+            </template>
+          </el-table-column>
+
+          <el-table-column width="100" 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> 项目设置
+              </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 { mapState } from "vuex";
+
+export default {
+  data() {
+    return {
+      formSearch: {
+        orgId: "",
+        examId: "",
+        pmId: "",
+        supplierId: "",
+        pageNo: 1,
+        pageSize: 10
+      },
+      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 == "") {
+        this.$notify({
+          message: "请选择学校!",
+          type: "warning"
+        });
+        return;
+      }
+
+      let examId = this.formSearch.examId;
+      if (!examId || examId == "") {
+        this.$notify({
+          message: "请选择考试!",
+          type: "warning"
+        });
+        return;
+      }
+
+      this.loading = true;
+      let url = print_api + "/printing/project/list";
+      this.$http.post(url, this.formSearch).then(
+        response => {
+          this.tableData = response.data.content;
+          this.totalElements = response.data.totalElements;
+          this.loading = false;
+        },
+        error => {
+          console.log(error);
+          this.loading = false;
+        }
+      );
+    },
+    searchExamList(orgId) {
+      /* 查询考试列表 */
+      this.formSearch.examId = "";
+      this.examList = [];
+
+      if (orgId && 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;
+      });
+    },
+    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;
+      });
+    },
+    gotoProjectStatistic(row) {
+      /* 查看项目统计 */
+      let url = "/print/project/statistic/" + row.orgId + "/" + row.examId;
+      this.$router.push({ path: url });
+    },
+    editProjectSetting(row) {
+      console.log(row);
+    }
+  },
+  computed: {
+    ...mapState({ user: state => state.user })
+  },
+  created() {
+    this.searchOrgList();
+
+    this.checkUserRole(this.user);
+
+    if (this.curUserRole.isSuperLeader) {
+      this.hasPermit = true;
+      this.searchPmList();
+      this.searchSupplierList();
+    } else if (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;
+    }
+  }
+};
+</script>
+
+<style scoped>
+.page {
+  margin-top: 10px;
+}
+
+.el-table th > .cell {
+  text-align: center;
+}
+</style>