|  | @@ -127,18 +127,28 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |                          $('#bills-expr').val(data[exprInfo.expr] ? data[exprInfo.expr] : data[col.field])
 | 
	
		
			
				|  |  |                              .attr('field', col.field).attr('org', data[col.field]);
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  | -                        $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field]);
 | 
	
		
			
				|  |  | +                        $('#bills-expr').val(data[col.field])
 | 
	
		
			
				|  |  | +                            .attr('field', col.field).attr('org', data[col.field]);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      if (col.field.indexOf('dgn') >= 0) {
 | 
	
		
			
				|  |  |                          $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (_.isString(data.b_code) && data.b_code !== ''));
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  | -                        $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
 | 
	
		
			
				|  |  | +                        const nodePos = pos.getLedgerPos(data.id);
 | 
	
		
			
				|  |  | +                        if (nodePos && nodePos.length > 0) {
 | 
	
		
			
				|  |  | +                            $('#bills-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                            $('#bills-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                    $('#bills-expr').attr('data-row', sel.row);
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      $('#bills-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                    $('#bills-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  $('#bills-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                $('#bills-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          getSelectNode: function (sheet) {
 | 
	
	
		
			
				|  | @@ -866,6 +876,12 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |                  info.cancel = true;
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            const exprInfo = getExprInfo(col.field);
 | 
	
		
			
				|  |  | +            if (exprInfo) {
 | 
	
		
			
				|  |  | +                if (node[exprInfo.expr] && node[exprInfo.expr] !== '') {
 | 
	
		
			
				|  |  | +                    info.sheet.getCell(info.row, info.col).text(node[exprInfo.expr]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              switch (col.field) {
 | 
	
		
			
				|  |  |                  case 'code':
 | 
	
		
			
				|  |  |                      const posRange = pos.getLedgerPos(node.id);
 | 
	
	
		
			
				|  | @@ -933,13 +949,10 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |              treeOperationObj.refreshOperationValid(info.sheet, info.newSelections);
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          ledgerSpread.bind(GC.Spread.Sheets.Events.EditEnded, treeOperationObj.editEnded);
 | 
	
		
			
				|  |  | -        //ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardPasted, treeOperationObj.clipboardPasted);
 | 
	
		
			
				|  |  |          SpreadJsObj.addDeleteBind(ledgerSpread, treeOperationObj.deletePress);
 | 
	
		
			
				|  |  |          ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardChanging, function (e, info) {
 | 
	
		
			
				|  |  |              const copyText = SpreadJsObj.getFilterCopyText(info.sheet);
 | 
	
		
			
				|  |  | -            //console.log(info.copyData);
 | 
	
		
			
				|  |  |              SpreadJsObj.Clipboard.setCopyData(copyText);
 | 
	
		
			
				|  |  | -            //copyToClipboard(copyText);
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardPasting, treeOperationObj.clipboardPasting);
 | 
	
		
			
				|  |  |          ledgerSpread.bind(spreadNS.Events.EditStarting, treeOperationObj.editStarting);
 | 
	
	
		
			
				|  | @@ -983,15 +996,31 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        $('#bills-expr').bind('change mouseleave', function () {
 | 
	
		
			
				|  |  | -            if (document.activeElement.id !== "bills-expr") return;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        $('#bills-expr').bind('change onblur', function () {
 | 
	
		
			
				|  |  |              const expr = $(this);
 | 
	
		
			
				|  |  | -            const sheet = ledgerSpread.getActiveSheet();
 | 
	
		
			
				|  |  | -            const select = SpreadJsObj.getSelectObject(sheet);
 | 
	
		
			
				|  |  | +            const row = expr.attr('data-row') ? _.toInteger(expr.attr('data-row')) : -1;
 | 
	
		
			
				|  |  | +            const select = ledgerTree.getItemsByIndex(row);
 | 
	
		
			
				|  |  | +            if (!select) return;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = trimInvalidChar(expr.val());
 | 
	
		
			
				|  |  |              if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            // 台账模式,检查计量单元相关
 | 
	
		
			
				|  |  | +            if (checkTzMeasureType()) {
 | 
	
		
			
				|  |  | +                if (field === 'sgfh_qty' || field === 'sgfh_tp' ||
 | 
	
		
			
				|  |  | +                    field === 'sjcl_qty' || field === 'sjcl_tp' ||
 | 
	
		
			
				|  |  | +                    field === 'qtcl_qty' || field === 'qtcl_tp') {
 | 
	
		
			
				|  |  | +                    if (!select.children || select.children.length === 0) {
 | 
	
		
			
				|  |  | +                        const lPos = pos.getLedgerPos(select.id);
 | 
	
		
			
				|  |  | +                        if (lPos && lPos.length > 0) {
 | 
	
		
			
				|  |  | +                            toastr.error('清单含有计量单元,请在计量单元输入数量');
 | 
	
		
			
				|  |  | +                            expr.val('');
 | 
	
		
			
				|  |  | +                            return;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              const data = {
 | 
	
		
			
				|  |  |                  id: select.id,
 | 
	
		
			
				|  |  |                  tender_id: select.tender_id,
 | 
	
	
		
			
				|  | @@ -1026,7 +1055,7 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |              // 更新至服务器
 | 
	
		
			
				|  |  |              postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
 | 
	
		
			
				|  |  |                  const refreshNode = ledgerTree.loadPostData(result);
 | 
	
		
			
				|  |  | -                treeOperationObj.refreshTree(sheet, refreshNode);
 | 
	
		
			
				|  |  | +                treeOperationObj.refreshTree(ledgerSpread.getActiveSheet(), refreshNode);
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -1451,6 +1480,16 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          editStarting: function (e, info) {
 | 
	
		
			
				|  |  |              posOperationObj.ledgerTreeNode = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
 | 
	
		
			
				|  |  | +            const sel = info.sheet.getSelections();
 | 
	
		
			
				|  |  | +            if (!sel || !sel[0]) return;
 | 
	
		
			
				|  |  | +            const col = info.sheet.zh_setting.cols[sel[0].col];
 | 
	
		
			
				|  |  | +            const node = SpreadJsObj.getSelectObject(info.sheet);
 | 
	
		
			
				|  |  | +            const exprInfo = getExprInfo(col.field);
 | 
	
		
			
				|  |  | +            if (exprInfo) {
 | 
	
		
			
				|  |  | +                if (node[exprInfo.expr] && node[exprInfo.expr] !== '') {
 | 
	
		
			
				|  |  | +                    info.sheet.getCell(info.row, info.col).text(node[exprInfo.expr]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          loadExprToInput: function () {
 | 
	
		
			
				|  |  |              const sheet = posSpread.getActiveSheet();
 | 
	
	
		
			
				|  | @@ -1466,12 +1505,14 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |                          ? (data[exprInfo.expr] ? data[exprInfo.expr] : data[col.field])
 | 
	
		
			
				|  |  |                          : data[col.field];
 | 
	
		
			
				|  |  |                      $('#pos-expr').val(value).attr('field', col.field).attr('org', data[col.field])
 | 
	
		
			
				|  |  | -                        .attr('row', sel.row).attr('readOnly', readOnly || cell.locked());
 | 
	
		
			
				|  |  | +                        .attr('readOnly', readOnly || cell.locked()).attr('data-row', sel.row);
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      $('#pos-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                    $('#pos-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  $('#pos-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  | +                $('#pos-expr').removeAttr('data-row');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          /**
 | 
	
	
		
			
				|  | @@ -1836,15 +1877,14 @@ $(document).ready(function() {
 | 
	
		
			
				|  |  |          $('a[name="pos-opr"]').click(function () {
 | 
	
		
			
				|  |  |              posOperationObj.baseOpr(posSpread.getActiveSheet(), this.getAttribute('type'));
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  | -        $('#pos-expr').bind('change mouseleave', function () {
 | 
	
		
			
				|  |  | -            if (document.activeElement.id !== "pos-expr") return;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        $('#pos-expr').bind('change onblur', function () {
 | 
	
		
			
				|  |  |              const expr = $(this);
 | 
	
		
			
				|  |  |              const posSheet = posSpread.getActiveSheet();
 | 
	
		
			
				|  |  | -            const select = SpreadJsObj.getSelectObject(posSheet);
 | 
	
		
			
				|  |  | +            const row = expr.attr('data-row') ? _.toInteger(expr.attr('data-row')) : -1;
 | 
	
		
			
				|  |  | +            const select = posSheet.zh_data ? posSheet.zh_data[row] : null;
 | 
	
		
			
				|  |  |              if (!select) return;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val(), row = trimInvalidChar(expr.attr('row'));
 | 
	
		
			
				|  |  | +            const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val();
 | 
	
		
			
				|  |  |              if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              const data = {id: select.id};
 |