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

147 lines
6.4 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: "/ProductManage/PreSaleOrder/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: '产品ID', name: 'Product_Id', hidden: true },
  27. //{ label: 'Product SN', name: 'Product_SN', width: 150, align: 'left' },
  28. //{
  29. // label: 'Schedule Time', name: 'PreSellTime', width: 80, align: 'left',
  30. // formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
  31. //}
  32. { label: "主键", name: "F_Id", hidden: true, key: true },
  33. { label: '产品ID', name: 'Product_Id', hidden: true },
  34. { label: 'Product No', name: 'ProductSN', width: 80, align: 'left' },
  35. { label: 'Measurement', name: 'Measurement', width: 90, align: 'left' },//尺寸
  36. {
  37. label: 'Schedule Time', name: 'PreSellTime', width: 100, align: 'left',
  38. formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
  39. },
  40. { label: 'Sort', name: 'Other', width: 60, align: 'left' },
  41. //{ label: 'Weight', name: 'Weight', width: 60, align: 'left' },//重量
  42. {
  43. label: 'FinishedWeight', name: 'Weight', width: 100, align: 'left',
  44. formatter: "number", formatoptions: { thousandsSeparator: ',', defaulValue: '', decimalPlaces: 3 }
  45. },
  46. {
  47. label: 'RoughWeight', name: 'GrossWeight', width: 90, align: 'left',
  48. formatter: "number", formatoptions: { thousandsSeparator: ',', defaulValue: '', decimalPlaces: 3 }
  49. },
  50. { label: 'Shape', name: 'Shape', width: 60, align: 'left' },//形状
  51. { label: 'Certificate No', name: 'CertificateNo', width: 100, align: 'left' },//证书号码
  52. { label: 'Price', name: 'Price', width: 60, align: 'left' },//价格
  53. { label: 'Location', name: 'Location', width: 120, align: 'left' }
  54. ],
  55. multiselect: true,
  56. editurl: "JqGridHandler.ashx?sign=singleEdit"
  57. });
  58. $("#btn_search").click(function () {
  59. $gridList.jqGrid('setGridParam', {
  60. url: "/ProductManage/PreSaleOrder/GetGridJson",
  61. postData: { itemId: $("#itemTree").getCurrentNode().id, keyword: $("#txt_keyword").val() },
  62. }).trigger('reloadGrid');
  63. });
  64. }
  65. function btn_deleteOrder() {
  66. var records = $('#gridList').jqGrid('getGridParam', 'records');
  67. if (records > 0)
  68. {
  69. alert("Not empty orders, not deleted.");
  70. }
  71. else
  72. {
  73. var id = $("#itemTree").getCurrentNode().id;
  74. $.deleteForm({
  75. url: "/ProductManage/PreSaleOrder/DeleteFormOrder",
  76. param: { keyValue: id },
  77. success: function () {
  78. treeView();
  79. $("#gridList").resetSelection();
  80. $("#gridList").trigger("reloadGrid");
  81. }
  82. })
  83. }
  84. }
  85. function btn_delete() {
  86. var ids = $('#gridList').jqGrid('getGridParam', 'selarrrow');
  87. var keyValues = "";
  88. for (var i = 0; i < ids.length; i++) {
  89. if (i == 0)
  90. keyValues += ids[i];
  91. else
  92. keyValues += "," + ids[i];
  93. }
  94. $.deleteForm({
  95. url: "/ProductManage/PreSaleOrder/DeleteForm",
  96. param: { keyValue: keyValues },
  97. success: function () {
  98. treeView();
  99. $("#gridList").resetSelection();
  100. $("#gridList").trigger("reloadGrid");
  101. }
  102. })
  103. }
  104. </script>
  105. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  106. <div class="ui-layout-west">
  107. <div id="itemTree"></div>
  108. </div>
  109. <div class="ui-layout-center">
  110. <div class="topPanel">
  111. <div class="toolbar">
  112. <div class="btn-group">
  113. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  114. </div>
  115. <div class="btn-group">
  116. @*<a id="NF-Details" authorize="yes" class="btn btn-primary" onclick="btn_details()"><i class="fa fa-search-plus"></i>Look Product</a>*@
  117. <a id="NF-delete" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_delete()"><i class="fa fa-trash-o"></i>Cancel Schedule</a>
  118. </div>
  119. <script>$('.toolbar').authorizeButton()</script>
  120. </div>
  121. <div class="search">
  122. <table>
  123. <tr>
  124. <td>
  125. <div class="toolbar" style="line-height:30px;">
  126. <div class="btn-group">
  127. <a id="NF-deleteOrder" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_deleteOrder()"><i class="fa fa-trash-o"></i>Delete Order</a>
  128. </div>
  129. </div>
  130. <div class="input-group">
  131. <input id="txt_keyword" type="text" class="form-control" placeholder="Product SN" style="width: 200px;">
  132. <span class="input-group-btn">
  133. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  134. </span>
  135. </div>
  136. </td>
  137. </tr>
  138. </table>
  139. </div>
  140. </div>
  141. <div class="gridPanel">
  142. <table id="gridList"></table>
  143. </div>
  144. </div>
  145. </div>