zhangjie 3 years ago
parent
commit
54da9469e6

+ 119 - 119
src/main.js

@@ -1,119 +1,119 @@
-import Vue from "vue";
-import axios from "axios";
-
-import App from "./App.vue";
-import router from "./routers";
-import store from "./store";
-import GLOBAL from "./config";
-import globalVuePlugins from "./plugins/globalVuePlugins";
-
-// https://github.com/RobinCK/vue-ls
-import VueLocalStorage from "vue-ls";
-import ViewUI from "view-design";
-// import "view-design/dist/styles/iview.css";
-import "./assets/styles/index.less";
-// regist v-chart
-import "./plugins/VueCharts";
-
-import { checkRouterValid } from "./constants/authority";
-
-Vue.use(ViewUI);
-ViewUI.Message.config({
-  duration: 3
-});
-ViewUI.Notice.config({
-  duration: 3
-});
-Vue.use(VueLocalStorage, { storage: "session" });
-Vue.use(globalVuePlugins);
-
-Vue.prototype.GLOBAL = GLOBAL;
-
-Vue.config.productionTip = false;
-
-// route interceptor
-router.beforeEach((to, from, next) => {
-  const user = Vue.ls.get("user");
-  if (to.meta.noRequire) {
-    // 不需要登录的页面
-    next();
-  } else {
-    // 需要登录的路由
-    if (user && checkRouterValid(user["role"], to.name)) {
-      next();
-    } else {
-      ViewUI.Notice.error({ title: "错误提示", desc: "权限失效!" });
-      // 登录失效的处理
-      Vue.ls.clear();
-      next({ name: "Login" });
-    }
-  }
-});
-
-// axios interceptors
-var load = "";
-// 同一时间有多个请求时,会形成队列。在第一个请求创建loading,在最后一个响应关闭loading
-var queue = [];
-axios.interceptors.request.use(
-  config => {
-    // 显示loading提示
-    if (!queue.length) {
-      load = ViewUI.Message.loading({
-        content: "Loading...",
-        duration: 0
-      });
-    }
-
-    queue.push(1);
-
-    // 为请求地址添加全局domain
-    if (config.url.indexOf("http://") < 0) {
-      config.url = GLOBAL.domain + config.url;
-    }
-
-    // 为请求头添加token信息
-    const user = Vue.ls.get("user", {});
-    if (user) {
-      config.headers["userId"] = user.id;
-      config.headers["workId"] = user.workId;
-      config.headers["Authorization"] = user.token;
-    }
-
-    // 设置延迟时效
-    config.timeout = GLOBAL.timeout;
-    return config;
-  },
-  error => {
-    // 关闭loading提示
-    // 继发请求,延时处理是为防止出现多个loading实例。
-    setTimeout(() => {
-      queue.shift();
-      if (!queue.length) load();
-    }, 100);
-    return Promise.reject(error);
-  }
-);
-axios.interceptors.response.use(
-  response => {
-    // 关闭loading提示
-    setTimeout(() => {
-      queue.shift();
-      if (!queue.length) load();
-    }, 100);
-    return response;
-  },
-  error => {
-    // 关闭loading提示
-    setTimeout(() => {
-      queue.shift();
-      if (!queue.length) load();
-    }, 100);
-    return Promise.reject(error);
-  }
-);
-
-new Vue({
-  router,
-  store,
-  render: h => h(App)
-}).$mount("#app");
+import Vue from "vue";
+import axios from "axios";
+
+import App from "./App.vue";
+import router from "./routers";
+import store from "./store";
+import GLOBAL from "./config";
+import globalVuePlugins from "./plugins/globalVuePlugins";
+
+// https://github.com/RobinCK/vue-ls
+import VueLocalStorage from "vue-ls";
+import ViewUI from "view-design";
+// import "view-design/dist/styles/iview.css";
+import "./assets/styles/index.less";
+// regist v-chart
+import "./plugins/VueCharts";
+
+import { checkRouterValid } from "./constants/authority";
+
+Vue.use(ViewUI);
+ViewUI.Message.config({
+  duration: 3
+});
+ViewUI.Notice.config({
+  duration: 3
+});
+Vue.use(VueLocalStorage, { storage: "session" });
+Vue.use(globalVuePlugins);
+
+Vue.prototype.GLOBAL = GLOBAL;
+
+Vue.config.productionTip = false;
+
+// route interceptor
+router.beforeEach((to, from, next) => {
+  const user = Vue.ls.get("user");
+  if (to.meta.noRequire) {
+    // 不需要登录的页面
+    next();
+  } else {
+    // 需要登录的路由
+    if (user && checkRouterValid(user["role"], to.name)) {
+      next();
+    } else {
+      ViewUI.Notice.error({ title: "错误提示", desc: "权限失效!" });
+      // 登录失效的处理
+      Vue.ls.clear();
+      next({ name: "Login" });
+    }
+  }
+});
+
+// axios interceptors
+var load = "";
+// 同一时间有多个请求时,会形成队列。在第一个请求创建loading,在最后一个响应关闭loading
+var queue = [];
+axios.interceptors.request.use(
+  config => {
+    // 显示loading提示
+    if (!queue.length && !config.hideLoad) {
+      load = ViewUI.Message.loading({
+        content: "Loading...",
+        duration: 0
+      });
+    }
+
+    queue.push(1);
+
+    // 为请求地址添加全局domain
+    if (config.url.indexOf("http://") < 0) {
+      config.url = GLOBAL.domain + config.url;
+    }
+
+    // 为请求头添加token信息
+    const user = Vue.ls.get("user", {});
+    if (user) {
+      config.headers["userId"] = user.id;
+      config.headers["workId"] = user.workId;
+      config.headers["Authorization"] = user.token;
+    }
+
+    // 设置延迟时效
+    config.timeout = GLOBAL.timeout;
+    return config;
+  },
+  error => {
+    // 关闭loading提示
+    // 继发请求,延时处理是为防止出现多个loading实例。
+    setTimeout(() => {
+      queue.shift();
+      if (!queue.length) load();
+    }, 100);
+    return Promise.reject(error);
+  }
+);
+axios.interceptors.response.use(
+  response => {
+    // 关闭loading提示
+    setTimeout(() => {
+      queue.shift();
+      if (!queue.length) load();
+    }, 100);
+    return response;
+  },
+  error => {
+    // 关闭loading提示
+    setTimeout(() => {
+      queue.shift();
+      if (!queue.length) load();
+    }, 100);
+    return Promise.reject(error);
+  }
+);
+
+new Vue({
+  router,
+  store,
+  render: h => h(App)
+}).$mount("#app");

