import request from '@/utils/request';

/**
 * 查询故障类型列表
 * @param query
 * @returns {*}
 */
export const listFaultType = (query) => {
    return request({
        url: '/jdyw/faultType/list',
        method: 'get',
        params: query
    });
};
/**
 * 查询故障类型信息详细
 * @param id
 */
export const getFaultType = (id) => {
    return request({
        url: '/jdyw/faultType/' + id,
        method: 'get'
    });
};

/**
 * 新增故障类型信息
 * @param data
 */
export const addFaultType = (data) => {
    return request({
        url: '/jdyw/faultType',
        method: 'post',
        data: data
    });
};

/**
 * 修改故障类型信息
 * @param data
 */
export const updateFaultType = (data) => {
    return request({
        url: '/jdyw/faultType',
        method: 'put',
        data: data
    });
};

/**
 * 删除故障类型信息
 * @param id
 */
export const delFaultType = (id: string | number | Array<string | number>) => {
    return request({
        url: '/jdyw/faultType/' + id,
        method: 'delete'
    });
};

/**
 * 查询故障信息列表
 * @param query
 * @returns {*}
 */
export const listFault = (query) => {
  return request({
      url: '/jdyw/fault/list',
      method: 'get',
      params: query
  });
};
/**
* 查询故障信息详细
* @param id
*/
export const getFault = (id) => {
  return request({
      url: '/jdyw/fault/' + id,
      method: 'get'
  });
};

/**
* 新增故障信息
* @param data
*/
export const addFault = (data) => {
  return request({
      url: '/jdyw/fault',
      method: 'post',
      data: data
  });
};

/**
* 修改故障信息
* @param data
*/
export const updateFault = (data) => {
  return request({
      url: '/jdyw/fault',
      method: 'put',
      data: data
  });
};

/**
* 删除故障信息
* @param id
*/
export const delFault = (id: string | number | Array<string | number>) => {
  return request({
      url: '/jdyw/fault/' + id,
      method: 'delete'
  });
};

/**
* 新增工单信息
* @param data
*/
export const addWorkTask = (data) => {
  return request({
      url: '/jdyw/workTask',
      method: 'post',
      data: data
  });
};

/**
* 修改工单信息
* @param data
*/
export const updateWorkTask = (data) => {
  return request({
      url: '/jdyw/workTask',
      method: 'put',
      data: data
  });
};

/**
* 工单列表
* @param query
*/
export const getWorkTaskList = (query) => {
  return request({
      url: '/jdyw/workTask/list',
      method: 'get',
      params: query
  });
};
/**
* 工单信息
* @param id
*/
export const getWorkTaskInfo = (id) => {
  return request({
      url: `/jdyw/workTask/${id}`,
      method: 'get',
  });
};
/**
* 根据报修单号 查询工单处理进度
* @param sn
*/
export const getOrderProgress = (sn) => {
  return request({
      url: `/jdyw/workTask/getOrderProgress`,
    method: 'get',
      params: {sn}
  });
};
