addRenovationMachine.ftl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <#include "/base/add_base.ftl">
  10. <title>添加翻新机</title>
  11. <style>
  12. .my-title{font-weight: 500;padding-left: 15px;position: relative;}
  13. .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
  14. .my-input{padding: 8px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
  15. .my-input-date{padding: 8px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(http://s.iamberry.com/images/rili-1.png) 98.5% center no-repeat; background-size:auto 50%;}
  16. .input-box{margin: 18px 0;}
  17. .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
  18. .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
  19. .add-list>li{margin: 10px 0;}
  20. .my-textarea{padding: 5px 10px;width: 80%;border:1px solid rgba(0,0,0,.1);}
  21. .my-btn-reset{padding: 10px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
  22. .my-btn-submit{padding: 10px 20px;width: 150px; background-color: #32a3d8;color: #fff;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
  23. .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;width: 80%; height: 34px; -webkit-appearance:none;appearance:none;background: url(http://s.iamberry.com/images/select-1.png) right center no-repeat #fff;background-size:auto 100%;}
  24. input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
  25. input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
  26. .spanhidth{width: 70px;text-align: right;}
  27. </style>
  28. </head>
  29. <body>
  30. <div class="pd-20">
  31. <form class="form form-horizontal" id="form-admin-add">
  32. <div class="input-box">
  33. <span class="input-dic spanhidth">产品:</span>
  34. <input type="hidden" id="batchId" name="batchId" value="">
  35. <select class="my-select" name="produceId" id="produceId">
  36. <#if (produceList ?size > 0)>
  37. <#list produceList as list>
  38. <option value ="${list.produceId!''}"
  39. <#if list.ptsBatch?? >
  40. isBacth="1"
  41. bacth = "${list.ptsBatch.batchNo!''}"
  42. batchId = "${list.ptsBatch.batchId!''}"
  43. softwareVersionNo="${list.ptsBatch.softwareVersionNo!''}"
  44. bomName="${list.ptsBatch.bomName!''}"
  45. <#else >
  46. isBacth="2"
  47. </#if>
  48. >${list.produceName!''}</option>
  49. </#list>
  50. <#else >
  51. <option value ="">暂无产品,请先添加产品</option>
  52. </#if>
  53. </select>
  54. </div>
  55. <div class="input-box">
  56. <span class="input-dic spanhidth">批次:</span>
  57. <span class="input-dic spanhidth" id="ptsBatch" style="width: 76%;text-align: left;padding-left: 10px;height: 30px;"></span>
  58. <span style="margin-left:15.5%;color:#ccc" >请对照生产计划部给到的纸制生产计划信息。</span>
  59. </div>
  60. <div class="input-box">
  61. <span class="input-dic spanhidth">软件版本:</span>
  62. <span class="input-dic spanhidth" id="softwareVersionNo" style="width: 76%;text-align: left;padding-left: 10px;height: 30px;"></span>
  63. </div>
  64. <div class="input-box">
  65. <span class="input-dic spanhidth">Bom单:</span>
  66. <span class="input-dic spanhidth" id="bomName" style="width: 76%;text-align: left;padding-left: 10px;height: 30px;"></span>
  67. </div>
  68. <div class="input-box">
  69. <span class="input-dic" style="margin-top: 0">是否翻新机:</span>
  70. <label for="radio-10">
  71. <input type="radio" id="radio-10" name="isRefurbishment" value="1" />是
  72. </label>
  73. <label for="radio-11" style="margin-left: 50px;">
  74. <input type="radio" id="radio-11" name="isRefurbishment" value="2" checked />否
  75. </label>
  76. </div>
  77. <#--<div class="input-box">-->
  78. <#--<span class="input-dic" style="margin-top: 0">产品类型:</span>-->
  79. <#--<label for="radio-10">-->
  80. <#--<input type="radio" id="radio-10" name="productType" value="1" checked/>净水机-->
  81. <#--</label>-->
  82. <#--<label for="radio-11" style="margin-left: 50px;">-->
  83. <#--<input type="radio" id="radio-11" name="productType" value="2"/>冲奶机-->
  84. <#--</label>-->
  85. <#--<label for="radio-12" style="margin-left: 50px;">-->
  86. <#--<input type="radio" id="radio-12" name="productType" value="3"/>电动牙刷-->
  87. <#--</label>-->
  88. <#--</div>-->
  89. <div class="input-box"><span class="input-dic spanhidth">拉线:</span><input class="my-input" type="text" style="width: 76%;" name="machineLine" id="machineLine" value="A1"/> </div>
  90. <div class="input-box"><span class="input-dic spanhidth">机器数量:</span><input class="my-input" type="text" style="width: 76%;" name="number" id="number" value="4" placeholder="每次最少生成一个机器"/> </div>
  91. <#--<div class="input-box">如果遇到批次,软件版本,BOM不清晰时,请联系POA(刘经理)</div>-->
  92. <div class="input-box">
  93. <span class="input-dic spanhidth"></span>
  94. <input id="sumbit" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" onclick="admin_add()">
  95. </div>
  96. </form>
  97. </div>
  98. <#--<script type="text/javascript" src="${path}/common/admin/js/tips.js"></script>-->
  99. <script type="text/javascript">
  100. $(function(){
  101. setHtml();
  102. })
  103. /*监听产品修改*/
  104. $("#produceId").change(function(){
  105. setHtml();
  106. });
  107. function setHtml(){
  108. var flag = false;
  109. var isBacth = $("#produceId").find("option:selected").attr("isBacth");
  110. if(isBacth == 1){
  111. var ptsBatch = $("#produceId").find("option:selected").attr("bacth");
  112. var softwareVersionNo = $("#produceId").find("option:selected").attr("softwareVersionNo");
  113. var bomName = $("#produceId").find("option:selected").attr("bomName");
  114. var batchId = $("#produceId").find("option:selected").attr("batchId");
  115. $("#ptsBatch").html(ptsBatch);
  116. $("#ptsBatch").css("color","#000");
  117. $("#softwareVersionNo").html(softwareVersionNo);
  118. $("#bomName").html(bomName);
  119. $("#batchId").val(batchId);
  120. }else{
  121. $("#ptsBatch").css("color","#d00");
  122. $("#ptsBatch").html("请添加对应产品的正在使用状态的批次!");
  123. $("#softwareVersionNo").html("");
  124. $("#bomName").html("");
  125. $("#batchId").val("");
  126. }
  127. }
  128. /*获取bom信息,赋值在页面上*/
  129. /* function getBom(batchId){
  130. var bom = new Object();
  131. $.ajax({
  132. type: "POST",
  133. data: {
  134. batchId : batchId
  135. },
  136. url: "${path}/admin/machine/select_bom",
  137. async: false,
  138. success: function(data){
  139. if (data.returnCode == 200) {
  140. bom = data.returnMsg.listBom;
  141. }
  142. },
  143. error: function(XmlHttpRequest, textStatus, errorThrown){
  144. }
  145. });
  146. if(bom != null){
  147. $("#bomId").empty();
  148. $.each(bom,function(n,value) {
  149. var appoption = "<option value='"+value.bomId+"'>"+value.bomName+"</option>";
  150. $("#bomId").append(appoption);
  151. });
  152. }
  153. }*/
  154. /*获取批次信息,赋值在页面上*/
  155. /* function getProduce(produceId){
  156. var listptsBatch = new Object();
  157. $.ajax({
  158. type: "POST",
  159. data: {
  160. productId : produceId
  161. },
  162. url: "${path}/admin/machine/select_Batch",
  163. async: false,
  164. success: function(data){
  165. if (data.returnCode == 200) {
  166. listptsBatch = data.returnMsg.listptsBatch;
  167. }
  168. },
  169. error: function(XmlHttpRequest, textStatus, errorThrown){
  170. }
  171. });
  172. if(listptsBatch != null){
  173. $("#bomId").empty();
  174. $("#batchId").empty();
  175. $.each(listptsBatch,function(n,value) {
  176. if(n == 0){
  177. getBom(value.batchId);
  178. }
  179. var appoption = "<option value='"+value.batchId+"'>"+value.batchNo+"</option>";
  180. $("#batchId").append(appoption);
  181. });
  182. }
  183. }*/
  184. function dataCharm() {
  185. var batchId = $("#batchId").val();
  186. if(batchId == null || batchId == "" || typeof(batchId)=="undefined"){
  187. layer.msg("该产品没有可用的批次,请联系生产部门添加批次信息!",{icon: 5,time:5000});
  188. return false;
  189. }
  190. var machineLine = $("#machineLine").val();
  191. if(machineLine == null || machineLine == "" || typeof(machineLine)=="undefined"){
  192. layer.msg("拉线不能为空",{icon: 5,time:3000});
  193. return false;
  194. }
  195. var number = $("#number").val();
  196. if(number == null || number == "" || typeof(number)=="undefined"){
  197. layer.msg("数量不能为空",{icon: 5,time:3000});
  198. return false;
  199. }
  200. if(number == 0){
  201. layer.msg("数量不能小于1",{icon: 5,time:3000});
  202. return false;
  203. }
  204. if(1 > number.length > 5){
  205. layer.msg("数量长度为2-10位",{icon: 5,time:3000});
  206. return false;
  207. }
  208. if( number > 500){
  209. layer.msg("每次最高生产数量为500",{icon: 5,time:3000});
  210. return false;
  211. }
  212. return true;
  213. }
  214. /*机器-添加*/
  215. function admin_add(){
  216. var msg = dataCharm();
  217. if(msg){
  218. $("#submit").attr("disabled","disabled");
  219. layer.msg('加载中', {icon: 16,time:500000});
  220. $.ajax({
  221. url: '${path}/admin/machine/add_renovationMachine',
  222. type: "POST",
  223. dataType: "json",
  224. data: $("#form-admin-add").serialize(),
  225. success: function(data){
  226. layer.msg('加载中', {icon: 16});
  227. $("#submit").removeAttr("disabled");
  228. if(data.returnCode){
  229. layer.msg("添加成功",{icon: 1,time:3000});
  230. window.parent.location.reload();
  231. var index = parent.layer.getFrameIndex(window.name);
  232. parent.layer.close(index);
  233. }else{
  234. layer.msg("添加失败",{icon: 5,time:3000});
  235. }
  236. },
  237. error:function(data){
  238. layer.msg("添加失败",{icon: 5,time:3000});
  239. }
  240. });
  241. }
  242. }
  243. </script>
  244. </body>
  245. </html>