import fetch from '@/common/fetchs.js';
import useNetWork from '@/common/useNetWork.js';

const visitReason =  'https://smartwell.gd.smartlog.work/device/list-page'
const baseConfig =  'https://smartwell.gd.smartlog.work/sys/config/baseConfig'
const Login =  'https://smartwell.gd.smartlog.work/sys/user/login'
const Alarm =  'https://smartwell.gd.smartlog.work/alarm/list'
const JobInfo =  'https://smartwell.gd.smartlog.work/job/info'
const DeviceDetail =  'https://smartwell.gd.smartlog.work/overview/deviceDetail'
const WellInfo =  'https://smartwell.gd.smartlog.work/well/info'
const Welldata =  'https://smartwell.gd.smartlog.work/welldata/list-page'
const Liquiddata =  'https://smartwell.gd.smartlog.work/liquiddata/list-page'
const Gasdata =  'https://smartwell.gd.smartlog.work/gasdata/list-page'


/**
 * 获取燃气数据
 * @param {*}  
 */
export function getGasdata(params) {
	useNetWork();
  return fetch.get(Gasdata,params).then(res => res);
}

/**
 * 获取液位数据
 * @param {*}  
 */
export function getLiquiddata(params) {
	useNetWork();
  return fetch.get(Liquiddata,params).then(res => res);
}

/**
 * 获取井盖数据
 * @param {*}  
 */
export function getWelldata(params) {
	useNetWork();
  return fetch.get(Welldata,params).then(res => res);
}

/**
 * 获取井口详情
 * @param {*}  
 */
export function getWellInfo(params) {
	useNetWork();
  return fetch.get(WellInfo,params).then(res => res);
}

/**
 * 获取设备详情
 * @param {*}  
 */
export function getDeviceDetail(params) {
	useNetWork();
  return fetch.get(DeviceDetail,params).then(res => res);
}

/**
 * 批量消警
 * @param {*}  
 */
export function getBatchCancel(data) {
	useNetWork();
	const BatchCancel =  `https://smartwell.gd.smartlog.work/alarm/batchCancel?keywords=${data.keywords}&alarmType=${data.alarmType}
	&alarmContent=${data.alarmContent}&beginTime=${data.beginTime}&endTime=${data.endTime}&jobStatus=${data.jobStatus}&handleMessage=${data.handleMessage}`
  return fetch.post(BatchCancel).then(res => res);
}

/**
 * 获取宵禁时间
 * @param {*}  
 */
export function getJobInfo(params) {
	useNetWork();
  return fetch.get(JobInfo,params).then(res => res);
}

/**
 * 取消报警
 * @param {*}  
 */
export function getCancelAlarm(data) {
	useNetWork();
  const CancelAlarm = `https://smartwell.gd.smartlog.work/alarm/cancelAlarm?id=${data.id}&jobStatus=${data.jobStatus}&handleMessage=${data.handleMessage}` 
  return fetch.post(CancelAlarm).then(res => res);
}

/**
 * 获取到报警列表
 * @param {*}  
 */
export function getAlarm(params) {
	useNetWork();
  return fetch.get(Alarm,params).then(res => res);
}

/**
 * 登录
 * @param {*}  
 */
export function getLogin(data) {
	useNetWork();
  return fetch.post(Login,data).then(res => res);
}
/**
 * 获取baseConfig
 * @param {*}  
 */
export function getbaseConfig() {
  return fetch.get(baseConfig).then(res => res);
}

/**
 * 获取设备数据
 * @param {*}  
 */
export function getPageList(params) {
	useNetWork();
  return fetch.get(visitReason, params).then(res => res);
}