Commit f98316e2 by 胡懿

Merge branches 'hy' and 'master' of 47.92.228.5:huyi/warehouse into hy

parents a40ff95f b6ae5746
...@@ -354,7 +354,7 @@ function delRow(obj, prefix){ ...@@ -354,7 +354,7 @@ function delRow(obj, prefix){
openGridSelectDialog:function(params, yesFuc){ openGridSelectDialog:function(params, yesFuc){
top.layer.open({ top.layer.open({
type: 2, type: 2,
area: ['800px', '500px'], area: ['1200px', '600px'],
title: params.title, title: params.title,
auto:true, auto:true,
name:'friend', name:'friend',
...@@ -367,7 +367,8 @@ function delRow(obj, prefix){ ...@@ -367,7 +367,8 @@ function delRow(obj, prefix){
jp.warning("必须选择一条数据!"); jp.warning("必须选择一条数据!");
return; return;
} }
yesFuc(items); var result = yesFuc(items);
if (result === false) return;
top.layer.close(index);//关闭对话框。 top.layer.close(index);//关闭对话框。
}, },
cancel: function(index){ cancel: function(index){
......
...@@ -180,7 +180,9 @@ $(function(){ ...@@ -180,7 +180,9 @@ $(function(){
return this.optional(element) || /^[A-Za-z0-9_-]+$/.test(value); return this.optional(element) || /^[A-Za-z0-9_-]+$/.test(value);
}, "判断是否为合法字符(a-zA-Z0-9-_)"); }, "判断是否为合法字符(a-zA-Z0-9-_)");
jQuery.validator.addMethod('positiveInteger', function (value, element) {
return this.optional(element) || /^[1-9]\d*$/.test(value);
})
//身份证号码的验证规则 //身份证号码的验证规则
function isIdCardNo(num){ function isIdCardNo(num){
......
<style>
#scanIpt_ {
position: absolute;
top: -10000px;
left: 0;
opacity: 0;
}
</style>
<input id="scanIpt_" type="text" />
<script>
// function Scan () {
// this.scanIptFocusTimer$ = null;
// this.inputMethodCnType$ = false;
//
// $(document).ready(function () {
// var ipt = getScanIpt();
// document.addEventListener('visibilitychange', pageVisible);
// ipt.addEventListener('change', scanDataChange);
// ipt.addEventListener('compositionstart', iptCompositionstart);
// ipt.addEventListener('compositionend', iptCompositionend);
// scanIptGetFocusStart();
// })
// }
var scanIptFocusTimer$ = null;
var inputMethodCnType$ = false;
var focusStop = true;
$(document).ready(function () {
$(document.body).on('focusin', function (e) {
var dom = e.target;
if (dom.id === 'scanIpt_') return;
scanIptGetFocusStop();
})
$(document.body).on('focusout', function (e) {
var dom = e.target;
if (dom.id === 'scanIpt_') return;
scanIptGetFocusStart();
})
})
function scanStart () {
var ipt = getScanIpt();
focusStop = false;
ipt.focus();
document.addEventListener('visibilitychange', pageVisible);
ipt.addEventListener('change', scanDataChange);
ipt.addEventListener('compositionstart', iptCompositionstart);
ipt.addEventListener('compositionend', iptCompositionend);
scanIptGetFocusStart();
// var allFormDom = $("input, select, textarea");
// allFormDom.on('focus', function () {
// if (this.id === 'scanIpt_') return;
// scanIptGetFocusStop();
// })
// allFormDom.on('blur', function () {
// if (this.id === 'scanIpt_') return;
// scanIptGetFocusStart();
// })
}
function scanStop () {
focusStop = true;
var ipt = getScanIpt();
ipt.removeEventListener('change', scanDataChange);
ipt.removeEventListener('compositionstart', iptCompositionstart);
scanIptGetFocusStop();
document.removeEventListener('visibilitychange', pageVisible);
}
window.onbeforeunload = function (e) {
scanStop();
}
// $(document).ready(function () {
// var ipt = getScanIpt();
// document.addEventListener('visibilitychange', pageVisible);
// ipt.addEventListener('change', scanDataChange);
// ipt.addEventListener('compositionstart', iptCompositionstart);
// ipt.addEventListener('compositionend', iptCompositionend);
// })
function getScanIpt () {
return document.getElementById("scanIpt_");
}
function pageVisible () {
var state = document.visibilityState;
if (state === 'visible') {
scanIptGetFocusStart();
} else if (state === 'hidden') {
scanIptGetFocusStop();
}
}
function scanIptGetFocusStart () {
if (focusStop) return;
var ipt = getScanIpt();
if (ipt) {
scanIptFocusTimer$ = iptFocus(ipt);
}
}
function scanIptGetFocusStop () {
if (scanIptFocusTimer$) {
clearInterval(scanIptFocusTimer$);
scanIptFocusTimer$ = null;
}
}
function iptFocus () {
var ipt = getScanIpt();
var timer = setInterval(function () {
if (ipt !== document.activeElement && scanIptFocusTimer$) {
ipt.focus();
}
}, 300);
return timer;
}
function iptCompositionstart () {
inputMethodCnType = true;
}
function iptCompositionend () {
var ipt = getScanIpt();
if (inputMethodCnType$) {
jp.alert('请将输入法设置为英文');
inputMethodCnType$ = false;
ipt.value = '';
}
}
function scanDataChange () {
var elem = getScanIpt();
var val = $(elem).val();
if (!val) {
return;
}
try {
window.scanIptChangeCallback && window.scanIptChangeCallback(val);
} catch (e) {}
setTimeout(function () {
$(elem).val('');
$(elem).blur();
}, 100)
}
</script>
...@@ -66,7 +66,16 @@ $(document).ready(function() { ...@@ -66,7 +66,16 @@ $(document).ready(function() {
,{ ,{
field: '${fieldKeys[status.index]}', field: '${fieldKeys[status.index]}',
title: '${fieldLabels[status.index]}', title: '${fieldLabels[status.index]}',
sortable: true sortable: true,
formatter (val, row, index) {
var result = val;
var key = '${fieldKeys[status.index]}';
if (top.gridSelectColumnFormatterMap && top.gridSelectColumnFormatterMap[key] && top.gridSelectColumnFormatterMap[key].formatter) {
result = top.gridSelectColumnFormatterMap[key].formatter(val, row, index);
}
return result;
},
events: (top.gridSelectColumnFormatterMap && top.gridSelectColumnFormatterMap['${fieldKeys[status.index]}']) ? top.gridSelectColumnFormatterMap['${fieldKeys[status.index]}'].events : {}
} }
</c:forEach> </c:forEach>
......
...@@ -107,14 +107,14 @@ ...@@ -107,14 +107,14 @@
sortName: 'type.name' sortName: 'type.name'
}, },
// {
// field: 'model',
// title: '型号',
// sortable: true,
// sortName: 'model'
//
// }
{ {
field: 'model',
title: '型号',
sortable: true,
sortName: 'model'
}
,{
field: 'sum', field: 'sum',
title: '总价', title: '总价',
sortable: true, sortable: true,
...@@ -303,9 +303,9 @@ function getScanIpt () { ...@@ -303,9 +303,9 @@ function getScanIpt () {
return document.getElementById("scanIpt"); return document.getElementById("scanIpt");
} }
// 判断是否是中文输入法 // 判断是否是中文输入法
var inputMethodCnType = false; // var inputMethodCnType = false;
// input持续获取焦点 // // input持续获取焦点
var scanIptFocusTimer = null; // var scanIptFocusTimer = null;
function viewScanData () { function viewScanData () {
layer.open({ layer.open({
...@@ -315,35 +315,31 @@ function viewScanData () { ...@@ -315,35 +315,31 @@ function viewScanData () {
area: ['1200','600'], area: ['1200','600'],
content: $("#scanTpl").html(), content: $("#scanTpl").html(),
success: function () { success: function () {
var ipt = getScanIpt(); // var ipt = getScanIpt();
ipt.addEventListener('change', scanDataChange); // ipt.addEventListener('change', scanDataChange);
// ipt.addEventListener('blur', allFocus); // // ipt.addEventListener('blur', allFocus);
ipt.addEventListener('compositionstart', iptCompositionstart); // ipt.addEventListener('compositionstart', iptCompositionstart);
ipt.addEventListener('compositionend', iptCompositionend); // ipt.addEventListener('compositionend', iptCompositionend);
scanIptGetFocusStart(); // scanIptGetFocusStart();
$("#scanIpt").focus(); // $("#scanIpt").focus();
scanStart();
renderScanTable(); renderScanTable();
document.addEventListener('visibilitychange', pageVisible); // document.addEventListener('visibilitychange', pageVisible);
}, },
cancel: function () { cancel: function () {
var ipt = getScanIpt(); // var ipt = getScanIpt();
ipt.removeEventListener('change', scanDataChange); // ipt.removeEventListener('change', scanDataChange);
// ipt.removeEventListener('blur', allFocus); // // ipt.removeEventListener('blur', allFocus);
ipt.removeEventListener('compositionstart', iptCompositionstart); // ipt.removeEventListener('compositionstart', iptCompositionstart);
scanIptGetFocusStop(); // scanIptGetFocusStop();
document.removeEventListener('visibilitychange', pageVisible); // document.removeEventListener('visibilitychange', pageVisible);
scanStop();
}, },
btn:['关闭'] btn:['关闭']
}) })
} }
function scanDataChange () { function scanIptChangeCallback (val) {
var elem = getScanIpt();
var val = $(elem).val();
if (!val) {
return;
}
try {
var json = JSON.parse(val); var json = JSON.parse(val);
var params = "qrId=" + json.code; var params = "qrId=" + json.code;
getScanData( getScanData(
...@@ -364,25 +360,54 @@ function scanDataChange () { ...@@ -364,25 +360,54 @@ function scanDataChange () {
table.bootstrapTable('append', list); table.bootstrapTable('append', list);
} }
); );
} catch (e) {}
setTimeout(function () {
$(elem).val('');
$(elem).blur();
}, 100)
}
function iptCompositionstart () {
inputMethodCnType = true;
} }
function iptCompositionend () { // function scanDataChange () {
var ipt = getScanIpt(); // var elem = getScanIpt();
if (inputMethodCnType) { // var val = $(elem).val();
jp.alert('请将输入法设置为英文'); // if (!val) {
inputMethodCnType = false; // return;
ipt.value = ''; // }
} // try {
} // var json = JSON.parse(val);
// var params = "qrId=" + json.code;
// getScanData(
// { qrId: json.code },
// function (list) {
// var table = getTable();
// var tableData = table.bootstrapTable('getData');
// list = list.filter(function (item) {
// var i = tableData.find(function (e) {
// return e.id === item.id;
// })
// return !i;
// });
// if (!list.length) {
// jp.alert('请勿重复扫码');
// return;
// }
// table.bootstrapTable('append', list);
// }
// );
// } catch (e) {}
// setTimeout(function () {
// $(elem).val('');
// $(elem).blur();
// }, 100)
// }
// function iptCompositionstart () {
// inputMethodCnType = true;
// }
//
// function iptCompositionend () {
// var ipt = getScanIpt();
// if (inputMethodCnType) {
// jp.alert('请将输入法设置为英文');
// inputMethodCnType = false;
// ipt.value = '';
// }
// }
function iptFocus (ipt) { function iptFocus (ipt) {
var timer = setInterval(function () { var timer = setInterval(function () {
...@@ -393,21 +418,21 @@ function iptFocus (ipt) { ...@@ -393,21 +418,21 @@ function iptFocus (ipt) {
return timer; return timer;
} }
function debounce (callback, timeout = 500) { // function debounce (callback, timeout = 500) {
let timer = null; // let timer = null;
return function (...arg) { // return function (...arg) {
const content = this; // const content = this;
if (timer) { // if (timer) {
clearTimeout(timer); // clearTimeout(timer);
} else { // } else {
callback.apply(content, arg); // callback.apply(content, arg);
} // }
timer = setTimeout(function () { // timer = setTimeout(function () {
clearTimeout(timer); // clearTimeout(timer);
timer = null; // timer = null;
}, timeout) // }, timeout)
} // }
} // }
function renderScanTable () { function renderScanTable () {
getTable().bootstrapTable('destroy').bootstrapTable({ getTable().bootstrapTable('destroy').bootstrapTable({
...@@ -499,27 +524,27 @@ function getScanData (params, callback) { ...@@ -499,27 +524,27 @@ function getScanData (params, callback) {
}) })
} }
function pageVisible () { // function pageVisible () {
var state = document.visibilityState; // var state = document.visibilityState;
if (state === 'visible') { // if (state === 'visible') {
scanIptGetFocusStart(); // scanIptGetFocusStart();
} else if (state === 'hidden') { // } else if (state === 'hidden') {
scanIptGetFocusStop(); // scanIptGetFocusStop();
} // }
} // }
function scanIptGetFocusStart () { // function scanIptGetFocusStart () {
var ipt = getScanIpt(); // var ipt = getScanIpt();
if (ipt) { // if (ipt) {
scanIptFocusTimer = iptFocus(ipt); // scanIptFocusTimer = iptFocus(ipt);
} // }
} // }
function scanIptGetFocusStop () { // function scanIptGetFocusStop () {
if (scanIptFocusTimer) { // if (scanIptFocusTimer) {
clearInterval(scanIptFocusTimer); // clearInterval(scanIptFocusTimer);
scanIptFocusTimer = null; // scanIptFocusTimer = null;
} // }
} // }
</script> </script>
<script type="text/template" id="ledgerChildrenTpl">//<!-- <script type="text/template" id="ledgerChildrenTpl">//<!--
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<%@ include file="/webpage/include/bootstraptable.jsp"%> <%@ include file="/webpage/include/bootstraptable.jsp"%>
<%@include file="/webpage/include/treeview.jsp" %> <%@include file="/webpage/include/treeview.jsp" %>
<%@include file="ledgerList.js" %> <%@include file="ledgerList.js" %>
<%@include file="../../../include/scan.jsp" %>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script> <script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<style> <style>
#scanIpt { #scanIpt {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script> <script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script> <script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script> <script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<%@include file="../../../include/scan.jsp" %>
<style> <style>
.sign-result{ .sign-result{
width: 80px; width: 80px;
...@@ -30,6 +31,10 @@ ...@@ -30,6 +31,10 @@
.sign:focus-visible { .sign:focus-visible {
outline: none; outline: none;
} }
.scan-data-content {
padding: 10px;
}
</style> </style>
</head> </head>
<body> <body>
...@@ -146,5 +151,30 @@ ...@@ -146,5 +151,30 @@
} }
</script> </script>
<script type="text/template" id="scanTpl">
<div class="scan-content">
<%-- <input type="text" id="scanIpt" />--%>
<div id="scan-searchForm-box" class="collapse show">
<div class="accordion-inner">
<form:form id="scan-searchForm" class="form form-horizontal well clearfix">
<div class="col-xs-12 col-sm-6 col-md-4">
<label class="label-item single-overflow pull-left" title="数量:">编号:</label>
<%-- <form:input path="code" htmlEscape="false" class=" form-control"/>--%>
<input type="text" id="scan-code" class="form-control" onfocus="scanIptGetFocusStop()" onblur="scanIptGetFocusStart()" />
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div style="margin-top:26px">
<a id="scan-search" class="btn btn-primary btn-rounded btn-bordered btn-sm" onclick="searchScanData()"><i class="fa fa-search"></i> 查询</a>
<a id="scan-reset" class="btn btn-primary btn-rounded btn-bordered btn-sm" onclick="refreshScanData()"><i class="fa fa-refresh"></i> 重置</a>
</div>
</div>
</form:form>
</div>
</div>
<div class="scan-data-content">
<table id="scan_detail_table"></table>
</div>
</div>
</script>
</body> </body>
</html> </html>
...@@ -204,6 +204,10 @@ ...@@ -204,6 +204,10 @@
return res; return res;
} }
window.onbeforeunload = function () {
delete top.selectStorageData;
}
/** /**
* 手动添加明细 * 手动添加明细
* @param selector * @param selector
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment