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

219 lines
8.9 KiB

3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. debugger;
  7. //var Type = $.request("Type");
  8. var ColModelMain = [];
  9. var ColModelSub = [];
  10. $(function () {
  11. gridList();
  12. })
  13. function gridList() {
  14. var $gridList = $("#gridList");
  15. var queryJson = {
  16. MTDOCCode: $("#txt_MTDOCCode").val(),
  17. }
  18. $gridList.dataGrid({
  19. url: "/WMS/ICSMTDOC/GetGridJson" + "?" + Math.random(),
  20. postData: { queryJson: JSON.stringify(queryJson) },
  21. height: $(window).height() - 200,
  22. width: $(window).width() - 300,
  23. colModel: [
  24. { label: "主键", name: "ID", hidden: true, key: true },
  25. { label: '形态转换单号', name: 'MTDOCCode', width: 120, align: 'left' },
  26. //{ label: '部门代码', name: 'DepCode', width: 150, align: 'left' },
  27. {
  28. label: "状态", name: "Status", width: 60, align: "left",
  29. formatter: function (cellvalue) {
  30. if (cellvalue == "1") {
  31. return "开立";
  32. } else if (cellvalue == "2") {
  33. return "审核";
  34. }
  35. else if (cellvalue == "3") {
  36. return "关闭";
  37. }
  38. else { return ""; }
  39. }
  40. },
  41. { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
  42. { label: '创建时间', name: 'CreateDateTime', width: 100, align: 'left' },
  43. { label: '操作人', name: 'MUSER', width: 100, align: 'left' },
  44. { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
  45. { label: '操作时间', name: 'MTIME', width: 100, align: 'left' },
  46. ],
  47. //colModel: ColModelMan,
  48. width: "100%",
  49. autowidth: true,
  50. //shrinkToFit: true,
  51. gridComplete: function () {
  52. },
  53. pager: "#gridPager",
  54. sortname: 'MTDOCCode',
  55. sortorder: "desc",
  56. viewrecords: true,
  57. multiselect: true,
  58. beforeSelectRow: function (rowid, e) {
  59. $("#gridList").jqGrid('resetSelection');
  60. return (true);
  61. },
  62. subGrid: true, // (1)开启子表格支持
  63. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  64. $("#gridList").jqGrid("setSelection", rowid, false);
  65. bindSubGrid(subgrid_id, rowid)
  66. }
  67. });
  68. $("#warehouse a.btn-default").click(function () {
  69. $("#warehouse a.btn-default").removeClass("active");
  70. $(this).addClass("active");
  71. $('#btn_search').trigger("click");
  72. });
  73. $("#btn_search").click(function () {
  74. var warehouse = $("#warehouse a.active").attr('data-value');
  75. var queryJson = {
  76. MTDOCCode: $("#txt_MTDOCCode").val(),
  77. }
  78. $gridList.jqGrid('setGridParam', {
  79. postData: { queryJson: JSON.stringify(queryJson) },
  80. }).trigger('reloadGrid');
  81. });
  82. }
  83. function bindSubGrid(subgrid_id, rowid) {
  84. debugger;
  85. $("#gridList").jqGrid("setSelection", rowid, false);
  86. var subgrid_table_id;
  87. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  88. var subgrid_pager_id;
  89. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  90. // (5)动态添加子报表的table和pager
  91. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  92. var MTDOCCode = $("#gridList").jqGrid('getRowData', rowid).MTDOCCode;
  93. //var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  94. // (6)创建jqGrid对象
  95. $("#" + subgrid_table_id).dataGrid({
  96. cellEdit: true,
  97. url: "/WMS/ICSMTDOC/GetSubGridJson?MTDOCCode=" + MTDOCCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  98. colModel: [
  99. { label: "主键", name: "ID", hidden: true, key: true },
  100. { label: "行号", name: "Sequence", width: 50, align: 'left' },
  101. { label: '部门代码', name: 'DepCode', width: 100, align: 'left' },
  102. { label: '部门名称', name: 'DepName', width: 100, align: 'left' },
  103. { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
  104. { label: '仓库名称', name: 'WarehouseName', width: 100, align: 'left' },
  105. { label: '条码', name: 'LotNo', width: 100, align: 'left' },
  106. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  107. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  108. { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  109. { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
  110. { label: '已转换数量', name: 'MTDOCQuantity', width: 100, align: 'left' },
  111. { label: '转换类型', name: 'MTDOCQuantity', width: 100, align: 'left' },
  112. ],
  113. //colModel: ColModelSub,
  114. shrinkToFit: true,//宽度自适应
  115. multiselect: true,
  116. prmNames: { search: "search" },
  117. viewrecords: true,
  118. height: "100%",
  119. rowNum: 20,
  120. pager: subgrid_pager_id,
  121. });
  122. }
  123. function btnCreate() {
  124. debugger;
  125. $.modalOpen({
  126. id: "ICSMTDOCAdd",
  127. title: "形态转换",
  128. url: "/WMS/ICSMTDOC/ICSMTDOCAdd",
  129. width: "1200px",
  130. height: "1150px",
  131. callBack: function (iframeId) {
  132. top.frames[iframeId].submitForm();
  133. }
  134. });
  135. }
  136. //审核
  137. function btnAudit() {
  138. debugger;
  139. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  140. if (ids.length == 0) {
  141. $.modalAlertNew("WMS00004");
  142. return;
  143. }
  144. for (var i = 0; i < ids.length; i++) {
  145. var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
  146. var MTDOCCode = rowData.MTDOCCode;
  147. }
  148. $.modalConfirm("确定审核吗?", function (r) {
  149. if (r) {
  150. $.submitForm({
  151. url: "/WMS/ICSMTDOC/ICSMTDOCAudit?MTDOCCode=" + MTDOCCode + "&" + Math.random(),
  152. //param: { keyValue: IDlist },
  153. success: function () {
  154. $.currentWindow().$("#gridList").trigger("reloadGrid");
  155. }
  156. })
  157. }
  158. });
  159. }
  160. function btnToLead() {
  161. $.modalOpen({
  162. id: "ToLead",
  163. title: "形态转换",
  164. url: "/WMS/ICSMTDOC/MetamorphosisToLead?" + Math.random(),
  165. width: "400px",
  166. height: "225px",
  167. btn: null,
  168. });
  169. }
  170. </script>
  171. <div class="topPanel" style="height:60px;">
  172. <div class="toolbar">
  173. <div class="btn-group">
  174. <a id="NF-Create" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>形态转换</a>
  175. <a id="NF-Audit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnAudit()"><i class="fa fa-pencil-square-o"></i>审核</a>
  176. <a id="NF-ToLead" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnToLead()"><i class="fa fa-pencil-square-o"></i>导入</a>
  177. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  178. </div>
  179. <script>$('.toolbar').authorizeButton()</script>
  180. </div>
  181. <div class="search">
  182. <table>
  183. <tr>
  184. <td style="text-align:right;"><label class="lglabel" for="txt_MTDOCCode">单据号</label>:</td>
  185. <td>
  186. <div class="input-group">
  187. <input id="txt_MTDOCCode" type="text" class="form-control" style="width: 100px;">
  188. </div>
  189. </td>
  190. <td>
  191. <span class="input-group-btn">
  192. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  193. </span>
  194. </td>
  195. </tr>
  196. </table>
  197. </div>
  198. </div>
  199. <div class="gridPanel">
  200. <table id="gridList"></table>
  201. <div id="gridPager"></div>
  202. </div>