AllotMember.cshtml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. @{
  2. ViewBag.Title = "岗位成员";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script>
  6. var postId = request('postId');
  7. $(function () {
  8. InitialPage();
  9. GetMember();
  10. GetTree();
  11. });
  12. //初始化页面
  13. function InitialPage() {
  14. //layout布局
  15. $('#layout').layout({
  16. applyDemoStyles: true,
  17. west__size: 160,
  18. spacing_open: 0,
  19. onresize: function () {
  20. $(window).resize();
  21. }
  22. });
  23. $(".center-Panel").height($(window).height() - 40);
  24. }
  25. //加载树
  26. var departmentid = "card-box";
  27. function GetTree() {
  28. var item = {
  29. height: $(window).height() - 1,
  30. url: "../../AuthorizeManage/PermissionPost/GetDepartmentTreeJson?postId=" + postId,
  31. onnodeclick: function (item) {
  32. Loading(true);
  33. window.setTimeout(function () {
  34. if (item.parentnodes == "0") {
  35. $(".card-box").show();
  36. departmentid = "card-box";
  37. } else {
  38. $(".card-box").hide();
  39. $('.' + item.id).show();
  40. departmentid = item.id;
  41. }
  42. Loading(false);
  43. }, 200);
  44. }
  45. };
  46. //初始化
  47. $("#itemTree").treeview(item);
  48. }
  49. //加载成员
  50. function GetMember() {
  51. $.ajax({
  52. url: "../../AuthorizeManage/PermissionPost/GetUserListJson?postId=" + postId,
  53. type: "get",
  54. dataType: "json",
  55. async: false,
  56. success: function (data) {
  57. var _html = "";
  58. $.each(data, function (i) {
  59. var row = data[i];
  60. if (row.isdefault == 0) {
  61. var imgName = "UserCard01.png";
  62. if (row.gender == 1) {
  63. imgName = "UserCard02.png";
  64. }
  65. var active = "";
  66. if (row.ischeck == 1) {
  67. active = "active";
  68. }
  69. _html += '<div class="card-box ' + row.departmentid + ' ' + active + '">';
  70. _html += ' <div class="card-box-img">';
  71. _html += ' <img src="/Content/images/' + imgName + '" />';
  72. _html += ' </div>';
  73. _html += ' <div id="' + row.userid + '" class="card-box-content">';
  74. _html += ' <p>账户:' + row.account + '</p>';
  75. _html += ' <p>姓名:' + row.realname + '</p>';
  76. _html += ' <p>部门:' + row.departmentname + '</p>';
  77. _html += ' </div><i></i>';
  78. _html += '</div>';
  79. }
  80. });
  81. $(".gridPanel").html(_html);
  82. $(".card-box").click(function() {
  83. if (!$(this).hasClass("active")) {
  84. $(this).addClass("active");
  85. } else {
  86. $(this).removeClass("active");
  87. }
  88. });
  89. Loading(false);
  90. }, beforeSend: function () {
  91. Loading(true);
  92. }
  93. });
  94. //模糊查询用户(注:这个方法是理由jquery查询)
  95. $("#txt_TreeKeyword").keyup(function () {
  96. var value = $(this).val();
  97. if (value != "") {
  98. window.setTimeout(function () {
  99. $("." + departmentid)
  100. .hide()
  101. .filter(":contains('" + (value) + "')")
  102. .show();
  103. }, 200);
  104. } else {
  105. $("." + departmentid).show();
  106. }
  107. }).keyup();
  108. }
  109. //保存表单
  110. function AcceptClick() {
  111. var userIds = [];
  112. $('.gridPanel .active .card-box-content').each(function () {
  113. userIds.push($(this).attr('id'));
  114. });
  115. var postData = $("#form1").GetWebControls();
  116. postData["postId"] = postId;
  117. postData["userIds"] = String(userIds);
  118. $.SaveForm({
  119. url: "../../AuthorizeManage/PermissionPost/SaveMember",
  120. param: postData,
  121. loading: "正在保存岗位成员...",
  122. success: function() {
  123. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  124. }
  125. });
  126. }
  127. </script>
  128. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  129. <div class="ui-layout-west">
  130. <div class="west-Panel" style="margin: 0px; border-top: none; border-left: none; border-bottom: none;">
  131. <div id="itemTree"></div>
  132. </div>
  133. </div>
  134. <div class="ui-layout-center">
  135. <div class="treesearch">
  136. <input id="txt_TreeKeyword" type="text" class="form-control" style="border-top: none;" placeholder="请输入要查询关键字" />
  137. <span id="btn_TreeSearch" class="input-query" title="Search"><i class="fa fa-search"></i></span>
  138. </div>
  139. <div class="center-Panel" style="margin: 0px; border-right: none; border-left: none; border-bottom: none; background-color: #fff; overflow: auto; padding-bottom: 10px;">
  140. <div class="gridPanel">
  141. </div>
  142. </div>
  143. </div>
  144. </div>