AllotMember.cshtml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. @{
  2. ViewBag.Title = "职位成员";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script>
  6. var jobId = request('jobId');
  7. var departmentId = request('departmentId');
  8. $(function () {
  9. InitialPage();
  10. GetMember();
  11. });
  12. //初始化页面
  13. function InitialPage() {
  14. $(".center-Panel").height($(window).height() - 40)
  15. }
  16. //加载成员
  17. function GetMember() {
  18. $.ajax({
  19. url: "../../AuthorizeManage/PermissionJob/GetUserListJson?jobId=" + jobId + "&departmentId=" + departmentId,
  20. type: "get",
  21. dataType: "json",
  22. async: false,
  23. success: function (data) {
  24. var _html = "";
  25. $.each(data, function (i) {
  26. var row = data[i];
  27. if (row.isdefault == 0) {
  28. var imgName = "UserCard01.png";
  29. if (row.gender == 1) {
  30. imgName = "UserCard02.png";
  31. }
  32. var active = "";
  33. if (row.ischeck == 1) {
  34. active = "active";
  35. }
  36. _html += '<div class="card-box' + active + '">';
  37. _html += ' <div class="card-box-img">';
  38. _html += ' <img src="/Content/images/' + imgName + '" />';
  39. _html += ' </div>';
  40. _html += ' <div id="' + row.userid + '" class="card-box-content">';
  41. _html += ' <p>账户:' + row.account + '</p>';
  42. _html += ' <p>姓名:' + row.realname + '</p>';
  43. _html += ' <p>部门:' + row.departmentname + '</p>';
  44. _html += ' </div><i></i>';
  45. _html += '</div>';
  46. }
  47. });
  48. $(".gridPanel").html(_html);
  49. $(".card-box").click(function () {
  50. if (!$(this).hasClass("active")) {
  51. $(this).addClass("active")
  52. } else {
  53. $(this).removeClass("active")
  54. }
  55. })
  56. Loading(false);
  57. }, beforeSend: function () {
  58. Loading(true);
  59. }
  60. });
  61. //模糊查询用户(注:这个方法是理由jquery查询)
  62. $("#txt_TreeKeyword").keyup(function () {
  63. var value = $(this).val();
  64. if (value != "") {
  65. window.setTimeout(function () {
  66. $(".card-box")
  67. .hide()
  68. .filter(":contains('" + (value) + "')")
  69. .show();
  70. }, 200);
  71. } else {
  72. $(".card-box").show();
  73. }
  74. }).keyup();
  75. }
  76. //保存表单
  77. function AcceptClick() {
  78. var userIds = [];
  79. $('.gridPanel .active .card-box-content').each(function () {
  80. userIds.push($(this).attr('id'));
  81. });
  82. var postData = $("#form1").GetWebControls();
  83. postData["jobId"] = jobId;
  84. postData["userIds"] = String(userIds)
  85. $.SaveForm({
  86. url: "../../AuthorizeManage/PermissionJob/SaveMember",
  87. param: postData,
  88. loading: "正在保存职位成员...",
  89. success: function () {
  90. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  91. }
  92. })
  93. }
  94. </script>
  95. <div class="treesearch border-bottom">
  96. <input id="txt_TreeKeyword" type="text" class="form-control" style="border-top: none;" placeholder="请输入要查询关键字" />
  97. <span id="btn_TreeSearch" class="input-query" title="Search"><i class="fa fa-search"></i></span>
  98. </div>
  99. <div class="center-Panel" style="margin: 0px; border-right: none; border-left: none; border-bottom: none; background-color: #fff; overflow: auto; padding-bottom: 10px;">
  100. <div class="gridPanel">
  101. </div>
  102. </div>