|
@@ -121,14 +121,14 @@ let calcProgramManage = {
|
|
|
}
|
|
|
},
|
|
|
onEnterCell: function (sender, args) {
|
|
|
- let t = calcProgramManage.getSelectionInfo().template;
|
|
|
- let c = calcProgramManage.getSelectionInfo().calcItem;
|
|
|
- let lc = analyzer.calcItemLabourCoe(c);
|
|
|
- c.dispExpr = analyzer.getDispExpr(c.expression, t);
|
|
|
- c.dispExprUser = analyzer.getDispExprUser(c.dispExpr, lc);
|
|
|
- c.compiledExpr = analyzer.getCompiledExpr(c.expression, lc);
|
|
|
- let e = `ID:${c.ID} ${c.expression} ${c.dispExpr} ${c.dispExprUser} ${c.compiledExpr} ${c.custom}`;
|
|
|
- projectObj.testDisplay('', e);
|
|
|
+ // let t = calcProgramManage.getSelectionInfo().template;
|
|
|
+ // let c = calcProgramManage.getSelectionInfo().calcItem;
|
|
|
+ // let lc = analyzer.calcItemLabourCoe(c);
|
|
|
+ // c.dispExpr = analyzer.getDispExpr(c.expression, t);
|
|
|
+ // c.dispExprUser = analyzer.getDispExprUser(c.dispExpr, lc);
|
|
|
+ // c.compiledExpr = analyzer.getCompiledExpr(c.expression, lc);
|
|
|
+ // let e = `ID:${c.ID} ${c.expression} ${c.dispExpr} ${c.dispExprUser} ${c.compiledExpr} ${c.custom}`;
|
|
|
+ // projectObj.testDisplay('', e);
|
|
|
},
|
|
|
loadMainContextMenu: function () {
|
|
|
$.contextMenu({
|
|
@@ -167,7 +167,6 @@ let calcProgramManage = {
|
|
|
calcProgramManage.buildSheet();
|
|
|
calcProgramManage.mainSpread.getActiveSheet().setSelection(ts.length - 1, 0, 1, 1);
|
|
|
calcProgramManage.refreshDetailSheet();
|
|
|
- // projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
else $.bootstrapLoading.end();
|
|
@@ -231,9 +230,15 @@ let calcProgramManage = {
|
|
|
},
|
|
|
callback: function () {
|
|
|
$.bootstrapLoading.start();
|
|
|
+ let template = calcProgramManage.getSelectionInfo().template;
|
|
|
+ if (analyzer.templateIsUsed(template.ID)) {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ alert(`计算模板“${template.name}”已被使用,不允许删除!`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
let data = {
|
|
|
'projectID': projectObj.project.ID(),
|
|
|
- 'ID': calcProgramManage.getSelectionInfo().template.ID
|
|
|
+ 'ID': template.ID
|
|
|
};
|
|
|
calcProgramManage.deleteTemplate(data, function (rst) {
|
|
|
if (rst){
|
|
@@ -243,7 +248,6 @@ let calcProgramManage = {
|
|
|
calcProgramManage.buildSheet();
|
|
|
calcProgramManage.mainSpread.getActiveSheet().setSelection(idx - 1, 0, 1, 1);
|
|
|
calcProgramManage.refreshDetailSheet();
|
|
|
- // projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
else $.bootstrapLoading.end();
|
|
@@ -269,7 +273,7 @@ let calcProgramManage = {
|
|
|
|
|
|
let newItem = {};
|
|
|
newItem.ID = analyzer.calcItemMaxID(template) + 1;
|
|
|
- newItem.name = '新建';
|
|
|
+ // newItem.name = '新建';
|
|
|
newItem.memo = '自定义';
|
|
|
newItem.custom = true;
|
|
|
newItem.expression = '0';
|
|
@@ -284,7 +288,7 @@ let calcProgramManage = {
|
|
|
projectObj.project.calcProgram.compileTemplate(template);
|
|
|
calcProgramManage.refreshDetailSheet();
|
|
|
calcProgramManage.detailSpread.getActiveSheet().setSelection(idx + 1, 0, 1, 1);
|
|
|
- // projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
});
|
|
@@ -314,6 +318,7 @@ let calcProgramManage = {
|
|
|
if (rst){
|
|
|
projectObj.project.calcProgram.compileTemplate(template);
|
|
|
calcProgramManage.refreshDetailSheet();
|
|
|
+ projectObj.project.calcProgram.calcAllNodesAndSave();
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
});
|