diff --git a/package.json b/package.json index e7147e5..edbb202 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "lint": "vue-cli-service lint", "analyz": "npm_config_report=true npm run build", "test:unit": "vue-cli-service test:unit", - "test:e2e": "vue-cli-service test:e2e" + "test:e2e": "vue-cli-service test:e2e", + "buildDev": "vue-cli-service build --mode development" }, "dependencies": { "avue-plugin-ueditor": "^0.1.4", diff --git a/src/api/plugin/workflow/form.js b/src/api/plugin/workflow/form.js index 6cd47a6..c36f211 100644 --- a/src/api/plugin/workflow/form.js +++ b/src/api/plugin/workflow/form.js @@ -78,6 +78,14 @@ export const getCompany = (query) => { params: query, }); }; +// 运维公司单个详情 +export const getCompanyById = (query) => { + return request({ + url: "/api/blade-user/client/user-info-by-id", + method: "get", + params: query, + }); +}; // 运维部门 export const getDepts = (query) => { return request({ diff --git a/src/page/index/top/index.vue b/src/page/index/top/index.vue index e81f66d..bd389a7 100644 --- a/src/page/index/top/index.vue +++ b/src/page/index/top/index.vue @@ -68,8 +68,7 @@ export default { }).then(() => { this.$store.dispatch("LogOut").then(() => { resetRouter(); - // this.$router.push({ path: "/newlogin" }); - window.location.href="http://jhoa.qd.gov.cn/Default.aspx"; + process.env.NODE_ENV != "production" ? this.$router.push({path: '/newlogin'}) : window.location.href="http://jhoa.qd.gov.cn/Default.aspx"; }); }); }, diff --git a/src/page/lock/index.vue b/src/page/lock/index.vue index 404df8a..2ced0c2 100644 --- a/src/page/lock/index.vue +++ b/src/page/lock/index.vue @@ -50,7 +50,7 @@ export default { }).then(() => { this.$store.dispatch("LogOut").then(() => { // this.$router.push({ path: "/newlogin" }); - window.location.href="http://jhoa.qd.gov.cn/Default.aspx"; + process.env.NODE_ENV != "production" ? this.$router.push({path: '/newlogin'}) : window.location.href="http://jhoa.qd.gov.cn/Default.aspx"; }); }); }, diff --git a/src/page/login/index.vue b/src/page/login/index.vue index 57f5247..e2d0b92 100644 --- a/src/page/login/index.vue +++ b/src/page/login/index.vue @@ -47,9 +47,7 @@ export default { // this.loading = false; console.log('err=======res',err) if(err.error == 'invalid_request') { - // let url = err.error_description+'?SSOToken=' + encodeURIComponent(window.location); window.location.href = err.error_description;//重定向 - // window.location.href = 'http://jhoa.qd.gov.cn/Keeper.aspx?SSOToken=PSOSite%24TjZXxbcic5BDwCphjqib%2BVEWXFe1JX5N1VBWsX%2FNAapJ5MHEKOyR0Jf24C09C1NdofaFCYjfNvA%3D'; }else if(err.error == 'invalid_grant') { this.$confirm(err.error_description, '提示', { confirmButtonText: '确定', @@ -58,7 +56,6 @@ export default { type: 'warning', closeOnClickModal: false }).then(() => { - // this.$router.replace({ path: '/newlogin' }); window.location.href = 'http://jhoa.qd.gov.cn/Default.aspx'; }) }else { @@ -69,7 +66,6 @@ export default { type: 'warning', closeOnClickModal: false }).then(() => { - // this.$router.replace({ path: '/newlogin' }); window.location.href = 'http://jhoa.qd.gov.cn/Default.aspx'; }) } diff --git a/src/permission.js b/src/permission.js index 2e01152..5c65e7f 100644 --- a/src/permission.js +++ b/src/permission.js @@ -4,11 +4,12 @@ */ import router from './router/router' import store from './store' -import {validatenull} from '@/util/validate' -import {getToken} from '@/util/auth' +import { validatenull } from '@/util/validate' +import { getToken } from '@/util/auth' import NProgress from 'nprogress' // progress bar import 'nprogress/nprogress.css' // progress bar style -NProgress.configure({showSpinner: false}); +import { MessageBox } from 'element-ui'; +NProgress.configure({ showSpinner: false }); const lockPage = store.getters.website.lockPage; //锁屏页 router.beforeEach((to, from, next) => { const meta = to.meta || {}; @@ -16,14 +17,14 @@ router.beforeEach((to, from, next) => { store.commit('SET_IS_MENU', isMenu === undefined); if (getToken()) { if (store.getters.isLock && to.path !== lockPage) { //如果系统激活锁屏,全部跳转到锁屏页 - next({path: lockPage}) + next({ path: lockPage }) } else if (to.path === '/newlogin') { //如果登录成功访问登录页跳转到主页 - next({path: '/wel/index'}) + next({ path: '/wel/index' }) } else { //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页 if (store.getters.token.length === 0) { store.dispatch('FedLogOut').then(() => { - next({path: '/newlogin'}) + next({ path: '/newlogin' }) }) } else { const value = to.query.src || to.fullPath; @@ -53,9 +54,58 @@ router.beforeEach((to, from, next) => { } } } else { - console.log('nologin===permission===========',to.path) + console.log('nologin===permission===========', to,from) + const ssotoken = to.query.SSOToken; + if (process.env.NODE_ENV == "production" && to.path != '/newlogin') { + //过滤ssotoken重新拼接回调地址 + let newQuery = JSON.parse(JSON.stringify(to.query)); + delete newQuery.SSOToken; + let fallbackUrl = window.location.href.substring(0, window.location.href.indexOf("?")); + let keys = Object.keys(newQuery); + for (let i = 0; i < keys.length; i++) { + if (i === 0) { + fallbackUrl = fallbackUrl + '?' + keys[i] + '=' + newQuery[keys[i]] + } else { + fallbackUrl = fallbackUrl + '&' + keys[i] + '=' + newQuery[keys[i]] + } + } + // alert(fallbackUrl) + // router.replace({path: fallbackUrl}) + store.dispatch("LoginBySso", { SSOToken: ssotoken, grantType: 'yawei', fallbackUrl: fallbackUrl }) + .then(() => { + // this.loading = false; + console.log('=============登录成功') + router.replace({ path: fallbackUrl }) + }, err => { + // this.loading = false; + console.log('err=======res', err) + if (err.error == 'invalid_request') { + window.location.href = err.error_description;//重定向 + } else if (err.error == 'invalid_grant') { + MessageBox.confirm(err.error_description, '提示', { + confirmButtonText: '确定', + showClose: false, + showCancelButton: false, + type: 'warning', + closeOnClickModal: false + }).then(() => { + window.location.href = 'http://jhoa.qd.gov.cn/Default.aspx'; + }) + } else { + MessageBox.confirm(err.error_description || '登录失败', '提示', { + confirmButtonText: '确定', + showClose: false, + showCancelButton: false, + type: 'warning', + closeOnClickModal: false + }).then(() => { + window.location.href = 'http://jhoa.qd.gov.cn/Default.aspx'; + }) + } + }); + } //判断是否需要认证,没有登录访问去登录页 - if (meta.isAuth === false) { + else if (meta.isAuth === false) { next() } else { next('/newlogin') diff --git a/src/router/axios.js b/src/router/axios.js index 159c319..c3b40fa 100644 --- a/src/router/axios.js +++ b/src/router/axios.js @@ -66,7 +66,9 @@ axios.interceptors.response.use(res => { if (statusWhiteList.includes(status)) return Promise.reject(res); //如果是401则跳转到登录页面 // if (status === 401) store.dispatch('FedLogOut').then(() => router.push({path: '/newlogin'})); - if (status === 401) store.dispatch('FedLogOut').then(() => {window.location.href="http://jhoa.qd.gov.cn/Default.aspx";}); + if (status === 401) store.dispatch('FedLogOut').then(() => { + process.env.NODE_ENV == "production" ? window.location.href="http://jhoa.qd.gov.cn/Default.aspx" : router.push({path: '/newlogin'}); + }); // 如果请求为非200否者默认统一处理 if(res.data.error != undefined && res.config.params != undefined && res.config.params.grant_type != undefined && res.config.params.grant_type == 'yawei') { return Promise.reject(res.data) diff --git a/src/views/maintenance/system.vue b/src/views/maintenance/system.vue index d336c7a..511add7 100644 --- a/src/views/maintenance/system.vue +++ b/src/views/maintenance/system.vue @@ -323,6 +323,7 @@ export default { const { dataBaseAlias, company, + companyName, dataBaseIp, dataBasePort, deptId, @@ -338,7 +339,14 @@ export default { this.findObject(this.option.column,"systemName").disabled = true; this.form.dataBaseAlias = dataBaseAlias; - this.form.company = company; + //判断运维公司是否存在 + const _idx = this.findObject(this.option.column,"company").dicData.findIndex(item => item.id == company); + if(_idx > -1){ + this.form.company = company; + } + else{ + this.form.company = companyName; + } this.form.dataBaseIp = dataBaseIp; this.form.dataBasePort = dataBasePort; this.form.deptId = deptId; diff --git a/src/views/plugin/workflow/process/components/detail.vue b/src/views/plugin/workflow/process/components/detail.vue index 0e53e75..4e9ef85 100644 --- a/src/views/plugin/workflow/process/components/detail.vue +++ b/src/views/plugin/workflow/process/components/detail.vue @@ -232,7 +232,8 @@ import { getTaskAndDataBase, getModuleAndDataTable, getDatabasePro, - getDatabaseTab + getDatabaseTab, + getCompanyById } from "@/api/plugin/workflow/form.js"; import {repeatMode} from "@/api/plugin/workflow/workorder.js"; import WfExamineForm from "./examForm.vue"; @@ -611,6 +612,14 @@ export default { setTimeout(() => { this.form = variables; // this.form.renwuzhonglei = variables.renwuzhonglei + //判断运维公司是否存在 + const _idx = this.companyList.findIndex(item => item.id == variables.yunweigongsi); + if(_idx < 0){ + getCompanyById({userId: variables.yunweigongsi}).then(res => { + this.form.yunweigongsi = res.data.data.name; + // console.log(this.form,"================") + }) + } this.waiting = false; }, 100); });