feat: There is no way the idm and oa
This commit is contained in:
+185
-82
@@ -46,86 +46,189 @@ import router from './router'
|
||||
// 路由解析器
|
||||
import Re from 'path-to-regexp'
|
||||
|
||||
import { get_verify_by_instance } from 'api/process'
|
||||
import { get_verify_by_instance,loginIdm,getMenu } from 'api/process'
|
||||
|
||||
import { ssoLoginUrlDev,ssoLoginUrl,webLoginType,devWebUrl } from '@/sysConfig'
|
||||
|
||||
import { mapMutations, mapActions } from 'vuex'
|
||||
|
||||
// 路由拦截
|
||||
router.beforeEach(function (to, from, next) {
|
||||
let path = to.path;
|
||||
console.log("auth : to =>", to);
|
||||
console.log("auth : path =>" + path);
|
||||
let taskId = to.query.taskIds;
|
||||
let prcId = to.query.prcId;
|
||||
let prcNum = to.query.prcNum;
|
||||
let prcName = to.query.prcName;
|
||||
let prcType = to.query.prcType;
|
||||
let param = "?taskIds="+taskId+"&prcId="+prcId
|
||||
+"&prcNum="+prcNum+"&prcName="+prcName+"&prcType="+prcType;
|
||||
if(taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null){
|
||||
get_verify_by_instance({
|
||||
taskId: taskId, // 任务id
|
||||
pId: prcId // 流程实例
|
||||
}).then(res => {
|
||||
let hisCount = res.hisCount === undefined ? 0 : res.hisCount;
|
||||
let commitStatus = res.commitStatus === undefined ? 0 : res.commitStatus;
|
||||
let isNotFinished = res.isNotFinished === undefined ? 0 :res.isNotFinished;
|
||||
|
||||
if(hisCount && hisCount > 0){ // 业务系统 当前节点已完成
|
||||
// 根据type判断跳转具体流程页面
|
||||
if (prcType === '1') {
|
||||
// 标准入库流程数据
|
||||
next({path:"bzrkStep5"+param})
|
||||
}else if(prcType === '4'){
|
||||
//标准清单发布流程数据
|
||||
next({path:"bzqdfbStep1-4"+param})
|
||||
}else if (prcType === '5'){
|
||||
//标准项目合规评估 标准维度
|
||||
if(path === "/xmpgStep2" || path === "/xmpgStep1" || path === "/xmpgStep1-2"){
|
||||
next({path:"xmpgStep1-2"+param})
|
||||
}else {
|
||||
next({path:"xmpgStep1-7"+param})
|
||||
}
|
||||
}else if(prcType === '6'){
|
||||
//标准项目合规评估 项目维度
|
||||
if(path === "/xmpg2Step1" || path === "/xmpg2Step2" || path === "/xmpg2Step1-2"){
|
||||
next({path:"xmpg2Step1-2"+param})
|
||||
}else {
|
||||
next({path:"xmpg2Step1-12"+param})
|
||||
}
|
||||
} else if (prcType === '8') {
|
||||
// 未符合项整改
|
||||
next({path:"wfhxzgStep5-1"+param})
|
||||
} else if(prcType === '9'){
|
||||
next({path:"bzjdStep1-6"+param})
|
||||
//标准调研流程
|
||||
}else if(prcType === '2'){
|
||||
next({path:"bzdyStep1-9"+param})
|
||||
}else if(prcType === '3'){
|
||||
//标准征求意见
|
||||
next({path:"bzzqyjStep1-9"+param})
|
||||
}else if(prcType === '10'){
|
||||
//项目清单确认
|
||||
next({path:"xmqdqrStep1-3"+param})
|
||||
console.log("auth : to =>", to);
|
||||
console.log(webLoginType)
|
||||
let toName = to.name
|
||||
let token = store.state.token
|
||||
let path = to.path;
|
||||
let requireAuth = to.meta.requireAuth;
|
||||
console.log("auth : path =>" + path);
|
||||
console.log("token : token =>" + token);
|
||||
console.log("requireAuth : requireAuth =>" + requireAuth);
|
||||
let taskId = to.query.taskIds;
|
||||
let prcId = to.query.prcId;
|
||||
let prcNum = to.query.prcNum;
|
||||
let prcName = to.query.prcName;
|
||||
let prcType = to.query.prcType;
|
||||
let param = "taskIds=" + taskId + "&prcId=" + prcId
|
||||
+ "&prcNum=" + prcNum + "&prcName=" + prcName + "&prcType=" + prcType;
|
||||
console.log(store)
|
||||
let url = window.location.search
|
||||
let code = "";
|
||||
if(url){
|
||||
url = url.substr(1);
|
||||
url = url.split('&');
|
||||
let info = [];
|
||||
let obj = {};
|
||||
for (let i = 0,len = url.length; i < len; i++) {
|
||||
info = url[i].split('=')
|
||||
obj[info[0]] = decodeURI(info[1]);
|
||||
url[i] = obj;
|
||||
}
|
||||
}else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
if(isNotFinished && isNotFinished > 0 && commitStatus && commitStatus > 0){
|
||||
if(prcType === '3'){
|
||||
//标准征求意见 接受节点 未完成 oa已办 跳转详情页面
|
||||
if(path === '/bzzqyjStep3'){
|
||||
next({path:"processAcceptDetail?prcNum="+prcNum+"&tabsName=AlreadyProcess"})
|
||||
}
|
||||
}
|
||||
}else{
|
||||
next()
|
||||
}
|
||||
}
|
||||
console.log("res : res =>", res);
|
||||
})
|
||||
}
|
||||
next()
|
||||
code = url[0].code
|
||||
}
|
||||
|
||||
function extractedLocalStorage(url,param) {
|
||||
localStorage.removeItem("routerUrl")
|
||||
localStorage.setItem('routerUrl', url)
|
||||
localStorage.removeItem("routerParam")
|
||||
localStorage.setItem('routerParam', param)
|
||||
}
|
||||
// 返回值为登录状态
|
||||
if ((token === null || token === '' ) && toName !== 'Login') {
|
||||
if(webLoginType != null && webLoginType === 'idm' ){
|
||||
if(code){
|
||||
next()
|
||||
}else {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
extractedVerify(token)
|
||||
}else {
|
||||
extractedLocalStorage('home2','');
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
}
|
||||
}
|
||||
}else if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
}
|
||||
}else {
|
||||
extractedVerify(token)
|
||||
}
|
||||
|
||||
function extractedVerify() {
|
||||
if (taskId !== undefined && taskId !== null && prcId !== undefined && prcId !== null) {
|
||||
get_verify_by_instance({
|
||||
taskId: taskId, // 任务id
|
||||
pId: prcId // 流程实例
|
||||
}).then(res => {
|
||||
let hisCount = res.hisCount === undefined ? 0 : res.hisCount;
|
||||
let commitStatus = res.commitStatus === undefined ? 0 : res.commitStatus;
|
||||
let isNotFinished = res.isNotFinished === undefined ? 0 : res.isNotFinished;
|
||||
|
||||
if (hisCount && hisCount > 0) { // 业务系统 当前节点已完成
|
||||
// 根据type判断跳转具体流程页面
|
||||
if (prcType === '1') {
|
||||
// 标准入库流程数据
|
||||
extracted("bzrkStep5");
|
||||
} else if (prcType === '4') {
|
||||
//标准清单发布流程数据
|
||||
extracted("bzqdfbStep1-4");
|
||||
} else if (prcType === '5') {
|
||||
//标准项目合规评估 标准维度
|
||||
if (path === "/xmpgStep2" || path === "/xmpgStep1" || path === "/xmpgStep1-2") {
|
||||
extracted("xmpgStep1-2");
|
||||
} else {
|
||||
extracted("xmpgStep1-7");
|
||||
}
|
||||
} else if (prcType === '6') {
|
||||
//标准项目合规评估 项目维度
|
||||
if (path === "/xmpg2Step1" || path === "/xmpg2Step2" || path === "/xmpg2Step1-2") {
|
||||
extracted("xmpg2Step1-2");
|
||||
} else {
|
||||
extracted("xmpg2Step1-12");
|
||||
}
|
||||
} else if (prcType === '8') {
|
||||
// 未符合项整改
|
||||
extracted("wfhxzgStep5-1");
|
||||
} else if (prcType === '9') {
|
||||
extracted("bzjdStep1-6");
|
||||
//标准调研流程
|
||||
} else if (prcType === '2') {
|
||||
extracted("bzdyStep1-9");
|
||||
} else if (prcType === '3') {
|
||||
//标准征求意见
|
||||
extracted("bzzqyjStep1-9");
|
||||
} else if (prcType === '10') {
|
||||
//项目清单确认
|
||||
extracted("xmqdqrStep1-3");
|
||||
}
|
||||
} else { // 业务系统 当前节点未完成
|
||||
// commitStatus 大于0 表示当前节点存在未完成干活流程
|
||||
if (isNotFinished && isNotFinished > 0 && commitStatus && commitStatus > 0) {
|
||||
if (prcType === '3') {
|
||||
//标准征求意见 接受节点 未完成 oa已办 跳转详情页面
|
||||
if (path === '/bzzqyjStep3') {
|
||||
extracted2("processAcceptDetail","prcNum=" + prcNum + "&tabsName=AlreadyProcess");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// oa 待测 sso
|
||||
extracted3()
|
||||
}
|
||||
}
|
||||
function extracted(routerPath) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' +param})
|
||||
}
|
||||
}
|
||||
|
||||
function extracted3() {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(toName,param);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
function extracted2(routerPath,param2) {
|
||||
if (token === null || token === '') {
|
||||
extractedLocalStorage(routerPath,param2);
|
||||
// ssoLoginUrlDev 默认sso 地址
|
||||
window.location.href = ssoLoginUrlDev
|
||||
} else {
|
||||
next({path: routerPath + '?' + param2})
|
||||
}
|
||||
}
|
||||
console.log("res : res =>", res);
|
||||
})
|
||||
}
|
||||
if(path === '/loginVerify'){
|
||||
if(webLoginType != null && webLoginType === 'dev'){
|
||||
next('/Login')
|
||||
}else {
|
||||
next()
|
||||
}
|
||||
}else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 设置用户信息
|
||||
function setUserInfo (userInfo) {
|
||||
const timeStamp = new Date().getTime().toString()
|
||||
const _USERINFO = JSON.parse(userInfo)
|
||||
_USERINFO.userId = _USERINFO.userId || _USERINFO.usId
|
||||
_USERINFO.userName = _USERINFO.userName || _USERINFO.uName
|
||||
try {
|
||||
localStorage.setItem('userInfo', JSON.stringify(_USERINFO))
|
||||
localStorage.setItem('userInfoModifyTime', timeStamp)
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
|
||||
Vue.config.productionTip = false
|
||||
// jquery
|
||||
@@ -147,16 +250,16 @@ Vue.prototype.simpleUploadPath = simpleUploadPath
|
||||
Vue.prototype.$moment = moment
|
||||
// 国际化
|
||||
const i18n = new VueI18n({
|
||||
locale: store.getters.getLanguage || 'cn', // 定义默认语言为中文
|
||||
messages: {
|
||||
cn: require('@/assets/languages/cn'),
|
||||
en: require('@/assets/languages/en')
|
||||
}
|
||||
locale: store.getters.getLanguage || 'cn', // 定义默认语言为中文
|
||||
messages: {
|
||||
cn: require('@/assets/languages/cn'),
|
||||
en: require('@/assets/languages/en')
|
||||
}
|
||||
})
|
||||
/* eslint-disable no-new */
|
||||
window.vm = new Vue({
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
|
||||
Reference in New Issue
Block a user