|
@@ -139,7 +139,7 @@ let calcProgramManage = {
|
|
|
items: {
|
|
|
"copyTemplate": {
|
|
|
name: "另存为",
|
|
|
- icon: 'fa-sign-in',
|
|
|
+ icon: 'copy',
|
|
|
callback: function (key, opt) {
|
|
|
$.bootstrapLoading.start();
|
|
|
let template = calcProgramManage.getSelectionInfo().template;
|
|
@@ -174,6 +174,52 @@ let calcProgramManage = {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ "reNameTemplate": {
|
|
|
+ name: "重命名...",
|
|
|
+ icon: 'edit',
|
|
|
+ disabled: function () {
|
|
|
+ let custom = calcProgramManage.getSelectionInfo().template.custom;
|
|
|
+ let canReName = custom ? custom : false;
|
|
|
+ return !canReName;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ let template = calcProgramManage.getSelectionInfo().template;
|
|
|
+ let idx = calcProgramManage.mainSpread.getActiveSheet().getActiveRowIndex();
|
|
|
+
|
|
|
+ let newName = prompt("请输入新的模板名称:", template.name);
|
|
|
+ if (!newName || (newName && newName == template.name)) {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ return;
|
|
|
+ };
|
|
|
+
|
|
|
+ while (analyzer.templateNameIsExist(newName)){
|
|
|
+ alert(`“${newName}”已存在,请重新输入!`);
|
|
|
+ newName = prompt("请输入新的模板名称:", template.name);
|
|
|
+ };
|
|
|
+
|
|
|
+ if (!newName || (newName && newName == template.name)) {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ return;
|
|
|
+ };
|
|
|
+
|
|
|
+ template.name = newName;
|
|
|
+
|
|
|
+ let data = {
|
|
|
+ 'projectID': projectObj.project.ID(),
|
|
|
+ 'ID': template.ID,
|
|
|
+ 'name': template.name
|
|
|
+ };
|
|
|
+ calcProgramManage.updateTemplate(data, function (rst) {
|
|
|
+ if (rst){
|
|
|
+ projectObj.project.calcProgram.compileTemplate(template);
|
|
|
+ sheetCommonObj.showData(calcProgramManage.mainSpread.getSheet(0), calcProgramManage.mainSetting, calcProgramManage.datas);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }
|
|
|
+ else $.bootstrapLoading.end();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
"spr1": '--------',
|
|
|
"deleteTemplate": {
|
|
|
name: '删除',
|
|
@@ -244,6 +290,7 @@ let calcProgramManage = {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ "spr1": '--------',
|
|
|
"deleteCalcItem": {
|
|
|
name: '删除行',
|
|
|
icon: 'fa-remove',
|