|
@@ -242,10 +242,8 @@ $(document).ready(() => {
|
|
|
const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
// 未改变值则不提交
|
|
|
- const validText = info.editingText !== null && !isNaN(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
|
|
|
+ const validText = _.isNumber(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
|
|
|
const orgValue = select[col.field];
|
|
|
- console.log(orgValue);
|
|
|
- console.log(validText);
|
|
|
if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
@@ -327,10 +325,58 @@ $(document).ready(() => {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ deletePress: function (sheet) {
|
|
|
+ return;
|
|
|
+ },
|
|
|
clipboardPasted(e, info) {
|
|
|
// const tree = info.sheet.zh_tree;
|
|
|
// if (!tree) { return; }
|
|
|
+ const hint = {
|
|
|
+ codeEmpty: {type: 'error', msg: '请先输入编号'},
|
|
|
+ codeUsed: {type: 'error', msg: '该编号已存在,请重新输入。'},
|
|
|
+ numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
|
|
|
+ riskCan: {type: 'error', msg: '只能粘贴0-100的正整数'},
|
|
|
+ numberCan: {type: 'error', msg: '请粘贴大于0并且小于3位小数的浮点数'},
|
|
|
+ };
|
|
|
console.log(info);
|
|
|
+ const range = info.cellRange;
|
|
|
+ const sortData = info.sheet.zh_data || [];
|
|
|
+ if (info.cellRange.row + info.cellRange.rowCount > sortData.length) {
|
|
|
+ SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = [];
|
|
|
+ for (let iRow = 0; iRow < range.rowCount; iRow++) {
|
|
|
+ let bPaste = true;
|
|
|
+ const curRow = range.row + iRow;
|
|
|
+ const materialData = {id: sortData[curRow].id};
|
|
|
+ for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
+ const curCol = range.col + iCol;
|
|
|
+ const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
+ if (!colSetting) continue;
|
|
|
+
|
|
|
+
|
|
|
+ let validText = info.sheet.getText(curRow, curCol);
|
|
|
+ console.log(validText, isNaN(parseFloat(validText)));
|
|
|
+ validText = _.isNumber(validText) ? parseFloat(validText) : (validText ? trimInvalidChar(validText) : null);
|
|
|
+ console.log(validText);
|
|
|
+ const orgValue = sortData[curRow][colSetting.field];
|
|
|
+ console.log(orgValue);
|
|
|
+ if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ materialData[colSetting.field] = validText;
|
|
|
+
|
|
|
+ // if (colSetting.type === 'Number') {
|
|
|
+ // const num = _.toNumber(materialData[colSetting.field]);
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ console.log(materialData);
|
|
|
+ }
|
|
|
+ if (data.length === 0) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ return;
|
|
|
+ }
|
|
|
// if (info.sheet.zh_setting) {
|
|
|
// const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
// const col = info.sheet.zh_setting.cols[info.col];
|
|
@@ -425,6 +471,7 @@ $(document).ready(() => {
|
|
|
materialSpreadObj.refreshActn();
|
|
|
materialSpread.bind(spreadNS.Events.SelectionChanged, materialSpreadObj.selectionChanged);
|
|
|
materialSpread.bind(spreadNS.Events.ClipboardPasted, materialSpreadObj.clipboardPasted);
|
|
|
+ SpreadJsObj.addDeleteBind(materialSpread, materialSpreadObj.deletePress);
|
|
|
// const sheet = materialSpread.getActiveSheet();
|
|
|
// sheet.suspendPaint();
|
|
|
// var range = sheet.getRange(-1, 8, -1, 1);
|