import request from '@/utils/request'


//  标题 字典 接口 
export function dictData(data) {
  return request({
    url: "/system/dict/data/list",
    method: "post",
    data: data,
  });
}



// 首页 
export function lastData(data) {
  return request({
    url: "/system/data/lastData",
    method: "get",
    params: data,
  });
}



// 首页 
export function taskInfo(data) {
  return request({
    url: "/system/task/info",
    method: "get",
    params: data,
  });
}



// 任务列表 
export function taskList(data) {
  return request({
    url: "/system/task/list",
    method: "post",
    data: data,
  });
}

// 创建任务
export function taskAdd(data) {
  return request({
    url: "/system/task/add",
    method: "post",
    data: data,
  });
}

// 修改任务
export function taskUpdate(data) {
  return request({
    url: "/system/task/edit/",
    method: "post",
    data: data,
  });
}
// 任务 详情
export function taskDelite(id) {
  return request({
    url: "/system/task/edit/" + id,
    method: "get",
    // data: data,
  });
}

// 删除任务
export function remove(data) {
  return request({
    url: "/system/task/remove",
    method: "post",
    data: data,
  });
}

// 小组及关系录入
export function importFile(data) {
  return request({
    url: "/system/data/importData",
    method: "post",
    data: data,
  });
}



/*
导出
current 当前页数
size 每页多少行数据
params 入参(查询参数)
*/
export const exportFile = (current, size, params) => {
  return request({
    url: baseURL + '/lhkyKyxmglGdgl/export',
    method: 'get',
    responseType: 'blob',
    params: {
      ...params,
      current,
      size,
    }
  })
}


// 任务数据
export function taskData(data) {
  return request({
    url: "/system/data/list",
    method: "post",
    data: data,
  });
}

// 数据修改
export function update(data) {
  return request({
    url: "/system/data/edit",
    method: "post",
    data: data,
  });
}

// 批量保存
export function batchSave(data) {
  return request({
    url: "/system/data/batchSave",
    method: "post",
    data: data,
  });
}

//  信宿、信源、信息类型数据统计
export function statistics(query) {
  return request({
    url: "/system/data/stats",
    method: "get",
    params: query,
  });
}


// websocket 回传
export function updateData(data) {
  return request({
    headers: {
      'Content-Type': 'application/json;charset=utf-8'
    },
    url: "/system/data/updateData",
    method: "post",
    data: data,
  });
} 

// 数据添加
export function dataAdd(data) {
  return request({
    url: "/system/data/add",
    method: "post",
    data: data,
  });
}
// 数据删除
export function dataRemove(data) {
  return request({
    url: "/system/data/remove",
    method: "post",
    data: data,
  });
}