zhangjie 1 жил өмнө
parent
commit
71c3804557

+ 8 - 2
src/modules/exam/store.js

@@ -8,6 +8,7 @@ const state = {
     stmms: 0,
     analysis: 0,
   },
+  waitTypes: [],
   // createExamAndPrintTask
   infoExamTask: {},
   infoExamTaskDetail: {},
@@ -22,6 +23,9 @@ const mutations = {
   setWaitTask(state, waitTask) {
     state.waitTask = waitTask;
   },
+  setWaitTypes(state, waitTypes) {
+    state.waitTypes = waitTypes;
+  },
   updateWaitTask(state, data) {
     const waitTask = Object.assign({}, state.waitTask, data);
     state.waitTask = waitTask;
@@ -43,7 +47,7 @@ const mutations = {
 };
 
 const actions = {
-  async updateWaitTaskCount({ commit }) {
+  async updateWaitTaskCount({ state, commit }) {
     const task = [
       {
         type: "flow",
@@ -58,7 +62,9 @@ const actions = {
         func: analysisTaskCount,
       },
     ];
-    let countAll = task.map((item) => item.func());
+    let countAll = task
+      .filter((item) => state.waitTypes.includes(item.type))
+      .map((item) => item.func());
     const counts = await Promise.all(countAll).catch(() => {});
 
     if (!counts) return;

+ 21 - 15
src/modules/exam/views/WaitTask.vue

@@ -22,40 +22,46 @@ import WaitTaskStmms from "../components/WaitTaskStmms";
 import WaitTaskAnalysis from "../components/WaitTaskAnalysis";
 import { mapState } from "vuex";
 
+const tabs = [
+  {
+    name: "流程待办",
+    val: "flow",
+  },
+  {
+    name: "阅卷待办",
+    val: "stmms",
+  },
+  {
+    name: "教研待办",
+    val: "analysis",
+  },
+];
+
 export default {
   name: "wait-task",
   components: { WaitTaskFlow, WaitTaskStmms, WaitTaskAnalysis },
   data() {
     return {
       curTab: "flow",
-      tabs: [
-        {
-          name: "流程待办",
-          val: "flow",
-        },
-        {
-          name: "阅卷待办",
-          val: "stmms",
-        },
-        {
-          name: "教研待办",
-          val: "analysis",
-        },
-      ],
+      tabs: [],
     };
   },
   computed: {
-    ...mapState("exam", ["waitTask"]),
+    ...mapState("exam", ["waitTask", "waitTypes"]),
     compName() {
       return `wait-task-${this.curTab}`;
     },
   },
   created() {
+    this.initTabs();
     if (this.$route.query.type) {
       this.curTab = this.$route.query.type;
     }
   },
   methods: {
+    initTabs() {
+      this.tabs = tabs.filter((item) => this.waitTypes.includes(item.val));
+    },
     selectMenu(tab) {
       this.curTab = tab;
     },

+ 0 - 9
src/modules/stmms/components/SelectClassByCourse.vue

@@ -86,15 +86,6 @@ export default {
     },
     // confirm
     confirm() {
-      if (!this.classIds.length) {
-        this.$message.error("请选择班级");
-        return;
-      }
-
-      // const data = this.dataList.filter((item) =>
-      //   this.classIds.includes(item.id)
-      // );
-
       this.$emit("confirm", this.classIds);
       this.cancel();
     },

+ 18 - 0
src/views/Home.vue

@@ -333,6 +333,24 @@ export default {
       });
       this.$store.commit("setPrivilegeMap", privilegeMap);
       this.$ls.set("privilegeMap", privilegeMap);
+
+      // wait-types
+      const filterFunc = {
+        flow: () => {
+          return (
+            this.checkPrivilege("link", "edit", "TaskApplyManage") ||
+            this.checkPrivilege("link", "notReviewEdit", "TaskReviewManage")
+          );
+        },
+        stmms: () => {
+          return this.checkPrivilege("link", "Submit", "UploadStructure");
+        },
+        analysis: () => {
+          return this.checkPrivilege("link", "window", "DataInitManage");
+        },
+      };
+      const waitTypes = Object.keys(filterFunc).filter((k) => filterFunc[k]());
+      this.$store.commit("exam/setWaitTypes", waitTypes);
     },
     menuChange(menu) {
       this.curMenu = menu;

+ 5 - 4
src/views/HomePage.vue

@@ -130,7 +130,7 @@ export default {
   },
   computed: {
     ...mapState(["privilegeMap"]),
-    ...mapState("exam", ["waitTaskCount"]),
+    ...mapState("exam", ["waitTaskCount", "waitTypes"]),
   },
   created() {
     this.initShortcutList();
@@ -189,9 +189,10 @@ export default {
       await this.updateWaitTaskCount();
       this.summary.waitTaskCount = this.waitTaskCount;
 
-      await this.getFlowWaitTaskList();
-      await this.getStmmsWaitTaskList();
-      await this.getAnalysisWaitTaskList();
+      if (this.waitTypes.includes("flow")) await this.getFlowWaitTaskList();
+      if (this.waitTypes.includes("stmms")) await this.getStmmsWaitTaskList();
+      if (this.waitTypes.includes("analysis"))
+        await this.getAnalysisWaitTaskList();
       this.getWaitTaskList();
     },
     getWaitTaskList() {