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

167 lines
7.5 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. gridList();
  8. })
  9. function gridList() {
  10. var $gridList = $("#gridList");
  11. $gridList.dataGrid({
  12. url: "/ProductManage/Maintain/GetGridJson",
  13. height: $(window).height() - 96,
  14. colModel: [
  15. { label: "主键", name: "F_Id", hidden: true, key: true },
  16. { label: 'Product No', name: 'ProductSN', width: 80, align: 'left' },
  17. { label: 'Measurement', name: 'Measurement', width: 90, align: 'left' },//尺寸
  18. {
  19. label: 'FinishedWeight', name: 'Weight', width: 100, align: 'left',
  20. formatter: "number", formatoptions: { thousandsSeparator: ',', defaulValue: '', decimalPlaces: 3 }
  21. },
  22. {
  23. label: 'RoughWeight', name: 'GrossWeight', width: 90, align: 'left',
  24. formatter: "number", formatoptions: { thousandsSeparator: ',', defaulValue: '', decimalPlaces: 3 }
  25. },
  26. { label: 'Shape', name: 'Shape', width: 60, align: 'left' },//形状
  27. { label: 'Certificate No', name: 'CertificateNo', width: 100, align: 'left' },//证书号码
  28. { label: 'Price', name: 'Price', width: 60, align: 'left' },//价格
  29. //{ label: '色度', name: 'Color', width: 60, align: 'left' },//色度
  30. //{ label: '净度', name: 'Clarity', width: 60, align: 'left' },//净度
  31. //{ label: '抛光', name: 'Polish', width: 60, align: 'left' },//抛光
  32. //{ label: '对称性', name: 'Symmetry', width: 70, align: 'left' },//对称性
  33. //{ label: '切', name: 'Cut', width: 50, align: 'left' },//切
  34. { label: 'Sort', name: 'Other', width: 60, align: 'left' },//其他
  35. { label: 'InvQty', name: 'InvQty', width: 50, align: 'left' },//库存量
  36. { label: 'Location', name: 'Location', width: 120, align: 'left' },//位置
  37. {
  38. label: "Is Lock", name: "IsLock", width: 60, align: "left",
  39. formatter: function (cellvalue) {
  40. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  41. }
  42. },
  43. //{ label: '维护人', name: 'F_LastModifyUserId', width: 100, align: 'left' },//维护人
  44. {
  45. label: 'Modify User', name: 'F_LastModifyUserId', width: 90, align: 'left',
  46. formatter: function (cellvalue, options, rowObject) {
  47. return top.clients.user[cellvalue] == null ? "" : top.clients.user[cellvalue].realname;
  48. }
  49. },
  50. {
  51. label: 'Modify Time', name: 'F_LastModifyTime', width: 100, align: 'left',
  52. formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i', newformat: 'Y-m-d H:i' }
  53. }
  54. ],
  55. pager: "#gridPager",
  56. sortname: 'ProductSN asc,Weight desc,F_CreatorTime desc',
  57. viewrecords: true
  58. });
  59. $("#warehouse a.btn-default").click(function () {
  60. $("#warehouse a.btn-default").removeClass("active");
  61. $(this).addClass("active");
  62. $('#btn_search').trigger("click");
  63. });
  64. $("#btn_search").click(function () {
  65. var warehouse = $("#warehouse a.active").attr('data-value');
  66. var queryJson = {
  67. keyword: $("#txt_keyword").val(),
  68. warehouse: $("#warehouse a.active").attr('data-value'),
  69. }
  70. $gridList.jqGrid('setGridParam', {
  71. postData: { queryJson: JSON.stringify(queryJson) },
  72. }).trigger('reloadGrid');
  73. });
  74. }
  75. function btn_add() {
  76. $.modalOpen({
  77. id: "Form",
  78. title: "Add Product",
  79. url: "/ProductManage/Maintain/Form",
  80. width: "500px",
  81. height: "600px",
  82. callBack: function (iframeId) {
  83. top.frames[iframeId].submitForm();
  84. }
  85. });
  86. }
  87. function btn_edit() {
  88. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  89. $.modalOpen({
  90. id: "Form",
  91. title: "Edit Product",
  92. url: "/ProductManage/Maintain/Form?keyValue=" + keyValue,
  93. width: "550px",
  94. height: "420px",
  95. callBack: function (iframeId) {
  96. top.frames[iframeId].submitForm();
  97. }
  98. });
  99. }
  100. function btn_delete() {
  101. $.deleteForm({
  102. url: "/ProductManage/Maintain/DeleteForm",
  103. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  104. success: function () {
  105. $.currentWindow().$("#gridList").trigger("reloadGrid");
  106. }
  107. })
  108. }
  109. function btn_details() {
  110. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  111. $.modalOpen({
  112. id: "Details",
  113. title: "Look",
  114. url: "/ProductManage/Maintain/Details?keyValue=" + keyValue,
  115. width: "550px",
  116. height: "390px",
  117. btn: null,
  118. });
  119. }
  120. </script>
  121. <div class="topPanel">
  122. <div class="toolbar">
  123. <div class="btn-group">
  124. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  125. </div>
  126. <div class="btn-group">
  127. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>Add Product</a>
  128. </div>
  129. <div class="operate">
  130. <ul class="nav nav-pills">
  131. <li class="first">Already Selected<span>1</span>Item</li>
  132. <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>Edit Product</a></li>
  133. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>Delete Product</a></li>
  134. <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>Look Product</a></li>
  135. </ul>
  136. <a href="javascript:;" class="close"></a>
  137. </div>
  138. <script>$('.toolbar').authorizeButton()</script>
  139. </div>
  140. <div class="search">
  141. <table>
  142. <tr>
  143. <td>
  144. <div class="input-group">
  145. <input id="txt_keyword" type="text" class="form-control" placeholder="Product SN" style="width: 100px;">
  146. <span class="input-group-btn">
  147. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  148. </span>
  149. </div>
  150. </td>
  151. <td style="padding-left: 10px;">
  152. @*<div id="warehouse" class="btn-group">
  153. <a class="btn btn-default active" data-value="0">All</a>
  154. <a class="btn btn-default" data-value="10">成品仓(Finished WH)</a>
  155. <a class="btn btn-default" data-value="12">评估仓(Assessment WH)</a>
  156. <a class="btn btn-default" data-value="18">委外待发仓(Outsourcing WH)</a>
  157. </div>*@
  158. </td>
  159. </tr>
  160. </table>
  161. </div>
  162. </div>
  163. <div class="gridPanel">
  164. <table id="gridList"></table>
  165. <div id="gridPager"></div>
  166. </div>