import axios from 'axios';
import global from '../Global.js'

// 基础方法进行封装
function getApiBasic(url, postdata) {
    return axios.post(url, postdata).then(function (data) {
        let json = data.data;
        return json
    }, function (response) {
        console.info(response);
    })
}

// 调用的api改写成方法
export function worldDetail(postdata) {
    let url = headapi + 'worldDetail';
    return getApiBasic(url, postdata);
}

// 测试用接口
export function editbasicinfo(postdata) {
    let url = headapi + 'editbasicinfo';
    return getApiBasic(url, postdata);
}

export function modPwd(postdata) {
    let url = headapi + 'modPwd';
    return getApiBasic(url, postdata);
}

export function getLoftInfo(postdata) {
    let url = headapi + 'getLoftInfo';
    return getApiBasic(url, postdata);
}

export function wifiSingle(postdata) {
    let url = headapi + 'wifiSingle';
    return getApiBasic(url, postdata);
}

export function Scan(postdata) {
    let url = headapi + 'Scan';
    return getApiBasic(url, postdata);
}

export function Watching(postdata) {
    // let url = headapi + 'Watching';
    // return getApiBasic(url,postdata);
    let item = [];
    let t = 0;
    for (var i = 0; i < 9; i++) {
        t = i + 1;
        item.push({
            'time': "@date",
            'checkRs': "Signal设备03@integer(301,600)检测完成，206会议室安全",
        })
    }
    let res = {
        Rs: item,
        Code: 0,
        Memo: '登陆成功'
    };
    return res;
}

// 真实接口
// 用户登录
export function SignIn(postdata) {
    let url = headapi + 'v1/Auth/SignIn';
    return getApiBasic(url, postdata);
}

// 获取验证图片
export function GenVerifyPic(postdata) {
    let url = headapi + 'v1/Auth/GenVerifyPic';
    return getApiBasic(url, postdata);
}

// 用户退出
export function SignOut(postdata) {
    let url = headapi + 'v1/Auth/SignOut';
    return getApiBasic(url, postdata);
}

// Region

// 添加区域
export function RegionAdd(postdata) {
    let url = headapi + 'v1/Region/Add';
    return getApiBasic(url, postdata);
}

// 区域详情
export function RegionDetail(postdata) {
    let url = headapi + 'v1/Region/Detail';
    return getApiBasic(url, postdata);
}

// 区域列表
export function RegionList(postdata) {
    let url = headapi + 'v1/Region/List';
    return getApiBasic(url, postdata);
}

// Detector

// 添加检测设备
export function DetectorAdd(postdata) {
    let url = headapi + 'v1/Detector/Add';
    return getApiBasic(url, postdata);
}

// 添加检测设备
export function DetectorEdit(postdata) {
    let url = headapi + 'v1/Detector/Edit';
    return getApiBasic(url, postdata);
}

// 检测设备详情
export function DetectorDetail(postdata) {
    let url = headapi + 'v1/Detector/Detail';
    return getApiBasic(url, postdata);
}

// 检测设备列表
export function DetectorList(postdata) {
    let url = headapi + 'v1/Detector/List';
    return getApiBasic(url, postdata);
}

// 检测设备列表
export function Region06G(postdata) {
    let url = headapi + 'v1/Index/Region06G';
    return getApiBasic(url, postdata);
}

// 区域wifi信道信息
export function WifiChannel(postdata) {
    let url = headapi + 'v1/Index/WifiChannel';
    return getApiBasic(url, postdata);
}

// 区域监控平面
export function MonitorArea(postdata) {
    let url = headapi + 'v1/Index/MonitorArea';
    return getApiBasic(url, postdata);
}

// 实时监控详情
export function NetDevMonitor(postdata) {
    let url = headapi + 'v1/Index/NetDevMonitor';
    return getApiBasic(url, postdata);
}

// 探测设备工作监控
export function WirelessMonitor(postdata) {
    let url = headapi + 'v1/Index/WirelessMonitor';
    return getApiBasic(url, postdata);
}

