|
@@ -1001,6 +1001,24 @@ $(document).ready(() => {
|
|
}
|
|
}
|
|
// 计量单元 相关方法&绑定spreadjs事件
|
|
// 计量单元 相关方法&绑定spreadjs事件
|
|
const posSpreadObj = {
|
|
const posSpreadObj = {
|
|
|
|
+ loadExprToInput: function () {
|
|
|
|
+ const sel = posSheet.getSelections()[0];
|
|
|
|
+ if (!sel) return;
|
|
|
|
+
|
|
|
|
+ const col = posSheet.zh_setting.cols[sel.col];
|
|
|
|
+ const cell = posSheet.getCell(sel.col, sel.col);
|
|
|
|
+ if (col && col.type === 'Number') {
|
|
|
|
+ const data = SpreadJsObj.getSelectObject(posSheet);
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 加载计量单元 根据当前台账选择节点
|
|
* 加载计量单元 根据当前台账选择节点
|
|
*/
|
|
*/
|
|
@@ -1013,6 +1031,7 @@ $(document).ready(() => {
|
|
SpreadJsObj.loadSheetData(posSheet, 'data', []);
|
|
SpreadJsObj.loadSheetData(posSheet, 'data', []);
|
|
}
|
|
}
|
|
SpreadJsObj.resetFieldReadOnly(posSheet);
|
|
SpreadJsObj.resetFieldReadOnly(posSheet);
|
|
|
|
+ posSpreadObj.loadExprToInput();
|
|
},
|
|
},
|
|
editStarting: function (e, info) {
|
|
editStarting: function (e, info) {
|
|
posSpreadObj.billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
posSpreadObj.billsNode = SpreadJsObj.getSelectObject(billsSheet);
|
|
@@ -1285,19 +1304,7 @@ $(document).ready(() => {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
selectionChanged: function (e, info) {
|
|
selectionChanged: function (e, info) {
|
|
- const col = info.sheet.zh_setting.cols[info.newSelections[0].col];
|
|
|
|
- const cell = info.sheet.getCell(info.newSelections[0].col, 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);
|
|
|
|
- }
|
|
|
|
|
|
+ posSpreadObj.loadExprToInput();
|
|
},
|
|
},
|
|
addPegs: function (pegs) {
|
|
addPegs: function (pegs) {
|
|
if (!pegs || pegs.length <= 0) return;
|
|
if (!pegs || pegs.length <= 0) return;
|
|
@@ -1320,12 +1327,15 @@ $(document).ready(() => {
|
|
if (!readOnly && isTz) {
|
|
if (!readOnly && isTz) {
|
|
$('#pos-expr').bind('change mouseleave', function () {
|
|
$('#pos-expr').bind('change mouseleave', function () {
|
|
if (this.readOnly) return;
|
|
if (this.readOnly) return;
|
|
|
|
+ if (document.activeElement.id !== 'pos-expr') return;
|
|
|
|
|
|
const expr = $(this);
|
|
const expr = $(this);
|
|
const select = SpreadJsObj.getSelectObject(posSheet);
|
|
const select = SpreadJsObj.getSelectObject(posSheet);
|
|
|
|
+ if (!select) return;
|
|
|
|
+
|
|
const row = posSheet.getSelections()[0].row;
|
|
const row = posSheet.getSelections()[0].row;
|
|
const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = trimInvalidChar(expr.val());
|
|
const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = trimInvalidChar(expr.val());
|
|
- if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
|
|
|
|
|
|
+ if (orgValue === newValue || (!orgValue && newValue == '')) return;
|
|
|
|
|
|
const data = {id: select.id};
|
|
const data = {id: select.id};
|
|
if (newValue !== '') {
|
|
if (newValue !== '') {
|