纽威
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.

165 lines
6.7 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. $('#layout').layout();
  8. treeView();
  9. gridList();
  10. });
  11. function treeView() {
  12. $("#itemTree").treeview({
  13. url: "/SystemManage/ItemsType/GetTreeJson",
  14. onnodeclick: function (item) {
  15. $("#txt_keyword").val('');
  16. $('#btn_search').trigger("click");
  17. }
  18. });
  19. }
  20. function gridList() {
  21. var $gridList = $("#gridList");
  22. $gridList.dataGrid({
  23. height: $(window).height() - 96,
  24. colModel: [
  25. { label: "主键", name: "F_Id", hidden: true, key: true },
  26. { label: '名称', name: 'F_ItemName', width: 150, align: 'left' },
  27. { label: '编号', name: 'F_ItemCode', width: 150, align: 'left' },
  28. { label: '排序', name: 'F_SortCode', width: 80, align: 'center' },
  29. {
  30. label: "默认", name: "F_IsDefault", width: 60, align: "center",
  31. formatter: function (cellvalue) {
  32. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  33. }
  34. },
  35. {
  36. label: '创建时间', name: 'F_CreatorTime', width: 80, align: 'left',
  37. formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
  38. },
  39. {
  40. label: "有效", name: "F_EnabledMark", width: 60, align: "center",
  41. formatter: function (cellvalue) {
  42. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  43. }
  44. },
  45. { label: "备注", name: "F_Description", index: "F_Description", width: 200, align: "left", sortable: false }
  46. ]
  47. });
  48. $("#btn_search").click(function () {
  49. $gridList.jqGrid('setGridParam', {
  50. url: "/SystemManage/ItemsData/GetGridJson",
  51. postData: { itemId: $("#itemTree").getCurrentNode().id, keyword: $("#txt_keyword").val() },
  52. }).trigger('reloadGrid');
  53. });
  54. }
  55. function btn_add() {
  56. var itemId = $("#itemTree").getCurrentNode().id;
  57. var itemName = $("#itemTree").getCurrentNode().text;
  58. if (!itemId) {
  59. return false;
  60. }
  61. $.modalOpen({
  62. id: "Form",
  63. title: itemName + " 》新增字典",
  64. url: "/SystemManage/ItemsData/Form?itemId=" + itemId,
  65. width: "450px",
  66. height: "350px",
  67. callBack: function (iframeId) {
  68. top.frames[iframeId].submitForm();
  69. }
  70. });
  71. }
  72. function btn_edit() {
  73. var itemName = $("#itemTree").getCurrentNode().text;
  74. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  75. $.modalOpen({
  76. id: "Form",
  77. title: itemName + " 》修改字典",
  78. url: "/SystemManage/ItemsData/Form?keyValue=" + keyValue,
  79. width: "450px",
  80. height: "350px",
  81. callBack: function (iframeId) {
  82. top.frames[iframeId].submitForm();
  83. }
  84. });
  85. }
  86. function btn_delete() {
  87. $.deleteForm({
  88. url: "/SystemManage/ItemsData/DeleteForm",
  89. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  90. success: function () {
  91. $("#gridList").resetSelection();
  92. $("#gridList").trigger("reloadGrid");
  93. }
  94. })
  95. }
  96. function btn_details() {
  97. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  98. $.modalOpen({
  99. id: "Details",
  100. title: "查看字典",
  101. url: "/SystemManage/ItemsData/Details?keyValue=" + keyValue,
  102. width: "450px",
  103. height: "470px",
  104. btn: null,
  105. });
  106. }
  107. function btn_itemstype() {
  108. $.modalOpen({
  109. id: "ItemsType",
  110. title: "字典分类",
  111. url: "/SystemManage/ItemsType/Index",
  112. width: "800px",
  113. height: "550px",
  114. btn: null,
  115. });
  116. }
  117. </script>
  118. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  119. <div class="ui-layout-west">
  120. <div id="itemTree"></div>
  121. </div>
  122. <div class="ui-layout-center">
  123. <div class="topPanel">
  124. <div class="toolbar">
  125. <div class="btn-group">
  126. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  127. </div>
  128. <div class="btn-group">
  129. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建字典</a>
  130. <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
  131. <ul class="dropdown-menu pull-right">
  132. <li><a id="NF-itemstype" authorize="yes" onclick="btn_itemstype()" href="javascript:void()">分类管理</a></li>
  133. </ul>
  134. </div>
  135. <div class="operate">
  136. <ul class="nav nav-pills">
  137. <li class="first">已选中<span>1</span>项</li>
  138. <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改字典</a></li>
  139. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除字典</a></li>
  140. <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看字典</a></li>
  141. </ul>
  142. <a href="javascript:;" class="close"></a>
  143. </div>
  144. <script>$('.toolbar').authorizeButton()</script>
  145. </div>
  146. <div class="search">
  147. <table>
  148. <tr>
  149. <td>
  150. <div class="input-group">
  151. <input id="txt_keyword" type="text" class="form-control" placeholder="名称/编号" style="width: 200px;">
  152. <span class="input-group-btn">
  153. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  154. </span>
  155. </div>
  156. </td>
  157. </tr>
  158. </table>
  159. </div>
  160. </div>
  161. <div class="gridPanel">
  162. <table id="gridList"></table>
  163. </div>
  164. </div>
  165. </div>