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

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