| | |
| | | <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi, initial-scale=1.0, user-scalable=no"/> |
| | | <title>中扬物流</title> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <style> |
| | | .mat-msg { |
| | | overflow: auto; |
| | | margin-top: 10px; |
| | | height: 100px; |
| | | background-color: #fff; |
| | | border-radius: 5px; |
| | | box-shadow: 0 0 3px rgba(0,0,0,.3); |
| | | } |
| | | /* 堆垛机状态信息表 */ |
| | | #mat-msg-table { |
| | | font-size: 12px; |
| | | border-collapse: collapse; |
| | | margin: 0 auto; |
| | | text-align: center; |
| | | } |
| | | #mat-msg-table td, #mat-msg-table th { |
| | | border: 1px solid #f1f1f1; |
| | | color: #666; |
| | | height: 15px; |
| | | line-height: 15px; |
| | | } |
| | | #mat-msg-table thead th { |
| | | background-color: #fff; |
| | | width: 400px; |
| | | font-weight: normal; |
| | | } |
| | | #mat-msg-table tr:nth-child(odd) { |
| | | background: #fff; |
| | | } |
| | | #mat-msg-table tr:nth-child(even) { |
| | | background: #fff; |
| | | } |
| | | |
| | | .btn-con { |
| | | padding-left: 10px; |
| | | position: absolute; |
| | | bottom: 10px; |
| | | width: 100%; |
| | | } |
| | | .btn-con button { |
| | | display: inline-block; |
| | | vertical-align: middle; |
| | | } |
| | | #tips { |
| | | font-size: 12px; |
| | | margin-left: 10px; |
| | | display: inline-block; |
| | | vertical-align: middle; |
| | | width: 90px; |
| | | overflow:hidden; |
| | | white-space:nowrap; |
| | | text-overflow:ellipsis; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | Hello World |
| | | <!-- <button onclick="her()">页面跳转</button>--> |
| | | <div> |
| | | <span>条码</span> |
| | | <input type="text" id="code"> |
| | | </div> |
| | | <div> |
| | | <span>物料</span> |
| | | <input type="text" id="matnr" onkeyup="find(this)" autocomplete="off"> |
| | | </div> |
| | | |
| | | <!-- 堆垛机状态 --> |
| | | <div class="mat-msg" id="mat-msg-id"> |
| | | <table id="mat-msg-table"> |
| | | <thead> |
| | | <tr> |
| | | <th>编码</th> |
| | | <th>名称</th> |
| | | <th>单位</th> |
| | | <th>数量</th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | |
| | | <div class="btn-con"> |
| | | <button style="margin-right: 20px" onclick="reset()">重置</button> |
| | | <button >组托</button> |
| | | <span id="tips"></span> |
| | | </div> |
| | | </body> |
| | | <script> |
| | | function her() { |
| | | window.location.href="login.html"; |
| | | // initCrnMsgTable() |
| | | var code = document.getElementById("code") |
| | | var matnr = document.getElementById("matnr") |
| | | var matMsg = document.getElementById("mat-msg-id"); |
| | | var tipDom = document.getElementById("tips"); |
| | | |
| | | // 查询物流 |
| | | function find(el) { |
| | | httpRequest({ |
| | | httpUrl: baseUrl + "/matCode/auth", |
| | | type: 'post', |
| | | data: { |
| | | id: el.value |
| | | }, |
| | | }, function (res) { |
| | | if (res.code === 200) { |
| | | if (res.data != null) { |
| | | matMsg.style.display = 'none'; |
| | | } else { |
| | | matMsg.style.display = 'block'; |
| | | } |
| | | } else { |
| | | alert(res.msg); |
| | | } |
| | | |
| | | }) |
| | | } |
| | | |
| | | // 堆垛机数据表获取 ----- 表二 |
| | | function initCrnMsgTable(row) { |
| | | var line; |
| | | if (row === undefined){ |
| | | var one = $('#crn-msg-table thead').height(); |
| | | var total = $('.crn-msg').height(); |
| | | var count = total / one; |
| | | count = parseInt(count) - 1; |
| | | crnMsgTableBlankRows = count; |
| | | line = count; |
| | | } else { |
| | | line = row; |
| | | } |
| | | var html = ""; |
| | | for (var i = 0; i < line; i ++){ |
| | | html += " <tr>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " <td></td>\n" + |
| | | " </tr>\n"; |
| | | } |
| | | $('#crn-msg-table tbody').after(html); |
| | | } |
| | | |
| | | // 重置 |
| | | function reset() { |
| | | code.value = ""; |
| | | matnr.value = ""; |
| | | } |
| | | |
| | | /** |
| | | * 提示信息 |
| | | * @param msg 提示内容 |
| | | * @param warn true:红色字体 |
| | | */ |
| | | function tips(msg, warn) { |
| | | tipDom.innerText = msg; |
| | | if (warn) { |
| | | tipDom.style.color = "red"; |
| | | } else { |
| | | tipDom.style.color = "#000"; |
| | | } |
| | | } |
| | | |
| | | function httpRequest(paramObj,fun,errFun) { |
| | | var xmlhttp = null; |
| | | /*创建XMLHttpRequest对象, |
| | | *老版本的 Internet Explorer(IE5 和 IE6)使用 ActiveX 对象:new ActiveXObject("Microsoft.XMLHTTP") |
| | | * */ |
| | | if(window.XMLHttpRequest) { |
| | | xmlhttp = new XMLHttpRequest(); |
| | | }else if(window.ActiveXObject) { |
| | | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); |
| | | } |
| | | /*判断是否支持请求*/ |
| | | if(xmlhttp == null) { |
| | | alert('你的浏览器不支持XMLHttp'); |
| | | return; |
| | | } |
| | | /*请求方式,并且转换为大写*/ |
| | | var httpType = (paramObj.type || 'GET').toUpperCase(); |
| | | /*数据类型*/ |
| | | var dataType = paramObj.dataType || 'json'; |
| | | /*请求接口*/ |
| | | var httpUrl = paramObj.httpUrl || ''; |
| | | /*是否异步请求*/ |
| | | var async = paramObj.async || true; |
| | | /*请求参数--post请求参数格式为:foo=bar&lorem=ipsum*/ |
| | | var paramData = paramObj.data || []; |
| | | var requestData = ''; |
| | | for(var name in paramData) { |
| | | requestData += name + '='+ paramData[name] + '&'; |
| | | } |
| | | requestData = requestData === '' ? '' : requestData.substring(0,requestData.length - 1); |
| | | |
| | | /*请求接收*/ |
| | | xmlhttp.onreadystatechange = function() { |
| | | if(xmlhttp.readyState === 4 && xmlhttp.status === 200) { |
| | | /*成功回调函数*/ |
| | | fun(JSON.parse(xmlhttp.responseText)); |
| | | }else{ |
| | | /*失败回调函数*/ |
| | | errFun; |
| | | } |
| | | } |
| | | |
| | | /*接口连接,先判断连接类型是post还是get*/ |
| | | if(httpType === 'GET') { |
| | | xmlhttp.open("GET",httpUrl,async); |
| | | xmlhttp.send(null); |
| | | }else if(httpType === 'POST'){ |
| | | xmlhttp.open("POST",httpUrl,async); |
| | | //发送合适的请求头信息 |
| | | xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
| | | xmlhttp.send(requestData); |
| | | } |
| | | } |
| | | </script> |
| | | </html> |