import { request } from '../libs/request.js'

//获取组织架构
export function getGroupTree() {
	return request({
		url: '/group/treeView'
	})
}
//获取隐患类别
export function getDangerCatList() {
	return request({
		url: '/ent/danger/cat'
	})
}

/**
 * 获取用户列表
 */
export function getUserList() {
	return request({
		url: '/user/selectUserByOcId'
	})
}

/**
 * 添加隐患
 * @param data
 * @returns {AxiosPromise}
 */
export function add(data) {
	return request({
		url: `/ent/danger/trigger`,
		method: 'PUT',
		data
	})
}

/**
 * 创建Danger Ins
 * @param data
 * @returns {AxiosPromise}
 */
export function createDangerIns(wfDefId) {
	return request({
		url: `/ent/danger/create/` + wfDefId,
		method: 'POST'
	})
}
/**
 * 我处理的隐患分页列表
 * @param {Object} data
 */
export function getMyHandlingDangerInsByPage(data) {
	return request({
		// url: `/ent/danger/myHandling/page`,
		url: "/ent/danger/page",
		data
	})
}
/**
 * 获取详细流程信息
 * @param {Object} dangerId
 * 废弃
 */
export function getDangerInsById(dangerId) {
	return request({
		// url: `/ent/danger/ins/` + dangerId,
		url: "/ent/danger/" + dangerId,
	})
}
/**
 * 创建Danger Ins
 * @param data
 * @returns {AxiosPromise}
 */
export function triggerDangerIns(data) {
	return request({
		url: `/ent/danger/trigger`,
		method: 'PUT',
		data
	})
}
/*
	获取隐患详情
*/
export function getDangerDetailsById(dangerId) {
	return request({
		url: `/ent/danger/${dangerId}` ,
	})
}