// 区域安全状态和无线设备列表
export function DevList(postdata) {
    let url = headapi + 'v1/Index/DevList';
    return getApiBasic(url, postdata);
}

// 开始无线扫描
export function WirelessStart(postdata) {
    let url = headapi + 'v1/DetectorControl/WirelessStart';
    return getApiBasic(url, postdata);
}

// 无线扫描状态
export function WirelessStatus(postdata) {
    let url = headapi + 'v1/DetectorControl/WirelessStatus';
    return getApiBasic(url, postdata);
}

// 扫描策略列表
export function ScanStrategyList(postdata) {
    let url = headapi + 'v1/ScanStrategy/List';
    return getApiBasic(url, postdata);
}

// 扫描策略详情
export function ScanStrategyDetail(postdata) {
    let url = headapi + 'v1/ScanStrategy/Detail';
    return getApiBasic(url, postdata);
}

// 策略列表带详情
export function ScanStrategyListDetail(postdata) {
    let url = headapi + 'v1/ScanStrategy/ListDetail';
    return getApiBasic(url, postdata);
}

// 策略列表带详情
export function ScanStrategyAdd(postdata) {
    let url = headapi + 'v1/ScanStrategy/Add';
    return getApiBasic(url, postdata);
}

// 策略删除
export function ScanStrategyDel(postdata) {
    let url = headapi + 'v1/ScanStrategy/Del';
    return getApiBasic(url, postdata);
}

// 策略修改
export function ScanStrategyEdit(postdata) {
    let url = headapi + 'v1/ScanStrategy/Edit';
    return getApiBasic(url, postdata);
}

// 获取探测记录
export function DetectorLogQuery(postdata) {
    let url = headapi + 'v1/Detector/LogQuery';
    return getApiBasic(url, postdata);
}

// 网络设备列表
export function DetectorNetDevList(postdata) {
    let url = headapi + 'v1/Detector/NetDevList';
    return getApiBasic(url, postdata);
}

// 区域列表带详情
export function RegionListDetail(postdata) {
    let url = headapi + 'v1/Region/ListDetail';
    return getApiBasic(url, postdata);
}

// 2021/1/27

// 区域删除
export function RegionDelete(postdata) {
    let url = headapi + 'v1/Region/Delete';
    return getApiBasic(url, postdata);
}

// 提交已知设备
export function DetectorKnownEdit(postdata) {
    let url = headapi + 'v1/Detector/KnownEdit';
    return getApiBasic(url, postdata);
}

// 已知设备移除
export function DetectorKnownRemove(postdata) {
    let url = headapi + 'v1/Detector/KnownRemove';
    return getApiBasic(url, postdata);
}

// 获取探测走势图
export function ChartDayCount(postdata) {
    let url = headapi + 'v1/Chart/DayCount';
    return getApiBasic(url, postdata);
}

// 无线扫描任务列表
export function WirelessTaskList(postdata) {
    let url = headapi + 'v1/DetectorControl/WirelessTaskList';
    return getApiBasic(url, postdata);
}

// ScheduledTask计划任务
// 计划任务添加
export function ScheduledTaskAdd(postdata) {
    let url = headapi + 'v1/ScheduledTask/Add';
    return getApiBasic(url, postdata);
}

// 计划任务删除
export function ScheduledTaskDel(postdata) {
    let url = headapi + 'v1/ScheduledTask/Del';
    return getApiBasic(url, postdata);
}

// 计划任务修改
export function ScheduledTaskEdit(postdata) {
    let url = headapi + 'v1/ScheduledTask/Edit';
    return getApiBasic(url, postdata);
}

// 计划任务列表
export function ScheduledTaskList(postdata) {
    let url = headapi + 'v1/ScheduledTask/List';
    return getApiBasic(url, postdata);
}
// 停止无线扫描
export function WirelessStop(postdata) {
    let url = headapi + 'v1/DetectorControl/WirelessStop';
    return getApiBasic(url, postdata);
}
