|
@@ -114,7 +114,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
SpreadJsObj.reLoadRowsData(sheet, rows);
|
|
|
},
|
|
|
- editEnding: function (e, info) {
|
|
|
+ editEnded: function (e, info) {
|
|
|
if (info.sheet.zh_setting) {
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
@@ -122,13 +122,13 @@ $(document).ready(() => {
|
|
|
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
toast('清单父项不可计量', 'error');
|
|
|
- info.cancel = true;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
} else {
|
|
|
const nodePos = stagePos.getLedgerPos(node.id);
|
|
|
if (nodePos && nodePos.length > 0) {
|
|
|
toast('该清单有部位明细,请在部位明细处计量', 'error');
|
|
|
- info.cancel = true;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -239,7 +239,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- slSpread.bind(spreadNS.Events.EditEnding, stageTreeSpreadObj.editEnding);
|
|
|
+ slSpread.bind(spreadNS.Events.EditEnded, stageTreeSpreadObj.editEnded);
|
|
|
slSpread.bind(spreadNS.Events.SelectionChanged, stageTreeSpreadObj.selectionChanged);
|
|
|
slSpread.bind(spreadNS.Events.ClipboardPasting, stageTreeSpreadObj.clipboardPasting);
|
|
|
slSpread.bind(spreadNS.Events.ClipboardPasted, stageTreeSpreadObj.clipboardPasted);
|
|
@@ -258,17 +258,17 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.loadSheetData(spSpread.getActiveSheet(), 'data', []);
|
|
|
}
|
|
|
},
|
|
|
- editEnding: function(e, info) {
|
|
|
+ editEdited: function (e, info) {
|
|
|
if (info.sheet.zh_setting) {
|
|
|
// 未改变过,则直接跳过
|
|
|
- const orgText = info.sheet.getCell(info.row, info.row).value();
|
|
|
+ const posData = info.sheet.zh_data ? info.sheet.zh_data[info.row] : null;
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ const orgText = posData ? posData[col.field] : null;
|
|
|
if (orgText === info.editingText || ((!orgText || orgText === '') && (info.editingText === ''))) {
|
|
|
- info.cancel = true;
|
|
|
return;
|
|
|
}
|
|
|
// 台账模式下,不可新增
|
|
|
- const pos = info.sheet.zh_data ? info.sheet.zh_data[info.row] : null;
|
|
|
- if (checkTzMeasureType() && !pos) {
|
|
|
+ if (checkTzMeasureType() && !posData) {
|
|
|
toast('台账模式不可新增部位明细数据', 'error');
|
|
|
info.cancel = true;
|
|
|
return ;
|
|
@@ -277,18 +277,18 @@ $(document).ready(() => {
|
|
|
const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
if (!node) {
|
|
|
toast('数据错误, 请刷新页面后再试', 'warning');
|
|
|
- info.cancel = true;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
} else if (info.editingText !== '' && node.children && node.children > 0) {
|
|
|
toast('父节点不可插入部位明细', 'error');
|
|
|
- info.cancel = true;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
} else if (info.editingText !== '' && !node.b_code || node.b_code === '') {
|
|
|
toast('项目节不可插入部位明细', 'error');
|
|
|
- info.cancel = true;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
return;
|
|
|
}
|
|
|
- const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ // 生成提交数据
|
|
|
const data = {};
|
|
|
if (col.field === 'name') {
|
|
|
if (info.editingText === '' && pos) {
|
|
@@ -313,6 +313,7 @@ $(document).ready(() => {
|
|
|
data.updateData = {pid: pos.id, lid: pos.lid};
|
|
|
data.updateData[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText;
|
|
|
}
|
|
|
+ // 提交数据到服务器
|
|
|
postData(window.location.pathname + '/update', {pos: data}, function (result) {
|
|
|
if (result.pos) {
|
|
|
stagePos.updateDatas(result.pos.pos);
|
|
@@ -479,7 +480,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
stagePosSpreadObj.loadCurPosData();
|
|
|
});
|
|
|
- spSpread.bind(spreadNS.Events.EditEnding, stagePosSpreadObj.editEnding);
|
|
|
+ spSpread.bind(spreadNS.Events.EditEnded, stagePosSpreadObj.editEnded);
|
|
|
spSpread.bind(spreadNS.Events.ClipboardPasting, stagePosSpreadObj.clipboardPasting);
|
|
|
spSpread.bind(spreadNS.Events.ClipboardPasted, stagePosSpreadObj.clipboardPasted);
|
|
|
SpreadJsObj.addDeleteBind(spSpread, stagePosSpreadObj.deletePress);
|