|  | @@ -59,8 +59,15 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              if (col.type === 'Number') {
 | 
	
		
			
				|  |  |                  const data = SpreadJsObj.getSelectObject(sheet);
 | 
	
		
			
				|  |  |                  if (data) {
 | 
	
		
			
				|  |  | -                    $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
 | 
	
		
			
				|  |  | -                        .attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
 | 
	
		
			
				|  |  | +                    $('#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() || data.b_code);
 | 
	
		
			
				|  |  | +                    } else if (col.field === 'unit_price') {
 | 
	
		
			
				|  |  | +                        $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0) || node.used);
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      $('#bills-expr').val('').attr('readOnly', true);
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -563,6 +570,12 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          $('a[name="base-opr"]').click(function () {
 | 
	
		
			
				|  |  |              billsTreeSpreadObj.baseOpr(billsSheet, this.getAttribute('type'));
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  | +        $('a[name=cpc]').click(function () {
 | 
	
		
			
				|  |  | +            billsSpread.commandManager().execute({
 | 
	
		
			
				|  |  | +                cmd: this.getAttribute('type'),
 | 
	
		
			
				|  |  | +                sheetName: billsSpread.getActiveSheet().name()
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $('#bills-expr').bind('change mouseleave', function () {
 | 
	
		
			
				|  |  |              if (this.readOnly) return;
 | 
	
	
		
			
				|  | @@ -577,23 +590,27 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  tender_id: select.tender_id,
 | 
	
		
			
				|  |  |                  ledger_id: select.ledger_id
 | 
	
		
			
				|  |  |              };
 | 
	
		
			
				|  |  | -            const num = _.toNumber(newValue);
 | 
	
		
			
				|  |  | -            if (num) {
 | 
	
		
			
				|  |  | -                data[field] = num;
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                try {
 | 
	
		
			
				|  |  | -                    data[field] = math.evaluate(transExpr(newValue));
 | 
	
		
			
				|  |  | -                } catch (err) {
 | 
	
		
			
				|  |  | -                    toastr.error('输入的表达式非法');
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +            if (newValue !== '') {
 | 
	
		
			
				|  |  | +                const num = _.toNumber(newValue);
 | 
	
		
			
				|  |  | +                if (num) {
 | 
	
		
			
				|  |  | +                    data[field] = num;
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    try {
 | 
	
		
			
				|  |  | +                        data[field] = math.evaluate(transExpr(newValue));
 | 
	
		
			
				|  |  | +                    } catch (err) {
 | 
	
		
			
				|  |  | +                        toastr.error('输入的表达式非法');
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                data[field] = null;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // 更新至服务器
 | 
	
		
			
				|  |  |              postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
 | 
	
		
			
				|  |  |                  const refreshNode = billsTree.loadPostData(result);
 | 
	
		
			
				|  |  |                  expr.val(select[field]);
 | 
	
		
			
				|  |  | -                billsTreeSpreadObj.refreshTree(info.sheet, refreshNode);
 | 
	
		
			
				|  |  | +                billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -996,28 +1013,33 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              const expr = $(this);
 | 
	
		
			
				|  |  |              const select = SpreadJsObj.getSelectObject(posSheet);
 | 
	
		
			
				|  |  | +            const row = posSheet.getSelections()[0].row;
 | 
	
		
			
				|  |  |              const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = trimInvalidChar(expr.val());
 | 
	
		
			
				|  |  |              if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              const data = {id: select.id};
 | 
	
		
			
				|  |  | -            const num = _.toNumber(newValue);
 | 
	
		
			
				|  |  | -            if (num) {
 | 
	
		
			
				|  |  | -                data[field] = num;
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                try {
 | 
	
		
			
				|  |  | -                    data[field] = math.evaluate(transExpr(newValue));
 | 
	
		
			
				|  |  | -                } catch (err) {
 | 
	
		
			
				|  |  | -                    toastr.error('输入的表达式非法');
 | 
	
		
			
				|  |  | -                    return;
 | 
	
		
			
				|  |  | +            if (newValue !== '') {
 | 
	
		
			
				|  |  | +                const num = _.toNumber(newValue);
 | 
	
		
			
				|  |  | +                if (num) {
 | 
	
		
			
				|  |  | +                    data[field] = num;
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    try {
 | 
	
		
			
				|  |  | +                        data[field] = math.evaluate(transExpr(newValue));
 | 
	
		
			
				|  |  | +                    } catch (err) {
 | 
	
		
			
				|  |  | +                        toastr.error('输入的表达式非法');
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                data[field] = null;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // 更新至服务器
 | 
	
		
			
				|  |  | -            postData(window.location.pathname + '/update', {posPostType: 'update', posData: data}, function (result) {
 | 
	
		
			
				|  |  | +            postData(window.location.pathname + '/update', {postType: 'pos', posPostType: 'update', postData: data}, function (result) {
 | 
	
		
			
				|  |  |                  const updateRst = pos.updateDatas(result.pos);
 | 
	
		
			
				|  |  |                  expr.val(select[field]);
 | 
	
		
			
				|  |  |                  // 刷新当前行, 不适用于新增(在非下一空白行新增)
 | 
	
		
			
				|  |  | -                SpreadJsObj.reLoadRowData(info.sheet, _.toNumber(row));
 | 
	
		
			
				|  |  | +                SpreadJsObj.reLoadRowData(posSheet, row);
 | 
	
		
			
				|  |  |                  const loadResult = billsTree.loadPostData(result.ledger);
 | 
	
		
			
				|  |  |                  billsTreeSpreadObj.refreshTree(billsSheet, loadResult);
 | 
	
		
			
				|  |  |                  billsTreeSpreadObj.refreshOperationValid(billsSheet);
 |