102 lines
5.0 KiB
JavaScript
102 lines
5.0 KiB
JavaScript
import axios from 'axios'
|
|
import Cookies from 'js-cookie'
|
|
import store from '@/store'
|
|
|
|
const wsuri_config = `ws://192.168.1.27:61101//WebMoudule//websocket`
|
|
const name_config = `OP8888`
|
|
const name1_config = `OP1000`
|
|
const name3_config = `OP2000`
|
|
const name4_config = `OP9999`
|
|
const readFile_config = window.g.baseURL + `/webpage/file/` // invoice
|
|
const readImg_config = window.g.baseURL + `/webpage/img/` // delivery/MS/performancebond
|
|
const upload_config = window.g.baseURL + `/submit/uploadFile.ashx` // ContractInformationManagement
|
|
const upload2_config = window.g.baseURL + `/submit/upload2.ashx` // delivery
|
|
const upload3_config = window.g.baseURL + `/submit/upload3.ashx` // performancebond
|
|
const uploadInvoiceScan_config = window.g.baseURL + `/submit/uploadInvoiceScan.ashx` // invoice
|
|
const uploadInvoiceScan1_config = window.g.baseURL + `/submit/uploadInvoiceScan1.ashx` // invoice(workshop)
|
|
const download_config = window.g.baseURL + `/submit/downloadFile.ashx` // ContractInformationManagement
|
|
const uploadPerson_config = window.g.baseURL + `/submit/uploadPerson.ashx`
|
|
const uploadOP_config = window.g.baseURL + `/submit/uploadOP.ashx`
|
|
const url_config = window.g.baseURL + `/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
|
|
const ExcelDownLoad_config = window.g.baseURL + '/submit/MESCommonBase.ashx' // 导出excel
|
|
const ServerIP_config = window.g.baseURL + `/webpage/file/`
|
|
const uploadFileMachine_config = window.g.baseURL + `/submit/uploadFileMachine.ashx` // 机床总图 发布时改成0.231
|
|
const downloadFileMachine_config = window.g.baseURL + `/submit/downloadFileMachine.ashx` // 机床总图 发布时改成0.231
|
|
const MESUploadFile_config = window.g.baseURL + `/submit/MESUploadFileParts.ashx`
|
|
const MESUploadFileProduct_config = window.g.baseURL + `/submit/MESUploadFileProduct.ashx`
|
|
const MESDownloadFile_config = window.g.baseURL + `/submit/MESDownloadFile.ashx`
|
|
const MESUploadFileProject_config = window.g.baseURL + `/submit/MESUploadFileProject.ashx`
|
|
const MESUploadFileProcess_config = window.g.baseURL + `/submit/MESUploadFileProcess.ashx`
|
|
const request_config = window.g.baseURL + `/submit/MESCommonBase.ashx`
|
|
|
|
export const wsuri = wsuri_config
|
|
export const name = name_config
|
|
export const name1 = name1_config
|
|
export const name3 = name3_config
|
|
export const name4 = name4_config
|
|
|
|
export const readFile = readFile_config // invoice
|
|
export const readImg = readImg_config // delivery/MS/performancebond
|
|
export const upload = upload_config // ContractInformationManagement
|
|
export const upload2 = upload2_config // delivery
|
|
export const upload3 = upload3_config // performancebond
|
|
export const uploadInvoiceScan = uploadInvoiceScan_config // invoice
|
|
export const uploadInvoiceScan1 = uploadInvoiceScan1_config // invoice(workshop)
|
|
export const download = download_config // ContractInformationManagement
|
|
export const uploadPerson = uploadPerson_config
|
|
export const uploadOP = uploadOP_config
|
|
export const url = url_config // 采购件入库、离线件入库
|
|
export const ExcelDownLoad = ExcelDownLoad_config // 导出excel
|
|
// 技术中心程序发布时要更改下面所有的IP到0段
|
|
export const ServerIP = ServerIP_config
|
|
export const uploadFileMachine = uploadFileMachine_config // 机床总图 发布时改成0.231
|
|
export const downloadFileMachine = downloadFileMachine_config // 机床总图 发布时改成0.231
|
|
export const MESUploadFile = MESUploadFile_config
|
|
export const MESUploadFileProduct = MESUploadFileProduct_config
|
|
export const MESDownloadFile = MESDownloadFile_config
|
|
export const MESUploadFileProject = MESUploadFileProject_config
|
|
export const MESUploadFileProcess = MESUploadFileProcess_config
|
|
const service = axios.create({
|
|
baseURL: request_config,
|
|
timeout: 1500000 // 请求超时时间
|
|
})
|
|
|
|
// && config.data.name !== '菜单系统模块_通知信息_查询数据' && config.data.name !== '菜单系统模块_首页信息_查询数据1' && config.data.name !== '菜单系统模块_首页信息_查询数据2'
|
|
service.interceptors.request.use(config => {
|
|
if (config.data.name !== '菜单系统模块_用户名密码_查询数据_new2' && config.data.name !== '菜单系统模块_获取角色模块_查询数据') {
|
|
const id = Cookies.get('id')
|
|
if (typeof (id) === 'undefined') {
|
|
store.dispatch('FedLogOut').then(() => {
|
|
location.reload() // 为了重新实例化vue-router对象 避免bug
|
|
alert('此账号登录失效,请重新登录')
|
|
})
|
|
}
|
|
}
|
|
return config
|
|
}, error => {
|
|
Promise.reject(error)
|
|
})
|
|
|
|
export default service
|
|
|
|
// async function getSession_id() {
|
|
// const id = Cookies.get('id')
|
|
// const session_id = Cookies.get('session_id')
|
|
// const param = {
|
|
// url: url,
|
|
// method: 'post',
|
|
// data: {
|
|
// type: '1',
|
|
// name: '菜单系统模块_用户sessionID_查询数据',
|
|
// param: '人员编号=' + id
|
|
// }
|
|
// }
|
|
// const res = await axios(param)
|
|
// if (session_id !== res.data[0].session_id) {
|
|
// return 0
|
|
// } else {
|
|
// return 1
|
|
// }
|
|
// }
|
|
export const action = 'http://192.168.1.178:8082/submit/MESCommonBase.ashx'
|