|
@@ -60,6 +60,7 @@ let calcProgramManage = {
|
|
|
me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.ValueChanged, me.onDetailValueChanged);
|
|
|
me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
|
|
|
me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.EnterCell, me.onDetailEnterCell);
|
|
|
+ me.detailSpread.getSheet(0).bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
|
|
|
|
|
|
let mSheet = me.mainSpread.getSheet(0);
|
|
|
sheetCommonObj.showData(mSheet, me.mainSetting, me.datas);
|
|
@@ -159,6 +160,9 @@ let calcProgramManage = {
|
|
|
// let e = `ID:${c.ID} ${c.expression} ${c.dispExpr} ${c.dispExprUser} ${c.compiledExpr} ${c.custom}`;
|
|
|
// projectObj.testDisplay('', e);
|
|
|
},
|
|
|
+ onClipboardPasting: function (sender, args) {
|
|
|
+ args.cancel = true;
|
|
|
+ },
|
|
|
loadMainContextMenu: function () {
|
|
|
$.contextMenu({
|
|
|
selector: '#mainSpread',
|
|
@@ -216,7 +220,7 @@ let calcProgramManage = {
|
|
|
let idx = calcProgramManage.mainSpread.getActiveSheet().getActiveRowIndex();
|
|
|
|
|
|
let newName = '';
|
|
|
- hintBox.valueBox('请输入新的模板名称:', template.name, function () {
|
|
|
+ hintBox.valueBox('重命名', template.name, function () {
|
|
|
newName = hintBox.value;
|
|
|
|
|
|
if (!newName){
|
|
@@ -243,6 +247,7 @@ let calcProgramManage = {
|
|
|
calcProgramManage.updateTemplate(data, function (rst) {
|
|
|
if (rst){
|
|
|
projectObj.project.calcProgram.compileTemplateMaps();
|
|
|
+ projectObj.mainController.refreshTreeNode(calcTools.getNodesByProgramID(template.ID));
|
|
|
sheetCommonObj.showData(calcProgramManage.mainSpread.getSheet(0), calcProgramManage.mainSetting, calcProgramManage.datas);
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
@@ -260,28 +265,29 @@ let calcProgramManage = {
|
|
|
return !canDelete;
|
|
|
},
|
|
|
callback: function () {
|
|
|
- $.bootstrapLoading.start();
|
|
|
let template = calcProgramManage.getSelectionInfo().template;
|
|
|
if (analyzer.templateIsUsed(template.ID)) {
|
|
|
$.bootstrapLoading.end();
|
|
|
hintBox.infoBox('系统提示', `计算模板“${template.name}”已被使用,不允许删除!`, 1);
|
|
|
return;
|
|
|
- }
|
|
|
- let data = {
|
|
|
- 'projectID': projectObj.project.ID(),
|
|
|
- 'ID': template.ID
|
|
|
};
|
|
|
- calcProgramManage.deleteTemplate(data, function (rst) {
|
|
|
- if (rst){
|
|
|
- let idx = calcProgramManage.mainSpread.getActiveSheet().getActiveRowIndex();
|
|
|
- projectObj.project.calcProgram.templates.splice(idx, 1);
|
|
|
- projectObj.project.calcProgram.compileTemplateMaps();
|
|
|
- calcProgramManage.buildSheet();
|
|
|
- calcProgramManage.mainSpread.getActiveSheet().setSelection(idx - 1, 0, 1, 1);
|
|
|
- calcProgramManage.refreshDetailSheet();
|
|
|
- }
|
|
|
- });
|
|
|
- $.bootstrapLoading.end();
|
|
|
+ hintBox.infoBox('系统提示', `确定要删除计算模板“${template.name}”吗?`, 2, cbYes);
|
|
|
+ function cbYes() {
|
|
|
+ let data = {
|
|
|
+ 'projectID': projectObj.project.ID(),
|
|
|
+ 'ID': template.ID
|
|
|
+ };
|
|
|
+ calcProgramManage.deleteTemplate(data, function (rst) {
|
|
|
+ if (rst){
|
|
|
+ let idx = calcProgramManage.mainSpread.getActiveSheet().getActiveRowIndex();
|
|
|
+ projectObj.project.calcProgram.templates.splice(idx, 1);
|
|
|
+ projectObj.project.calcProgram.compileTemplateMaps();
|
|
|
+ calcProgramManage.buildSheet();
|
|
|
+ calcProgramManage.mainSpread.getActiveSheet().setSelection(idx - 1, 0, 1, 1);
|
|
|
+ calcProgramManage.refreshDetailSheet();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -399,11 +405,13 @@ let calcProgramManage = {
|
|
|
);
|
|
|
},
|
|
|
deleteTemplate: function (data, callback) {
|
|
|
+ $.bootstrapLoading.start();
|
|
|
CommonAjax.post('/calcProgram/deleteTemplate', data,
|
|
|
function (result) {
|
|
|
if(callback){
|
|
|
callback(result);
|
|
|
}
|
|
|
+ $.bootstrapLoading.end();
|
|
|
}
|
|
|
);
|
|
|
},
|