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

174 lines
7.2 KiB

3 years ago
3 years ago
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. rowNum: 20,
  53. sortname: 'F_ItemCode',
  54. sortorder: "asc",
  55. });
  56. $("#btn_search").click(function () {
  57. $gridList.jqGrid('setGridParam', {
  58. url: "/SystemManage/ItemsData/GetGridJson2",
  59. postData: { itemId: $("#itemTree").getCurrentNode().id, keyword: $("#txt_keyword").val() },
  60. }).trigger('reloadGrid');
  61. });
  62. }
  63. function btn_add() {
  64. var itemId = $("#itemTree").getCurrentNode().id;
  65. var itemName = $("#itemTree").getCurrentNode().text;
  66. if (!itemId) {
  67. return false;
  68. }
  69. $.modalOpen({
  70. id: "Form",
  71. title: itemName + " 》新增字典",
  72. url: "/SystemManage/ItemsData/Form?itemId=" + itemId,
  73. width: "450px",
  74. height: "550px",
  75. callBack: function (iframeId) {
  76. top.frames[iframeId].submitForm();
  77. }
  78. });
  79. }
  80. function btn_edit() {
  81. var itemName = $("#itemTree").getCurrentNode().text;
  82. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  83. $.modalOpen({
  84. id: "Form",
  85. title: itemName + " 》修改字典",
  86. url: "/SystemManage/ItemsData/Form?keyValue=" + keyValue,
  87. width: "450px",
  88. height: "550px",
  89. callBack: function (iframeId) {
  90. top.frames[iframeId].submitForm();
  91. }
  92. });
  93. }
  94. function btn_delete() {
  95. $.deleteForm({
  96. url: "/SystemManage/ItemsData/DeleteForm",
  97. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  98. success: function () {
  99. $("#gridList").resetSelection();
  100. $("#gridList").trigger("reloadGrid");
  101. }
  102. })
  103. }
  104. function btn_details() {
  105. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  106. $.modalOpen({
  107. id: "Details",
  108. title: "查看字典",
  109. url: "/SystemManage/ItemsData/Details?keyValue=" + keyValue,
  110. width: "450px",
  111. height: "550px",
  112. btn: null,
  113. });
  114. }
  115. function btn_itemstype() {
  116. $.modalOpen({
  117. id: "ItemsType",
  118. title: "字典分类",
  119. url: "/SystemManage/ItemsType/Index",
  120. width: "800px",
  121. height: "550px",
  122. btn: null,
  123. });
  124. }
  125. </script>
  126. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  127. <div class="ui-layout-west">
  128. <div id="itemTree"></div>
  129. </div>
  130. <div class="ui-layout-center">
  131. <div class="topPanel">
  132. <div class="toolbar">
  133. <div class="btn-group">
  134. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  135. </div>
  136. <div class="btn-group">
  137. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建字典</a>
  138. <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
  139. <ul class="dropdown-menu pull-right">
  140. <li><a id="NF-itemstype" authorize="yes" onclick="btn_itemstype()" href="javascript:void()">分类管理</a></li>
  141. </ul>
  142. </div>
  143. <div class="operate">
  144. <ul class="nav nav-pills">
  145. <li class="first">已选中<span>1</span>项</li>
  146. <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改字典</a></li>
  147. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除字典</a></li>
  148. <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看字典</a></li>
  149. </ul>
  150. <a href="javascript:;" class="close"></a>
  151. </div>
  152. <script>$('.toolbar').authorizeButton()</script>
  153. </div>
  154. <div class="search">
  155. <table>
  156. <tr>
  157. <td>
  158. <div class="input-group">
  159. <input id="txt_keyword" type="text" class="form-control" placeholder="名称/编号" style="width: 200px;">
  160. <span class="input-group-btn">
  161. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  162. </span>
  163. </div>
  164. </td>
  165. </tr>
  166. </table>
  167. </div>
  168. </div>
  169. <div class="gridPanel">
  170. <table id="gridList"></table>
  171. <div id="gridPager"></div>
  172. </div>
  173. </div>
  174. </div>