纽威
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
6.6 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. 
  2. @{
  3. ViewBag.Title = "Form";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
  7. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  8. <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
  9. <script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
  10. <style>
  11. * {
  12. box-sizing: border-box;
  13. }
  14. </style>
  15. <script>
  16. var ID = $.request("ID");
  17. $(function () {
  18. $("#txtLableCode").attr("disabled", "disabled");
  19. InitControl();
  20. InitContro2();
  21. if (ID != "") {
  22. GetTXT();
  23. }
  24. });
  25. function GetTXT() {
  26. if (!!ID) {
  27. $.ajax({
  28. url: "/WMS/BasicSettings/GetLabelTXT?ID=" + ID + "&" + Math.random(),
  29. dataType: "json",
  30. async: false,
  31. success: function (data) {
  32. debugger;
  33. $("#txtLableCode").val(data.rows[0].LableCode);
  34. $("#txtLableName").val(data.rows[0].LableName);
  35. $("#sel_LableType").val(data.rows[0].LableType).trigger("change");
  36. $("#sel_LableSourceID").val(data.rows[0].LableSourceID).trigger("change");
  37. }
  38. });
  39. }
  40. };
  41. function InitControl() {
  42. var $VenCode = $("#sel_LableType");
  43. $VenCode.select2({
  44. allowClear: true,
  45. escapeMarkup: function (m) {
  46. return m;
  47. }
  48. });
  49. $.ajax({
  50. url: "/WMS/Print/GetLableType" + "?" + Math.random(),
  51. dataType: "json",
  52. async: false,
  53. success: function (data) {
  54. $.each(data, function (index, item) {
  55. $VenCode.append("<option value='" + item.F_ItemCode + "'>&nbsp;" + item.F_ItemName + "</option>");
  56. });
  57. }
  58. });
  59. }
  60. function InitContro2() {
  61. var $VenCode = $("#sel_LableSourceID");
  62. $VenCode.select2({
  63. allowClear: true,
  64. escapeMarkup: function (m) {
  65. return m;
  66. }
  67. });
  68. $.ajax({
  69. url: "/WMS/Print/GetLableSourceID" + "?" + Math.random(),
  70. dataType: "json",
  71. async: false,
  72. success: function (data) {
  73. $.each(data, function (index, item) {
  74. $VenCode.append("<option value='" + item.ID + "'>&nbsp;" + item.SourceName + "</option>");
  75. });
  76. }
  77. });
  78. }
  79. function submitForm() {
  80. var Sys_LableDataSource = [];
  81. var txtLableCode = $("#txtLableCode").val();//编号(新增时是空)
  82. var txtLableName = $("#txtLableName").val();//名称
  83. var sel_LableType = $("#sel_LableType").val();//;类型
  84. var sel_LableSourceID = $("#sel_LableSourceID").val();//标签数据源id
  85. if (txtLableName == '' || txtLableName == undefined) {
  86. $.modalAlertNew("WMS00052");
  87. return;
  88. }
  89. if (sel_LableType == '' || sel_LableType == undefined) {
  90. $.modalAlertNew("WMS00053");
  91. return;
  92. }
  93. if (sel_LableSourceID == '' && sel_LableSourceID == undefined) {
  94. $.modalAlertNew("WMS00054");
  95. return;
  96. }
  97. if (ID=='') {
  98. $.modalConfirm("确定新建吗?", function (r) {
  99. if (r) {
  100. $.submitForm({
  101. url: "/WMS/BasicSettings/CreateLables?txtLableName=" + txtLableName + "&sel_LableType=" + sel_LableType + "&sel_LableSourceID=" + sel_LableSourceID + "&" + Math.random(),
  102. param: { Sys_LableDataSource: JSON.stringify(Sys_LableDataSource) },
  103. success: function () {
  104. $.currentWindow().$("#gridList").trigger("reloadGrid");
  105. }
  106. })
  107. }
  108. });
  109. } else {
  110. $.modalConfirm("确定修改吗?", function (r) {
  111. if (r) {
  112. $.submitForm({
  113. url: "/WMS/BasicSettings/updateLables?txtLableName=" + txtLableName + "&sel_LableType=" + sel_LableType + "&sel_LableSourceID=" + sel_LableSourceID + "&ID=" + ID + "&" + Math.random(),
  114. param: { Sys_LableDataSource: JSON.stringify(Sys_LableDataSource) },
  115. success: function () {
  116. $.currentWindow().$("#gridList").trigger("reloadGrid");
  117. }
  118. })
  119. }
  120. });
  121. }
  122. }
  123. </script>
  124. <form id="form1">
  125. <div class="widget-body">
  126. <div style="padding-top: 5px; ">
  127. <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
  128. <div class="step-pane active" id="step-1" style="padding-left: 5px; padding-top: 20px; margin-right: 20px;">
  129. <table class="form">
  130. <tr>
  131. <th class="formTitle">标签编号: </th>
  132. <td class="formValue" style="overflow:auto" colspan="1">
  133. <input class="form-control" name="txtLableCode" id="txtLableCode" style="width: 95%" />
  134. </td>
  135. <th class="formTitle">标签名称: </th>
  136. <td class="formValue" style="overflow:auto" colspan="1">
  137. <input class="form-control" name="txtLableName" id="txtLableName" style="width: 95%" />
  138. </td>
  139. </tr>
  140. <tr>
  141. <th class="formTitle">标签类型: </th>
  142. <td class="formValue">
  143. <select id="sel_LableType" name="sel_LableType" class="form-control select2" style="width: 230px" placeholder="请选择标签类型..."></select>
  144. <input type="hidden" id="hidetext" />
  145. </td>
  146. <th class="formTitle">标签数据: </th>
  147. <td class="formValue">
  148. <select id="sel_LableSourceID" name="sel_LableSourceID" class="form-control select2" style="width: 230px" placeholder="请选择标签数据..."></select>
  149. <input type="hidden" id="hidetext" />
  150. </td>
  151. </tr>
  152. </table>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </form>