|
|
@@ -607,10 +607,21 @@ $(document).ready(function() {
|
|
|
if (orgValue == info.editingText || ((!orgValue || orgValue === '') && (newValue === ''))) {
|
|
|
return;
|
|
|
}
|
|
|
+ if (['calc', 'calc2'].includes(col.field) && node.c_code && isNaN(newValue)) {
|
|
|
+ toastr.error('不能输入其它非数字类型字符');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 获取更新数据
|
|
|
if (info.editingText) {
|
|
|
const text = newValue;
|
|
|
- data[col.field] = text;
|
|
|
+ // 如果列类型为数字,尝试转换为数值;非数字则保留为 null,防止 NaN 传播
|
|
|
+ if (col.type === 'Number') {
|
|
|
+ const num = parseFloat(text);
|
|
|
+ data[col.field] = Number.isFinite(num) ? num : null;
|
|
|
+ } else {
|
|
|
+ data[col.field] = text;
|
|
|
+ }
|
|
|
} else {
|
|
|
data[col.field] = null;
|
|
|
}
|