Index.cshtml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script>;
  6. $(function () {
  7. InitialPage();
  8. GetGrid();
  9. });
  10. //初始化页面
  11. function InitialPage() {
  12. //resize重设布局;
  13. $(window).resize(function (e) {
  14. window.setTimeout(function () {
  15. $('#gridTable').setGridWidth(($('.gridPanel').width()));
  16. $('#gridTable').setGridHeight($(window).height() - 136.5);
  17. }, 200);
  18. e.stopPropagation();
  19. });
  20. }
  21. //加载表格
  22. function GetGrid() {
  23. var selectedRowIndex = 0;
  24. var $gridTable = $('#gridTable');
  25. $gridTable.jqGrid({
  26. autowidth: true,
  27. height: $(window).height() - 136.5,
  28. url: "../../WarehouseManage/Warehouse/GetListJson",
  29. datatype: "json",
  30. colModel: [
  31. { label: '申请主键', name: 'WarehouseId', index: 'WarehouseId', width: 100, align: 'left', sortable: true, hidden: true },
  32. { label: '编码', name: 'Code', index: 'Code', width: 100, align: 'left', sortable: true },
  33. { label: '仓库名称', name: 'WarehouseName', index: 'WarehouseName', width: 80, align: 'left', sortable: true },
  34. { label: '创建时间', name: 'CreateDt', index: 'CreateDt', width: 80, align: 'center', sortable: true },
  35. //{ label: '备注', name: 'Description', index: 'Description', width: 200, align: 'left', sortable: true },
  36. ],
  37. viewrecords: true,
  38. rowNum: 30,
  39. rowList: [30, 50, 100],
  40. pager: "#gridPager",
  41. sortname: 'Code',
  42. sortorder: 'desc',
  43. rownumbers: true,
  44. shrinkToFit: false,
  45. gridview: true,
  46. onSelectRow: function () {
  47. selectedRowIndex = $('#' + this.id).getGridParam('selrow');
  48. },
  49. gridComplete: function () {
  50. $('#' + this.id).setSelection(selectedRowIndex, false);
  51. }
  52. });
  53. //$gridTable.authorizeColModel();
  54. }
  55. //新增
  56. function btn_add() {
  57. dialogOpen({
  58. id: 'Form',
  59. title: '添加仓库',
  60. url: '/WarehouseManage/Warehouse/Form',
  61. width: '750px',
  62. height: '350px',
  63. callBack: function (iframeId) {
  64. top.frames[iframeId].AcceptClick();
  65. }
  66. });
  67. }
  68. </script>
  69. <div class="titlePanel">
  70. <div class="title-search">
  71. <table>
  72. <tr>
  73. </tr>
  74. </table>
  75. </div>
  76. <div class="toolbar">
  77. <div class="btn-group">
  78. <a id="WareAddBtn" class="btn btn-default" onclick="btn_add()"><i class="fa fa-plus"></i>&nbsp;添加</a>
  79. </div>
  80. <script>$('.toolbar').authorizeButton()</script>
  81. </div>
  82. </div>
  83. <div class="gridPanel">
  84. <table id="gridTable"></table>
  85. <div id="gridPager"></div>
  86. </div>