+ 333 - 336
src/modules/grading/GradingProgress.vue

@@ -1,336 +1,333 @@
-<template>
-  <div class="grading-progress">
-    <div class="part-box-head" v-if="IS_ADMIN">
-      <div class="part-box-head-right">
-        <Button
-          type="error"
-          shape="circle"
-          icon="area icon"
-          @click="toCleanData"
-          v-if="showClearDataBtn"
-          >清除当前阅卷数据</Button
-        >
-        <Button
-          type="success"
-          shape="circle"
-          icon="recode-white icon"
-          @click="toGrading"
-          v-if="showGradingBtn"
-          >正评任务创建</Button
-        >
-        <Button
-          type="warning"
-          shape="circle"
-          icon="recode-white icon"
-          @click="toTryGrading"
-          v-if="showTryGradingBtn"
-          >试评任务创建</Button
-        >
-        <Button shape="circle" @click="toMark" v-if="showMarkBtn"
-          >进入打分阶段
-          <Icon type="arrow-right-long icon" style="margin-left:8px;" />
-        </Button>
-      </div>
-      <div class="part-box-head-left" v-if="IS_LEVEL">
-        <Button shape="circle" icon="md-download" @click="toExportStandard"
-          >导出标准卷信息</Button
-        >
-        <Button shape="circle" icon="md-download" @click="toExportGrading"
-          >导出一键定档信息</Button
-        >
-      </div>
-      <div v-if="IS_SCORE" class="part-box-head-left">
-        <Button shape="circle" icon="md-download" @click="toExportChangeLevel"
-          >导出改档信息</Button
-        >
-      </div>
-    </div>
-    <Row :gutter="20" type="flex">
-      <Col span="12">
-        <div class="part-box progress-table">
-          <table class="table table-noborder">
-            <tr v-for="(item, aindex) in areaProgress" :key="aindex">
-              <td>{{ item.areaName }}</td>
-              <td>
-                <progress-line
-                  :sum="item.totalCount"
-                  :current="item.successCount"
-                ></progress-line>
-              </td>
-              <td>进度:{{ item.progress }}%</td>
-              <td></td>
-            </tr>
-          </table>
-        </div>
-      </Col>
-      <Col span="12">
-        <div class="part-box progress-table">
-          <table
-            class="table table-noborder kzz-table"
-            v-if="kzzInfo.length && IS_LEVEL"
-          >
-            <tr v-for="kzz in kzzInfo" :key="kzz.loginName">
-              <td>{{ kzz.loginName }}</td>
-              <td style="text-align:left">仲裁:{{ kzz.arbitrated }}</td>
-            </tr>
-          </table>
-
-          <div v-for="(group, index) in groupMarkers" :key="index">
-            <table v-if="IS_LEVEL" class="table table-noborder kzz-table">
-              <tr v-for="kzz in group.kzzProgress" :key="kzz.loginName">
-                <td>{{ kzz.loginName }}</td>
-                <td colspan="3" style="text-align:left">
-                  仲裁:{{ kzz.arbitrated }}
-                </td>
-              </tr>
-              <tr v-for="(item, aindex) in group.markerProgress" :key="aindex">
-                <td>{{ item.loginName }}</td>
-                <td>
-                  <progress-line
-                    :sum="item.totalCount"
-                    :current="item.successCount"
-                  ></progress-line>
-                </td>
-                <td>进度:{{ item.progress }}%</td>
-                <td>打回:{{ item.rejectedCount }}</td>
-              </tr>
-            </table>
-
-            <table v-if="IS_SCORE" class="table table-noborder kzz-table">
-              <tr v-for="kzz in group.kzzProgress" :key="kzz.loginName">
-                <td>{{ kzz.loginName }}</td>
-                <td colspan="3"></td>
-              </tr>
-              <tr v-for="(item, aindex) in group.markerProgress" :key="aindex">
-                <td>{{ item.loginName }}</td>
-                <td>
-                  <progress-line
-                    :sum="item.totalCount"
-                    :current="item.successCount"
-                  ></progress-line>
-                </td>
-                <td>进度:{{ item.progress }}%</td>
-                <td>改档:{{ item.shiftCount }}</td>
-                <td>改档打分:{{ item.shiftScoreCount }}</td>
-              </tr>
-            </table>
-          </div>
-        </div>
-      </Col>
-    </Row>
-
-    <!-- clean-grading-data-dialog -->
-    <clean-grading-data-dialog
-      :cur-subject="curSubject"
-      @modified="initData"
-      ref="CleanGradingDataDialog"
-    ></clean-grading-data-dialog>
-    <!-- modify-unformal-grading-task -->
-    <modify-unformal-grading-task
-      :cur-subject="curSubject"
-      @modified="taskSubmitSuccess"
-      ref="ModifyUnformalGradingTask"
-      v-if="curSubject.id"
-    ></modify-unformal-grading-task>
-    <!-- modify-formal-grading-task -->
-    <modify-formal-grading-task
-      :subject-id="subjectId"
-      @modified="taskSubmitSuccess"
-      ref="ModifyFormalGradingTask"
-    ></modify-formal-grading-task>
-  </div>
-</template>
-
-<script>
-import ProgressLine from "./components/ProgressLine";
-import ModifyUnformalGradingTask from "./components/ModifyUnformalGradingTask";
-import ModifyFormalGradingTask from "./components/ModifyFormalGradingTask";
-import CleanGradingDataDialog from "./components/CleanGradingDataDialog";
-import {
-  gradingProgressDetail,
-  subjectDetail,
-  gotoScoreStep,
-  getParamsSet
-} from "@/api";
-import { SUBJECT_STAGE } from "@/constants/enumerate";
-
-export default {
-  name: "grading-progress",
-  components: {
-    ProgressLine,
-    ModifyUnformalGradingTask,
-    ModifyFormalGradingTask,
-    CleanGradingDataDialog
-  },
-  data() {
-    return {
-      subjectId: this.$route.params.subjectId,
-      workId: this.$route.params.workId,
-      paramsSet: {},
-      curSubject: {},
-      SUBJECT_STAGE,
-      kzzInfo: [],
-      totalProgress: {},
-      areaProgress: [],
-      groupMarkers: [],
-      curUserRoleType: ""
-    };
-  },
-  computed: {
-    showClearDataBtn() {
-      return this.paramsSet.clearData && (this.IS_LEVEL || this.IS_SCORE);
-    },
-    showGradingBtn() {
-      // 采集时已知档位,则不显示正评任务按钮
-      if (this.paramsSet.paperStage) return false;
-
-      return (
-        (this.curSubject.stage == "INIT" &&
-          this.curSubject.test !== 2 &&
-          !this.curSubject.formal &&
-          this.totalProgress.progress > 0) ||
-        (this.curSubject.stage == "LEVEL" &&
-          this.totalProgress.progress !== 100 &&
-          this.curSubject.test === 0 &&
-          this.curSubject.formal)
-      );
-    },
-    showTryGradingBtn() {
-      // 采集时已知档位,则不显示试评任务按钮
-      if (this.paramsSet.paperStage) return false;
-
-      return (
-        (this.curSubject.stage == "INIT" &&
-          this.curSubject.test !== 2 &&
-          !this.curSubject.formal &&
-          this.totalProgress.progress > 0) ||
-        (this.curSubject.stage == "LEVEL" && this.curSubject.test === 2)
-      );
-    },
-    showMarkBtn() {
-      // 采集时已知档位,分档阶段则可直接进入打分
-      if (this.paramsSet.paperStage) return this.curSubject.stage == "LEVEL";
-
-      // 若不知档位,则必须分档进度为100时,才能进入打分
-      return (
-        (this.curSubject.stage == "LEVEL" &&
-          this.totalProgress.progress === 100) ||
-        (this.curSubject.stage == "SCORE" && !this.curSubject.allLevel)
-      );
-    },
-    IS_ADMIN() {
-      return this.curUserRoleType === "ADMIN";
-    },
-    IS_MARK_LEADER() {
-      return this.curUserRoleType === "MARK_LEADER";
-    },
-    IS_LEVEL() {
-      return this.curSubject.stage === "LEVEL";
-    },
-    IS_SCORE() {
-      return this.curSubject.stage === "SCORE";
-    }
-  },
-  mounted() {
-    this.curUserRoleType = this.$ls.get("user", { role: "" }).role;
-    this.initData();
-  },
-  methods: {
-    async initData() {
-      await this.getSubjectDetail();
-      this.getParamsSetInfo();
-      this.getProgressDetail();
-    },
-    async getParamsSetInfo() {
-      this.paramsSet = await getParamsSet(this.workId);
-    },
-    async getProgressDetail() {
-      const data = await gradingProgressDetail({
-        workId: this.curSubject.workId,
-        subject: this.curSubject.subject
-      });
-      this.kzzInfo = data.kzz || {};
-      this.totalProgress = data.totalProgress;
-      const totalInfo = {
-        successCount: data.totalProgress.successCount,
-        totalCount: data.totalProgress.totalCount,
-        progress: data.totalProgress.progress.toFixed(2),
-        areaName: "总体进度"
-      };
-      if (this.curSubject.stage === "INIT") {
-        this.areaProgress = [totalInfo];
-        this.groupMarkers = [];
-      } else {
-        this.areaProgress = [totalInfo, ...this.addProgress(data.areaProgress)];
-        this.groupMarkers = data.groupMarkers.map(group => {
-          group.markerProgress = this.addProgress(group.markerProgress);
-          return group;
-        });
-      }
-      this.$parent.setProgress &&
-        this.$parent.setProgress(data.totalProgress.progress);
-    },
-    addProgress(data) {
-      return data.map(item => {
-        item.successCount = item.totalCount - item.leftCount;
-        item.progress = item.totalCount
-          ? ((100 * item.successCount) / item.totalCount).toFixed(2)
-          : "0.00";
-        return item;
-      });
-    },
-    async getSubjectDetail() {
-      this.curSubject = await subjectDetail(this.subjectId);
-    },
-    toCleanData() {
-      this.$refs.CleanGradingDataDialog.open();
-    },
-    toGrading() {
-      this.$refs.ModifyFormalGradingTask.open();
-    },
-    toTryGrading() {
-      this.$refs.ModifyUnformalGradingTask.open();
-    },
-    toMark() {
-      this.$Modal.confirm({
-        content: "确定要进入打分阶段吗?",
-        onOk: async () => {
-          await gotoScoreStep(this.subjectId);
-          this.$router.replace({
-            name: "Mark",
-            params: {
-              workId: this.curSubject.workId,
-              subjectId: this.subjectId
-            }
-          });
-        }
-      });
-    },
-    taskSubmitSuccess() {
-      this.$parent.initData();
-      this.initData();
-    },
-    toExportStandard() {
-      window.open(
-        this.urlAddAuthor(
-          `${this.GLOBAL.domain}/api/export/paper/${this.curSubject.workId}/${this.curSubject.subject}/sample`
-        )
-      );
-    },
-    toExportGrading() {
-      window.open(
-        this.urlAddAuthor(
-          `${this.GLOBAL.domain}/api/export/paper/${this.curSubject.workId}/${this.curSubject.subject}/oneClick`
-        )
-      );
-    },
-    toExportChangeLevel() {
-      window.open(
-        this.urlAddAuthor(
-          `${this.GLOBAL.domain}/api/export/paper/${this.curSubject.workId}/${this.curSubject.subject}/changeLevel`
-        )
-      );
-    }
-  }
-};
-</script>
+<template>
+  <div class="grading-progress">
+    <div class="part-box-head" v-if="IS_ADMIN">
+      <div class="part-box-head-left" v-if="IS_LEVEL">
+        <Button shape="circle" icon="md-download" @click="toExportStandard"
+          >导出标准卷信息</Button
+        >
+        <Button shape="circle" icon="md-download" @click="toExportGrading"
+          >导出一键定档信息</Button
+        >
+      </div>
+      <div v-if="IS_SCORE" class="part-box-head-left">
+        <Button shape="circle" icon="md-download" @click="toExportChangeLevel"
+          >导出改档信息</Button
+        >
+      </div>
+      <div class="part-box-head-right">
+        <Button
+          type="error"
+          shape="circle"
+          icon="area icon"
+          @click="toCleanData"
+          v-if="showClearDataBtn"
+          >清除当前阅卷数据</Button
+        >
+        <Button
+          type="success"
+          shape="circle"
+          icon="recode-white icon"
+          @click="toGrading"
+          v-if="showGradingBtn"
+          >正评任务创建</Button
+        >
+        <Button
+          type="warning"
+          shape="circle"
+          icon="recode-white icon"
+          @click="toTryGrading"
+          v-if="showTryGradingBtn"
+          >试评任务创建</Button
+        >
+        <Button shape="circle" @click="toMark" v-if="showMarkBtn"
+          >进入打分阶段
+          <Icon type="arrow-right-long icon" style="margin-left:8px;" />
+        </Button>
+      </div>
+    </div>
+    <Row :gutter="20" type="flex">
+      <Col span="12">
+        <div class="part-box progress-table">
+          <table class="table table-noborder">
+            <tr v-for="(item, aindex) in areaProgress" :key="aindex">
+              <td>{{ item.areaName }}</td>
+              <td>
+                <progress-line
+                  :sum="item.totalCount"
+                  :current="item.successCount"
+                ></progress-line>
+              </td>
+              <td>进度:{{ item.progress }}%</td>
+              <td></td>
+            </tr>
+          </table>
+        </div>
+      </Col>
+      <Col span="12">
+        <div class="part-box progress-table">
+          <table
+            class="table table-noborder kzz-table"
+            v-if="kzzInfo.length && IS_LEVEL"
+          >
+            <tr v-for="kzz in kzzInfo" :key="kzz.loginName">
+              <td>{{ kzz.loginName }}</td>
+              <td style="text-align:left">仲裁:{{ kzz.arbitrated }}</td>
+            </tr>
+          </table>
+
+          <div v-for="(group, index) in groupMarkers" :key="index">
+            <table v-if="IS_LEVEL" class="table table-noborder kzz-table">
+              <tr v-for="kzz in group.kzzProgress" :key="kzz.loginName">
+                <td>{{ kzz.loginName }}</td>
+                <td colspan="3" style="text-align:left">
+                  仲裁:{{ kzz.arbitrated }}
+                </td>
+              </tr>
+              <tr v-for="(item, aindex) in group.markerProgress" :key="aindex">
+                <td>{{ item.loginName }}</td>
+                <td>
+                  <progress-line
+                    :sum="item.totalCount"
+                    :current="item.successCount"
+                  ></progress-line>
+                </td>
+                <td>进度:{{ item.progress }}%</td>
+                <td>打回:{{ item.rejectedCount }}</td>
+              </tr>
+            </table>
+
+            <table v-if="IS_SCORE" class="table table-noborder kzz-table">
+              <tr v-for="kzz in group.kzzProgress" :key="kzz.loginName">
+                <td>{{ kzz.loginName }}</td>
+                <td colspan="3"></td>
+              </tr>
+              <tr v-for="(item, aindex) in group.markerProgress" :key="aindex">
+                <td>{{ item.loginName }}</td>
+                <td>
+                  <progress-line
+                    :sum="item.totalCount"
+                    :current="item.successCount"
+                  ></progress-line>
+                </td>
+                <td>进度:{{ item.progress }}%</td>
+                <td>改档:{{ item.shiftCount }}</td>
+                <td>改档打分:{{ item.shiftScoreCount }}</td>
+              </tr>
+            </table>
+          </div>
+        </div>
+      </Col>
+    </Row>
+
+    <!-- clean-grading-data-dialog -->
+    <clean-grading-data-dialog
+      :cur-subject="curSubject"
+      @modified="initData"
+      ref="CleanGradingDataDialog"
+    ></clean-grading-data-dialog>
+    <!-- modify-unformal-grading-task -->
+    <modify-unformal-grading-task
+      :cur-subject="curSubject"
+      @modified="taskSubmitSuccess"
+      ref="ModifyUnformalGradingTask"
+      v-if="curSubject.id"
+    ></modify-unformal-grading-task>
+    <!-- modify-formal-grading-task -->
+    <modify-formal-grading-task
+      :subject-id="subjectId"
+      @modified="taskSubmitSuccess"
+      ref="ModifyFormalGradingTask"
+    ></modify-formal-grading-task>
+  </div>
+</template>
+
+<script>
+import ProgressLine from "./components/ProgressLine";
+import ModifyUnformalGradingTask from "./components/ModifyUnformalGradingTask";
+import ModifyFormalGradingTask from "./components/ModifyFormalGradingTask";
+import CleanGradingDataDialog from "./components/CleanGradingDataDialog";
+import {
+  gradingProgressDetail,
+  subjectDetail,
+  gotoScoreStep,
+  getParamsSet
+} from "@/api";
+import { SUBJECT_STAGE } from "@/constants/enumerate";
+
+export default {
+  name: "grading-progress",
+  components: {
+    ProgressLine,
+    ModifyUnformalGradingTask,
+    ModifyFormalGradingTask,
+    CleanGradingDataDialog
+  },
+  data() {
+    return {
+      subjectId: this.$route.params.subjectId,
+      workId: this.$route.params.workId,
+      paramsSet: {},
+      curSubject: {},
+      SUBJECT_STAGE,
+      kzzInfo: [],
+      totalProgress: {},
+      areaProgress: [],
+      groupMarkers: [],
+      curUserRoleType: ""
+    };
+  },
+  computed: {
+    showClearDataBtn() {
+      return this.paramsSet.clearData && (this.IS_LEVEL || this.IS_SCORE);
+    },
+    showGradingBtn() {
+      // 采集时已知档位,则不显示正评任务按钮
+      if (this.paramsSet.paperStage) return false;
+
+      return (
+        (this.curSubject.stage == "INIT" &&
+          this.curSubject.test !== 2 &&
+          this.totalProgress.progress > 0) ||
+        (this.curSubject.stage == "LEVEL" &&
+          this.totalProgress.progress !== 100 &&
+          this.curSubject.test === 0)
+      );
+    },
+    showTryGradingBtn() {
+      // 采集时已知档位,则不显示试评任务按钮
+      if (this.paramsSet.paperStage) return false;
+
+      return (
+        (this.curSubject.stage == "INIT" &&
+          this.curSubject.test !== 2 &&
+          this.totalProgress.progress > 0) ||
+        (this.curSubject.stage == "LEVEL" && this.curSubject.test === 2)
+      );
+    },
+    showMarkBtn() {
+      // 采集时已知档位,分档阶段则可直接进入打分
+      if (this.paramsSet.paperStage) return this.curSubject.stage == "LEVEL";
+
+      // 若不知档位,则必须分档进度为100时,才能进入打分
+      return (
+        (this.curSubject.stage == "LEVEL" &&
+          this.totalProgress.progress === 100) ||
+        (this.curSubject.stage == "SCORE" && !this.curSubject.allLevel)
+      );
+    },
+    IS_ADMIN() {
+      return this.curUserRoleType === "ADMIN";
+    },
+    IS_MARK_LEADER() {
+      return this.curUserRoleType === "MARK_LEADER";
+    },
+    IS_LEVEL() {
+      return this.curSubject.stage === "LEVEL";
+    },
+    IS_SCORE() {
+      return this.curSubject.stage === "SCORE";
+    }
+  },
+  mounted() {
+    this.curUserRoleType = this.$ls.get("user", { role: "" }).role;
+    this.initData();
+  },
+  methods: {
+    async initData() {
+      await this.getSubjectDetail();
+      this.getParamsSetInfo();
+      this.getProgressDetail();
+    },
+    async getParamsSetInfo() {
+      this.paramsSet = await getParamsSet(this.workId);
+    },
+    async getProgressDetail() {
+      const data = await gradingProgressDetail({
+        workId: this.curSubject.workId,
+        subject: this.curSubject.subject
+      });
+      this.kzzInfo = data.kzz || {};
+      this.totalProgress = data.totalProgress;
+      const totalInfo = {
+        successCount: data.totalProgress.successCount,
+        totalCount: data.totalProgress.totalCount,
+        progress: data.totalProgress.progress.toFixed(2),
+        areaName: "总体进度"
+      };
+      if (this.curSubject.stage === "INIT") {
+        this.areaProgress = [totalInfo];
+        this.groupMarkers = [];
+      } else {
+        this.areaProgress = [totalInfo, ...this.addProgress(data.areaProgress)];
+        this.groupMarkers = data.groupMarkers.map(group => {
+          group.markerProgress = this.addProgress(group.markerProgress);
+          return group;
+        });
+      }
+      this.$parent.setProgress &&
+        this.$parent.setProgress(data.totalProgress.progress);
+    },
+    addProgress(data) {
+      return data.map(item => {
+        item.successCount = item.totalCount - item.leftCount;
+        item.progress = item.totalCount
+          ? ((100 * item.successCount) / item.totalCount).toFixed(2)
+          : "0.00";
+        return item;
+      });
+    },
+    async getSubjectDetail() {
+      this.curSubject = await subjectDetail(this.subjectId);
+    },
+    toCleanData() {
+      this.$refs.CleanGradingDataDialog.open();
+    },
+    toGrading() {
+      this.$refs.ModifyFormalGradingTask.open();
+    },
+    toTryGrading() {
+      this.$refs.ModifyUnformalGradingTask.open();
+    },
+    toMark() {
+      this.$Modal.confirm({
+        content: "确定要进入打分阶段吗?",
+        onOk: async () => {
+          await gotoScoreStep(this.subjectId);
+          this.$router.replace({
+            name: "Mark",
+            params: {
+              workId: this.curSubject.workId,
+              subjectId: this.subjectId
+            }
+          });
+        }
+      });
+    },
+    taskSubmitSuccess() {
+      this.$parent.initData();
+      this.initData();
+    },
+    toExportStandard() {
+      window.open(
+        this.urlAddAuthor(
+          `${this.GLOBAL.domain}/api/export/paper/${this.curSubject.workId}/${this.curSubject.subject}/sample`
+        )
+      );
+    },
+    toExportGrading() {
+      window.open(
+        this.urlAddAuthor(
+          `${this.GLOBAL.domain}/api/export/paper/${this.curSubject.workId}/${this.curSubject.subject}/oneClick`
+        )
+      );
+    },
+    toExportChangeLevel() {
+      window.open(
+        this.urlAddAuthor(
+          `${this.GLOBAL.domain}/api/export/paper/${this.curSubject.workId}/${this.curSubject.subject}/changeLevel`
+        )
+      );
+    }
+  }
+};
+</script>

