|
@@ -56,9 +56,10 @@
|
|
<script>
|
|
<script>
|
|
import { mapMutations } from "vuex";
|
|
import { mapMutations } from "vuex";
|
|
import { username, password } from "@/plugins/formRules";
|
|
import { username, password } from "@/plugins/formRules";
|
|
-import { login, subjectDetail } from "@/api";
|
|
|
|
|
|
+import { login } from "@/api";
|
|
import ResetPwd from "./ResetPwd";
|
|
import ResetPwd from "./ResetPwd";
|
|
import { MARK_LEADER_RIGHTS } from "@/constants/enumerate";
|
|
import { MARK_LEADER_RIGHTS } from "@/constants/enumerate";
|
|
|
|
+import { getFirstRoute } from "./check";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "login",
|
|
name: "login",
|
|
@@ -73,29 +74,6 @@ export default {
|
|
loginName: username,
|
|
loginName: username,
|
|
password,
|
|
password,
|
|
},
|
|
},
|
|
- rightRoutes: {
|
|
|
|
- ADMIN: {
|
|
|
|
- router: "WorkManage",
|
|
|
|
- },
|
|
|
|
- MARKER_LEVEL: {
|
|
|
|
- router: "MarkerGrading",
|
|
|
|
- },
|
|
|
|
- MARKER_SCORE: {
|
|
|
|
- router: "MarkerMarking",
|
|
|
|
- },
|
|
|
|
- MARK_LEADER_LEVEL: {
|
|
|
|
- router: "LeaderGrading",
|
|
|
|
- },
|
|
|
|
- MARK_LEADER_SCORE: {
|
|
|
|
- router: "LeaderMarking",
|
|
|
|
- },
|
|
|
|
- INSPECTION: {
|
|
|
|
- router: "Inspection",
|
|
|
|
- },
|
|
|
|
- QC: {
|
|
|
|
- router: "Quality",
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
isSubmit: false,
|
|
isSubmit: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -165,36 +143,18 @@ export default {
|
|
subjectId: `${data.workId}-${data.subject}`,
|
|
subjectId: `${data.workId}-${data.subject}`,
|
|
};
|
|
};
|
|
// 根据角色跳转不同的路由
|
|
// 根据角色跳转不同的路由
|
|
- const { role, markRight } = data;
|
|
|
|
- let routerType = role;
|
|
|
|
- if (role.includes("MARK")) {
|
|
|
|
- const levelStages = ["LEVEL", "ROUGH_LEVEL"];
|
|
|
|
- const curSubject = await subjectDetail(params.subjectId);
|
|
|
|
- const stage = levelStages.includes(curSubject.stage)
|
|
|
|
- ? "LEVEL"
|
|
|
|
- : curSubject.stage;
|
|
|
|
- routerType = `${role}_${stage}`;
|
|
|
|
-
|
|
|
|
- if (stage === "INIT") {
|
|
|
|
- this.$Message.error("当前工作未开启分档!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (role === "MARKER") {
|
|
|
|
- if (
|
|
|
|
- (levelStages.includes(stage) && markRight === "ALLOW_SCORING") ||
|
|
|
|
- (stage === "SCORE" && markRight === "ALLOW_LEVELING")
|
|
|
|
- ) {
|
|
|
|
- this.$Message.error("您的权限不够!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ const result = await getFirstRoute(data);
|
|
|
|
+ if (!result.valid) {
|
|
|
|
+ this.$Message.error(result.message);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ if (data.role.includes("MARK")) {
|
|
this.initRibbonSet(data.id);
|
|
this.initRibbonSet(data.id);
|
|
}
|
|
}
|
|
|
|
|
|
- const routerName = this.rightRoutes[routerType].router;
|
|
|
|
this.$router.push({
|
|
this.$router.push({
|
|
- name: routerName,
|
|
|
|
|
|
+ name: result.data,
|
|
params,
|
|
params,
|
|
});
|
|
});
|
|
},
|
|
},
|