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.

204 lines
8.3 KiB

4 days 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. debugger;
  81. var Complete = '';
  82. $.ajax({
  83. url: "/SystemManage/User/IsF_RoleID?keyValue=" + $("#gridList").jqGridRowValue().F_Id,
  84. dataType: "json",
  85. async: false,
  86. success: function (data) {
  87. debugger;
  88. if (data != null && data.length > 0) {
  89. Complete = data[0].F_RoleID;
  90. }
  91. }
  92. });
  93. if (Complete == "") {
  94. $.deleteForm({
  95. url: "/SystemManage/User/DeleteForm",
  96. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  97. success: function () {
  98. $.currentWindow().$("#gridList").trigger("reloadGrid");
  99. }
  100. })
  101. } else {
  102. $.modalAlert("用户已绑定角色不能删除!", "warning");
  103. return;
  104. }
  105. }
  106. function btn_details() {
  107. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  108. $.modalOpen({
  109. id: "Details",
  110. title: "查看用户",
  111. url: "/SystemManage/User/Details?keyValue=" + keyValue,
  112. width: "700px",
  113. height: "400px",
  114. btn: null,
  115. });
  116. }
  117. function btn_revisepassword() {
  118. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  119. var Account = $("#gridList").jqGridRowValue().F_Account;
  120. var RealName = $("#gridList").jqGridRowValue().F_RealName;
  121. $.modalOpen({
  122. id: "RevisePassword",
  123. title: '重置密码',
  124. url: '/SystemManage/User/RevisePassword?keyValue=' + keyValue + "&account=" + escape(Account) + '&realName=' + escape(RealName),
  125. width: "450px",
  126. height: "260px",
  127. callBack: function (iframeId) {
  128. top.frames[iframeId].submitForm();
  129. }
  130. });
  131. }
  132. function btn_disabled() {
  133. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  134. $.modalConfirm("注:您确定要【禁用】该项账户吗?", function (r) {
  135. if (r) {
  136. $.submitForm({
  137. url: "/SystemManage/User/DisabledAccount",
  138. param: { keyValue: keyValue },
  139. success: function () {
  140. $.currentWindow().$("#gridList").trigger("reloadGrid");
  141. }
  142. })
  143. }
  144. });
  145. }
  146. function btn_enabled() {
  147. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  148. $.modalConfirm("注:您确定要【启用】该项账户吗?", function (r) {
  149. if (r) {
  150. $.submitForm({
  151. url: "/SystemManage/User/EnabledAccount",
  152. param: { keyValue: keyValue },
  153. success: function () {
  154. $.currentWindow().$("#gridList").trigger("reloadGrid");
  155. }
  156. })
  157. }
  158. });
  159. }
  160. </script>
  161. <div class="topPanel">
  162. <div class="toolbar">
  163. <div class="btn-group">
  164. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  165. </div>
  166. <div class="btn-group">
  167. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建用户</a>
  168. </div>
  169. <div class="operate">
  170. <ul class="nav nav-pills">
  171. <li class="first">已选中<span>1</span>项</li>
  172. <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改用户</a></li>
  173. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除用户</a></li>
  174. <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看用户</a></li>
  175. <li class="split"></li>
  176. <li><a id="NF-revisepassword" authorize="yes" onclick="btn_revisepassword()"><i class="fa fa-key"></i>密码重置</a></li>
  177. <li class="split"></li>
  178. <li><a id="NF-disabled" authorize="yes" onclick="btn_disabled()"><i class="fa fa-stop-circle"></i>禁用</a></li>
  179. <li><a id="NF-enabled" authorize="yes" onclick="btn_enabled()"><i class="fa fa-play-circle"></i>启用</a></li>
  180. </ul>
  181. <a href="javascript:;" class="close"></a>
  182. </div>
  183. <script>$('.toolbar').authorizeButton()</script>
  184. </div>
  185. <div class="search">
  186. <table>
  187. <tr>
  188. <td>
  189. <div class="input-group">
  190. <input id="txt_keyword" type="text" class="form-control" placeholder="账户/姓名/手机" style="width: 200px;">
  191. <span class="input-group-btn">
  192. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  193. </span>
  194. </div>
  195. </td>
  196. </tr>
  197. </table>
  198. </div>
  199. </div>
  200. <div class="gridPanel">
  201. <table id="gridList"></table>
  202. <div id="gridPager"></div>
  203. </div>