mesQualityCheck.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>抽检</title>
  8. <link rel="stylesheet" href="${ctxStatic}/bootstrap/css/bootstrap.min.css">
  9. <style>
  10. .fxbox{
  11. position: fixed;
  12. z-index: 10;
  13. top: 0;
  14. left: 0;
  15. bottom: 0;
  16. right: 0;
  17. background-color: rgba(240,240,240,1);
  18. }
  19. .fxbox-sn{
  20. position: fixed;
  21. width: 530px;
  22. height: 70px;
  23. top: 40px;
  24. left: 150px;
  25. z-index: 100;
  26. font-size: 26px;
  27. text-align: center;
  28. }
  29. .fxbox-btn-scan{
  30. position: fixed;
  31. width: 150px;
  32. height: 70px;
  33. z-index: 100;
  34. top: 40px;
  35. left: 690px;
  36. font-size: 40px;
  37. }
  38. .fxbox-btn-ok{
  39. position: fixed;
  40. width: 240px;
  41. height: 70px;
  42. z-index: 100;
  43. bottom: 40px;
  44. left: 370px;
  45. font-size: 40px;
  46. }
  47. .fxbox-btn-ng{
  48. position: fixed;
  49. width: 240px;
  50. height: 70px;
  51. z-index: 100;
  52. bottom: 40px;
  53. left: 560px;
  54. font-size: 40px;
  55. }
  56. .fxbox-items{
  57. display: none;
  58. position: fixed;
  59. z-index: 20;
  60. top: 290px;
  61. left: 100px;
  62. width: 800px;
  63. bottom: 135px;
  64. /*background-color: red;*/
  65. overflow: auto;
  66. }
  67. .fxbox-items .panel-heading{
  68. font-size: 22px;
  69. }
  70. .fxbox-items .panel-body{
  71. font-size: 18px;
  72. }
  73. .fxbox-result{
  74. position: fixed;
  75. z-index: 21;
  76. top: 120px;
  77. left: 100px;
  78. width: 800px;
  79. height: 60px;
  80. line-height: 60px;
  81. font-size: 30px;
  82. text-align: center;
  83. }
  84. .fxbox-select{
  85. position: fixed;
  86. z-index: 21;
  87. top: 180px;
  88. left: 100px;
  89. width: 800px;
  90. height: 50px;
  91. line-height: 50px;
  92. font-size: 30px;
  93. text-align: left;
  94. padding-left: 135px;
  95. }
  96. .layui-layer-prompt .layui-layer-input:focus{
  97. outline: none!important;
  98. }
  99. .list-group-item{
  100. font-size: 20px;
  101. }
  102. .list-group-item .glyphicon{
  103. display: none;
  104. }
  105. .list-group-item.active .glyphicon{
  106. display: block;
  107. }
  108. .list-group {
  109. padding-left: 0;
  110. margin-bottom: 0;
  111. }
  112. </style>
  113. </head>
  114. <body>
  115. <div class="fxbox">
  116. <input type="text" class="form-control fxbox-sn" readonly name="sn" id="sn" placeholder="请扫工件码" />
  117. <button type="button" class="btn btn-default fxbox-btn-scan" onclick="scanBarcode()">扫码</button>
  118. <div class="fxbox-result" style="display: none">
  119. 当前工位结果 <label id="product_result"></label>
  120. </div>
  121. <div class="fxbox-select">
  122. <div>
  123. 检查类型:
  124. <% for(var dict in types){ %>
  125. <label><input type="radio" name="type" value="${dict.dictValue}" onclick="selectType('${dict.dictValue}')">${dict.dictLabel}</label>&nbsp;&nbsp;&nbsp;
  126. <% } %>
  127. </div>
  128. <div>
  129. 检查结果:
  130. <label><input type="radio" name="result" value="OK" onclick="selectResult(1)">OK</label>&nbsp;&nbsp;&nbsp;
  131. <label><input type="radio" name="result" value="NG" onclick="selectResult(2)">NG</label>
  132. </div>
  133. </div>
  134. <div class="fxbox-items">
  135. <div class="list-group">
  136. <% for(var dict in items){ %>
  137. <a href="javascript:;" class="list-group-item" data-id="${dict.id}" data-select="0" onclick="selectItems(this)">
  138. ${dict.title}
  139. <i class="glyphicon glyphicon-ok pull-right"></i>
  140. </a>
  141. <% } %>
  142. </div>
  143. </div>
  144. <button type="button" class="btn btn-success fxbox-btn-ok" disabled id="btn-ok" onclick="submitData(this)">确 定</button>
  145. <!-- <button type="button" class="btn btn-danger fxbox-btn-ng" disabled id="btn-ng" onclick="bc('3')">NG</button>-->
  146. </div>
  147. <script src="${ctxStatic}/jquery-1.11.3.min.js"></script>
  148. <script src="${ctxStatic}/bootstrap/js/bootstrap.min.js"></script>
  149. <script src="${ctxStatic}/layer/3.5/layer.js?${_version}"></script>
  150. <script>
  151. var flag = 0;
  152. var oprno = "${oprno}";
  153. var lineSn = "${lineSn}";
  154. var type = "";
  155. var result = "";
  156. var items = [];
  157. var __sid = "${__sid}";
  158. function selectItems(_self) {
  159. let id = $(_self).attr("data-id");
  160. let sel = $(_self).attr("data-select");
  161. if(sel == 0){
  162. $(_self).addClass("active");
  163. $(_self).attr("data-select",1);
  164. items.push(id);
  165. }else{
  166. $(_self).removeClass("active");
  167. $(_self).attr("data-select",0);
  168. items = items.filter((item) => {
  169. return item != id;
  170. })
  171. }
  172. }
  173. function selectType(typeval) {
  174. type = typeval;
  175. }
  176. function selectResult(val) {
  177. if(val == 1){
  178. $(".fxbox-items").hide();
  179. $(".list-group-item").removeClass("active");
  180. result = "OK";
  181. }else{
  182. $(".fxbox-items").show();
  183. result = "NG";
  184. }
  185. }
  186. function scanBarcode(){
  187. // layer.prompt({title: '请扫工件码', formType: 0}, function(text, index){
  188. // layer.close(index);
  189. // // layer.msg('演示完毕!您的口令:'+ pass +'<br>您最后写下了:'+text);
  190. // $("#sn").value(text);
  191. // });
  192. layer.prompt({
  193. title: '请扫工件码',        
  194. formType: 0, //隐藏用户输入内容
  195. // 这个是确定按钮的事件
  196. success:function(){
  197. // 键盘事件,判断回车
  198. $("input.layui-layer-input").on('keydown',function(e){
  199. if (e.which == 13) {
  200. layer.closeAll();
  201. var pass =$(document.getElementsByClassName('layui-layer-input')[0]).val();
  202. barcodeData(pass);
  203. }
  204. });
  205. },
  206. // 点击确定按钮事件
  207. yes : function(){
  208. layer.closeAll();
  209. // 取输入框数据
  210. var pass =$(document.getElementsByClassName('layui-layer-input')[0]).val();
  211. barcodeData(pass);
  212. }
  213. });
  214. }
  215. function barcodeData(text){
  216. $("#product_result").html("");
  217. $(".fxbox-result").hide();
  218. // resetPage();
  219. $("#sn").val(text);
  220. $.post('${ctx}/mes/mesQuality/checkProduct',{sn:text,oprno:oprno,lineSn:lineSn,__sid:__sid,__ajax:"json"},function (res){
  221. if(res.result=='true'){
  222. flag = 1;
  223. $("#product_result").html(res.data);
  224. $(".fxbox-result").show();
  225. $('#btn-ok').attr('disabled',false);
  226. }else{
  227. // $("#info").css('display','none')
  228. layer.alert(res.message);
  229. return ;
  230. }
  231. },'json')
  232. }
  233. function submitData(_self){
  234. let ff = $(_self).attr("data-ff");
  235. if(ff == 1){
  236. return;
  237. }
  238. $(_self).attr("data-ff",1);
  239. if(flag == 0){
  240. layer.alert("请扫工件码");
  241. $(_self).attr("data-ff",0);
  242. return ;
  243. }
  244. let sn = $("#sn").val().trim();
  245. if(!sn){
  246. layer.alert("请扫工件码");
  247. $(_self).attr("data-ff",0);
  248. return ;
  249. }
  250. if(!type){
  251. layer.alert("请选择检查类型");
  252. $(_self).attr("data-ff",0);
  253. return ;
  254. }
  255. if(!result){
  256. layer.alert("请选择检查结果");
  257. $(_self).attr("data-ff",0);
  258. return ;
  259. }
  260. // let items = [];
  261. if(result == "NG"){
  262. // $(".list-group-item").each(() => {
  263. // let sel = $(this)[0].attr("data-select");
  264. // console.log('sel:'+sel,$(this));
  265. // if(Number(sel) == 1){
  266. // items.push($(this).attr("data-id"))
  267. // }
  268. // });
  269. console.log(items);
  270. if(items.length == 0){
  271. layer.alert("请选择错误类型");
  272. $(_self).attr("data-ff",0);
  273. return ;
  274. }
  275. }
  276. $.post('${ctx}/mes/mesQuality/checkSave',{sn:sn,oprno:oprno,lineSn:lineSn,type:type,result:result,items:items.join(","),__sid:__sid,__ajax:"json"},function (res){
  277. $(_self).attr("data-ff",0);
  278. if(res.result=='true'){
  279. layer.alert(res.message);
  280. resetPage();
  281. }else{
  282. // $("#info").css('display','none')
  283. layer.alert(res.message);
  284. return ;
  285. }
  286. },'json')
  287. }
  288. function resetPage() {
  289. // $("#sn").val('');
  290. // // $("#accordion").html('');
  291. // flag = 0;
  292. // $('#btn-ok').attr('disabled',true);
  293. // // $('#btn-ng').attr('disabled',true);
  294. //
  295. // $("#product_result").html("");
  296. // $(".fxbox-result").show();
  297. setTimeout(function () {
  298. window.location.reload();
  299. },1500);
  300. }
  301. </script>
  302. </body>
  303. </html>