/**分页查询接口重试日志 */
import request from '@/utils/request'

import { UPCLOUD_RDC_TMS_MAINDATA_SERVICE, UPCLOUD_RDC_TMS_BUSINESS_SERVICE } from '@/config/serviceSettings.js'

const serviceName = UPCLOUD_RDC_TMS_BUSINESS_SERVICE
//  分页查询接口重试日志 GET
export const mainTableInfoUrl = serviceName + '/inTransit/loadingBill/getLoadingBill'
//派车单定位 POST
export const getPositionUrl = serviceName + '/inTransit/loadingBill/getPositionByLoadingBillId'
//派车单轨迹 POST
export const getTrackUrl = serviceName + '/inTransit/loadingBill/getTrackByLoadingBillId'

export const shipUrl=serviceName+'/inTransit/common/getShipBillByLoadingBillNo'
export const pathUrl=getTrackUrl
export const warnUrl=serviceName + '/inTransit/common/getAlarm'
export const billUrl = mainTableInfoUrl


function responseThen(response) {
  if (response.success) {
    this.visible = false
    this.$message.success(response.message)
  } else {
    this.$exception(response)
  }
  this.confirmLoading = false
  return response
}
export const getMapData = (_this, params,urlType) => {
  let url = {
    location: getPositionUrl+'/'+urlType,
    path: getTrackUrl+'/'+urlType
  }
  return request({
    url: url[_this.type],
    method: 'post',
    params,
  })
}

//派车单迹点
export const getPathMapData = (_this, data,urlType) => {

  // data.shipBillId = data.shipBillNod
  // delete data.loadingBillNo
  return request({
    url:getTrackUrl+ '/' + urlType,
    method: 'post',
    data,
  })
}

//派车单定位
export const getLocationMapData = (_this, data,urlType) => {
  return request({
    url: getPositionUrl+'/'+urlType,
    method: 'post',
    data
  })
}

//通过派车单查找运单
export const getShillData = (_this, data,urlType) => {
  return request({
    url: shipUrl+'/'+urlType,
    method: 'post',
    data
  })
}

export const getAlarmData = (_this, data, urlType) => {

  return request({
    url: warnUrl+'/'+urlType,
    method: 'post',
    data
  })
}


export const getSiteInfo = (_this, data, urlType) => {
  return request({
    url: serviceName+'/sendcar/site_info',
    method: 'post',
    data
  })
}



