import request from '../utils/request'

// 公共 url  主要用于 获取 人员 部门 枚举 等

export function getUserLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function getUserListFos(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/OrderPagedFO", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getSubUserLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMUser/GetDepUsersRecursion", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function modifyPassword(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/UpdatePwd", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getUserOrDepInfo(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/Department/GetSelectUsers", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

//下拉选择人员
export function OrderPagedUseful(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMUser/OrderPagedUseful", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function OrderPagedUseful2(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMUser/OrderPagedUseful", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
//获取用户信息 班组做限制
export function UserPagedLimit(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMUser/OrderPagedUseful", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
//获取用户信息 班组不做限制
export function OrderEntities(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/OrderEntities", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
//获取用户信息 不做限制 
export function UserPagedAll(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

//未删除 不包含 admin
export function OrderPagedUser(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

//下拉选择隐患上报  整改实施单位
export function GetDpartMentNameHeader(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/BSRiskSubmit/GetDpartMentNameHeader", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}


//驳回处理
export function auditOptionShow(dataState, stateReject, dataId) {
	return new Promise((resolve, reject) => {
		if (dataState == stateReject) {
			request.get("/PF/PFApprove/GetRejectContentByAPPID", {
				"ApproveID": dataId
			}).then((result) => {
				resolve(result.Data);
			}).catch((error) => {
				reject(error);
			})
		} else {
			resolve('');
		}
	})
}

// 意见反馈
export function feedBack(params) {
	return new Promise((resolve, reject) => {
		request.post("/PF/Fddeback/Update", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

//意见反馈列表
export function feedBackOrderPaged(params) {
	return new Promise((resolve, reject) => {
		request.post("/PF/Fddeback/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
//获取意见反馈
export function feedBackGet(params) {
	return new Promise((resolve, reject) => {
		request.post("/PF/Fddeback/Get", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

//获取枚举  name:''
export function getEnum(params) {
	return new Promise((resolve, reject) => {
		request.get("/PF/Extend/GetEnum", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

//获取枚举  name:'' ，其中枚举名称以|区分
export function GetEnumAnyOrder(params) {
	return new Promise((resolve, reject) => {
		request.get("/PF/Extend/GetEnumAnyOrder", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}