
import axios from 'axios'
import request from '../../utils/request'
import qs from 'qs'

export default {
  // 保留请求取消
  cancels: {},
  // 话务模型----------------------------------------------------------------------------------------------------------------
  // 话务列表
  simu_voiceslist(params) {
    this.cancels['simu_voiceslist']?.()
    return request.get(
      `/simu/voice/list?${qs.stringify(params)}`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_voiceslist'] = c
        })
      }
    )
  },
  //新增话务
  simu_voicesAdd(params) {
    this.cancels['simu_voicesAdd']?.()
    return request.post(
      `/simu/voice`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_voicesAdd'] = c
        })
      }
    )
  },
  //修改话务
  simu_voicesput(params) {
    this.cancels['simu_voicesput']?.()
    return request.put(
      `/simu/voice`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_voicesput'] = c
        })
      }
    )
  },
  //删除话务
  simu_voicesRemo(data) {
    this.cancels['simu_voicesRemo']?.()
    return request.delete(
      `/simu/voice/${data.ids}`,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_voicesRemo'] = c
        })
      }
    )
  },
  //话务详细信息
  simu_voicesId(params) {
    this.cancels['simu_voicesId']?.()
    return request.get(
      `/simu/voice/${params.id}`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_voicesId'] = c
        })
      }
    )
  },
  // 话务模型结束----------------------------------------------------------------------------------------------------------------
  // 业务模型----------------------------------------------------------------------------------------------------------------
  // 业务列表
  simu_businesslist(params) {
    this.cancels['simu_businesslist']?.()
    return request.get(
      `/simu/business/list?${qs.stringify(params)}`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_businesslist'] = c
        })
      }
    )
  },
  //新增业务
  simu_businessAdd(params) {
    this.cancels['simu_businessAdd']?.()
    return request.post(
      `/simu/business`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_businessAdd'] = c
        })
      }
    )
  },
  //修改业务
  simu_businessput(params) {
    this.cancels['simu_businessput']?.()
    return request.put(
      `/simu/business`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_businessput'] = c
        })
      }
    )
  },
  //删除业务
  simu_businessRemo(data) {
    this.cancels['simu_businessRemo']?.()
    return request.delete(
      `/simu/business/${data.ids}`,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_businessRemo'] = c
        })
      }
    )
  },
  //业务详细信息
  simu_businessId(params) {
    this.cancels['simu_businessId']?.()
    return request.get(
      `/simu/business/${params.id}`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_businessId'] = c
        })
      }
    )
  },
  // 业务模型结束-------------------------------------------------------------------------------------------------------------    ----

  //接口调节-------------------------------------------------------------------------------------------------------------  
  simu_rdFileInsList(params) {
    this.cancels['simu_rdFileInsList']?.()
    return request.get(
      `/simu/rdFileIns/list?${qs.stringify(params)}`,
      params,
      {
        cancelToken: new axios.CancelToken(c => {
          this.cancels['simu_rdFileInsList'] = c
        })
      }
    )
  },
}