pengjingzhao 3 주 전
부모
커밋
a4fcd621fe
1개의 변경된 파일24개의 추가작업 그리고 4개의 파일을 삭제
  1. 24 4
      src/main/resources/static/js/yk/drug_storage.js

+ 24 - 4
src/main/resources/static/js/yk/drug_storage.js

@@ -226,19 +226,26 @@ $(function () {
     initDetailed();
     initBar();
     $("#addDetailed").click(function () {
+        // console.log('addDetailed')
         $("#detailedFormModal").modal("hide");
         if ($("#checkerName").val() == '') {//新增
             let ids = $("#tb_table_detailed").jqGrid("getDataIDs");//得到jqgrid当前行数
+            console.log('ids',ids)
             let rowid = Math.max.apply(Math, ids);//获得当前最大行号
+            if(rowid == "-Infinity"){
+                rowid = 0;
+            }
             let formData = {};
             let t = $("#detailedForm").serializeArray();
             $.each(t, function () {
                 formData[this.name] = this.value
             });
-            $("#tb_table_detailed").addRowData(rowid + 1, formData, 'first');
-            $("#tb_table_detailed").jqGrid('editRow', rowid + 1);
+            $("#tb_table_detailed").addRowData(rowid+1, formData, 'first');
+            $("#tb_table_detailed").jqGrid('editRow',rowid+1);
+            // console.log('formData',formData)
         } else {//修改
-            var ids = $("#tb_bar_code").jqGrid("getDataIDs");//得到jqgrid当前行数
+            let ids = $("#tb_bar_code").jqGrid("getDataIDs");//得到jqgrid当前行数
+            // console.log('ids2',ids)
             var rowid = Math.max.apply(Math,ids);//获得当前最大行号
             if(rowid == "-Infinity"){
                 rowid = 0;
@@ -710,9 +717,17 @@ function initDetailed() {
             root: "data", repeatitems: false
         },
         onCellSelect: function (rowid, iCol, cellcontent, e) {
+            // console.log('1111111111111111',rowid, iCol, cellcontent, e);
+            // var rowIndex = $('#tb_table_detailed').jqGrid('getInd', rowid);
+            // console.log('行索引:', rowIndex);
+            // if(rowid == "-Infinity"){
+            //     rowid = 0;
+            // }
             selectRowId = rowid;
+            // console.log('selectRowId',selectRowId)
         },
         ondblClickRow: function (row) {
+            // console.log('44444',row)
             let rowData = $('#tb_table_detailed').jqGrid('getRowData', row);
             let inType = 0;
             switch (rowData) {
@@ -804,6 +819,7 @@ function initDetailed() {
         $("#tb_bar_code").jqGrid('clearGridData');
     });
     $("#removeDetailed").on('click', function () {
+        // console.log('5555',selectRowId)
         if($("#confirmFlag").val() == 1){
             return errorMesageSimaple('已审核,禁止操作!');
         }
@@ -909,6 +925,7 @@ function initBar() {
             root: "data", repeatitems: false
         },
         afterSubmitCell: function(rowid, cellname, value, iRow, iCol) {
+            // console.log('6666')
             $("#tb_bar_code").setCell(rowid, iCol, value);
             return true; // 必须返回 ture  or false,否则 下面的  afterSaveCell 方法执行不了的
         },
@@ -917,6 +934,8 @@ function initBar() {
             return true;
         },
         onCellSelect: function (rowid, iCol, cellcontent, e) {
+            // console.log('222222222222222222',rowid, iCol, cellcontent,e);
+            return
             $("#tb_bar_code #jqg_tb_bar_code_" + rowid).prop("checked", true);//打钩
             if(iCol === 4){
                 let rowData = $("#tb_bar_code").jqGrid("getRowData", rowid);
@@ -936,6 +955,7 @@ function initBar() {
             }
         },
         beforeSelectRow: function(rowid, e) {
+            // console.log('33333',rowid, e)
             // 阻止行选择
             return true;
         },
@@ -1035,7 +1055,7 @@ function setPrintHtml() {
         method: 'GET',
         data: date
     }).then((res) => {
-        console.log(res);
+        // console.log(res);
         let html = '';
         let packRetpriceSum = 0;
         let buyPriceSum = 0;