import {
	request
} from '@/utils/request'
// 获取故障上报统计
export function getFaultCount(params) {
	return request({
		url: '/rq/stat/main/total',
		method: 'get',
		params
	})
}
// 故障上报列表
export function getFaultList(params) {
	return request({
		url: '/rq/iot-failure-report/page/app',
		method: 'get',
		params
	})
}
// 故障上报
export function createFault(data) {
	return request({
		url: '/rq/iot-failure-report/create',
		method: 'post',
		data: data
	})
}
// 故障上报详情
export function getFaultDetail(params) {
	return request({
		url: '/rq/iot-failure-report/get',
		method: 'get',
		params
	})
}
// 故障上报修改
export function updateFault(data) {
	return request({
		url: '/rq/iot-failure-report/update',
		method: 'put',
		data: data
	})
}
// 故障上报删除
export function deleteFault(params) {
	return request({
		url: '/rq/iot-failure-report/delete',
		method: 'delete',
		params
	})
}

/**
 * 更新故障上报流程信息
 * @param id 故障id
 * @param type 维修类型
 * @param assigneeUserId 负责人
 */
export const updateFaultProcess = (id, type, assigneeUserId) =>
	request({
		url: '/rq/iot-failure-report/process-info',
		method: 'PUT',
		params: { id, type, assigneeUserId }
	})

/**
 * 故障上报审批人列表
 */
export const getFailureApprovalList = () =>
	request({
		url: '/rq/iot-failure-report/get/approval',
		method: 'GET',
	})



// 获取部门名称
	export function getDeptName(deviceId) {
		return request({
			url: `/rq/iot-device/company/${deviceId}`,
			method: 'GET'
		});
}
	


 export function updateIotMaintainProcess(processId,id, type,assigneeUserId, trans){
	//  return request.put({ url: `/rq/iot-failure-report/process-info?processId=` + processId + `&id=` + id + `&type=` + type + `&assigneeUserId=` + assigneeUserId + `&trans=` + trans })
		request({
			url: `/rq/iot-failure-report/process-info?processId=` + processId + `&id=` + id + `&type=` + type + `&assigneeUserId=` + assigneeUserId + `&trans=` + trans,
			method: 'PUT',
		})
  }