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

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. var BID = $.request("ID");
  89. var BRGCode = $.request("BRGCode");
  90. var BRGDesc = decodeURI($.request("BRGDesc"));
  91. $(function () {
  92. if (BID != "") {
  93. $("#BRGCode").val(BRGCode);
  94. $("#BRGDesc").val(BRGDesc);
  95. gridListColorFastness2();
  96. } else {
  97. gridListColorFastness();
  98. }
  99. });
  100. function gridListColorFastness() {
  101. var $gridList = $("#gridListColorFastness");
  102. $gridList.dataGrid({
  103. url: "/WMS/BasicSettings/GetICSBadReason?" + Math.random(),
  104. height: $(window).height() -50,
  105. width: $(window).width() - 400,
  106. cellEdit: true,
  107. cellsubmit: "clientArray",
  108. colModel: [
  109. { label: "主键", name: "ID", hidden: true, key: true },
  110. { label: '不良原因编码', name: 'BadReasonCode', width: 400, align: 'left', editable: true, },
  111. { label: '不良原因描述', name: 'BadReasonDesc', width: 400, align: 'left', editable: true, },
  112. ],
  113. afterSaveCell: function (rowid, cellname, value) {
  114. if (cellname === 'ProjectCN') {
  115. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  116. }
  117. },
  118. width: "100%",
  119. autowidth: true,
  120. rownumbers: true,
  121. viewrecords: true,
  122. });
  123. }
  124. function gridListColorFastness2() {
  125. var $gridList = $("#gridListColorFastness");
  126. $gridList.dataGrid({
  127. url: "/WMS/BasicSettings/GetICSBadReason2?BRGCode=" + BRGCode + "&" + Math.random(),
  128. height: $(window).height() - 50,
  129. width: $(window).width() - 400,
  130. cellEdit: true,
  131. cellsubmit: "clientArray",
  132. colModel: [
  133. { label: "主键", name: "ID", hidden: true, key: true },
  134. { label: 'ID', name: 'ID', hidden: true },
  135. { label: '不良原因编码', name: 'BadReasonCode', width: 400, align: 'left', editable: true, },
  136. { label: '不良原因描述', name: 'BadReasonDesc', width: 400, align: 'left', editable: true, },
  137. ],
  138. afterSaveCell: function (rowid, cellname, value) {
  139. if (cellname === 'ProjectCN') {
  140. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  141. }
  142. },
  143. width: "100%",
  144. autowidth: true,
  145. rownumbers: true,
  146. viewrecords: true,
  147. });
  148. }
  149. function guid() {
  150. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  151. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  152. return v.toString(16);
  153. });
  154. }
  155. function AddRows_ColorFastness() {
  156. var obj = {
  157. ID: guid(),
  158. BadReasonCode: "",
  159. BadReasonDesc: ""
  160. };
  161. $("#gridListColorFastness").jqGrid('addRowData', obj.ID, obj, 'last');
  162. $(".unwritten").hide();
  163. }
  164. function DelRows_ColorFastness() {
  165. var rowid = $("#gridListColorFastness").jqGridRowValue().ID
  166. $.ajax({
  167. url: "/WMS/BasicSettings/DeleteItem?" + Math.random(),
  168. data: { ID: rowid },
  169. dataType: "json",
  170. async: false,
  171. success: function (data) {
  172. $("#gridListColorFastness").delRowData(rowid);
  173. }
  174. });
  175. }
  176. function submitForm() {
  177. debugger;
  178. $("#gridListColorFastness").find($("td[aria-describedby='gridListColorFastness_rn']")).click();//提交取消编辑状态
  179. var BRGCodes = $("#BRGCode").val();
  180. var BRGDescs = $("#BRGDesc").val();
  181. if (BRGCodes=='') {
  182. $.modalAlert("请先输入不良原因组编码!");
  183. return;
  184. }
  185. if (BRGDescs == '') {
  186. $.modalAlert("请先输入不良原因组描述!");
  187. return;
  188. }
  189. var obj_Item1 = $("#gridListColorFastness");
  190. var rowIds_Item1 = obj_Item1.getDataIDs();
  191. var arrayData_Item1 = new Array();
  192. if (rowIds_Item1.length > 0) {
  193. debugger;
  194. for (var i = 0; i < rowIds_Item1.length; i++) {
  195. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  196. if (RowData_Item1.BadReasonCode=='') {
  197. $.modalAlert("请先输入不良原因编码!");
  198. return;
  199. }
  200. if (RowData_Item1.BadReasonDesc == '') {
  201. $.modalAlert("请先输入不良原因编码!");
  202. return;
  203. }
  204. var obj = {
  205. ID: RowData_Item1.ID,
  206. BadReasonCode: RowData_Item1.BadReasonCode,
  207. BadReasonDesc: RowData_Item1.BadReasonDesc,
  208. };
  209. arrayData_Item1.push(obj);
  210. }
  211. }
  212. var arrayItem1 = JSON.stringify(arrayData_Item1);
  213. debugger;
  214. if (BID != "") {
  215. $.ajax({
  216. url: "/WMS/BasicSettings/UpdateICSBadReasonGroup?BID=" + BID + "&BRGCode=" + BRGCodes + "&BRGDesc=" + BRGDescs + "&" + Math.random(),
  217. data: {
  218. arrayShellFabricItem: arrayItem1,
  219. },
  220. type: "post",
  221. dataType: "json",
  222. success: function (data) {
  223. layer.msg(data.message);
  224. window.setTimeout(function () {
  225. $.modalClose();
  226. }, 2500);
  227. $.currentWindow().$("#gridList").trigger("reloadGrid");
  228. },
  229. });
  230. } else {
  231. $.ajax({
  232. url: "/WMS/BasicSettings/SubICSBadReasonGroupAdd?BRGCode=" + BRGCodes + "&BRGDesc=" + BRGDescs + "&" + Math.random(),
  233. data: {
  234. arrayShellFabricItem: arrayItem1,
  235. },
  236. type: "post",
  237. dataType: "json",
  238. success: function (data) {
  239. layer.msg(data.message);
  240. window.setTimeout(function () {
  241. $.modalClose();
  242. }, 2500);
  243. $.currentWindow().$("#gridList").trigger("reloadGrid");
  244. },
  245. });
  246. }
  247. }
  248. </script>
  249. <form id="form1">
  250. <div style="padding-top: 20px; margin-right: 20px;">
  251. <div class="ibox-title">
  252. 主表
  253. </div>
  254. <table class="form">
  255. <tr>
  256. <th class="formTitle">不良原因组编码:</th>
  257. <td class="formValue">
  258. <input id="BRGCode" type="text" class="form-control" placeholder="不良原因组编码" style="width: 300px;">
  259. </td>
  260. <th class="formTitle">不良原因组描述:</th>
  261. <td class="formValue">
  262. <input id="BRGDesc" type="text" class="form-control" placeholder="不良原因组描述" style="width: 300px;">
  263. </td>
  264. </tr>
  265. </table>
  266. </div>
  267. </form>
  268. <!--色牢度-->
  269. <div class="gridPanel" style="width: 100% ">
  270. <div class="ibox-title">
  271. 子表
  272. </div>
  273. <div class="gridPanel">
  274. <div id="gridPagerColorFastness">
  275. <label class="radio-inline">
  276. <a style="margin-left:3px;" class="btn btn-next" onclick="AddRows_ColorFastness()"><i class="fa fa-plus" style="margin-right:5px"></i>新增</a>
  277. </label>
  278. <label class="radio-inline">
  279. <a style="margin-left:3px;" class="btn btn-next" onclick="DelRows_ColorFastness()"><i class="fa fa-minus" style="margin-right:5px"></i>删除</a>
  280. </label>
  281. </div>
  282. <table id="gridListColorFastness"></table>
  283. </div>
  284. </div>
  285. n