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

335 lines
9.8 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <style>
  7. .formTitle {
  8. text-align: right;
  9. width: 10%;
  10. }
  11. .formActions {
  12. text-align: left;
  13. width: 15%;
  14. }
  15. .project-list table tr td {
  16. padding: 5px;
  17. }
  18. .th_classAdd {
  19. text-align: center !important;
  20. }
  21. .th_classMar {
  22. padding: 10px;
  23. vertical-align: inherit;
  24. }
  25. .ui-jqgrid .ui-jqgrid-view {
  26. height: 500px;
  27. }
  28. .ui-jqgrid .ui-jqgrid-bdiv {
  29. height: 500px !important;
  30. }
  31. .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
  32. width: 100%;
  33. }
  34. .lr-layout-center {
  35. padding: 0 5px;
  36. }
  37. .th_classMar {
  38. padding: 0;
  39. }
  40. .lr-layout-tool {
  41. height: 50px;
  42. }
  43. .lr-layout-center .lr-layout-wrap.lr-layout-wrap-notitle {
  44. padding-top: 50px;
  45. }
  46. .wrapper .nav-tabs {
  47. padding: 0;
  48. }
  49. .webuploader-pick {
  50. padding: 7px 15px;
  51. }
  52. .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
  53. padding: 3px;
  54. }
  55. .form .formTitle {
  56. padding-right: 8px;
  57. }
  58. .form-control, .single-line {
  59. padding: 3px;
  60. }
  61. .ibox-title {
  62. height: 20px;
  63. line-height: 20px;
  64. padding: 0;
  65. padding-left: 15px;
  66. }
  67. .table {
  68. margin-bottom: 0;
  69. }
  70. .bootstrap-select > .dropdown-toggle {
  71. height: 22px;
  72. padding: 2px 6px;
  73. }
  74. .bootstrap-select > .dropdown-toggle.bs-placeholder, .bootstrap-select > .dropdown-toggle.bs-placeholder:hover, .bootstrap-select > .dropdown-toggle.bs-placeholder:focus, .bootstrap-select > .dropdown-toggle.bs-placeholder:active {
  75. height: 22px;
  76. padding: 2px 6px;
  77. }
  78. .form-control, .single-line {
  79. padding: 3px;
  80. height: 22px;
  81. padding: 0 3px;
  82. }
  83. </style>
  84. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  85. <script src="~/Content/js/select2/select2.min.js"></script>
  86. <script src="~/Content/js/layer/layer.js"></script>
  87. <script>
  88. debugger;
  89. var BID = $.request("ID");
  90. var BRGCode = $.request("BRGCode");
  91. var BRGDesc = decodeURI($.request("BRGDesc"));
  92. $(function () {
  93. if (BID != "") {
  94. $("#BRGCode").val(BRGCode);
  95. $("#BRGDesc").val(BRGDesc);
  96. gridListColorFastness2();
  97. } else {
  98. gridListColorFastness();
  99. }
  100. });
  101. function gridListColorFastness() {
  102. var $gridList = $("#gridListColorFastness");
  103. $gridList.dataGrid({
  104. url: "/WMS/BasicSettings/GetICSBadCodeGroupdetil?" + Math.random(),
  105. height: $(window).height() -50,
  106. width: $(window).width() - 400,
  107. cellEdit: true,
  108. cellsubmit: "clientArray",
  109. colModel: [
  110. { label: "主键", name: "ID", hidden: true, key: true },
  111. { label: '不良代码编码', name: 'BadCode', width: 400, align: 'left', editable: true, },
  112. { label: '不良代码描述', name: 'BadDesc', width: 400, align: 'left', editable: true, },
  113. ],
  114. afterSaveCell: function (rowid, cellname, value) {
  115. if (cellname === 'ProjectCN') {
  116. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  117. }
  118. },
  119. width: "100%",
  120. autowidth: true,
  121. rownumbers: true,
  122. viewrecords: true,
  123. });
  124. }
  125. function gridListColorFastness2() {
  126. var $gridList = $("#gridListColorFastness");
  127. $gridList.dataGrid({
  128. url: "/WMS/BasicSettings/GetICSBadCodeGroupdetil2?ID=" + BID + "&" + Math.random(),
  129. height: $(window).height() - 50,
  130. width: $(window).width() - 400,
  131. cellEdit: true,
  132. cellsubmit: "clientArray",
  133. colModel: [
  134. { label: "主键", name: "ID", hidden: true, key: true },
  135. { label: 'ID', name: 'ID', hidden: true },
  136. { label: '不良原因编码', name: 'BadCode', width: 400, align: 'left', editable: true, },
  137. { label: '不良原因描述', name: 'BadDesc', width: 400, align: 'left', editable: true, },
  138. ],
  139. afterSaveCell: function (rowid, cellname, value) {
  140. if (cellname === 'ProjectCN') {
  141. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  142. }
  143. },
  144. width: "100%",
  145. autowidth: true,
  146. rownumbers: true,
  147. viewrecords: true,
  148. });
  149. }
  150. function guid() {
  151. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  152. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  153. return v.toString(16);
  154. });
  155. }
  156. function AddRows_ColorFastness() {
  157. var obj = {
  158. ID: guid(),
  159. BadReasonCode: "",
  160. BadReasonDesc: ""
  161. };
  162. $("#gridListColorFastness").jqGrid('addRowData', obj.ID, obj, 'last');
  163. $(".unwritten").hide();
  164. }
  165. function DelRows_ColorFastness() {
  166. var rowid = $("#gridListColorFastness").jqGridRowValue().ID
  167. $.ajax({
  168. url: "/WMS/BasicSettings/DeleteItem?" + Math.random(),
  169. data: { ID: rowid },
  170. dataType: "json",
  171. async: false,
  172. success: function (data) {
  173. $("#gridListColorFastness").delRowData(rowid);
  174. }
  175. });
  176. }
  177. function submitForm() {
  178. debugger;
  179. $("#gridListColorFastness").find($("td[aria-describedby='gridListColorFastness_rn']")).click();//提交取消编辑状态
  180. var BRGCodes = $("#BRGCode").val();
  181. var BRGDescs = $("#BRGDesc").val();
  182. if (BRGCodes == '') {
  183. $.modalAlertNew("WMS00007");
  184. return;
  185. }
  186. if (BRGDescs == '') {
  187. $.modalAlertNew("WMS00008");
  188. return;
  189. }
  190. var obj_Item1 = $("#gridListColorFastness");
  191. var rowIds_Item1 = obj_Item1.getDataIDs();
  192. var arrayData_Item1 = new Array();
  193. if (rowIds_Item1.length > 0) {
  194. debugger;
  195. for (var i = 0; i < rowIds_Item1.length; i++) {
  196. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  197. if (RowData_Item1.BadCode == '') {
  198. $.modalAlertNew("WMS00009");
  199. return;
  200. }
  201. if (RowData_Item1.BadDesc == '') {
  202. $.modalAlertNew("WMS00009");
  203. return;
  204. }
  205. var obj = {
  206. ID: RowData_Item1.ID,
  207. BadReasonCode: RowData_Item1.BadCode,
  208. BadReasonDesc: RowData_Item1.BadDesc,
  209. };
  210. arrayData_Item1.push(obj);
  211. }
  212. }
  213. var arrayItem1 = JSON.stringify(arrayData_Item1);
  214. debugger;
  215. if (BID != "") {
  216. $.ajax({
  217. url: "/WMS/BasicSettings/UpdateICSBadCodeGroup?BID=" + BID + "&BRGCode=" + BRGCodes + "&BRGDesc=" + BRGDescs + "&" + Math.random(),
  218. data: {
  219. arrayShellFabricItem: arrayItem1,
  220. },
  221. type: "post",
  222. dataType: "json",
  223. success: function (data) {
  224. layer.msg(data.message);
  225. window.setTimeout(function () {
  226. $.modalClose();
  227. }, 2500);
  228. $.currentWindow().$("#gridList").trigger("reloadGrid");
  229. },
  230. });
  231. } else {
  232. $.ajax({
  233. url: "/WMS/BasicSettings/SubICSBadCodeGroupAdd?BRGCode=" + BRGCodes + "&BRGDesc=" + BRGDescs + "&" + Math.random(),
  234. data: {
  235. arrayShellFabricItem: arrayItem1,
  236. },
  237. type: "post",
  238. dataType: "json",
  239. success: function (data) {
  240. layer.msg(data.message);
  241. window.setTimeout(function () {
  242. $.modalClose();
  243. }, 2500);
  244. $.currentWindow().$("#gridList").trigger("reloadGrid");
  245. },
  246. });
  247. }
  248. }
  249. </script>
  250. <form id="form1">
  251. <div style="padding-top: 20px; margin-right: 20px;">
  252. <div class="ibox-title">
  253. 主表
  254. </div>
  255. <table class="form">
  256. <tr>
  257. <th class="formTitle">不良代码组编码:</th>
  258. <td class="formValue">
  259. <input id="BRGCode" type="text" class="form-control" placeholder="不良代码组编码" style="width: 300px;">
  260. </td>
  261. <th class="formTitle">不良代码组描述:</th>
  262. <td class="formValue">
  263. <input id="BRGDesc" type="text" class="form-control" placeholder="不良代码组描述" style="width: 300px;">
  264. </td>
  265. </tr>
  266. </table>
  267. </div>
  268. </form>
  269. <!--色牢度-->
  270. <div class="gridPanel" style="width: 100% ">
  271. <div class="ibox-title">
  272. 子表
  273. </div>
  274. <div class="gridPanel">
  275. <div id="gridPagerColorFastness">
  276. <label class="radio-inline">
  277. <a style="margin-left:3px;" class="btn btn-next" onclick="AddRows_ColorFastness()"><i class="fa fa-plus" style="margin-right:5px"></i>新增</a>
  278. </label>
  279. <label class="radio-inline">
  280. <a style="margin-left:3px;" class="btn btn-next" onclick="DelRows_ColorFastness()"><i class="fa fa-minus" style="margin-right:5px"></i>删除</a>
  281. </label>
  282. </div>
  283. <table id="gridListColorFastness"></table>
  284. </div>
  285. </div>