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){
openGridSelectDialog:function(params, yesFuc){
top.layer.open({
type: 2,
area: ['800px', '500px'],
area: ['1200px', '600px'],
title: params.title,
auto:true,
name:'friend',
......@@ -367,7 +367,8 @@ function delRow(obj, prefix){
jp.warning("必须选择一条数据!");
return;
}
yesFuc(items);
var result = yesFuc(items);
if (result === false) return;
top.layer.close(index);//关闭对话框。
},
cancel: function(index){
......
......@@ -180,7 +180,9 @@ $(function(){
return this.optional(element) || /^[A-Za-z0-9_-]+$/.test(value);
}, "判断是否为合法字符(a-zA-Z0-9-_)");
jQuery.validator.addMethod('positiveInteger', function (value, element) {
return this.optional(element) || /^[1-9]\d*$/.test(value);
})
//身份证号码的验证规则
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() {
,{
field: '${fieldKeys[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>
......
......@@ -74,92 +74,8 @@
{
title: '操作',
align: 'center',
formatter: function (){
return '<a class="view-detail">查看明细</a>'
},
events: {
'click .view-detail': function (e,value,row){
layer.open({
title: '查看明细',
type: 1,
auto: true,
area: ['1000', '600'],
content: $("#detailTpl").html(),
success: function (){
$("#table").bootstrapTable({
method: 'get',
url: '${ctx}/warehouse/ledger/ledger/infoDate?batchNum='+ row.batchNum+'&ledger.id=${ledger.id}',
//是否显示分页(*)
pagination: true,
//排序方式
sortOrder: "asc",
//初始化加载第一页,默认第一页
pageNumber:1,
//每页的记录行数(*)
pageSize: 10,
//可供选择的每页的行数(*)
pageList: [10, 25, 50, 100],
sidePagination: "server",
queryParams : function(params) {
var searchParam = $("#searchForm").serializeJSON();
searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
searchParam.pageSize = params.limit === undefined? -1 : params.limit;
searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
return searchParam;
},
columns: [
{checkbox:true},
{field: 'code', title: '物资编码'},
{
field: 'type.name',
title: '品名',
},
{
field: 'type.code',
title: '代码',
},
{
field: 'batchNum',
title: '批次号',
},
{
field: 'amount',
title: '单价'
},
{
field: "type.unit",
title: '单位'
},
{
field: 'amount',
title: '单价'
},
{
field: "type.unit",
title: '单位'
},
{field: 'model', title: '型号'},
{field: 'shelves.name', title: '货架'},
// {field: 'amount', title: '单价'},
{
field: 'num',
title: '数量'
},
{
field: 'sum',
title: '总价',
sortName: 'sum',
formatter (v, row) {
return new Big(row.num).times(row.amount).toNumber()
}
},
{
field: 'qr.url',
title: '二维码',
sortable: true,
sortName: 'qr.url',
formatter: function (){
return '<a class="view-qrcode">查看</a>&nbsp;&nbsp;<a class="print">打印</a>';
formatter () {
return '<a class="view-qrcode">查看</a>&nbsp;&nbsp;<a class="print">打印</a>'
},
events: {
'click .view-qrcode': function (e,value,row){
......@@ -169,20 +85,119 @@
onPrint(row);
}
}
}
]
});
},
<%--{--%>
<%-- title: '操作',--%>
<%-- align: 'center',--%>
<%-- formatter: function (){--%>
<%-- return '<a class="view-detail">查看明细</a>'--%>
<%-- },--%>
<%-- events: {--%>
<%-- 'click .view-detail': function (e,value,row){--%>
<%-- layer.open({--%>
<%-- title: '查看明细',--%>
<%-- type: 1,--%>
<%-- auto: true,--%>
<%-- area: ['1000', '600'],--%>
<%-- content: $("#detailTpl").html(),--%>
<%-- success: function (){--%>
<%-- $("#table").bootstrapTable({--%>
<%-- method: 'get',--%>
<%-- url: '${ctx}/warehouse/ledger/ledger/infoDate?batchNum='+ row.batchNum+'&ledger.id=${ledger.id}',--%>
<%-- //是否显示分页(*)--%>
<%-- pagination: true,--%>
<%-- //排序方式--%>
<%-- sortOrder: "asc",--%>
<%-- //初始化加载第一页,默认第一页--%>
<%-- pageNumber:1,--%>
<%-- //每页的记录行数(*)--%>
<%-- pageSize: 10,--%>
<%-- //可供选择的每页的行数(*)--%>
<%-- pageList: [10, 25, 50, 100],--%>
<%-- sidePagination: "server",--%>
<%-- queryParams : function(params) {--%>
<%-- var searchParam = $("#searchForm").serializeJSON();--%>
<%-- searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;--%>
<%-- searchParam.pageSize = params.limit === undefined? -1 : params.limit;--%>
<%-- searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;--%>
<%-- return searchParam;--%>
<%-- },--%>
<%-- columns: [--%>
<%-- {checkbox:true},--%>
<%-- {field: 'code', title: '物资编码'},--%>
<%-- {--%>
<%-- field: 'type.name',--%>
<%-- title: '品名',--%>
<%-- },--%>
<%-- {--%>
<%-- field: 'type.code',--%>
<%-- title: '代码',--%>
<%-- },--%>
<%-- {--%>
<%-- field: 'batchNum',--%>
<%-- title: '批次号',--%>
<%-- },--%>
<%-- {--%>
<%-- field: 'amount',--%>
<%-- title: '单价'--%>
<%-- },--%>
<%-- {--%>
<%-- field: "type.unit",--%>
<%-- title: '单位'--%>
<%-- },--%>
<%-- {--%>
<%-- field: 'amount',--%>
<%-- title: '单价'--%>
<%-- },--%>
<%-- {--%>
<%-- field: "type.unit",--%>
<%-- title: '单位'--%>
<%-- },--%>
<%-- {field: 'model', title: '型号'},--%>
<%-- {field: 'shelves.name', title: '货架'},--%>
<%-- // {field: 'amount', title: '单价'},--%>
<%-- {--%>
<%-- field: 'num',--%>
<%-- title: '数量'--%>
<%-- },--%>
<%-- {--%>
<%-- field: 'sum',--%>
<%-- title: '总价',--%>
<%-- sortName: 'sum',--%>
<%-- formatter (v, row) {--%>
<%-- return new Big(row.num).times(row.amount).toNumber()--%>
<%-- }--%>
<%-- },--%>
<%-- {--%>
<%-- field: 'qr.url',--%>
<%-- title: '二维码',--%>
<%-- sortable: true,--%>
<%-- sortName: 'qr.url',--%>
<%-- formatter: function (){--%>
<%-- return '<a class="view-qrcode">查看</a>&nbsp;&nbsp;<a class="print">打印</a>';--%>
<%-- },--%>
<%-- events: {--%>
<%-- 'click .view-qrcode': function (e,value,row){--%>
<%-- jp.showPic('${ctxPath}'+row.qr.url)--%>
<%-- },--%>
<%-- 'click .print': function (e,value,row){--%>
<%-- onPrint(row);--%>
<%-- }--%>
<%-- }--%>
<%-- }--%>
<%-- ]--%>
<%-- });--%>
$('#table').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#batchPrintBtn').prop('disabled', ! $('#table').bootstrapTable('getSelections').length);
});
<%-- $('#table').on('check.bs.table uncheck.bs.table load-success.bs.table ' +--%>
<%-- 'check-all.bs.table uncheck-all.bs.table', function () {--%>
<%-- $('#batchPrintBtn').prop('disabled', ! $('#table').bootstrapTable('getSelections').length);--%>
<%-- });--%>
},
})
}
}
}
<%-- },--%>
<%-- })--%>
<%-- }--%>
<%-- }--%>
<%--}--%>
].map(function (e) {
e.align = 'center';
return e;
......
......@@ -107,14 +107,14 @@
sortName: 'type.name'
},
// {
// field: 'model',
// title: '型号',
// sortable: true,
// sortName: 'model'
//
// }
{
field: 'model',
title: '型号',
sortable: true,
sortName: 'model'
}
,{
field: 'sum',
title: '总价',
sortable: true,
......@@ -303,9 +303,9 @@ function getScanIpt () {
return document.getElementById("scanIpt");
}
// 判断是否是中文输入法
var inputMethodCnType = false;
// input持续获取焦点
var scanIptFocusTimer = null;
// var inputMethodCnType = false;
// // input持续获取焦点
// var scanIptFocusTimer = null;
function viewScanData () {
layer.open({
......@@ -315,35 +315,31 @@ function viewScanData () {
area: ['1200','600'],
content: $("#scanTpl").html(),
success: function () {
var ipt = getScanIpt();
ipt.addEventListener('change', scanDataChange);
// ipt.addEventListener('blur', allFocus);
ipt.addEventListener('compositionstart', iptCompositionstart);
ipt.addEventListener('compositionend', iptCompositionend);
scanIptGetFocusStart();
$("#scanIpt").focus();
// var ipt = getScanIpt();
// ipt.addEventListener('change', scanDataChange);
// // ipt.addEventListener('blur', allFocus);
// ipt.addEventListener('compositionstart', iptCompositionstart);
// ipt.addEventListener('compositionend', iptCompositionend);
// scanIptGetFocusStart();
// $("#scanIpt").focus();
scanStart();
renderScanTable();
document.addEventListener('visibilitychange', pageVisible);
// document.addEventListener('visibilitychange', pageVisible);
},
cancel: function () {
var ipt = getScanIpt();
ipt.removeEventListener('change', scanDataChange);
// ipt.removeEventListener('blur', allFocus);
ipt.removeEventListener('compositionstart', iptCompositionstart);
scanIptGetFocusStop();
document.removeEventListener('visibilitychange', pageVisible);
// var ipt = getScanIpt();
// ipt.removeEventListener('change', scanDataChange);
// // ipt.removeEventListener('blur', allFocus);
// ipt.removeEventListener('compositionstart', iptCompositionstart);
// scanIptGetFocusStop();
// document.removeEventListener('visibilitychange', pageVisible);
scanStop();
},
btn:['关闭']
})
}
function scanDataChange () {
var elem = getScanIpt();
var val = $(elem).val();
if (!val) {
return;
}
try {
function scanIptChangeCallback (val) {
var json = JSON.parse(val);
var params = "qrId=" + json.code;
getScanData(
......@@ -364,25 +360,54 @@ function scanDataChange () {
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 scanDataChange () {
// var elem = getScanIpt();
// var val = $(elem).val();
// if (!val) {
// return;
// }
// 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) {
var timer = setInterval(function () {
......@@ -393,21 +418,21 @@ function iptFocus (ipt) {
return timer;
}
function debounce (callback, timeout = 500) {
let timer = null;
return function (...arg) {
const content = this;
if (timer) {
clearTimeout(timer);
} else {
callback.apply(content, arg);
}
timer = setTimeout(function () {
clearTimeout(timer);
timer = null;
}, timeout)
}
}
// function debounce (callback, timeout = 500) {
// let timer = null;
// return function (...arg) {
// const content = this;
// if (timer) {
// clearTimeout(timer);
// } else {
// callback.apply(content, arg);
// }
// timer = setTimeout(function () {
// clearTimeout(timer);
// timer = null;
// }, timeout)
// }
// }
function renderScanTable () {
getTable().bootstrapTable('destroy').bootstrapTable({
......@@ -499,27 +524,27 @@ function getScanData (params, callback) {
})
}
function pageVisible () {
var state = document.visibilityState;
if (state === 'visible') {
scanIptGetFocusStart();
} else if (state === 'hidden') {
scanIptGetFocusStop();
}
}
function scanIptGetFocusStart () {
var ipt = getScanIpt();
if (ipt) {
scanIptFocusTimer = iptFocus(ipt);
}
}
function scanIptGetFocusStop () {
if (scanIptFocusTimer) {
clearInterval(scanIptFocusTimer);
scanIptFocusTimer = null;
}
}
// function pageVisible () {
// var state = document.visibilityState;
// if (state === 'visible') {
// scanIptGetFocusStart();
// } else if (state === 'hidden') {
// scanIptGetFocusStop();
// }
// }
// function scanIptGetFocusStart () {
// var ipt = getScanIpt();
// if (ipt) {
// scanIptFocusTimer = iptFocus(ipt);
// }
// }
// function scanIptGetFocusStop () {
// if (scanIptFocusTimer) {
// clearInterval(scanIptFocusTimer);
// scanIptFocusTimer = null;
// }
// }
</script>
<script type="text/template" id="ledgerChildrenTpl">//<!--
......
......@@ -8,6 +8,7 @@
<%@ include file="/webpage/include/bootstraptable.jsp"%>
<%@include file="/webpage/include/treeview.jsp" %>
<%@include file="ledgerList.js" %>
<%@include file="../../../include/scan.jsp" %>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<style>
#scanIpt {
......
......@@ -32,6 +32,7 @@
}
$(selector).bootstrapTable({
data: data,
uniqueId: 'sortId',
columns: [{checkbox: true},
{
field: 'no',
......@@ -171,6 +172,11 @@
return $(selector).bootstrapTable('getSelections');
}
var addDetailColumns = {
label: '物资编码|品名|代码|型号|批次号|单价|单位|数量|选择数量',
key: 'code|type.name|type.code|model|batchNum|amount|type.unit|num|selectNum'
};
/**
* 手动添加明细
* @param selector
......@@ -180,40 +186,138 @@
title: '选择物资台账明细',
isMultiSelect: true,
url: "${ctx}/warehouse/ledger/ledger/findByQrOrCode",
fieldLabels: "物资编码|物资名称|品名代码|型号|批次号|单价",
fieldKeys: "code|name|type.name|model|batchNum|amount",
fieldLabels: addDetailColumns.label,
fieldKeys: addDetailColumns.key,
searchLabels: "物资编码",
searchKeys: "code",
}, function (items) {
if (Array.isArray(items)) {
if (items.some(function (e) {
return !e.selectNum;
})) {
jp.alert('选择的数据必须填写选择数量');
return false;
}
/***
* 重复的物资编码去重
*/
var newItems = [];
items.forEach(function(item){
var fined = getTableData().find(function(v){
return v.ledgerInfo.code === item.code
})
if(!fined){
newItems.push(item);
}else{
jp.warning('有物资重复不能领用!');
// var newItems = [];
// items.forEach(function(item){
// var fined = getTableData().find(function(v){
// return v.ledgerInfo.code === item.code
// })
// if(!fined){
// newItems.push(item);
// }else{
// jp.warning('有物资重复不能领用!');
// }
// })
// var data = newItems.map(function (item) {
// item[0] = false;
// item.infoSum = new Big(item.num).times(item.amount).toNumber();
// return {
// id: '',
// delFlag: 0,
// remarks: '',
// ledgerInfo: item,
// sortId: item.code
// }
// })
// $(selector).bootstrapTable('append', data)
selectDetailHandle($(selector), items);
}
})
var data = newItems.map(function (item) {
item[0] = false;
item.infoSum = new Big(item.num).times(item.amount).toNumber();
}
function selectDetailHandle (table, list) {
var tableData = getTableData();
var newTableData = tableData.slice();
if (!tableData.length) {
list.forEach(function (item) {
var selectNum = Number(item.selectNum);
var list = new Array(selectNum).fill(0).map(function (t, index) {
return {
id: '',
delFlag: 0,
remarks: '',
ledgerInfo: item
ledgerInfo: Object.assign({}, item),
sortId: item.code + '_' + index
}
})
$(selector).bootstrapTable('append', data)
newTableData = newTableData.concat(list);
})
} else {
list.forEach(function (item) {
var list = tableData.filter(function (e) { return e.ledgerInfo.code === item.code });
var selectNum = Number(item.selectNum);
var length = list.length;
var startIndex = newTableData.findIndex(function (e) { return e.ledgerInfo.code === item.code; });
var endIndex = startIndex + length - 1;
if (length > selectNum) {
var delNum = length - selectNum;
var delStartIndex = startIndex + selectNum;
newTableData.splice(delStartIndex, delNum);
} else if (length < selectNum) {
var newAddList = new Array(selectNum - length).fill(0).map(function (t, index) {
return {
id: '',
delFlag: 0,
remarks: '',
ledgerInfo: Object.assign({}, item),
sortId: item.code + '_' + index
}
});
newTableData.splice.apply(newTableData, [endIndex, 0].concat(newAddList));
} else if (length === 0) {
var newAddList = new Array(selectNum).fill(0).map(function (t, index) {
return {
id: '',
delFlag: 0,
remarks: '',
ledgerInfo: Object.assign({}, item),
sortId: item.code + '_' + index
}
});
newTableData = newTableData.concat(newAddList);
}
})
}
table.bootstrapTable('load', newTableData);
}
function positiveInteger (v) {
return /^[1-9]\d*$/.test(v)
}
top.gridSelectColumnFormatterMap = {
selectNum: {
formatter: function (val, row, index) {
return "<input type='number' class='form-control selectNum' />"
},
events: {
'change .selectNum': function (e, v, r, i) {
var dom = e.target;
var selectNum = Number(dom.value);
var num = r.num;
if (!positiveInteger(selectNum)) {
jp.alert('只能输入正整数');
dom.value = '';
return;
} else if (selectNum > num) {
jp.alert('选择的数量不能大于总数量');
dom.value = '';
return;
}
r.selectNum = dom.value;
}
}
}
}
window.onbeforeunload = function () {
delete top.gridSelectColumnFormatterMap;
}
function removeRow(index, rowId, rowDelFlag) {
if (rowId && rowId != 'undefined') {
......@@ -319,12 +423,95 @@
type: 1,
title: '扫码',
auto: true,
area: ['500', '300'],
content: $("#scanResultTpl").html(),
area: ['1200', '600'],
content: $("#scanTpl").html(),
success: function () {
$("#scanResult").focus();
// $("#scanResult").focus();
scanStart();
renderScanTable();
},
btn: ['关闭']
yes: function (index, layero) {
var selectTableData = getSelectScanTable();
if (!selectTableData.length) {
jp.alert('至少选择一条数据');
return;
}
selectDetailHandle(getScanTable(), selectTableData);
top.layer.close(index);
},
cancel () {
scanStop();
}
})
}
function scanIptChangeCallback (val) {
var json = JSON.parse(val);
var qrCodeId = json.code;
// var params = "qrId=" + json.code;
console.log(val)
jp.get('${ctx}/warehouse/ledger/ledger/findByQrOrCode?qrCodeId=' + qrCodeId, function (res) {
var data = res.rows || [];
if (data.length) {
// var item = data[0];
//
// /***
// * 重复的物资编码去重
// */
// var fined = getTableData().find(function(v){
// return v.ledgerInfo.code === item.code
// })
// if(fined){
// jp.warning('有物资重复不能领用');
// return;
// }
// $(selector).bootstrapTable('append', [
// {
// id: '',
// delFlag: 0,
// remarks: '',
// ledgerInfo: item
// }
// ]);
// $(elem).val('').focus();
debugger
console.log(data)
}else{
jp.warning('未找到任何数据!');
// $(elem).val('').focus();
}
})
}
function getScanTable () {
return $("#scan_detail_table");
}
function getSelectScanTable () {
return getScanTable().bootstrapTable('getSelections');
}
function renderScanTable () {
var table = getScanTable();
var labelList = addDetailColumns.label.split('|');
var keyList = addDetailColumns.key.split('|');
table.bootstrapTable('destroy').bootstrapTable({
data: [],
columns: labelList.map(function (el, index) {
var key = keyList[index];
return {
title: el,
field: keyList[index],
formatter (v, r, i) {
var result = v;
if (top.gridSelectColumnFormatterMap[key]) {
result = top.gridSelectColumnFormatterMap[key].formatter(v, r, i)
}
return result;
},
events: top.gridSelectColumnFormatterMap[key] ? top.gridSelectColumnFormatterMap[key].events : {}
}
})
})
}
......
......@@ -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-zh-CN.js"></script>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<%@include file="../../../include/scan.jsp" %>
<style>
.sign-result{
width: 80px;
......@@ -30,6 +31,10 @@
.sign:focus-visible {
outline: none;
}
.scan-data-content {
padding: 10px;
}
</style>
</head>
<body>
......@@ -146,5 +151,30 @@
}
</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>
</html>
......@@ -204,6 +204,10 @@
return res;
}
window.onbeforeunload = function () {
delete top.selectStorageData;
}
/**
* 手动添加明细
* @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