import { request } from "@/utils/request.js";

export function getRecordFillingList(params) {
  return request({
    url: "/rq/iot-opeation-fill/page1",
    method: "GET",
    params,
  });
}
export function getRecordFillingDetailGetPage(params) {
  return request({
    url: "/rq/iot-opeation-fill/page",
    method: "GET",
    params,
  });
}
export function getRecordFillingDetailGetAttrs(params) {
  return request({
    url: "/rq/iot-opeation-fill/getAttrs",
    method: "GET",
    params,
  });
}
// 运行记录填报
export function recordFillingDetailInsertLog(data) {
  return request({
    url: "/rq/iot-opeation-fill/insertLog",
    method: "POST",
    data,
  });
}

/**
 * 运气记录详情
 * @param id
 */
export const getRecordFillingDetail = id =>
  request({
    url: "/rq/iot-opeation-fill/get",
    method: "GET",
    params: { id },
  });

/**
 * 运行记录模板列表
 */
export const getRecordFillingTemplateList = () =>
  request({
    url: "/rq/iot-model-template/page",
    method: "GET",
    params: { pageNo: 1, pageSize: 100, status: 0 },
  });

/**
 * 获取设备模板属性列表
 * @param deviceCategoryId
 */
export const getRecordFillingOptionList = deviceCategoryId =>
  request({
    url: "rq/iot-model-template-attrs/page",
    method: "GET",
    params: { pageNo: 1, pageSize: 100, deviceCategoryId },
  });

// 忽略运行工单
export function recordFillingIgnore(data) {
  return request({
    url: "/rq/iot-opeation-fill/update1",
    method: "put",
    data: data,
  });
}

// 运行记录填报后更新工单状态
export function recordFillingUpOperationOrder(data) {
  return request({
    url: "/rq/iot-opeation-fill/upOperationOrder",
    method: "POST",
    data: data,
  });
}

// 获取运行记录填报工单详情-设备列表+属性
export function recordFillingDetailGetPageAndAttrs(params) {
  return request({
    url: "/rq/iot-opeation-fill/orderFillpage1",
    method: "GET",
    params,
  });
}

export function reportDetailsGet(id) {
  return request({
    url: `rq/iot-opeation-fill/prod/detail/${id}`,
    method: "GET",
  });
}
// 保存运行记录填报工单详情填报内容
export function recordFillingDetailInsertDataList(data) {
  return request({
    url: "/rq/iot-opeation-fill/insertDataList",
    method: "POST",
    data: data,
  });
}

// 获取部门名称
export function getDeptName(deptId) {
  return request({
    url: `/rq/report/dept/${deptId}`,
    method: "GET",
  });
}