+ 39 - 6
src/modules/main/CheckData.vue

@@ -32,11 +32,10 @@
               >开始</Button
             >
             <Button
-              v-if="!nodetailCheckItems.includes(citem.checkItem)"
               size="small"
               type="primary"
               :loading="loading"
-              :disabled="!citem.result && !citem.content"
+              :disabled="!citem.content"
               @click="toView(citem)"
               >详情</Button
             >
@@ -45,6 +44,16 @@
       </table>
     </div>
 
+    <div class="text-center">
+      <Button
+        size="small"
+        type="primary"
+        :disabled="fetching"
+        @click="getCheckDataInfo(false)"
+        >刷新</Button
+      >
+    </div>
+
     <!-- CheckDataResult -->
     <CheckDataResult ref="CheckDataResult" :content="curCheckItemContent" />
   </div>
@@ -53,17 +62,19 @@
 <script>
 import { checkDataList, dataItemCheck } from "@/api";
 import CheckDataResult from "./components/CheckDataResult.vue";
+import timeMixin from "../../plugins/timeMixin";
 
 export default {
   name: "check-data",
   components: { CheckDataResult },
+  mixins: [timeMixin],
   data() {
     return {
       workId: this.$route.params && this.$route.params.workId,
       checkItemInfo: [],
       paramCheckItems: ["LEVEL_DIFF", "SCORE_DIFF"],
-      nodetailCheckItems: ["PAPER_SIZE", "ALL_SCORE"],
       loading: false,
+      fetching: false,
       curCheckItemContent: []
     };
   },
@@ -71,6 +82,9 @@ export default {
     this.initCheckDataInfo();
     this.getCheckDataInfo();
   },
+  beforeDestroy() {
+    this.clearSetTs();
+  },
   methods: {
     initCheckDataInfo() {
       const checkItems = [
@@ -101,7 +115,11 @@ export default {
       this.checkItemInfo = checkItemInfo;
     },
     async getCheckDataInfo() {
-      const res = await checkDataList(this.workId);
+      this.clearSetTs();
+      if (this.fetching) return;
+      this.fetching = true;
+      const res = await checkDataList(this.workId).catch(() => {});
+      this.fetching = false;
       const data = res || [];
       const checkItemInfoMap = {};
       data.forEach(item => {
@@ -111,13 +129,28 @@ export default {
       this.checkItemInfo = this.checkItemInfo.map(item => {
         return Object.assign({}, item, checkItemInfoMap[item.checkItem]);
       });
+      const hasRunningTask = this.checkItemInfo.some(
+        item => item.status === "RUNNING"
+      );
+      if (hasRunningTask) {
+        this.addSetTime(() => {
+          this.getCheckDataInfo(true);
+        }, 5 * 1000);
+      }
     },
     resultStr(val) {
       if (val === null) return "--";
-      return val ? "成功" : "失败";
+      return val ? "通过" : "不通过";
     },
     toView(row) {
-      this.curCheckItemContent = row.content;
+      if (["PAPER_SIZE", "ALL_SCORE"].includes(row.checkItem)) {
+        this.$Notice.error({
+          title: "校验详情",
+          desc: row.content
+        });
+        return;
+      }
+      this.curCheckItemContent = JSON.parse(row.content);
       this.$refs.CheckDataResult.open();
     },
     async submit(row) {

+ 127 - 127
src/modules/main/components/CheckDataResult.vue

@@ -1,127 +1,127 @@
-<template>
-  <Modal
-    class="check-data-result"
-    v-model="modalIsShow"
-    title="校验详情"
-    :mask-closable="false"
-    width="800"
-    @on-visible-change="visibleChange"
-  >
-    <Table
-      ref="TableList"
-      :columns="columns"
-      :data="students"
-      disabled-hover
-      border
-    ></Table>
-
-    <div class="part-page" v-if="total > size">
-      <Page
-        :current="current"
-        :total="total"
-        :page-size="size"
-        show-total
-        show-elevator
-        @on-change="toPage"
-      ></Page>
-    </div>
-  </Modal>
-</template>
-
-<script>
-export default {
-  name: "check-data-result",
-  props: {
-    content: {
-      type: Array,
-      default() {
-        return [];
-      }
-    }
-  },
-  data() {
-    return {
-      modalIsShow: false,
-      students: [],
-      columns: [
-        {
-          type: "index",
-          title: "序号",
-          width: 80,
-          align: "center",
-          indexMethod: row => {
-            return (this.current - 1) * this.size + row._index + 1;
-          }
-        },
-        {
-          title: "姓名",
-          key: "studentName",
-          width: 100
-        },
-        {
-          title: "考号",
-          key: "examNumber",
-          width: 120
-        },
-        {
-          title: "错误原因",
-          key: "errorMessage"
-        },
-        {
-          title: "操作",
-          key: "action",
-          width: 100,
-          align: "center",
-          className: "table-action",
-          render: (h, param) => {
-            let actions = [];
-            actions.push({
-              icon: "md-arrow-dropright-circle",
-              attrs: {
-                title: "查看"
-              },
-              action: () => {
-                this.toView(param.row);
-              }
-            });
-
-            return h("div", this.$tableIconAction(h, actions));
-          }
-        }
-      ],
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0
-    };
-  },
-  methods: {
-    visibleChange(visible) {
-      if (visible) {
-        this.toPage(1);
-      } else {
-        this.$emit("on-close");
-      }
-    },
-    toPage(page) {
-      this.current = page;
-      this.students = this.content.slice((page - 1) * this.size, this.size);
-    },
-    toView(row) {
-      window.open(
-        this.getRouterPath({
-          name: "StudentScore",
-          query: {
-            examNumber: row.examNumber
-          }
-        })
-      );
-    },
-    cancel() {
-      this.modalIsShow = false;
-    },
-    open() {
-      this.modalIsShow = true;
-    }
-  }
-};
-</script>
+<template>
+  <Modal
+    class="check-data-result"
+    v-model="modalIsShow"
+    title="校验详情"
+    :mask-closable="false"
+    width="800"
+    @on-visible-change="visibleChange"
+  >
+    <Table
+      ref="TableList"
+      :columns="columns"
+      :data="students"
+      disabled-hover
+      border
+    ></Table>
+
+    <div class="part-page" v-if="total > size">
+      <Page
+        :current="current"
+        :total="total"
+        :page-size="size"
+        show-total
+        show-elevator
+        @on-change="toPage"
+      ></Page>
+    </div>
+  </Modal>
+</template>
+
+<script>
+export default {
+  name: "check-data-result",
+  props: {
+    content: {
+      type: Array,
+      default() {
+        return [];
+      }
+    }
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      students: [],
+      columns: [
+        {
+          type: "index",
+          title: "序号",
+          width: 80,
+          align: "center",
+          indexMethod: row => {
+            return (this.current - 1) * this.size + row._index + 1;
+          }
+        },
+        {
+          title: "姓名",
+          key: "studentName",
+          width: 100
+        },
+        {
+          title: "考号",
+          key: "examNumber",
+          width: 120
+        },
+        {
+          title: "错误原因",
+          key: "errorMessage"
+        },
+        {
+          title: "操作",
+          key: "action",
+          width: 100,
+          align: "center",
+          className: "table-action",
+          render: (h, param) => {
+            let actions = [];
+            actions.push({
+              icon: "ios-paper",
+              attrs: {
+                title: "查看"
+              },
+              action: () => {
+                this.toView(param.row);
+              }
+            });
+
+            return h("div", this.$tableIconAction(h, actions));
+          }
+        }
+      ],
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0
+    };
+  },
+  methods: {
+    visibleChange(visible) {
+      if (visible) {
+        this.toPage(1);
+      } else {
+        this.$emit("on-close");
+      }
+    },
+    toPage(page) {
+      this.current = page;
+      this.students = this.content.slice((page - 1) * this.size, this.size);
+    },
+    toView(row) {
+      window.open(
+        this.getRouterPath({
+          name: "StudentScore",
+          query: {
+            examNumber: row.examNumber
+          }
+        })
+      );
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    }
+  }
+};
+</script>

+ 208 - 208
src/plugins/axios.js

@@ -1,208 +1,208 @@
-import axios from "axios";
-import qs from "qs";
-import ViewUI from "view-design";
-import router from "../routers";
-import Vue from "vue";
-
-// 防止鉴权失效之后多次弹窗。
-let unauthMsgBoxIsShow = false;
-
-/**
- * errorCallback 请求失败的回调
- * @param {Object} error 请求失败时的错误信息
- */
-const errorCallback = error => {
-  let content = "";
-  if (error.response) {
-    content = error.response.data && error.response.data.message;
-    console.log(content);
-
-    if (error.response.status === 401) {
-      if (unauthMsgBoxIsShow) return error;
-      unauthMsgBoxIsShow = true;
-      content = content || "身份验证失效,请重新登录!";
-      ViewUI.Modal.error({
-        content,
-        onOk: () => {
-          unauthMsgBoxIsShow = false;
-          Vue.ls.clear();
-          router.push({ name: "Login" });
-        }
-      });
-      return error;
-    }
-  } else if (error.request) {
-    content = "请求错误";
-    if (error.message.indexOf("timeout") > -1) {
-      content = "请求超时";
-    }
-  } else {
-    return error;
-  }
-
-  content = content.indexOf("###") !== -1 || !content ? "服务错误" : content;
-  content = content.length > 100 ? content.slice(0, 100) + "..." : content;
-  ViewUI.Notice.error({ title: "错误提示", desc: content });
-  return error;
-};
-
-/**
- * errorDataCallback 请求成功,结果有误的回调
- * @param {Object} error Response中的data信息
- */
-// const errorDataCallback = error => {
-//   let content = error.message || "数据错误";
-//   content = content.indexOf("###") !== -1 ? "参数错误" : content;
-
-//   // TODO:自定义处理逻辑,以下为epcc实例
-//   if (error.code === -100) {
-//     content = "身份验证失效,请重新登录";
-//     ViewUI.Modal.confirm({
-//       title: "重新登陆?",
-//       content,
-//       onOk: () => {
-//         Vue.ls.clear();
-//         router.push({ name: "Login" });
-//       }
-//     });
-//   } else {
-//     ViewUI.Notice.error({ title: "错误提示", desc: content });
-//   }
-//   return error;
-// };
-
-/**
- * response format
- *  {
-      config, header, data, request, status, statusText
-    }
- * 
- */
-
-/**
- * successCallback 请求成功的回调
- * @param {Object} data Response中的data信息
- */
-const successCallback = data => {
-  return data;
-  // if (data.code === 0) {
-  //   return data.data;
-  // } else {
-  //   throw new Error(errorDataCallback(data));
-  // }
-};
-
-/**
- * get请求
- * @param {String} url 请求地址
- * @param {Object} datas 请求数据
- */
-const $get = (url, datas) => {
-  let sqDatas = "";
-  if (datas) {
-    sqDatas = qs.stringify(datas, {
-      arrayFormat: "brackets"
-    });
-    url += "?" + sqDatas;
-  }
-  return axios
-    .get(url)
-    .then(rep => {
-      return successCallback(rep.data);
-    })
-    .catch(error => {
-      throw new Error(errorCallback(error));
-    });
-};
-
-/**
- * post请求
- * @param {String} url 请求地址
- * @param {Object} datas 请求数据
- */
-const $post = (url, datas, dataType = "form") => {
-  let sqDatas = "";
-  if (datas.constructor === Object && dataType === "form") {
-    sqDatas = qs.stringify(datas, { allowDots: true });
-  } else {
-    sqDatas = datas;
-  }
-
-  return axios
-    .post(url, sqDatas)
-    .then(rep => {
-      return successCallback(rep.data);
-    })
-    .catch(error => {
-      throw new Error(errorCallback(error));
-    });
-};
-
-/**
- * delete请求
- * @param {String} url
- * @param {Object} datas
- */
-const $del = (url, datas) => {
-  let sqDatas = "";
-  if (datas) {
-    sqDatas = qs.stringify(datas, { arrayFormat: "brackets" });
-    url += "?" + sqDatas;
-  }
-  return axios
-    .delete(url)
-    .then(rep => {
-      return successCallback(rep.data);
-    })
-    .catch(error => {
-      throw new Error(errorCallback(error));
-    });
-};
-
-/**
- * put 请求
- * @param {String} url 请求地址
- * @param {Object} datas 请求数据
- */
-const $put = (url, datas, dataType = "form") => {
-  let sqDatas = "";
-  if (datas.constructor === Object && dataType === "form") {
-    sqDatas = qs.stringify(datas, { allowDots: true });
-  } else {
-    sqDatas = datas;
-  }
-
-  return axios
-    .put(url, sqDatas)
-    .then(rep => {
-      return rep.data;
-    })
-    .catch(error => {
-      throw new Error(errorCallback(error));
-    });
-};
-
-/**
- * patch请求
- * @param {String} url 请求地址
- * @param {Object} datas 请求数据
- */
-const $patch = (url, datas, dataType = "form") => {
-  let sqDatas = "";
-  if (datas.constructor === Object && dataType === "form") {
-    sqDatas = qs.stringify(datas, { allowDots: true });
-  } else {
-    sqDatas = datas;
-  }
-
-  return axios
-    .patch(url, sqDatas)
-    .then(rep => {
-      return successCallback(rep.data);
-    })
-    .catch(error => {
-      throw new Error(errorCallback(error));
-    });
-};
-
-export { $get, $post, $del, $put, $patch };
+import axios from "axios";
+import qs from "qs";
+import ViewUI from "view-design";
+import router from "../routers";
+import Vue from "vue";
+
+// 防止鉴权失效之后多次弹窗。
+let unauthMsgBoxIsShow = false;
+
+/**
+ * errorCallback 请求失败的回调
+ * @param {Object} error 请求失败时的错误信息
+ */
+const errorCallback = error => {
+  let content = "";
+  if (error.response) {
+    content = error.response.data && error.response.data.message;
+    console.log(content);
+
+    if (error.response.status === 401) {
+      if (unauthMsgBoxIsShow) return error;
+      unauthMsgBoxIsShow = true;
+      content = content || "身份验证失效,请重新登录!";
+      ViewUI.Modal.error({
+        content,
+        onOk: () => {
+          unauthMsgBoxIsShow = false;
+          Vue.ls.clear();
+          router.push({ name: "Login" });
+        }
+      });
+      return error;
+    }
+  } else if (error.request) {
+    content = "请求错误";
+    if (error.message.indexOf("timeout") > -1) {
+      content = "请求超时";
+    }
+  } else {
+    return error;
+  }
+
+  content = content.indexOf("###") !== -1 || !content ? "服务错误" : content;
+  content = content.length > 100 ? content.slice(0, 100) + "..." : content;
+  ViewUI.Notice.error({ title: "错误提示", desc: content });
+  return error;
+};
+
+/**
+ * errorDataCallback 请求成功,结果有误的回调
+ * @param {Object} error Response中的data信息
+ */
+// const errorDataCallback = error => {
+//   let content = error.message || "数据错误";
+//   content = content.indexOf("###") !== -1 ? "参数错误" : content;
+
+//   // TODO:自定义处理逻辑,以下为epcc实例
+//   if (error.code === -100) {
+//     content = "身份验证失效,请重新登录";
+//     ViewUI.Modal.confirm({
+//       title: "重新登陆?",
+//       content,
+//       onOk: () => {
+//         Vue.ls.clear();
+//         router.push({ name: "Login" });
+//       }
+//     });
+//   } else {
+//     ViewUI.Notice.error({ title: "错误提示", desc: content });
+//   }
+//   return error;
+// };
+
+/**
+ * response format
+ *  {
+      config, header, data, request, status, statusText
+    }
+ * 
+ */
+
+/**
+ * successCallback 请求成功的回调
+ * @param {Object} data Response中的data信息
+ */
+const successCallback = data => {
+  return data;
+  // if (data.code === 0) {
+  //   return data.data;
+  // } else {
+  //   throw new Error(errorDataCallback(data));
+  // }
+};
+
+/**
+ * get请求
+ * @param {String} url 请求地址
+ * @param {Object} datas 请求数据
+ */
+const $get = (url, datas, config = {}) => {
+  let sqDatas = "";
+  if (datas) {
+    sqDatas = qs.stringify(datas, {
+      arrayFormat: "brackets"
+    });
+    url += "?" + sqDatas;
+  }
+  return axios
+    .get(url, config)
+    .then(rep => {
+      return successCallback(rep.data);
+    })
+    .catch(error => {
+      throw new Error(errorCallback(error));
+    });
+};
+
+/**
+ * post请求
+ * @param {String} url 请求地址
+ * @param {Object} datas 请求数据
+ */
+const $post = (url, datas, dataType = "form") => {
+  let sqDatas = "";
+  if (datas.constructor === Object && dataType === "form") {
+    sqDatas = qs.stringify(datas, { allowDots: true });
+  } else {
+    sqDatas = datas;
+  }
+
+  return axios
+    .post(url, sqDatas)
+    .then(rep => {
+      return successCallback(rep.data);
+    })
+    .catch(error => {
+      throw new Error(errorCallback(error));
+    });
+};
+
+/**
+ * delete请求
+ * @param {String} url
+ * @param {Object} datas
+ */
+const $del = (url, datas) => {
+  let sqDatas = "";
+  if (datas) {
+    sqDatas = qs.stringify(datas, { arrayFormat: "brackets" });
+    url += "?" + sqDatas;
+  }
+  return axios
+    .delete(url)
+    .then(rep => {
+      return successCallback(rep.data);
+    })
+    .catch(error => {
+      throw new Error(errorCallback(error));
+    });
+};
+
+/**
+ * put 请求
+ * @param {String} url 请求地址
+ * @param {Object} datas 请求数据
+ */
+const $put = (url, datas, dataType = "form") => {
+  let sqDatas = "";
+  if (datas.constructor === Object && dataType === "form") {
+    sqDatas = qs.stringify(datas, { allowDots: true });
+  } else {
+    sqDatas = datas;
+  }
+
+  return axios
+    .put(url, sqDatas)
+    .then(rep => {
+      return rep.data;
+    })
+    .catch(error => {
+      throw new Error(errorCallback(error));
+    });
+};
+
+/**
+ * patch请求
+ * @param {String} url 请求地址
+ * @param {Object} datas 请求数据
+ */
+const $patch = (url, datas, dataType = "form") => {
+  let sqDatas = "";
+  if (datas.constructor === Object && dataType === "form") {
+    sqDatas = qs.stringify(datas, { allowDots: true });
+  } else {
+    sqDatas = datas;
+  }
+
+  return axios
+    .patch(url, sqDatas)
+    .then(rep => {
+      return successCallback(rep.data);
+    })
+    .catch(error => {
+      throw new Error(errorCallback(error));
+    });
+};
+
+export { $get, $post, $del, $put, $patch };