PersonManagerController.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. using PMS.BusinessModels.Person;
  2. using PMS.EntityModels.PersonManager;
  3. using PMS.Interface;
  4. using PMS.Interface.PresonManager;
  5. using PMS.Interface.ProManager;
  6. using PMS.Interface.SysManager;
  7. using QWPlatform.SystemLibrary.Security;
  8. using QWPlatform.SystemLibrary.Web;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Web;
  13. using System.Web.Mvc;
  14. namespace PMS.WebUI.Controllers
  15. { /// <summary>
  16. /// 创建人:王璐
  17. /// 创建日期:2018/12/30
  18. /// 模块功能:机构人员
  19. /// </summary>
  20. public class PersonManagerController : BaseController
  21. {
  22. /// <summary>
  23. /// 实例接口
  24. /// </summary>
  25. IPersonModule PersonModule = InterfaceFactory.CreateBusinessInstance<IPersonModule>();
  26. [HttpGet]
  27. public ActionResult Index()
  28. {
  29. return View();
  30. }
  31. #region 信息显示以及查询
  32. /// <summary>
  33. /// 获取权限渠道
  34. /// </summary>
  35. public ActionResult ChannelInfo()
  36. {
  37. string json = PersonModule.GetAll_Channel(GetAuthDats().Channel);
  38. return Content(json, "application/json");
  39. }
  40. /// <summary>
  41. /// 渠道下的人员
  42. /// </summary>
  43. /// <param name="UserID"></param>
  44. /// <returns></returns>
  45. public ActionResult PersonInfo(string id, int page, int rows, string Search, string Nature, string Project)
  46. {
  47. string json = PersonModule.GetAll_PersonInfo(id, page, rows, Search, Nature, Project);
  48. return Content(json, "application/json");
  49. }
  50. /// <summary>
  51. /// 根据人员ID获取对应的人员信息
  52. /// </summary>
  53. /// <returns></returns>
  54. public ActionResult GetInfoByID(string id)
  55. {
  56. var json = PersonModule.GetInfoByID(id);
  57. return Content(json, "text/json");
  58. }
  59. #endregion
  60. #region 人员添加
  61. /// <summary>
  62. /// 增加人员的窗口
  63. /// </summary>
  64. public ActionResult PersonInfoWindow(string channelId)
  65. {
  66. ViewBag.id = channelId;
  67. return View();
  68. }
  69. /// <summary>
  70. /// 保存人员信息
  71. /// </summary>
  72. public int SavePerson(PersonBusinessModel model, string type)
  73. { //判断为说明操作 1:增加 2:修改
  74. if (type == "1")
  75. {
  76. return PersonModule.SaveAddPerson(model);
  77. }
  78. if (type == "2")
  79. {
  80. return PersonModule.SaveUpdatePerson(model);
  81. }
  82. return 0;
  83. }
  84. /// <summary>
  85. /// 创建人员时勾选自动生成账户
  86. /// </summary>
  87. /// <param name="model"></param>
  88. /// <returns></returns>
  89. public int AutoAccount(PersonBusinessModel model)
  90. {
  91. return PersonModule.AutoAccount(model);
  92. }
  93. /// <summary>
  94. /// 获取性别
  95. /// </summary>
  96. /// <returns></returns>
  97. public ActionResult GetSex()
  98. {
  99. var dt = PersonModule.GetSex();
  100. return Content(dt, "application/json");
  101. }
  102. /// <summary>
  103. /// 获取人员性质
  104. /// </summary>
  105. /// <returns></returns>
  106. public ActionResult GetXZ()
  107. {
  108. var user = GetCurrentUser();
  109. var dt = PersonModule.GetXZ(user.PersonProperty);
  110. return Content(dt, "application/json");
  111. }
  112. /// <summary>
  113. /// 获取职务
  114. /// </summary>
  115. /// <returns></returns>
  116. public ActionResult GetJob()
  117. {
  118. var user = GetCurrentUser();
  119. var dt = PersonModule.GetJob(user);
  120. return Content(dt, "application/json");
  121. }
  122. /// <summary>
  123. /// 根据渠道ID获取项目
  124. /// </summary>
  125. /// <returns></returns>
  126. public ActionResult GetProject(string id)
  127. {
  128. var dt = PersonModule.GetProject(id, "", GetAuthDats().Project);
  129. return Content(dt, "application/json");
  130. }
  131. /// <summary>
  132. /// 根据项目ID获取机构
  133. /// </summary>
  134. /// <returns></returns>
  135. public ActionResult GetStation(string id)
  136. {
  137. var dt = PersonModule.GetStation(id);
  138. return Content(dt, "application/json");
  139. }
  140. public ActionResult GetCurrentProject(string id)
  141. {
  142. var dt = PersonModule.GetCurrentProject(id);
  143. return Content(dt, "application/json");
  144. }
  145. /// <summary>
  146. /// 通过性质,职务提取人员信息(combobox)
  147. /// </summary>
  148. /// <param name="job">职务</param>
  149. /// <param name="Nature">性质</param>
  150. /// <returns></returns>
  151. public ActionResult GetPersonByJob(string Nature, string job)
  152. {
  153. string json = PersonModule.GetPersonByJob(Nature, job);
  154. return Content(json, "application/json");
  155. }
  156. /// <summary>
  157. /// 获取角色
  158. /// </summary>
  159. /// <returns></returns>
  160. public ActionResult GetRole()
  161. {
  162. var user = GetCurrentUser();
  163. var dt = PersonModule.GetRole(user.PersonProperty);
  164. return Content(dt, "application/json");
  165. }
  166. #endregion
  167. #region 人员修改
  168. /// <summary>
  169. /// 修改人员的窗口
  170. /// </summary>
  171. public ActionResult UpdateInfoWindow(string ID,int Type,string ChannelID,string RYID)
  172. {
  173. if(Type == 1)
  174. {
  175. var dt = PersonModule.GetChannelID(ID);
  176. ViewBag.channelID = dt.Rows[0]["渠道ID"];
  177. ViewBag.id = ID;
  178. }
  179. else
  180. {
  181. ViewBag.RYID = RYID;
  182. ViewBag.channelID = ChannelID;
  183. ViewBag.id = ID;
  184. }
  185. return View();
  186. }
  187. /// <summary>
  188. /// /批量修改
  189. /// </summary>
  190. /// <param name="model"></param>
  191. /// <param name="RYID"></param>
  192. /// <returns></returns>
  193. [HttpPost]
  194. public int Batch_Save(PersonBusinessModel model,string RYID)
  195. {
  196. return PersonModule.Batch_Save(model, RYID);
  197. }
  198. #endregion
  199. #region 人员删除
  200. //单个删除
  201. public int Delete_Person(string id)
  202. {
  203. int r = PersonModule.Delete_Person(id);
  204. return r;
  205. }
  206. //批量删除
  207. public int Delete_Batch(string id)
  208. {
  209. return PersonModule.Delete_Batch(id);
  210. }
  211. #endregion
  212. #region 生成单个账户
  213. //添加账户的弹窗
  214. public ActionResult Account_Window(string id)
  215. {
  216. ViewBag.id = id;
  217. return View();
  218. }
  219. //生成账号(单个)
  220. public int Add_Account(PersonBusinessModel model,string role)
  221. {
  222. return PersonModule.Add_Account(model, role);
  223. }
  224. //判断是否有账号
  225. public int CheckAccount(string id)
  226. {
  227. return PersonModule.CheckAccount(id);
  228. }
  229. #endregion
  230. #region 修改账号
  231. //修改账户的弹窗
  232. public ActionResult Account_Window_Update(string id)
  233. {
  234. ViewBag.id = id;
  235. return View();
  236. }
  237. //执行修改操作
  238. public int Update_Account(PersonBusinessModel model,string role)
  239. {
  240. return PersonModule.Update_Account(model,role);
  241. }
  242. // 根据人员ID获取系统账户的信息
  243. public ActionResult GetSysAccountInfo(string id)
  244. {
  245. var json = PersonModule.GetSysAccountInfo(id);
  246. return Content(json, "text/json");
  247. }
  248. // 根据账户ID获取系统账户的角色信息
  249. public ActionResult GetRoleInfo(string id)
  250. {
  251. var json = PersonModule.GetRoleInfo(id);
  252. return Content(json, "text/json");
  253. }
  254. //激活/停用
  255. public int ChangeActive(string id)
  256. {
  257. return PersonModule.ChangeActive(id);
  258. }
  259. #endregion
  260. #region 根据公司批量生成账户
  261. //弹窗
  262. public ActionResult Account_Window_Batch(string id)
  263. {
  264. ViewBag.id = id;
  265. return View();
  266. }
  267. //生成账号(批量)
  268. public int Add_Account_Batch(string id)
  269. {
  270. return PersonModule.Add_Account_Batch(id);
  271. }
  272. #endregion
  273. }
  274. }