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.

182 lines
5.9 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 MouldCode = $.request("MouldCode");
  16. //var WarehouseName = decodeURI($.getUrlParam("WarehouseName"));
  17. var MouldCode = $.request("MouldCode");
  18. var Describe = $.request("Describe");
  19. var MouldName = decodeURI($.request("MouldName"));
  20. var PicturePath = "";
  21. $(function () {
  22. debugger;
  23. InitControl();
  24. InitControl1();
  25. if (ID != "") {
  26. $("#sel_MouldCode").val([MouldCode]).trigger("change");
  27. $("#MouldName").val(MouldName);
  28. $("#Describe").val(Describe);
  29. $("#MouldCode").val(MouldCode);
  30. }
  31. });
  32. $.getUrlParam = function (name) {
  33. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  34. var r = window.location.search.substr(1).match(reg);
  35. if (r != null) return unescape(r[2]); return null;
  36. }
  37. ;
  38. function InitControl() {
  39. debugger;
  40. var $VenCode = $("#sel_MouldCode");
  41. $VenCode.select2({
  42. allowClear: true,
  43. escapeMarkup: function (m) {
  44. return m;
  45. }
  46. });
  47. $.ajax({
  48. url: "/Boxes/BasicSettings/GetMouldCode" + "?" + Math.random(),
  49. dataType: "json",
  50. async: false,
  51. success: function (data) {
  52. $.each(data, function (index, item) {
  53. $VenCode.append("<option value='" + item.MouldCode + "'>" + item.MouldCode + "</option>");
  54. });
  55. }
  56. });
  57. }
  58. function InitControl1() {
  59. debugger;
  60. var $VenCode = $("#sel_MajorStates");
  61. $VenCode.select2({
  62. allowClear: true,
  63. escapeMarkup: function (m) {
  64. return m;
  65. }
  66. });
  67. $.ajax({
  68. url: "/Boxes/BasicSettings/GetType?tableName=" + "ICSMouldLog" +"&" + Math.random(),
  69. dataType: "json",
  70. async: false,
  71. success: function (data) {
  72. $.each(data, function (index, item) {
  73. $VenCode.append("<option value='" + item.TypeName + "'>" + item.TypeName + "</option>");
  74. });
  75. }
  76. });
  77. }
  78. function submitForm() {
  79. var MouldCode = $("#MouldCode").val();//模具代码
  80. var MouldCode = $("#sel_MouldCode").find("option:selected").text();//模具编码
  81. var Status = $("#sel_MajorStates").find("option:selected").text();//状态
  82. var MouldName = $("#MouldName").val();//模具名称
  83. var Describe = $("#Describe").val();//模具描述
  84. if (MouldCode == "" || MouldCode == undefined) {
  85. $.modalAlertNew("WMS00113");
  86. return;
  87. }
  88. if (MouldCode == "" || MouldCode == undefined) {
  89. $.modalAlertNew("WMS00114");
  90. return;
  91. }
  92. if (MouldName == "" || MouldName == undefined) {
  93. $.modalAlertNew("WMS00115");
  94. return;
  95. }
  96. var objArr = {
  97. ID: ID,
  98. MouldCode: MouldCode,
  99. MouldCode: MouldCode,
  100. MouldName: MouldName,
  101. Status: Status,
  102. Describe: Describe
  103. }
  104. debugger;
  105. if (ID != "") {
  106. $.submitForm({
  107. url: "/Boxes/BasicSettings/UpdateMouldStatus" + "?" + Math.random(),
  108. param: { keyValue: JSON.stringify(objArr) },
  109. success: function () {
  110. $.currentWindow().$("#gridList").trigger("reloadGrid");
  111. }
  112. })
  113. } else {
  114. $.submitForm({
  115. url: "/Boxes/BasicSettings/InsertMouldAccount" + "?" + Math.random(),
  116. param: { keyValue: JSON.stringify(objArr) },
  117. success: function () {
  118. $.currentWindow().$("#gridList").trigger("reloadGrid");
  119. }
  120. })
  121. }
  122. }
  123. //导入
  124. function btn_Introduction() {
  125. debugger;
  126. $("#FileUp").click();
  127. }
  128. function btnUpLoad(up) {
  129. var form = new FormData(document.getElementById("form1"));
  130. $.ajax({
  131. url: "/Boxes/BasicSettings/UpLoadFileImport?" + Math.random(),
  132. type: "post",
  133. data: form,
  134. contentType: false,
  135. processData: false,
  136. success: function (data) {
  137. if (data!="") {
  138. alert("上传成功");
  139. PicturePath = data.data;
  140. }
  141. },
  142. error: function (aa) {
  143. alert("上传失败:" + aa);
  144. }
  145. });
  146. }
  147. </script>
  148. <form id="form1">
  149. <div style="padding-top: 50px; margin-right: 50px;">
  150. <table class="form">
  151. <tr>
  152. <th class="formTitle">模具代码:</th>
  153. <td style="width:150px">
  154. <select id="sel_MouldCode" name="sel_MouldCode" class="form-control select2" style="width: 135px; height: 25px;" placeholder="模具代码" disabled></select>
  155. <input type="hidden" id="hidetext" />
  156. </td>
  157. </tr>
  158. <tr>
  159. <th class="formTitle">名称:</th>
  160. <td class="formValue">
  161. <input id="MouldName" name="MouldName" type="text" class="form-control required" maxlength="10" placeholder="名称" disabled/>
  162. </td>
  163. </tr>
  164. <tr>
  165. <th class="formTitle">状态:</th>
  166. <td class="formValue">
  167. <select id="sel_MajorStates" name="sel_MajorStates" class="form-control select2" style="width: 135px; height: 25px;" placeholder="状态"></select>
  168. <input type="hidden" id="hidetext" />
  169. </tr>
  170. </table>
  171. </div>
  172. </form>