纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
7.7 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. gridList();
  8. })
  9. function gridList() {
  10. var $gridList = $("#gridList");
  11. $gridList.dataGrid({
  12. url: "/SystemManage/User/GetGridJson",
  13. height: $(window).height() - 128,
  14. colModel: [
  15. { label: '主键', name: 'F_Id', hidden: true },
  16. { label: '账户', name: 'F_Account', width: 80, align: 'left' },
  17. { label: '姓名', name: 'F_RealName', width: 120, align: 'left' },
  18. {
  19. label: '角色', name: 'F_RoleId', width: 120, align: 'left',
  20. formatter: function (cellvalue, options, rowObject) {
  21. return top.clients.role[cellvalue] == null ? "" : top.clients.role[cellvalue].fullname;
  22. }
  23. },
  24. { label: '供应商编码', name: 'F_VenCode', width: 100, align: 'left' },
  25. { label: '手机', name: 'F_MobilePhone', width: 100, align: 'left' },
  26. { label: '邮箱', name: 'F_Email', width: 150, align: 'left' },
  27. { label: '站点', name: 'F_Location', width: 50, align: 'left' },
  28. {
  29. label: '创建时间', name: 'F_CreatorTime', width: 80, align: 'left',
  30. formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
  31. },
  32. {
  33. label: "允许登录", name: "F_EnabledMark", width: 60, align: "center",
  34. formatter: function (cellvalue, options, rowObject) {
  35. if (cellvalue == 1) {
  36. return '<span class=\"label label-success\">正常</span>';
  37. } else if (cellvalue == 0) {
  38. return '<span class=\"label label-default\">禁用</span>';
  39. }
  40. }
  41. },
  42. { label: '备注', name: 'F_Description', width: 200, align: 'left' }
  43. ],
  44. pager: "#gridPager",
  45. sortname: 'F_DepartmentId asc,F_CreatorTime desc',
  46. viewrecords: true
  47. });
  48. $("#btn_search").click(function () {
  49. $gridList.jqGrid('setGridParam', {
  50. postData: { keyword: $("#txt_keyword").val() },
  51. }).trigger('reloadGrid');
  52. });
  53. }
  54. function btn_add() {
  55. $.modalOpen({
  56. id: "Form",
  57. title: "新增用户",
  58. url: "/SystemManage/User/Form",
  59. width: "700px",
  60. height: "450px",
  61. callBack: function (iframeId) {
  62. top.frames[iframeId].submitForm();
  63. }
  64. });
  65. }
  66. function btn_edit() {
  67. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  68. $.modalOpen({
  69. id: "Form",
  70. title: "修改用户",
  71. url: "/SystemManage/User/Form?keyValue=" + keyValue,
  72. width: "700px",
  73. height: "450px",
  74. callBack: function (iframeId) {
  75. top.frames[iframeId].submitForm();
  76. }
  77. });
  78. }
  79. function btn_delete() {
  80. $.deleteForm({
  81. url: "/SystemManage/User/DeleteForm",
  82. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  83. success: function () {
  84. $.currentWindow().$("#gridList").trigger("reloadGrid");
  85. }
  86. })
  87. }
  88. function btn_details() {
  89. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  90. $.modalOpen({
  91. id: "Details",
  92. title: "查看用户",
  93. url: "/SystemManage/User/Details?keyValue=" + keyValue,
  94. width: "700px",
  95. height: "400px",
  96. btn: null,
  97. });
  98. }
  99. function btn_revisepassword() {
  100. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  101. var Account = $("#gridList").jqGridRowValue().F_Account;
  102. var RealName = $("#gridList").jqGridRowValue().F_RealName;
  103. $.modalOpen({
  104. id: "RevisePassword",
  105. title: '重置密码',
  106. url: '/SystemManage/User/RevisePassword?keyValue=' + keyValue + "&account=" + escape(Account) + '&realName=' + escape(RealName),
  107. width: "450px",
  108. height: "260px",
  109. callBack: function (iframeId) {
  110. top.frames[iframeId].submitForm();
  111. }
  112. });
  113. }
  114. function btn_disabled() {
  115. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  116. $.modalConfirm("注:您确定要【禁用】该项账户吗?", function (r) {
  117. if (r) {
  118. $.submitForm({
  119. url: "/SystemManage/User/DisabledAccount",
  120. param: { keyValue: keyValue },
  121. success: function () {
  122. $.currentWindow().$("#gridList").trigger("reloadGrid");
  123. }
  124. })
  125. }
  126. });
  127. }
  128. function btn_enabled() {
  129. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  130. $.modalConfirm("注:您确定要【启用】该项账户吗?", function (r) {
  131. if (r) {
  132. $.submitForm({
  133. url: "/SystemManage/User/EnabledAccount",
  134. param: { keyValue: keyValue },
  135. success: function () {
  136. $.currentWindow().$("#gridList").trigger("reloadGrid");
  137. }
  138. })
  139. }
  140. });
  141. }
  142. </script>
  143. <div class="topPanel">
  144. <div class="toolbar">
  145. <div class="btn-group">
  146. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  147. </div>
  148. <div class="btn-group">
  149. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建用户</a>
  150. </div>
  151. <div class="operate">
  152. <ul class="nav nav-pills">
  153. <li class="first">已选中<span>1</span>项</li>
  154. <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改用户</a></li>
  155. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除用户</a></li>
  156. <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看用户</a></li>
  157. <li class="split"></li>
  158. <li><a id="NF-revisepassword" authorize="yes" onclick="btn_revisepassword()"><i class="fa fa-key"></i>密码重置</a></li>
  159. <li class="split"></li>
  160. <li><a id="NF-disabled" authorize="yes" onclick="btn_disabled()"><i class="fa fa-stop-circle"></i>禁用</a></li>
  161. <li><a id="NF-enabled" authorize="yes" onclick="btn_enabled()"><i class="fa fa-play-circle"></i>启用</a></li>
  162. </ul>
  163. <a href="javascript:;" class="close"></a>
  164. </div>
  165. <script>$('.toolbar').authorizeButton()</script>
  166. </div>
  167. <div class="search">
  168. <table>
  169. <tr>
  170. <td>
  171. <div class="input-group">
  172. <input id="txt_keyword" type="text" class="form-control" placeholder="账户/姓名/手机" style="width: 200px;">
  173. <span class="input-group-btn">
  174. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  175. </span>
  176. </div>
  177. </td>
  178. </tr>
  179. </table>
  180. </div>
  181. </div>
  182. <div class="gridPanel">
  183. <table id="gridList"></table>
  184. <div id="gridPager"></div>
  185. </div>