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.

155 lines
5.6 KiB

  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <style>
  6. #ISO {
  7. width: 10px;
  8. }
  9. </style>
  10. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  11. <script src="~/Content/js/select2/select2.min.js"></script>
  12. <script>
  13. var ID = $.request("ID");
  14. var MouldNumber = $.request("MouldNumber");
  15. //var WarehouseName = decodeURI($.getUrlParam("WarehouseName"));
  16. var Type = $.request("Type");
  17. var Phone = $.request("Phone");
  18. var MouldName = decodeURI($.request("MouldName"));
  19. var Specification = decodeURI($.request("Specification"));
  20. var Unit = decodeURI($.request("Unit"));
  21. //var expArrivalDate = $
  22. $(function () {
  23. debugger;
  24. InitControl();
  25. if (ID != "") {
  26. $("#sel_Type").val([Type]).trigger("change");
  27. $("#MouldNumber").val(MouldNumber);
  28. $("#MouldName").val(MouldName);
  29. $("#Specification").val(Specification);
  30. $("#Unit").val(Unit);
  31. $("#Phone").val(Phone);
  32. }
  33. });
  34. $.getUrlParam = function (name) {
  35. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  36. var r = window.location.search.substr(1).match(reg);
  37. if (r != null) return unescape(r[2]); return null;
  38. }
  39. ;
  40. function InitControl() {
  41. debugger;
  42. var $VenCode = $("#sel_Type");
  43. $VenCode.select2({
  44. allowClear: true,
  45. escapeMarkup: function (m) {
  46. return m;
  47. }
  48. });
  49. $.ajax({
  50. url: "/Boxes/BasicSettings/GetType?tableName=" + "ICSMould" + "&" + Math.random(),
  51. dataType: "json",
  52. async: false,
  53. success: function (data) {
  54. $.each(data, function (index, item) {
  55. $VenCode.append("<option value='" + item.Type + "'>" + item.Type + "</option>");
  56. });
  57. }
  58. });
  59. }
  60. //新增模具
  61. function submitForm() {
  62. if (!$('#form1').formValid()) {
  63. return false;
  64. }
  65. debugger;
  66. var MouldNumber = $("#MouldNumber").val();
  67. var MouldName = $("#MouldName").val();
  68. var Type = $("#sel_Type").find("option:selected").text();
  69. var Unit = $("#Unit").val();
  70. var Specification = $("#Specification").val();
  71. var Phone = $("#Phone").val();
  72. if (MouldNumber == "" || MouldName == "" || Type == "" || Specification == "" || Unit=="" ) {
  73. $.modalAlertNew("WMS00062");
  74. return;
  75. }
  76. var objArr = {
  77. ID:ID,
  78. MouldNumber: $("#MouldNumber").val(),
  79. MouldName: $("#MouldName").val(),
  80. Type: $("#sel_Type").find("option:selected").text(),
  81. Unit: $("#Unit").val(),
  82. Specification: $("#Specification").val(),
  83. Phone: $("#Phone").val(),
  84. }
  85. if (ID != "") {
  86. $.submitForm({
  87. url: "/Boxes/BasicSettings/UpdateMould" + "?" + Math.random(),
  88. param: { keyValue: JSON.stringify(objArr) },
  89. success: function () {
  90. $.currentWindow().$("#gridList").trigger("reloadGrid");
  91. }
  92. })
  93. } else {
  94. $.submitForm({
  95. url: "/Boxes/BasicSettings/InsertMould" + "?" + Math.random(),
  96. param: { keyValue: JSON.stringify(objArr) },
  97. success: function () {
  98. $.currentWindow().$("#gridList").trigger("reloadGrid");
  99. }
  100. })
  101. }
  102. }
  103. </script>
  104. <form id="form1">
  105. <div style="padding-top: 50px; margin-right: 50px;">
  106. <table class="form">
  107. <tr>
  108. <th class="formTitle"><span style="color: red;">*</span>模具编码:</th>
  109. <td class="formValue">
  110. <input id="MouldNumber" name="MouldNumber" type="text" class="form-control required" style="width: 150px;" maxlength="10" placeholder="模具编码" required />
  111. </td>
  112. <th class="formTitle"><span style="color: red;">*</span>名称:</th>
  113. <td class="formValue">
  114. <input id="MouldName" name="MouldName" type="text" class="form-control required" maxlength="10" placeholder="名称" required/>
  115. </tr>
  116. <tr>
  117. <th class="formTitle">联系电话:</th>
  118. <td class="formValue">
  119. <input id="Phone" name="Phone" type="text" class="form-control " style="width: 150px;" maxlength="10" placeholder="联系电话" />
  120. </td>
  121. <th class="formTitle"><span style="color: red;">*</span>类型:</th>
  122. <td style="width:150px">
  123. <select id="sel_Type" name="sel_Type" class="form-control select2 required" style="width: 135px; height: 25px;" placeholder="类型"></select>
  124. <input type="hidden" id="hidetext" />
  125. </td>
  126. </tr>
  127. <tr>
  128. <th class="formTitle"><span style="color: red;">*</span>规格:</th>
  129. <td class="formValue">
  130. <input id="Specification" name="Specification" type="text" class="form-control required" style="width: 150px; " maxlength="10" placeholder="规格" required />
  131. <th class="formTitle"><span style="color: red;">*</span>单位:</th>
  132. <td class="formValue">
  133. <input id="Unit" name="Unit" type="text" class="form-control required" maxlength="10" placeholder="单位" />
  134. </tr>
  135. </table>
  136. </div>
  137. </form>