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.

168 lines
7.5 KiB

4 days 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. page: 1
  73. }).trigger('reloadGrid');
  74. });
  75. }
  76. function btn_add() {
  77. $.modalOpen({
  78. id: "Form",
  79. title: "Add Product",
  80. url: "/ProductManage/Maintain/Form",
  81. width: "500px",
  82. height: "600px",
  83. callBack: function (iframeId) {
  84. top.frames[iframeId].submitForm();
  85. }
  86. });
  87. }
  88. function btn_edit() {
  89. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  90. $.modalOpen({
  91. id: "Form",
  92. title: "Edit Product",
  93. url: "/ProductManage/Maintain/Form?keyValue=" + keyValue,
  94. width: "550px",
  95. height: "420px",
  96. callBack: function (iframeId) {
  97. top.frames[iframeId].submitForm();
  98. }
  99. });
  100. }
  101. function btn_delete() {
  102. $.deleteForm({
  103. url: "/ProductManage/Maintain/DeleteForm",
  104. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  105. success: function () {
  106. $.currentWindow().$("#gridList").trigger("reloadGrid");
  107. }
  108. })
  109. }
  110. function btn_details() {
  111. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  112. $.modalOpen({
  113. id: "Details",
  114. title: "Look",
  115. url: "/ProductManage/Maintain/Details?keyValue=" + keyValue,
  116. width: "550px",
  117. height: "390px",
  118. btn: null,
  119. });
  120. }
  121. </script>
  122. <div class="topPanel">
  123. <div class="toolbar">
  124. <div class="btn-group">
  125. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  126. </div>
  127. <div class="btn-group">
  128. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>Add Product</a>
  129. </div>
  130. <div class="operate">
  131. <ul class="nav nav-pills">
  132. <li class="first">Already Selected<span>1</span>Item</li>
  133. <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>Edit Product</a></li>
  134. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>Delete Product</a></li>
  135. <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>Look Product</a></li>
  136. </ul>
  137. <a href="javascript:;" class="close"></a>
  138. </div>
  139. <script>$('.toolbar').authorizeButton()</script>
  140. </div>
  141. <div class="search">
  142. <table>
  143. <tr>
  144. <td>
  145. <div class="input-group">
  146. <input id="txt_keyword" type="text" class="form-control" placeholder="Product SN" style="width: 100px;">
  147. <span class="input-group-btn">
  148. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  149. </span>
  150. </div>
  151. </td>
  152. <td style="padding-left: 10px;">
  153. @*<div id="warehouse" class="btn-group">
  154. <a class="btn btn-default active" data-value="0">All</a>
  155. <a class="btn btn-default" data-value="10">成品仓(Finished WH)</a>
  156. <a class="btn btn-default" data-value="12">评估仓(Assessment WH)</a>
  157. <a class="btn btn-default" data-value="18">委外待发仓(Outsourcing WH)</a>
  158. </div>*@
  159. </td>
  160. </tr>
  161. </table>
  162. </div>
  163. </div>
  164. <div class="gridPanel">
  165. <table id="gridList"></table>
  166. <div id="gridPager"></div>
  167. </div>