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

192 lines
6.5 KiB

3 years ago
  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <script>
  7. $(function () {
  8. gridList();
  9. SireCodeBinding();
  10. CodeBinding();
  11. });
  12. function gridList() {
  13. var $gridList = $("#gridList");
  14. $gridList.dataGrid({
  15. url: "/WMS/BasicSettings/GetSendContainer?" + Math.random(),
  16. height: $(window).height() -50,
  17. width: $(window).width() - 400,
  18. cellEdit: true,
  19. cellsubmit: "clientArray",
  20. colModel: [
  21. { label: "主键", name: "ID", hidden: true, key: true },
  22. {
  23. label: '删除', width: 100, align: 'left',
  24. formatter: btnLook
  25. },
  26. { label: '父容器唯一标识', name: 'ContainerID', width: 120, align: 'left' },
  27. { label: '容器代码', name: 'ContainerCode', width: 150, align: 'left' },
  28. { label: '容器名称', name: 'ContainerName', width: 100, align: 'left' },
  29. { label: '备注', name: 'Memo', width: 200, align: 'left' },
  30. { label: '操作人', name: 'MUSER', width: 200, align: 'left' },
  31. { label: '操作人姓名', name: 'MUSERName', width: 200, align: 'left' },
  32. { label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
  33. { label: '站点', name: 'WorkPoint', width: 200, align: 'left' },
  34. ],
  35. afterSaveCell: function (rowid, cellname, value) {
  36. if (cellname === 'ProjectCN') {
  37. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  38. }
  39. },
  40. width: "100%",
  41. autowidth: true,
  42. rownumbers: true,
  43. viewrecords: true,
  44. });
  45. }
  46. function btnLook(cellvalue, options, rowObject) {
  47. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">删除</a>";
  48. }
  49. function UpLoadClick(ID) {
  50. $("#gridList").delRowData(ID);
  51. }
  52. function SireCodeBinding() {
  53. $("#SireCode").keydown(function (e) {
  54. var curKey = e.which;
  55. debugger;
  56. if (curKey == 13) {
  57. var SireCode = $("#SireCode").val();//需绑定容器
  58. $.ajax({
  59. url: "/WMS/BasicSettings/GetBindContainerID?SireCode=" + SireCode,
  60. dataType: "json",
  61. async: false,
  62. success: function (data) {
  63. debugger;
  64. if (data == "" || data == null) {
  65. $.modalAlert("未查询到该容器信息!");
  66. return;
  67. }
  68. $("#SireID").val(data.rows[0].ID);
  69. $("#Code").focus();
  70. }
  71. });
  72. }
  73. });
  74. };
  75. function CodeBinding() {
  76. $("#Code").keydown(function (e) {
  77. var curKey = e.which;
  78. debugger;
  79. if (curKey == 13) {
  80. var Code = $("#Code").val();//需绑定容器
  81. $.ajax({
  82. url: "/WMS/BasicSettings/GetContainerInfo?Code=" + Code,
  83. dataType: "json",
  84. async: false,
  85. success: function (data) {
  86. debugger;
  87. if (data == "" || data == null) {
  88. $.modalAlert("未查询到该容器信息!");
  89. return;
  90. }
  91. //最后一行新增数据
  92. var obj = {
  93. ID: data.rows[0].ID,
  94. ContainerID: data.rows[0].ContainerID,
  95. ContainerCode: data.rows[0].ContainerCode,
  96. ContainerName: data.rows[0].ContainerName,
  97. Memo: data.rows[0].Memo,
  98. MUSER: data.rows[0].MUSER,
  99. MUSERName: data.rows[0].MUSERName,
  100. MTIME: data.rows[0].MTIME,
  101. WorkPoint: data.rows[0].WorkPoint,
  102. };
  103. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'first');
  104. $(".unwritten").hide();
  105. }
  106. });
  107. }
  108. });
  109. };
  110. function submitForm() {
  111. debugger;
  112. var SireID = $("#SireID").val();
  113. var ICSMTDOC = [];
  114. var obj_Item1 = $("#gridList");
  115. var rowIds_Item1 = obj_Item1.getDataIDs();
  116. if (rowIds_Item1.length > 0) {
  117. for (var i = 0; i < rowIds_Item1.length; i++) {
  118. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  119. var obj = {
  120. ID: RowData_Item1.ID,
  121. ContainerCode: RowData_Item1.ContainerCode,
  122. };
  123. ICSMTDOC.push(obj);
  124. }
  125. }
  126. debugger;
  127. $.modalConfirm("确定绑定吗?", function (r) {
  128. if (r) {
  129. $.submitForm({
  130. url: "/WMS/BasicSettings/BindingContainerID?SireID=" + SireID + "&" + Math.random(),
  131. param: { ICSMTDOC: JSON.stringify(ICSMTDOC) },
  132. success: function () {
  133. $.currentWindow().$("#gridList").trigger("reloadGrid");
  134. }
  135. })
  136. }
  137. });
  138. }
  139. </script>
  140. <form id="form1">
  141. <div style="padding-top: 20px; margin-right: 20px;">
  142. <table class="form">
  143. <tr>
  144. <th class="formTitle">父容器:</th>
  145. <td class="formValue">
  146. <input id="SireCode" type="text" class="form-control" style="width: 300px;" οnkeydοwn="SireCodeBinding()"/>
  147. <input id="SireID" type="text" class="form-control" style="display:none" οnkeydοwn="SireCodeBinding()" />
  148. </td>
  149. <th class="formTitle">需绑定容器:</th>
  150. <td class="formValue">
  151. <input id="Code" type="text" class="form-control" style="width: 300px;" οnkeydοwn="CodeBinding()" />
  152. </td>
  153. </tr>
  154. </table>
  155. </div>
  156. </form>
  157. <!--色牢度-->
  158. <div class="gridPanel" style="width: 100% ">
  159. <div class="ibox-title">
  160. 子表
  161. </div>
  162. <div class="gridPanel">
  163. <table id="gridList"></table>
  164. </div>
  165. </div>