import request from '../../../utils/request'

// 获取排班车间数据
export function getWorkShopData(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/Department/WorkShopTreeData", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

// 获取排班数据
export function getScheduleData(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/DepartmentScheduling/OrderEntities", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

// 获取班组人员
export function getTeamPerson(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/TeamPerson/OrderEntities", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

// 获取随手拍数据by ID
export function getSnapshotData(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMSnapshot/GetEdit", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

// 获取随手拍列表
export function getSnapshotList(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMSnapshot/FullOrderPaged", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}

// 随手拍确认
export function handleOkSnapshot(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMSnapshot/PersonalAgree", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
// 获取待办数据列表
export function getNotificationTaskList(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/FMNotificationTask/FullOrderPaged", 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/OrderPagedAuthority", params).then((result) => {
      if (result.IsSuccessful) {
        resolve(result);
      }
    }).catch((error)=>{
      reject(error);
    })
  })
}
//转办
export function getChangeUser(params) {
	params.IgnoreDataRule = true;
	return new Promise((resolve, reject) => {
		request.post("/FM/FMNotificationTask/Complaint", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error);
		})
	})
}
//人员休假配置
export function PersonLeaveFull(params) {
	return new Promise((resolve, reject) => {
		request.post("/FM/UserVacationSet/Update", params).then((result) => {
			if (result.IsSuccessful) {
				resolve(result.Data);
			}
		}).catch((error) => {
			reject(error)
		})
	})
}
//人员列表
export function getFMUser(params) {
  return new Promise((resolve, reject) => {
    request.post("/FM/User/OrderPaged", params).then((result) => {
      if (result.IsSuccessful) {
        resolve(result);
      }
    }).catch((error)=>{
      reject(error);
    })
  })
}