import axios from 'axios'
// 创建axios实例
const service = axios.create({
  // baseURL: `http://127.0.0.1:41185/submit/MESCommonBase`,
  baseURL: window.dt_Config.serverAddress,
  // baseURL: `http://124.220.32.217:8015/submit/MESCommonBase.ashx`,
  // baseURL: `http://192.168.113.111:8459/submit/MESCommonBase.ashx`,
  timeout: 1500000 // 请求超时间 default service
})

// const ExcelDownLoad = 'http://127.0.0.1:41185/submit/MESCommonBase' // 导出excel
const ExcelDownLoad = window.dt_Config.serverAddress // 导出excel
// const ExcelDownLoad = 'http://124.220.32.217:8015/submit/MESCommonBase.ashx' // 导出excel
// const ExcelDownLoad = 'http://192.168.113.111:8459/submit/MESCommonBase.ashx' // 导出excel

const servicePlc_1 = axios.create({
  baseURL: `http://192.168.0.1:41186/api/PLC1`,
  timeout: 1500000, // 请求超时间 default service,
  method: 'GET'
})

const servicePlc_2 = axios.create({
  baseURL: `http://127.0.0.1:41185/api/PLC2`,
  // baseURL: `http://124.220.32.217:41181/api/PLC2`,
  // baseURL: `http://192.168.113.111:41181/api/PLC2`,
  timeout: 1500000, // 请求超时间 default service,
  method: 'GET'
})

const serviceDT_Process = axios.create({
  baseURL: `http://127.0.0.1:41185/api/SqlCraft`,
  // baseURL: `http://124.220.32.217:41181/api/SqlCraft`,
  // baseURL: `http://192.168.113.111:41181/api/SqlCraft`,
  timeout: 1500000, // 请求超时间 default service,
  method: 'GET'
})
const serviceDT_ProcessData = axios.create({
  baseURL: window.dt_Config.serviceProcessDataAddress,
  // baseURL: `http://124.220.32.217:41181/api/GetPositionData`,
  // baseURL: `http://192.168.113.111:41181/api/GetPositionData`,
  timeout: 1500000, // 请求超时间 default service,
  method: 'POST'
})
export default service
axios.defaults.headers.post['Content-Type'] = 'application/json'
export {
  servicePlc_1, servicePlc_2, ExcelDownLoad, serviceDT_Process, serviceDT_ProcessData
}
