提交
This commit is contained in:
parent
bcf0f349d1
commit
9c11810c6e
@ -6,308 +6,307 @@ import store from '@/store'
|
|||||||
import { Loading, Message, MessageBox } from 'element-ui'
|
import { Loading, Message, MessageBox } from 'element-ui'
|
||||||
|
|
||||||
Vue.prototype.$http = axios
|
Vue.prototype.$http = axios
|
||||||
// Vue.prototype.qs = QS;
|
// Vue.prototype.qs = QS;
|
||||||
// Vue.use(ElementUI)
|
// Vue.use(ElementUI)
|
||||||
var loading
|
var loading
|
||||||
let needLoadingRequestCount = 0
|
let needLoadingRequestCount = 0
|
||||||
let showLoadingConfig = ''
|
let showLoadingConfig = ''
|
||||||
var COMPANY = ''
|
var COMPANY = ''
|
||||||
|
|
||||||
function getLang() {
|
function getLang() {
|
||||||
let currentLanguage = store.state.currentLanguage
|
let currentLanguage = store.state.currentLanguage
|
||||||
let langParam = ''
|
let langParam = ''
|
||||||
switch (currentLanguage) {
|
switch (currentLanguage) {
|
||||||
case 'zh':
|
case 'zh':
|
||||||
langParam = 'zh_CN'
|
langParam = 'zh_CN'
|
||||||
break
|
break
|
||||||
case 'en':
|
case 'en':
|
||||||
langParam = 'en_US'
|
langParam = 'en_US'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return langParam
|
return langParam
|
||||||
}
|
}
|
||||||
// 环境的切换
|
// 环境的切换
|
||||||
if (process.env.NODE_ENV == 'development') {
|
if (process.env.NODE_ENV == 'development') {
|
||||||
// axios.defaults.baseURL = 'http://8.142.139.165:7080' // 湖里区
|
// axios.defaults.baseURL = 'http://8.142.139.165:7080' // 湖里区
|
||||||
// axios.defaults.baseURL = 'http://124.71.87.250/'
|
// axios.defaults.baseURL = 'http://124.71.87.250/'
|
||||||
// axios.defaults.baseURL = 'http://139.9.66.234:30/'
|
// axios.defaults.baseURL = 'http://139.9.66.234:30/'
|
||||||
// axios.defaults.baseURL = 'http://14.29.220.211:6023/'
|
// axios.defaults.baseURL = 'http://14.29.220.211:6023/'
|
||||||
// axios.defaults.baseURL = 'https://zhgd.loganwy.com/' //龙光
|
// axios.defaults.baseURL = 'https://zhgd.loganwy.com/' //龙光
|
||||||
// axios.defaults.baseURL = 'https://zhgd-uat.logan.com.cn/'
|
// axios.defaults.baseURL = 'https://zhgd-uat.logan.com.cn/'
|
||||||
// axios.defaults.baseURL = 'http://36.137.53.203:9090/' // 南昌地铁 17512009894 123456789 gdjt 87654321
|
// axios.defaults.baseURL = 'http://36.137.53.203:9090/' // 南昌地铁 17512009894 123456789 gdjt 87654321
|
||||||
// axios.defaults.baseURL = 'http://192.168.34.125:6023/'
|
// axios.defaults.baseURL = 'http://192.168.34.125:6023/'
|
||||||
// axios.defaults.baseURL = 'http://124.71.178.44:100/' // 河南
|
// axios.defaults.baseURL = 'http://124.71.178.44:100/' // 河南
|
||||||
// tag: 本地
|
// tag: 本地
|
||||||
// axios.defaults.baseURL = 'http://139.9.66.234:6324/' // 河南春笋
|
// axios.defaults.baseURL = 'http://139.9.66.234:6324/' // 河南春笋
|
||||||
// axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上(旧)地址
|
// axios.defaults.baseURL ='http://124.71.67.160:8088/' //中建四局线上(旧)地址
|
||||||
// axios.defaults.baseURL ='http://47.97.202.104:6023/' //金林湾线上旧
|
// axios.defaults.baseURL ='http://47.97.202.104:6023/' //金林湾线上旧
|
||||||
// axios.defaults.baseURL = 'http://47.97.202.104:6023/';
|
// axios.defaults.baseURL = 'http://47.97.202.104:6023/';
|
||||||
// axios.defaults.baseURL = 'http://139.9.66.234:8/';
|
// axios.defaults.baseURL = 'http://139.9.66.234:8/';
|
||||||
// axios.defaults.baseURL = 'http://120.196.217.6:7000/'; // 鹤洲
|
// axios.defaults.baseURL = 'http://120.196.217.6:7000/'; // 鹤洲
|
||||||
// axios.defaults.baseURL = 'http://182.90.224.237:7000/'; // 广西
|
// axios.defaults.baseURL = 'http://182.90.224.237:7000/'; // 广西
|
||||||
// axios.defaults.baseURL = 'http://120.196.217.6:7000/' //鹤洲
|
// axios.defaults.baseURL = 'http://120.196.217.6:7000/' //鹤洲
|
||||||
// axios.defaults.baseURL = 'http://117.156.17.59:9090/'; //
|
// axios.defaults.baseURL = 'http://117.156.17.59:9090/'; //
|
||||||
// axios.defaults.baseURL = 'http://120.236.247.200:9000/'; //横琴线上
|
// axios.defaults.baseURL = 'http://120.236.247.200:9000/'; //横琴线上
|
||||||
// axios.defaults.baseURL = 'http://223.82.100.80:9000/'; //南昌地铁
|
// axios.defaults.baseURL = 'http://223.82.100.80:9000/'; //南昌地铁
|
||||||
// axios.defaults.baseURL = 'http://139.9.66.234:40001/'; //南昌地铁二期
|
// axios.defaults.baseURL = 'http://139.9.66.234:40001/'; //南昌地铁二期
|
||||||
// axios.defaults.baseURL = 'http://124.71.178.44:30/';
|
// axios.defaults.baseURL = 'http://124.71.178.44:30/';
|
||||||
// axios.defaults.baseURL = 'http://192.168.34.125:9090/';
|
// axios.defaults.baseURL = 'http://192.168.34.125:9090/';
|
||||||
// axios.defaults.baseURL = 'http://192.168.88.220:6023/';
|
// axios.defaults.baseURL = 'http://192.168.88.220:6023/';
|
||||||
// axios.defaults.baseURL = 'http://124.71.178.44:9000/'; //中建 cscec101 123456
|
// axios.defaults.baseURL = 'http://124.71.178.44:9000/'; //中建 cscec101 123456
|
||||||
// axios.defaults.baseURL = 'https://jk.cscec1b1.com:5138/';//沃尔
|
// axios.defaults.baseURL = 'https://jk.cscec1b1.com:5138/';//沃尔
|
||||||
// axios.defaults.baseURL = 'http://61.190.32.219:9050/'
|
// axios.defaults.baseURL = 'http://61.190.32.219:9050/'
|
||||||
// axios.defaults.baseURL = 'http://183.95.84.54:5800/'//合展-宿迁 zxsd 123456
|
// axios.defaults.baseURL = 'http://183.95.84.54:5800/'//合展-宿迁 zxsd 123456
|
||||||
// axios.defaults.baseURL = 'http://183.95.84.54:9500/'//贵州-敏尚 17512075572 123456
|
// axios.defaults.baseURL = 'http://183.95.84.54:9500/'//贵州-敏尚 17512075572 123456
|
||||||
// axios.defaults.baseURL = 'http://183.95.84.34:7185/' //测试服
|
// axios.defaults.baseURL = 'http://183.95.84.34:7185/' //测试服
|
||||||
// axios.defaults.baseURL = 'http://183.60.227.61:30246/'
|
// axios.defaults.baseURL = 'http://183.60.227.61:30246/'
|
||||||
// axios.defaults.baseURL = 'http://183.60.227.61:30249/' //测试服2
|
// axios.defaults.baseURL = 'http://183.60.227.61:30249/' //测试服2
|
||||||
// axios.defaults.baseURL = 'http://183.60.227.61:20561/' //龙光地产 龙光地产 123456
|
// axios.defaults.baseURL = 'http://183.60.227.61:20561/' //龙光地产 龙光地产 123456
|
||||||
// axios.defaults.baseURL = 'http://218.92.215.138:9090/' //盐城 新佳城小区 123456
|
// axios.defaults.baseURL = 'http://218.92.215.138:9090/' //盐城 新佳城小区 123456
|
||||||
// axios.defaults.baseURL = 'http://36.137.53.203:9090/' //盐城 gdjt 123456789
|
// axios.defaults.baseURL = 'http://36.137.53.203:9090/' //盐城 gdjt 123456789
|
||||||
// axios.defaults.baseURL = 'http://183.234.150.152:9090/' //华发 huaxin 123456789
|
// axios.defaults.baseURL = 'http://183.234.150.152:9090/' //华发 huaxin 123456789
|
||||||
// axios.defaults.baseURL = 'http://182.90.224.147:18170' //瑞士恒通线上
|
// axios.defaults.baseURL = 'http://182.90.224.147:18170' //瑞士恒通线上
|
||||||
// axios.defaults.baseURL = 'http://58.250.210.9:9090/' //深汕线上
|
// axios.defaults.baseURL = 'http://58.250.210.9:9090/' //深汕线上
|
||||||
// axios.defaults.baseURL = 'http://101.43.164.214:12345/'//内蒙古线上
|
// axios.defaults.baseURL = 'http://101.43.164.214:12345/'//内蒙古线上
|
||||||
// axios.defaults.baseURL = 'http://121.196.214.246/api/'//金林湾线上新
|
// axios.defaults.baseURL = 'http://121.196.214.246/api/'//金林湾线上新
|
||||||
// axios.defaults.baseURL = 'http://42.194.144.62:8088/'//中建四局线上(新)地址
|
// axios.defaults.baseURL = 'http://42.194.144.62:8088/'//中建四局线上(新)地址
|
||||||
// axios.defaults.baseURL = 'http://101.43.164.214:12350/'//中建五局线上
|
// axios.defaults.baseURL = 'http://101.43.164.214:12350/'//中建五局线上
|
||||||
// axios.defaults.baseURL = 'http://182.90.224.147:15551/'//港投(成润)项目线上(1)
|
// axios.defaults.baseURL = 'http://182.90.224.147:15551/'//港投(成润)项目线上(1)
|
||||||
// axios.defaults.baseURL = 'http://118.121.198.147:23232/'//港投(成润)正式
|
// axios.defaults.baseURL = 'http://118.121.198.147:23232/'//港投(成润)正式
|
||||||
// axios.defaults.baseURL ='http://jxj.zhgdyun.com:100/' //演示平台/·
|
// axios.defaults.baseURL ='http://jxj.zhgdyun.com:100/' //演示平台/·
|
||||||
// axios.defaults.baseURL ='http://192.168.34.221:8188/' //郭圣雄本地
|
// axios.defaults.baseURL ='http://192.168.34.221:8188/' //郭圣雄本地
|
||||||
// axios.defaults.baseURL ='http://192.168.34.221:30001/' //郭圣雄本地
|
// axios.defaults.baseURL ='http://192.168.34.221:30001/' //郭圣雄本地
|
||||||
// axios.defaults.baseURL ='http://192.168.34.221:12350/' //金林湾本地
|
// axios.defaults.baseURL ='http://192.168.34.221:12350/' //金林湾本地
|
||||||
// axios.defaults.baseURL ='http://42.194.144.62:8099/' //坪山沙湖
|
// axios.defaults.baseURL ='http://42.194.144.62:8099/' //坪山沙湖
|
||||||
// axios.defaults.baseURL ='http://125.88.207.86:8099/' //坪山沙湖(最新)地址
|
// axios.defaults.baseURL ='http://125.88.207.86:8099/' //坪山沙湖(最新)地址
|
||||||
// axios.defaults.baseURL ='http://huli.zjzhiliao.com/jxjgdapi/' //金林湾测试线上
|
// axios.defaults.baseURL ='http://huli.zjzhiliao.com/jxjgdapi/' //金林湾测试线上
|
||||||
// axios.defaults.baseURL ='http://101.43.164.214:45001/' //上海张江
|
// axios.defaults.baseURL ='http://101.43.164.214:45001/' //上海张江
|
||||||
// axios.defaults.baseURL ='http://101.43.164.214:45011/' //上海优益(上海建工)
|
// axios.defaults.baseURL ='http://101.43.164.214:45011/' //上海优益(上海建工)
|
||||||
// axios.defaults.baseURL = 'http://192.168.34.221:28888/' //郭圣雄本地
|
// axios.defaults.baseURL = 'http://192.168.34.221:28888/' //郭圣雄本地
|
||||||
// axios.defaults.baseURL = 'http://192.168.34.221:28889/' //郭圣雄本地
|
// axios.defaults.baseURL = 'http://192.168.34.221:28889/' //郭圣雄本地
|
||||||
// axios.defaults.baseURL ='http://192.168.34.221:9111/' //郭圣雄本地
|
// axios.defaults.baseURL = 'http://192.168.34.221:9111/' //郭圣雄本地
|
||||||
// axios.defaults.baseURL = 'http://192.168.34.155:19111/' //彭洁本地
|
axios.defaults.baseURL = 'http://192.168.34.155:19111/' //彭洁本地
|
||||||
axios.defaults.baseURL = 'http://182.90.224.237:51234' //郭圣雄远程
|
// axios.defaults.baseURL = 'http://182.90.224.237:51234' //郭圣雄远程
|
||||||
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:61212/' //彭洁远程
|
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:61212/' //彭洁远程
|
||||||
// axios.defaults.baseURL ='http://101.43.164.214:45020/' //沈阳和盈
|
// axios.defaults.baseURL ='http://101.43.164.214:45020/' //沈阳和盈
|
||||||
// axios.defaults.baseURL ='http://183.249.224.118:9000/' //嘉兴王江泾公用码头
|
// axios.defaults.baseURL ='http://183.249.224.118:9000/' //嘉兴王江泾公用码头
|
||||||
// axios.defaults.baseURL ='http://101.43.164.214:11111/' // 百色三标段项目
|
// axios.defaults.baseURL ='http://101.43.164.214:11111/' // 百色三标段项目
|
||||||
// axios.defaults.baseURL = 'http://125.88.207.86:8088/'//中建四局线上(最新)地址
|
// axios.defaults.baseURL = 'http://125.88.207.86:8088/'//中建四局线上(最新)地址
|
||||||
// axios.defaults.baseURL = 'http://125.88.207.86:8099/'//中建四局(沙湖)线上(最新)地址
|
// axios.defaults.baseURL = 'http://125.88.207.86:8099/'//中建四局(沙湖)线上(最新)地址
|
||||||
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:15551/'//测试地址
|
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:15551/'//测试地址
|
||||||
// axios.defaults.baseURL = 'http://47.93.215.234:9809/'//鞍钢正式地址(弃用)
|
// axios.defaults.baseURL = 'http://47.93.215.234:9809/'//鞍钢正式地址(弃用)
|
||||||
// axios.defaults.baseURL = 'http://42.180.188.17:9809/'//鞍钢正式地址
|
// axios.defaults.baseURL = 'http://42.180.188.17:9809/'//鞍钢正式地址
|
||||||
// axios.defaults.baseURL = 'http://47.93.215.234:11211/'//鞍钢测试地址(弃用)
|
// axios.defaults.baseURL = 'http://47.93.215.234:11211/'//鞍钢测试地址(弃用)
|
||||||
// axios.defaults.baseURL = 'http://42.180.188.17:11211/'//鞍钢测试地址
|
// axios.defaults.baseURL = 'http://42.180.188.17:11211/'//鞍钢测试地址
|
||||||
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:19814/'//测试地址
|
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:19814/'//测试地址
|
||||||
|
|
||||||
} else if (process.env.NODE_ENV == 'debug') {
|
} else if (process.env.NODE_ENV == 'debug') {
|
||||||
axios.defaults.baseURL = 'https://www.ceshi.com'
|
axios.defaults.baseURL = 'https://www.ceshi.com'
|
||||||
} else if (process.env.NODE_ENV == 'production') {
|
} else if (process.env.NODE_ENV == 'production') {
|
||||||
let host = window.location.host
|
let host = window.location.host
|
||||||
// axios.defaults.baseURL = window.location.protocol + '//' + host + '/api/'//金林湾地址
|
// axios.defaults.baseURL = window.location.protocol + '//' + host + '/api/'//金林湾地址
|
||||||
axios.defaults.baseURL = window.location.protocol + '//' + host + '/'
|
axios.defaults.baseURL = window.location.protocol + '//' + host + '/'
|
||||||
// axios.defaults.baseURL ='http://192.168.34.216:6023/'
|
// axios.defaults.baseURL ='http://192.168.34.216:6023/'
|
||||||
// axios.defaults.baseURL = window.location.protocol + "//" + host.split(":")[0] + ":6023" + "/"
|
// axios.defaults.baseURL = window.location.protocol + "//" + host.split(":")[0] + ":6023" + "/"
|
||||||
// axios.defaults.baseURL = 'http://zhgd.loganwy.com/`'
|
// axios.defaults.baseURL = 'http://zhgd.loganwy.com/`'
|
||||||
}
|
}
|
||||||
|
|
||||||
// tag: 河南
|
// tag: 河南
|
||||||
if (COMPANY == 'henan') {
|
if (COMPANY == 'henan') {
|
||||||
// axios.defaults.baseURL = 'http://124.71.178.44:100/' // 备注 2022 10 12 后端说作废
|
// axios.defaults.baseURL = 'http://124.71.178.44:100/' // 备注 2022 10 12 后端说作废
|
||||||
axios.defaults.baseURL = 'http://139.9.66.234:6324/' // 2022 10 12 邱平毅 创建的服务器地址
|
axios.defaults.baseURL = 'http://139.9.66.234:6324/' // 2022 10 12 邱平毅 创建的服务器地址
|
||||||
}
|
}
|
||||||
|
|
||||||
// axios.defaults.baseURL = store.getters.BASEURL //'http://124.71.178.44:100/'axios.defaults.timeout = 600000;
|
// axios.defaults.baseURL = store.getters.BASEURL //'http://124.71.178.44:100/'axios.defaults.timeout = 600000;
|
||||||
|
|
||||||
// console.log('store.state.userInfo',store)
|
// console.log('store.state.userInfo',store)
|
||||||
if (store.state.userInfo) {
|
if (store.state.userInfo) {
|
||||||
axios.defaults.headers.common['Authorization'] =
|
axios.defaults.headers.common['Authorization'] =
|
||||||
'Bearer' + ' ' + store.state.userInfo.token
|
'Bearer' + ' ' + store.state.userInfo.token
|
||||||
axios.defaults.headers.common['operateId'] = store.state.userInfo.userId
|
axios.defaults.headers.common['operateId'] = store.state.userInfo.userId
|
||||||
}
|
}
|
||||||
// http请求拦截器
|
// http请求拦截器
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
(config) => {
|
(config) => {
|
||||||
if (config.url.includes('downloadTemplate')) {
|
if (config.url.includes('downloadTemplate')) {
|
||||||
config.headers.common['responseType'] = 'blob'
|
config.headers.common['responseType'] = 'blob'
|
||||||
}
|
}
|
||||||
if (config.url.includes('live?port')) return config
|
if (config.url.includes('live?port')) return config
|
||||||
// 分屏插件兼容配置
|
// 分屏插件兼容配置
|
||||||
const screensBaseURL = sessionStorage.getItem('screens-baseURL')
|
const screensBaseURL = sessionStorage.getItem('screens-baseURL')
|
||||||
if (config.url.indexOf(screensBaseURL) !== -1) {
|
if (config.url.indexOf(screensBaseURL) !== -1) {
|
||||||
delete config.headers.common['operateId']
|
delete config.headers.common['operateId']
|
||||||
if (config.url === screensBaseURL + '/login') {
|
if (config.url === screensBaseURL + '/login') {
|
||||||
const Authorization = sessionStorage.getItem('screens-Authorization')
|
const Authorization = sessionStorage.getItem('screens-Authorization')
|
||||||
config.headers.common['Authorization'] = Authorization
|
config.headers.common['Authorization'] = Authorization
|
||||||
} else {
|
} else {
|
||||||
delete config.headers.common['Authorization']
|
delete config.headers.common['Authorization']
|
||||||
const token = sessionStorage.getItem('screens-token')
|
const token = sessionStorage.getItem('screens-token')
|
||||||
config.headers.common['token'] = token
|
config.headers.common['token'] = token
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}
|
|
||||||
|
|
||||||
if (showLoadingConfig == '' || showLoadingConfig == undefined) {
|
|
||||||
// showFullScreenLoading()
|
|
||||||
}
|
|
||||||
return config
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
tryHideFullScreenLoading()
|
|
||||||
// Message.error('加载超时');
|
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
// 响应拦截器
|
|
||||||
axios.interceptors.response.use(
|
|
||||||
(response) => {
|
|
||||||
tryHideFullScreenLoading()
|
|
||||||
if (response.status === 200) {
|
|
||||||
return Promise.resolve(response)
|
|
||||||
} else {
|
|
||||||
// alert('进入了哪里444')
|
|
||||||
return Promise.reject(response)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 服务器状态码不是2开头的的情况
|
|
||||||
// 这里可以跟你们的后台开发人员协商好统一的错误状态码
|
|
||||||
// 然后根据返回的状态码进行一些操作,例如登录过期提示,错误提示等等
|
|
||||||
// 下面列举几个常见的操作,其他需求可自行扩展
|
|
||||||
(error) => {
|
|
||||||
// tryHideFullScreenLoading()
|
|
||||||
if (error.response.status) {
|
|
||||||
console.log('----------', error.response)
|
|
||||||
let errorUrl = error.response.config.baseURL
|
|
||||||
console.log('-----------------', errorUrl)
|
|
||||||
let screensUrl = sessionStorage.getItem('screens-baseURL')
|
|
||||||
|
|
||||||
const url = error.response.url
|
|
||||||
|
|
||||||
if (
|
|
||||||
errorUrl == screensUrl ||
|
|
||||||
url === '26938512:7zS9LX2X8u4tW4Ps0ZjN/login'
|
|
||||||
) {
|
|
||||||
// alert('进入了哪里3')
|
|
||||||
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
// alert('进入了哪里2')
|
|
||||||
switch (error.response.status) {
|
|
||||||
// 401: 未登录
|
|
||||||
// 未登录则跳转登录页面,并携带当前页面的路径
|
|
||||||
// 在登录成功后返回当前页面,这一步需要在登录页操作。
|
|
||||||
case 401:
|
|
||||||
// Message.error('会话已失效,请重新登录')
|
|
||||||
// logout()
|
|
||||||
let errorResponse = sessionStorage.getItem('errorResponse')
|
|
||||||
console.log('进入401', errorResponse)
|
|
||||||
if (errorResponse == null || errorResponse === 'null') {
|
|
||||||
sessionStorage.setItem('errorResponse', '1')
|
|
||||||
MessageBox.confirm('会话已失效,请重新登录', '提示', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
logout()
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
MessageBox.message({
|
|
||||||
type: 'info',
|
|
||||||
message: '已取消',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
break
|
|
||||||
|
|
||||||
// 403 token过期
|
if (showLoadingConfig == '' || showLoadingConfig == undefined) {
|
||||||
// 登录过期对用户进行提示
|
// showFullScreenLoading()
|
||||||
// 清除本地token和清空vuex中token对象
|
}
|
||||||
// 跳转登录页面
|
return config
|
||||||
case 403:
|
},
|
||||||
Message.error('登录过期,请重新登录')
|
(error) => {
|
||||||
logout()
|
tryHideFullScreenLoading()
|
||||||
break
|
// Message.error('加载超时');
|
||||||
// 404请求不存在
|
return Promise.reject(error)
|
||||||
case 404:
|
|
||||||
Message.error('网络请求不存在')
|
|
||||||
break
|
|
||||||
case 500:
|
|
||||||
Message.error('服务器错误')
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
return Promise.reject(error.response)
|
)
|
||||||
}
|
// 响应拦截器
|
||||||
}
|
axios.interceptors.response.use(
|
||||||
}
|
(response) => {
|
||||||
)
|
tryHideFullScreenLoading()
|
||||||
/**
|
if (response.status === 200) {
|
||||||
* get方法,对应get请求
|
return Promise.resolve(response)
|
||||||
* @param {String} url [请求的url地址]
|
} else {
|
||||||
* @param {Object} params [请求时携带的参数]
|
// alert('进入了哪里444')
|
||||||
*/
|
return Promise.reject(response)
|
||||||
function logout() {
|
}
|
||||||
store.commit('setUserInfo', null)
|
},
|
||||||
store.commit('setMapBackArr', [])
|
// 服务器状态码不是2开头的的情况
|
||||||
store.commit('setMoudle', null)
|
// 这里可以跟你们的后台开发人员协商好统一的错误状态码
|
||||||
store.commit('setProDetail', null)
|
// 然后根据返回的状态码进行一些操作,例如登录过期提示,错误提示等等
|
||||||
store.commit('setGroupTreeList', [])
|
// 下面列举几个常见的操作,其他需求可自行扩展
|
||||||
store.commit('setSelectedGroupSn', null)
|
(error) => {
|
||||||
sessionStorage.clear()
|
// tryHideFullScreenLoading()
|
||||||
sessionStorage.setItem('errorResponse', '1')
|
if (error.response.status) {
|
||||||
|
console.log('----------', error.response)
|
||||||
|
let errorUrl = error.response.config.baseURL
|
||||||
|
console.log('-----------------', errorUrl)
|
||||||
|
let screensUrl = sessionStorage.getItem('screens-baseURL')
|
||||||
|
|
||||||
let json = {
|
const url = error.response.url
|
||||||
name: '工作站',
|
|
||||||
id: 1,
|
if (
|
||||||
url: '/projectV2/taskList',
|
errorUrl == screensUrl ||
|
||||||
menuList: [
|
url === '26938512:7zS9LX2X8u4tW4Ps0ZjN/login'
|
||||||
{
|
) {
|
||||||
id: 100000,
|
// alert('进入了哪里3')
|
||||||
menuName: '任务清单',
|
|
||||||
path: '/projectV2/taskList',
|
return
|
||||||
},
|
} else {
|
||||||
{
|
// alert('进入了哪里2')
|
||||||
id: 100001,
|
switch (error.response.status) {
|
||||||
menuName: '通知公告',
|
// 401: 未登录
|
||||||
path: '/projectV2/noticeList',
|
// 未登录则跳转登录页面,并携带当前页面的路径
|
||||||
},
|
// 在登录成功后返回当前页面,这一步需要在登录页操作。
|
||||||
{
|
case 401:
|
||||||
id: 100002,
|
// Message.error('会话已失效,请重新登录')
|
||||||
menuName: '工作日程',
|
// logout()
|
||||||
path: '/projectV2/workerSchedule',
|
let errorResponse = sessionStorage.getItem('errorResponse')
|
||||||
},
|
console.log('进入401', errorResponse)
|
||||||
],
|
if (errorResponse == null || errorResponse === 'null') {
|
||||||
}
|
sessionStorage.setItem('errorResponse', '1')
|
||||||
this.$store.commit('setCurModule', json)
|
MessageBox.confirm('会话已失效,请重新登录', '提示', {
|
||||||
setTimeout(() => {
|
confirmButtonText: '确定',
|
||||||
window.location.href = '/index.html#/login'
|
cancelButtonText: '取消',
|
||||||
}, 1000)
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
logout()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
MessageBox.message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
// 403 token过期
|
||||||
|
// 登录过期对用户进行提示
|
||||||
|
// 清除本地token和清空vuex中token对象
|
||||||
|
// 跳转登录页面
|
||||||
|
case 403:
|
||||||
|
Message.error('登录过期,请重新登录')
|
||||||
|
logout()
|
||||||
|
break
|
||||||
|
// 404请求不存在
|
||||||
|
case 404:
|
||||||
|
Message.error('网络请求不存在')
|
||||||
|
break
|
||||||
|
case 500:
|
||||||
|
Message.error('服务器错误')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return Promise.reject(error.response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
/**
|
||||||
|
* get方法,对应get请求
|
||||||
|
* @param {String} url [请求的url地址]
|
||||||
|
* @param {Object} params [请求时携带的参数]
|
||||||
|
*/
|
||||||
|
function logout() {
|
||||||
|
store.commit('setUserInfo', null)
|
||||||
|
store.commit('setMapBackArr', [])
|
||||||
|
store.commit('setMoudle', null)
|
||||||
|
store.commit('setProDetail', null)
|
||||||
|
store.commit('setGroupTreeList', [])
|
||||||
|
store.commit('setSelectedGroupSn', null)
|
||||||
|
sessionStorage.clear()
|
||||||
|
sessionStorage.setItem('errorResponse', '1')
|
||||||
|
|
||||||
|
let json = {
|
||||||
|
name: '工作站',
|
||||||
|
id: 1,
|
||||||
|
url: '/projectV2/taskList',
|
||||||
|
menuList: [{
|
||||||
|
id: 100000,
|
||||||
|
menuName: '任务清单',
|
||||||
|
path: '/projectV2/taskList',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 100001,
|
||||||
|
menuName: '通知公告',
|
||||||
|
path: '/projectV2/noticeList',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 100002,
|
||||||
|
menuName: '工作日程',
|
||||||
|
path: '/projectV2/workerSchedule',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
this.$store.commit('setCurModule', json)
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.href = '/index.html#/login'
|
||||||
|
}, 1000)
|
||||||
}
|
}
|
||||||
export function get(url, params, config) {
|
export function get(url, params, config) {
|
||||||
showLoadingConfig = config
|
showLoadingConfig = config
|
||||||
url = url + '?lang=' + getLang()
|
url = url + '?lang=' + getLang()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.get(url, {
|
.get(url, {
|
||||||
params: params,
|
params: params,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (
|
if (
|
||||||
res.config.url == '/xmgl/progressTask/downloadTemplate?lang=zh_CN'
|
res.config.url == '/xmgl/progressTask/downloadTemplate?lang=zh_CN'
|
||||||
) {
|
) {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
} else {
|
} else {
|
||||||
Message.error(res.data.message)
|
Message.error(res.data.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
reject(err.data)
|
reject(err.data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -316,26 +315,26 @@ export function get(url, params, config) {
|
|||||||
* @param {Object} params [请求时携带的参数]
|
* @param {Object} params [请求时携带的参数]
|
||||||
*/
|
*/
|
||||||
export function post(url, params, config) {
|
export function post(url, params, config) {
|
||||||
showLoadingConfig = config
|
showLoadingConfig = config
|
||||||
url = url + '?lang=' + getLang()
|
url = url + '?lang=' + getLang()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.post(url, params)
|
.post(url, params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
} else {
|
} else {
|
||||||
if (res.data.status !== 'SUCCESS') {
|
if (res.data.status !== 'SUCCESS') {
|
||||||
Message.error(res.data.message)
|
Message.error(res.data.message)
|
||||||
} else {
|
} else {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
reject(err.data)
|
reject(err.data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* put方法,对应put请求
|
* put方法,对应put请求
|
||||||
@ -343,47 +342,47 @@ export function post(url, params, config) {
|
|||||||
* @param {Object} params [请求时携带的参数]
|
* @param {Object} params [请求时携带的参数]
|
||||||
*/
|
*/
|
||||||
export function put(url, params, config) {
|
export function put(url, params, config) {
|
||||||
showLoadingConfig = config
|
showLoadingConfig = config
|
||||||
url = url + '?lang=' + getLang()
|
url = url + '?lang=' + getLang()
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios
|
axios
|
||||||
.put(url, params)
|
.put(url, params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
} else {
|
} else {
|
||||||
Message.error(res.data.message)
|
Message.error(res.data.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
reject(err.data)
|
reject(err.data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export function showFullScreenLoading() {
|
export function showFullScreenLoading() {
|
||||||
if (needLoadingRequestCount === 0) {
|
if (needLoadingRequestCount === 0) {
|
||||||
startLoading()
|
startLoading()
|
||||||
}
|
}
|
||||||
needLoadingRequestCount++
|
needLoadingRequestCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
export function tryHideFullScreenLoading() {
|
export function tryHideFullScreenLoading() {
|
||||||
if (needLoadingRequestCount <= 0) return
|
if (needLoadingRequestCount <= 0) return
|
||||||
needLoadingRequestCount--
|
needLoadingRequestCount--
|
||||||
if (needLoadingRequestCount === 0) {
|
if (needLoadingRequestCount === 0) {
|
||||||
endLoading()
|
endLoading()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startLoading() {
|
function startLoading() {
|
||||||
loading = Loading.service({
|
loading = Loading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '加载中...',
|
text: '加载中...',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.5)',
|
background: 'rgba(0, 0, 0, 0.5)',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function endLoading() {
|
function endLoading() {
|
||||||
loading.close()
|
loading.close()
|
||||||
}
|
}
|
||||||
@ -80,6 +80,7 @@
|
|||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div class="tableBtns">
|
<div class="tableBtns">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-permission="{key: 'pjzx_detail', menuPath: '/project/labor/assessmentCentent'}"
|
||||||
type="text"
|
type="text"
|
||||||
class="operationText"
|
class="operationText"
|
||||||
@click="detailInfoBtn(scope.row)"
|
@click="detailInfoBtn(scope.row)"
|
||||||
@ -225,6 +226,7 @@
|
|||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div class="tableBtns">
|
<div class="tableBtns">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-permission="{key: 'pjzx_detail', menuPath: '/project/labor/assessmentCentent'}"
|
||||||
type="text"
|
type="text"
|
||||||
class="operationText"
|
class="operationText"
|
||||||
@click="detailInfoBtn(scope.row)"
|
@click="detailInfoBtn(scope.row)"
|
||||||
|
|||||||
@ -79,7 +79,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作">
|
<el-table-column align="center" label="操作">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div class="tableBtns" style="margin-left: 35px;">
|
<!-- style="margin-left: 35px;" -->
|
||||||
|
<div class="tableBtns" >
|
||||||
<div v-permission="{key: 'penalize_detail', menuPath: '/project/labor/penalize'}" class="operationText" @click="detailBtn(scope.row)">
|
<div v-permission="{key: 'penalize_detail', menuPath: '/project/labor/penalize'}" class="operationText" @click="detailBtn(scope.row)">
|
||||||
<img
|
<img
|
||||||
src="@/assets/images/xm_num.png"
|
src="@/assets/images/xm_num.png"
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
<p class="pageTitle">
|
<p class="pageTitle">
|
||||||
承包商列表
|
承包商列表
|
||||||
</p>
|
</p>
|
||||||
<vue-scroll style="height: calc(100% - 30px)" v-if="level1CompanyData.length > 0">
|
<vue-scroll v-if="level1CompanyData.length > 0">
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="level1CompanyData"
|
:data="level1CompanyData"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
@ -136,7 +136,7 @@
|
|||||||
>刷新</el-button
|
>刷新</el-button
|
||||||
> -->
|
> -->
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="{key: 'jdsp_add', menuPath: '/project/progressManagementAg/lcbManage'}"
|
v-permission="{key: 'lcbManage_add', menuPath: '/project/progressManagementAg/lcbManage'}"
|
||||||
class="expintBtn"
|
class="expintBtn"
|
||||||
size="medium"
|
size="medium"
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -201,7 +201,7 @@
|
|||||||
<el-table-column width="300" label="操作" align="center">
|
<el-table-column width="300" label="操作" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="{key: 'jdsp_edit', menuPath: '/project/progressManagementAg/lcbManage'}"
|
v-permission="{key: 'lcbManage_edit', menuPath: '/project/progressManagementAg/lcbManage'}"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@ -210,7 +210,7 @@
|
|||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="{key: 'jdsp_delete', menuPath: '/project/progressManagementAg/lcbManage'}"
|
v-permission="{key: 'lcbManage_delete', menuPath: '/project/progressManagementAg/lcbManage'}"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
class="delete-btn"
|
class="delete-btn"
|
||||||
@ -1121,7 +1121,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
.treeBox {
|
.treeBox {
|
||||||
height: 87%;
|
flex: 1;
|
||||||
background-color: rgba(216, 216, 216, 0.2);
|
background-color: rgba(216, 216, 216, 0.2);
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
|||||||
@ -45,7 +45,6 @@
|
|||||||
>
|
>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="{key: 'criterion_open', menuPath: '/project/safeSame/criterion'}"
|
|
||||||
v-if="data.recordStatus == 1"
|
v-if="data.recordStatus == 1"
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -54,9 +53,9 @@
|
|||||||
{{ $t('message.quality.click')
|
{{ $t('message.quality.click')
|
||||||
}}{{ $t('message.quality.startUsing') }}
|
}}{{ $t('message.quality.startUsing') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<!-- v-permission="{key: 'criterion_stop', menuPath: '/project/safeSame/criterion'}" -->
|
||||||
<el-button
|
<el-button
|
||||||
v-permission="{key: 'criterion_stop', menuPath: '/project/safeSame/criterion'}"
|
v-if="data.recordStatus != 1"
|
||||||
v-else
|
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click.stop="() => singleEditState(node, data, 1)"
|
@click.stop="() => singleEditState(node, data, 1)"
|
||||||
|
|||||||
@ -320,6 +320,7 @@
|
|||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div class="tableBtns" style="justify-content: center">
|
<div class="tableBtns" style="justify-content: center">
|
||||||
<div
|
<div
|
||||||
|
v-permission="{key: 'inspectionLedger_detail', menuPath: '/project/safeSame/inspectionLedger'}"
|
||||||
@click="newShowDatadetails(scope.row, scope.$index)"
|
@click="newShowDatadetails(scope.row, scope.$index)"
|
||||||
class="operationText last"
|
class="operationText last"
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user