|
@@ -593,7 +593,6 @@ function loadBar(inDocuNo, chargeCode, manuNo) {
|
|
|
* 初始化入库药品条码表格数据
|
|
|
*/
|
|
|
function initBar() {
|
|
|
- let selectRowId;//选中的行号
|
|
|
$.jgrid.gridUnload("tb_bar_code");
|
|
|
$("#tb_bar_code").jqGrid({
|
|
|
datatype: 'local',
|
|
@@ -624,11 +623,13 @@ function initBar() {
|
|
|
cellsubmit: "clientArray",
|
|
|
caption: '入库药品关联条码',
|
|
|
rownumbers: true,//是否显示序号
|
|
|
- colNames: ['入库单号','批号','药品编码','条码'],
|
|
|
+ multiselect: true,
|
|
|
+ multiboxonly:true,
|
|
|
+ colNames: ['入库单号','批号','药品编码','追溯码'],
|
|
|
colModel: [
|
|
|
- {name: 'inDocuNo', index: 'inDocuNo', align: 'center', width: 160,sortable: false},
|
|
|
- {name: 'manuNo', index: 'manuNo', align: 'center', width: 160},
|
|
|
- {name: 'chargeCode', index: 'chargeCode', align: 'center', width: 160},
|
|
|
+ {name: 'inDocuNo', index: 'inDocuNo', align: 'center', width: 150,sortable: false},
|
|
|
+ {name: 'manuNo', index: 'manuNo', align: 'center', width: 150},
|
|
|
+ {name: 'chargeCode', index: 'chargeCode', align: 'center', width: 120},
|
|
|
{name: 'barCode', index: 'barCode', align: 'left', width: 160,editable : true,edittype:'text'}
|
|
|
],
|
|
|
jsonReader: {
|
|
@@ -642,10 +643,9 @@ function initBar() {
|
|
|
$("#tb_bar_code").setCell(rowid, iCol, value);
|
|
|
},
|
|
|
onCellSelect: function (rowid, iCol, cellcontent, e) {
|
|
|
- selectRowId = rowid;
|
|
|
+ $("#tb_bar_code #jqg_tb_bar_code_" + rowid).prop("checked", true);//打钩
|
|
|
},
|
|
|
beforeEditCell: function(rowid,iCol,cellcontent,e){
|
|
|
- selectRowId = rowid;
|
|
|
},
|
|
|
loadComplete: function (res) { //加载完成(初始加载),回调函数
|
|
|
/*$("#barCode").focus();*/
|
|
@@ -680,13 +680,13 @@ function initBar() {
|
|
|
let data= {inDocuNo:$("#inDocuNoLabel").val(),manuNo:$("#manuNo").val(),chargeCode:$("#chargeCode").val(),barCode:""};
|
|
|
$("#tb_bar_code").addRowData(rowid+1, data,'first');
|
|
|
$("#tb_bar_code").jqGrid('editRow', rowid+1);
|
|
|
- selectRowId = rowid+1;
|
|
|
});
|
|
|
$("#removeBarCode").on('click', function () {
|
|
|
- if (selectRowId == null) {
|
|
|
- return errorMesageSimaple('请选择一行进行删除!');
|
|
|
+ let ids = $("#tb_bar_code").jqGrid("getDataIDs");
|
|
|
+ console.log(ids);
|
|
|
+ for (let i = 0; i < ids.length; i++) {
|
|
|
+ $("#tb_bar_code").jqGrid("delRowData", ids[i]);
|
|
|
}
|
|
|
- $("#tb_bar_code").jqGrid("delRowData", selectRowId);
|
|
|
});
|
|
|
|
|
|
/**
|
|
@@ -696,6 +696,9 @@ function initBar() {
|
|
|
function autoBar(value){
|
|
|
var ids = $("#tb_bar_code").jqGrid("getDataIDs");//得到jqgrid当前行数
|
|
|
var rowid = Math.max.apply(Math,ids);//获得当前最大行号
|
|
|
+ if(rowid == "-Infinity"){
|
|
|
+ rowid = 0;
|
|
|
+ }
|
|
|
$("#tb_bar_code").saveRow(rowid);//取消最后一行的编辑状态
|
|
|
let rowDatas = $("#tb_bar_code").getRowData();
|
|
|
for (let i = 0; i < rowDatas.length; i++) {
|