/*
包含n个接口请求函数的模块
函数的返回值: promise对象
 */

import ajax from './ajax'
import state from '../store/state'

const {systemJson} = state
const BASE_URL = `${systemJson.ServerIP}:${systemJson.ServerPort}`

// 登录
export const reqLogin = (data) => ajax(BASE_URL+'/login',data,'POST')

// 退出登录
export const reqLogout = (data) => ajax(BASE_URL+'/logout',data,'POST')

// 导入配置json文件(device和bigscreen)
export const reqImportConfigFiles = (data) => ajax(BASE_URL+'/v1/import',data,'POST')

// 刷新视图
export const reqRefreshView = (data) => ajax(BASE_URL+'/v1/refreshView',data,'POST')

// 配置大屏
export const reqConfigBigScreen = (data) => ajax(BASE_URL+'/v1/bigscreen',data,'POST')

// 配置设备
export const reqConfigDevice = (data) => ajax(BASE_URL+'/v1/device',data,'POST')

// 发送指令
export const reqSendInstruction = (data) => ajax(BASE_URL+'/v1/instruction',data,'POST')

// 获取预案列表
export const reqGetPlanList= () => ajax(BASE_URL+'/v1/plan')

// 保存预案
export const reqSavePlan = (data) => ajax(BASE_URL+'/v1/plan',data,'POST')

// 申请预案
export const reqApplyPlan = (id,data) => ajax(BASE_URL+`/v1/plan/${id}`,data,'POST')

// 删除预案
export const reqDeletePlan = (id) => ajax(BASE_URL+`/v1/plan`,{id},'DELETE')
















