|
|
@@ -138,6 +138,20 @@ const billsGuidance = (function () {
|
|
|
row = sheet.getActiveColumnIndex(),
|
|
|
col = sheet.getActiveColumnIndex();
|
|
|
if (compareData.postData.length > 0) {
|
|
|
+ //如果插入的是固定清单,则需要判断该固定清单在造价书中是否已存在,造价书中不可存在相同的固定清单
|
|
|
+ let fixedDatas = compareData.postData.filter((data) =>
|
|
|
+ data.updateType === updateType.create && Array.isArray(data.updateData.flags));
|
|
|
+ if (fixedDatas.length > 0) {
|
|
|
+ //提示已存在此固定清单并且定位
|
|
|
+ let firstFixed = fixedDatas[0].updateData;
|
|
|
+ let existNode = projectObj.project.mainTree.items.find((node) =>
|
|
|
+ node.data && node.data.flagsIndex && node.data.flagsIndex.fixed && node.data.flagsIndex.fixed.flag === firstFixed.flags[0].flag);
|
|
|
+ if (existNode) {
|
|
|
+ alert(`固定清单<strong>“${firstFixed.name}”</strong>已被第${existNode.serialNo() + 1}行清单占用。`);
|
|
|
+ locateAtSpread(sheet, existNode.serialNo(), col);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
isInserting = true;
|
|
|
CommonAjax.post('/bills/insertBills', {postData: compareData.postData}, function () {
|
|
|
//插入
|
|
|
@@ -163,9 +177,7 @@ const billsGuidance = (function () {
|
|
|
//该清单节点在主树的位置
|
|
|
row = projectObj.project.mainTree.nodes[projectObj.project.mainTree.prefix + compareData.locateNode.data.ID].serialNo();
|
|
|
}
|
|
|
- sheet.setSelection(row, col, 1, 1);
|
|
|
- projectObj.mainController.setTreeSelected(projectObj.mainController.tree.items[row]);//触发树节点选中事件
|
|
|
- sheet.showRow(row, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
+ locateAtSpread(sheet, row, col);
|
|
|
isInserting = false;
|
|
|
}, function () {
|
|
|
isInserting = false;
|
|
|
@@ -173,11 +185,14 @@ const billsGuidance = (function () {
|
|
|
} else if (compareData.locateNode) {
|
|
|
//该清单节点在主树的位置
|
|
|
row = projectObj.project.mainTree.nodes[projectObj.project.mainTree.prefix + compareData.locateNode.data.ID].serialNo();
|
|
|
- sheet.setSelection(row, col, 1, 1);
|
|
|
- projectObj.mainController.setTreeSelected(projectObj.mainController.tree.items[row]);//触发树节点选中事件
|
|
|
- sheet.showRow(row, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
+ locateAtSpread(sheet, row, col);
|
|
|
}
|
|
|
}
|
|
|
+ function locateAtSpread(sheet, row, col) {
|
|
|
+ sheet.setSelection(row, col, 1, 1);
|
|
|
+ projectObj.mainController.setTreeSelected(projectObj.mainController.tree.items[row]);//触发树节点选中事件
|
|
|
+ sheet.showRow(row, GC.Spread.Sheets.VerticalPosition.center);
|
|
|
+ }
|
|
|
/*
|
|
|
*
|
|
|
* 1.选中的树结构(清单规则选中的节点及其所有父项)与主树对比(主树中节点“编码-名称-单位”与选中树~组合相同视为同一节点),
|
|
|
@@ -336,6 +351,10 @@ const billsGuidance = (function () {
|
|
|
stdData.comments = stdNode.data.comments;
|
|
|
stdData.programID = stdNode.data.engineering;
|
|
|
stdData.billsLibId = stdNode.data.billsLibId;
|
|
|
+ if (stdNode.data.fixedFlag) {
|
|
|
+ stdData.flags = [{flag : stdNode.data.fixedFlag, fieldName : 'fixed'}];
|
|
|
+ stdData.flagsIndex = {fixed: {fieldName: 'fixed', flag: stdNode.data.fixedFlag}}; //前端用
|
|
|
+ }
|
|
|
return stdData;
|
|
|
}
|
|
|
//从同层节点中获取更新数据
|