|
@@ -42,7 +42,6 @@ $(document).ready(function() {
|
|
|
SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
|
|
|
// 加载台账数据到界面
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
|
-
|
|
|
// 初始化 部位明细
|
|
|
const pos = new PosData({
|
|
|
id: 'id', ledgerId: 'lid',
|
|
@@ -318,6 +317,14 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (col.field === 'b_code' && (info.editingText === '' || !info.editingText)) {
|
|
|
+ const lPos = pos.getLedgerPos(node.id);
|
|
|
+ if (lPos && lPos.length > 0) {
|
|
|
+ toast('清单含有部位明细,请先删除部位明细,再删除清单编号', 'error');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// 获取更新数据
|
|
|
if (info.editingText) {
|
|
@@ -342,8 +349,11 @@ $(document).ready(function() {
|
|
|
if (!tree) { return; }
|
|
|
|
|
|
const sortData = info.sheet.zh_tree.nodes;
|
|
|
- const datas = [], nodes = [];
|
|
|
+ const datas = [], filterNodes = [];
|
|
|
+ let bHint = false, bPaste;
|
|
|
+
|
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
|
|
|
+ bPaste = false;
|
|
|
const curRow = info.cellRange.row + iRow;
|
|
|
const node = sortData[curRow];
|
|
|
if (node) {
|
|
@@ -351,16 +361,37 @@ $(document).ready(function() {
|
|
|
for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
const curCol = info.cellRange.col + iCol;
|
|
|
const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
- data[colSetting.field] = info.sheet.getText(curRow, curCol).replace('\n', '');
|
|
|
+ const value = info.sheet.getText(curRow, curCol).replace('\n', '');
|
|
|
+ if (colSetting.field === 'b_code' && value === '') {
|
|
|
+ if (!bHint) {
|
|
|
+ toast('清单含有部位明细,请先删除部位明细,再删除清单编号', 'warning');
|
|
|
+ bHint = true;
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ data[colSetting.field] = value;
|
|
|
+ bPaste = true;
|
|
|
+ }
|
|
|
+ if (bPaste) {
|
|
|
+ datas.push(data);
|
|
|
+ } else {
|
|
|
+ filterNodes.push(node);
|
|
|
}
|
|
|
- datas.push(data);
|
|
|
- nodes.push(node);
|
|
|
}
|
|
|
}
|
|
|
console.log(JSON.stringify(datas));
|
|
|
- info.sheet.zh_tree.update('/tender/' + getTenderId() + '/ledger/update', datas, function (result) {
|
|
|
- treeOperationObj.refreshTree(info.sheet, result);
|
|
|
- });
|
|
|
+ if (datas.length > 0) {
|
|
|
+ info.sheet.zh_tree.update('/tender/' + getTenderId() + '/ledger/update', datas, function (result) {
|
|
|
+ if (result.update) {
|
|
|
+ result.update.concat(filterNodes);
|
|
|
+ }
|
|
|
+ treeOperationObj.refreshTree(info.sheet, result);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ treeOperationObj.refreshTree(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
@@ -375,12 +406,24 @@ $(document).ready(function() {
|
|
|
const sortData = sheet.zh_tree.nodes;
|
|
|
const datas = [], nodes = [];
|
|
|
const sel = sheet.getSelections()[0];
|
|
|
+ let bHint = false;
|
|
|
for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow++) {
|
|
|
const node = sortData[iRow];
|
|
|
if (node) {
|
|
|
let bDel = false;
|
|
|
const data = sheet.zh_tree.getNodeKeyData(node);
|
|
|
for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
+ const col = sheet.zh_setting.cols[iCol];
|
|
|
+ if (col.field === 'b_code') {
|
|
|
+ const lPos = pos.getLedgerPos(node.id);
|
|
|
+ if (lPos && lPos.length > 0) {
|
|
|
+ if (!bHint) {
|
|
|
+ toast('清单含有部位明细,请先删除部位明细,再删除清单编号', 'warning');
|
|
|
+ bHint = true;
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
const style = sheet.getStyle(iRow, iCol);
|
|
|
if (!style.locked) {
|
|
|
const colSetting = sheet.zh_setting.cols[iCol];
|