|
@@ -411,7 +411,22 @@ $(document).ready(() => {
|
|
|
|
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
|
const node = sortData[info.row];
|
|
|
- node[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText;
|
|
|
+ if (col.type === 'Number') {
|
|
|
+ const num = _.toNumber(info.editingText);
|
|
|
+ if (_.isFinite(num)) {
|
|
|
+ node[col.field] = num;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ node[col.field] = math.evaluate(transExpr(info.editingText));
|
|
|
+ } catch(err) {
|
|
|
+ toastr.error('输入的表达式非法');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ node[col.field] = info.editingText;
|
|
|
+ }
|
|
|
// 刷新界面
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
|
|
|
}
|
|
@@ -423,7 +438,20 @@ $(document).ready(() => {
|
|
|
const curRow = iRow + info.cellRange.row;
|
|
|
const curCol = info.cellRange.col;
|
|
|
const col = info.sheet.zh_setting.cols[info.cellRange.col];
|
|
|
- sortData[curRow][col.field] = col.type === 'Number' ? _.toNumber(info.sheet.getText(curRow, curCol)) : info.sheet.getText(curRow, curCol);
|
|
|
+ if (col.type === 'Number') {
|
|
|
+ const num = _.toNumber(info.sheet.getText(curRow, curCol));
|
|
|
+ if (_.isFinite(num)) {
|
|
|
+ sortData[curRow][col.field] = num;
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ sortData[curRow][col.field] = math.evaluate(transExpr(info.sheet.getText(curRow, curCol)));
|
|
|
+ } catch(err) {
|
|
|
+ // toastr.error('输入的表达式非法');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sortData[curRow][col.field] = info.sheet.getText(curRow, curCol);
|
|
|
+ }
|
|
|
}
|
|
|
SpreadJsObj.reLoadRowData(sheet, info.cellRange.row, sel.cellRange.rowCount);
|
|
|
}
|
|
@@ -998,7 +1026,6 @@ $(document).ready(() => {
|
|
|
if (posSearch) posSearch.search();
|
|
|
},
|
|
|
selectionChanged: function (e, info) {
|
|
|
- console.log(SpreadJsObj.getSelectObject(info.sheet));
|
|
|
if (!info.oldSelections || !info.oldSelections[0] || info.newSelections[0].row !== info.oldSelections[0].row) {
|
|
|
stageTreeSpreadObj.loadRelaData();
|
|
|
// 全选去除
|
|
@@ -4177,9 +4204,6 @@ $(document).ready(() => {
|
|
|
key: 'less', title: '漏计', valid: true,
|
|
|
check: function (node) {
|
|
|
if (node.quantity) {
|
|
|
- if (node.b_code === '204-1-g') {
|
|
|
- console.log(ZhCalc.sub(ZhCalc.sum([node.quantity, node.end_qc_qty, node.end_qc_minus_qty]), node.end_gather_qty));
|
|
|
- }
|
|
|
return ZhCalc.sub(ZhCalc.sum([node.quantity, node.end_qc_qty, node.end_qc_minus_qty]), node.end_gather_qty) > 0;
|
|
|
} else if (node.total_price) {
|
|
|
return ZhCalc.sub(ZhCalc.add(node.total_price, node.end_qc_tp), node.end_gather_tp) > 0;
|