mesQualityCheck.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 type = "";
  154. var result = "";
  155. var items = [];
  156. var __sid = "${__sid}";
  157. function selectItems(_self) {
  158. let id = $(_self).attr("data-id");
  159. let sel = $(_self).attr("data-select");
  160. if(sel == 0){
  161. $(_self).addClass("active");
  162. $(_self).attr("data-select",1);
  163. items.push(id);
  164. }else{
  165. $(_self).removeClass("active");
  166. $(_self).attr("data-select",0);
  167. items = items.filter((item) => {
  168. return item != id;
  169. })
  170. }
  171. }
  172. function selectType(typeval) {
  173. type = typeval;
  174. }
  175. function selectResult(val) {
  176. if(val == 1){
  177. $(".fxbox-items").hide();
  178. $(".list-group-item").removeClass("active");
  179. result = "OK";
  180. }else{
  181. $(".fxbox-items").show();
  182. result = "NG";
  183. }
  184. }
  185. function scanBarcode(){
  186. // layer.prompt({title: '请扫工件码', formType: 0}, function(text, index){
  187. // layer.close(index);
  188. // // layer.msg('演示完毕!您的口令:'+ pass +'<br>您最后写下了:'+text);
  189. // $("#sn").value(text);
  190. // });
  191. layer.prompt({
  192. title: '请扫工件码',        
  193. formType: 0, //隐藏用户输入内容
  194. // 这个是确定按钮的事件
  195. success:function(){
  196. // 键盘事件,判断回车
  197. $("input.layui-layer-input").on('keydown',function(e){
  198. if (e.which == 13) {
  199. layer.closeAll();
  200. var pass =$(document.getElementsByClassName('layui-layer-input')[0]).val();
  201. barcodeData(pass);
  202. }
  203. });
  204. },
  205. // 点击确定按钮事件
  206. yes : function(){
  207. layer.closeAll();
  208. // 取输入框数据
  209. var pass =$(document.getElementsByClassName('layui-layer-input')[0]).val();
  210. barcodeData(pass);
  211. }
  212. });
  213. }
  214. function barcodeData(text){
  215. $("#product_result").html("");
  216. $(".fxbox-result").hide();
  217. // resetPage();
  218. $("#sn").val(text);
  219. $.post('${ctx}/mes/mesQuality/checkProduct',{sn:text,oprno:oprno,__sid:__sid,__ajax:"json"},function (res){
  220. if(res.result=='true'){
  221. flag = 1;
  222. $("#product_result").html(res.data);
  223. $(".fxbox-result").show();
  224. $('#btn-ok').attr('disabled',false);
  225. }else{
  226. // $("#info").css('display','none')
  227. layer.alert(res.message);
  228. return ;
  229. }
  230. },'json')
  231. }
  232. function submitData(_self){
  233. let ff = $(_self).attr("data-ff");
  234. if(ff == 1){
  235. return;
  236. }
  237. $(_self).attr("data-ff",1);
  238. if(flag == 0){
  239. layer.alert("请扫工件码");
  240. $(_self).attr("data-ff",0);
  241. return ;
  242. }
  243. let sn = $("#sn").val().trim();
  244. if(!sn){
  245. layer.alert("请扫工件码");
  246. $(_self).attr("data-ff",0);
  247. return ;
  248. }
  249. if(!type){
  250. layer.alert("请选择检查类型");
  251. $(_self).attr("data-ff",0);
  252. return ;
  253. }
  254. if(!result){
  255. layer.alert("请选择检查结果");
  256. $(_self).attr("data-ff",0);
  257. return ;
  258. }
  259. // let items = [];
  260. if(result == "NG"){
  261. // $(".list-group-item").each(() => {
  262. // let sel = $(this)[0].attr("data-select");
  263. // console.log('sel:'+sel,$(this));
  264. // if(Number(sel) == 1){
  265. // items.push($(this).attr("data-id"))
  266. // }
  267. // });
  268. console.log(items);
  269. if(items.length == 0){
  270. layer.alert("请选择错误类型");
  271. $(_self).attr("data-ff",0);
  272. return ;
  273. }
  274. }
  275. $.post('${ctx}/mes/mesQuality/checkSave',{sn:sn,oprno:oprno,type:type,result:result,items:items.join(","),__sid:__sid,__ajax:"json"},function (res){
  276. $(_self).attr("data-ff",0);
  277. if(res.result=='true'){
  278. layer.alert(res.message);
  279. resetPage();
  280. }else{
  281. // $("#info").css('display','none')
  282. layer.alert(res.message);
  283. return ;
  284. }
  285. },'json')
  286. }
  287. function resetPage() {
  288. // $("#sn").val('');
  289. // // $("#accordion").html('');
  290. // flag = 0;
  291. // $('#btn-ok').attr('disabled',true);
  292. // // $('#btn-ng').attr('disabled',true);
  293. //
  294. // $("#product_result").html("");
  295. // $(".fxbox-result").show();
  296. setTimeout(function () {
  297. window.location.reload();
  298. },1500);
  299. }
  300. </script>
  301. </body>
  302. </html>