/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2024-10-08 09:26:24
 * @LastEditors: SunTao 328867980@qq.com
 * @LastEditTime: 2024-11-05 13:54:44
 * @FilePath: \znxjxt-ui\src\api\xj\disease.js
 * @Description: 巡检信息-病害管理
 */
import request from "@/utils/request";

// 查询病害日志列表
export function listDefect(query) {
  return request({
    url: "/xj/defect/list",
    method: "get",
    params: query,
  });
}

// 查询病害日志详细
export function getDefect(id) {
  return request({
    url: "/xj/defect/" + id,
    method: "get",
  });
}

// 新增病害日志
export function addDefect(data) {
  return request({
    url: "/xj/defect",
    method: "post",
    data: data,
  });
}

// 修改病害日志
export function updateDefect(data) {
  return request({
    url: "/xj/defect",
    method: "put",
    data: data,
  });
}

// 删除病害日志
export function delDefect(data) {
  return request({
    url: "/xj/defect/",
    method: "delete",
    data
  });
}

// 病害类型下拉数据
export function getDefectTypes() {
  return request({
    url: "/metadata/defectTypes",
    method: "get",
  });
}

// 路段下拉数据
export function getSegment() {
  return request({
    url: "/api/v2/segment/selectList",
    method: "post",
  });
}

// 查询列表病害类型
export function getDefectList(params) {
  return request({
    // 病害类型下拉
    // url: "/metadata/defectType",
    url: "/bigscreen/v2/getDefectTypesDrowDown",
    method: "get",
    params,
  });
}

// 校验状态下拉类型
export function getStatesList() {
  return request({
    url: "/metadata/defectDataStatus",
    method: "get",
  });
}

// 病害状态下拉类型
export function getDefectStatus() {
  return request({
    url: "/metadata/defectState",
    method: "get",
  });
}

// 批量修改病害状态
export function changeDefectStatus(data) {
  return request({
    url: "/xj/defect/batch",
    method: "put",
    data,
  });
}

// 合并病害接口
export function mergeDefect(data) {
  return request({
    url: "/xj/defect/mergeDefects",
    method: "post",
    data,
  });
}


// 拆分病害接口
export function splitDefect(data) {
  return request({
    url: "/xj/defect/splitDefect",
    method: "post",
    data,
  });
}


// 根据病害id查询快照id下拉
export function getDefectById(id) {
  return request({
    url: "/xj/defect/getDefectDetailDropDownList",
    method: "get",
    params: { id },
  });
}


// 根据快照id查询查询具体数据
export function getDetailsBySnapShotId(snapShotId) {
  return request({
    url: "/xj/defect/getDefectBySnapShotId",
    method: "get",
    params: { snapShotId },
  });
}

// 巡检任务下拉接口
export function getTaskList(params) {
  return request({
    url: "/xj/xjtask/taskDropDown",
    method: "get",
    params,
  });
}