import request from '../utils/request'

export function getCheckType(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/BSCheckType/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getCheckLevel(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/BSCheckTypeLevel/OrderPagedLevel", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getCheckArea(params) {
	return new Promise((resolve, reject) => {
		request.post("/HM/HMRiskTask/OrderPagedAreaMineType", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getCheckContent(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/BSCheckContents/OrderPagedObject", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getCheckProblem(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/CheckQuestion/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function saveRiskReport(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/BSRiskSubmit/FullUpdateUser", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getRiskReportData(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/RiskSubmit/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function getUserListOlds(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/OrderPagedOld", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
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 getTeamLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/Team/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function getClassLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/Class/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function getUserPostLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/UserPost/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function getDepartmentLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/Department/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function getProductionUnitLists(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/UserProductionUnitSet/OrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
export function saveUser(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/User/Update", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

export function getRiskDataById(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/RiskSubmit/Get", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

// wyw 手动隐患上报  区域选定 加载 责任人 责任部门
export function GetRiskAreaMaster(params) {
	return new Promise((resolve, reject) => {
		request.post("/BS/BSRiskSubmit/GetRiskAreaMaster", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}