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.

133 lines
4.6 KiB

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