|
@@ -923,6 +923,8 @@ $(document).ready(function() {
|
|
|
});
|
|
|
|
|
|
$('#bills-expr').bind('change mouseleave', function () {
|
|
|
+ if (document.activeElement.id !== "bills-expr") return;
|
|
|
+
|
|
|
const expr = $(this);
|
|
|
const sheet = ledgerSpread.getActiveSheet();
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
@@ -1338,6 +1340,24 @@ $(document).ready(function() {
|
|
|
editStarting: function (e, info) {
|
|
|
posOperationObj.ledgerTreeNode = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
|
|
|
},
|
|
|
+ loadExprToInput: function () {
|
|
|
+ const sheet = posSpread.getActiveSheet();
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!sel) return;
|
|
|
+
|
|
|
+ const col = sheet.zh_setting.cols[sel.col], cell = sheet.getCell(sel.row, sel.col);
|
|
|
+ if (col && col.type === 'Number') {
|
|
|
+ const data = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ if (data) {
|
|
|
+ $('#pos-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
|
|
|
+ .attr('row', sel.row).attr('readOnly', readOnly || cell.locked());
|
|
|
+ } else {
|
|
|
+ $('#pos-expr').val('').attr('readOnly', true);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $('#pos-expr').val('').attr('readOnly', true);
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 加载计量单元 根据当前台账选择节点
|
|
|
*/
|
|
@@ -1350,6 +1370,7 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
SpreadJsObj.loadSheetData(posSpread.getActiveSheet(), 'data', []);
|
|
|
}
|
|
|
+ posOperationObj.loadExprToInput();
|
|
|
},
|
|
|
/**
|
|
|
* 编辑单元格响应事件
|
|
@@ -1603,19 +1624,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
},
|
|
|
selectionChanged: function (e, info) {
|
|
|
- const col = info.sheet.zh_setting.cols[info.newSelections[0].col];
|
|
|
- const cell = info.sheet.getCell(info.newSelections[0].row, info.newSelections[0].col);
|
|
|
- if (col && col.type === 'Number') {
|
|
|
- const data = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
- if (data) {
|
|
|
- $('#pos-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
|
|
|
- .attr('row', info.newSelections[0].row).attr('readOnly', readOnly || cell.locked());
|
|
|
- } else {
|
|
|
- $('#pos-expr').val('').attr('readOnly', true);
|
|
|
- }
|
|
|
- } else {
|
|
|
- $('#pos-expr').val('').attr('readOnly', true);
|
|
|
- }
|
|
|
+ posOperationObj.loadExprToInput();
|
|
|
},
|
|
|
addPegs: function (pegs) {
|
|
|
if (!pegs || pegs.length <= 0) return;
|
|
@@ -1637,10 +1646,12 @@ $(document).ready(function() {
|
|
|
posSpread.bind(spreadNS.Events.SelectionChanged, posOperationObj.selectionChanged);
|
|
|
if (!posSpreadSetting.readOnly) {
|
|
|
$('#pos-expr').bind('change mouseleave', function () {
|
|
|
+ if (document.activeElement.id !== "pos-expr") return;
|
|
|
+
|
|
|
const expr = $(this);
|
|
|
const posSheet = posSpread.getActiveSheet();
|
|
|
const select = SpreadJsObj.getSelectObject(posSheet);
|
|
|
- if (select) return;
|
|
|
+ if (!select) return;
|
|
|
|
|
|
const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val(), row = trimInvalidChar(expr.attr('row'));
|
|
|
if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
|