|
@@ -27,7 +27,7 @@ var blockLibObj = {
|
|
|
"font":["Arial"]
|
|
|
},
|
|
|
"data":{
|
|
|
- "field":"name",
|
|
|
+ "field":"nodeName",
|
|
|
"vAlign":1,
|
|
|
"hAlign":0,
|
|
|
"font":"Arial"
|
|
@@ -70,14 +70,14 @@ var blockLibObj = {
|
|
|
$.bootstrapLoading.start();
|
|
|
let me = this;
|
|
|
me.mainDatas = [
|
|
|
- {ID: 1, ParentID: -1, NextSiblingID: 2, name: '分类1', type: 1},
|
|
|
- {ID: 2, ParentID: -1, NextSiblingID: 3, name: '分类2', type: 1},
|
|
|
- {ID: 3, ParentID: -1, NextSiblingID: 4, name: '分类3', type: 1},
|
|
|
+ {ID: 1, ParentID: -1, NextSiblingID: 2, nodeName: '分类1', type: 1},
|
|
|
+ {ID: 2, ParentID: -1, NextSiblingID: 3, nodeName: '分类2', type: 1},
|
|
|
+ {ID: 3, ParentID: -1, NextSiblingID: 4, nodeName: '分类3', type: 1},
|
|
|
// {ID: 105, ParentID: 1, NextSiblingID: 106, name: '块1', type: 2},
|
|
|
// {ID: 106, ParentID: 1, NextSiblingID: 107, name: '块2', type: 2},
|
|
|
- {ID: 7, ParentID: -1, NextSiblingID: 8, name: '分类7', type: 1},
|
|
|
- {ID: 9, ParentID: -1, NextSiblingID: -1, name: '分类9', type: 1}//,
|
|
|
- // {ID: 201, ParentID: 52, NextSiblingID: -1, name: '块201', type: 2}
|
|
|
+ {ID: 7, ParentID: -1, NextSiblingID: 8, nodeName: '分类7', type: 1},
|
|
|
+ {ID: 9, ParentID: -1, NextSiblingID: -1, nodeName: '分类9', type: 1}//,
|
|
|
+ // {ID: 201, ParentID: 52, NextSiblingID: -1, nodeName: '块201', type: 2}
|
|
|
];
|
|
|
|
|
|
if (me.mainSpread) {
|
|
@@ -366,7 +366,7 @@ var blockLibObj = {
|
|
|
|
|
|
let newNode = tree.insert(pID, nID);
|
|
|
newNode.data.type = nodeType;
|
|
|
- newNode.data.fileName = nodeName;
|
|
|
+ newNode.data.nodeName = nodeName;
|
|
|
if (nodeType == 2){
|
|
|
let bill = source.datas[0];
|
|
|
newNode.data.compilationID = source.compilationID;
|
|
@@ -401,7 +401,7 @@ var blockLibObj = {
|
|
|
let idx = tree.items.indexOf(newNode);
|
|
|
sheet.addRows(idx, 1);
|
|
|
sheet.getRange(idx, 0, 1, 1).locked(true);
|
|
|
- sheet.setValue(idx, 0, newNode.data.fileName);
|
|
|
+ sheet.setValue(idx, 0, newNode.data.nodeName);
|
|
|
sheet.setSelection(idx, 0, 1, 1);
|
|
|
|
|
|
sheet.resumeEvent();
|
|
@@ -409,7 +409,7 @@ var blockLibObj = {
|
|
|
},
|
|
|
reName: function (node, newName){
|
|
|
if (newName == '') return;
|
|
|
- node.data.fileName = newName;
|
|
|
+ node.data.nodeName = newName;
|
|
|
let idx = blockLibObj.mainTree.items.indexOf(node);
|
|
|
blockLibObj.mainSheet.setValue(idx, 0, newName);
|
|
|
},
|
|
@@ -455,10 +455,11 @@ var blockLibObj = {
|
|
|
name: '一对一克隆',
|
|
|
icon: "fa-battery-empty",
|
|
|
disabled: function () {
|
|
|
-
|
|
|
+ let ok = me.curIsBlock() && calcTools.isLeafBill(projectObj.project.mainTree.selected);
|
|
|
+ return !ok;
|
|
|
},
|
|
|
visible: function(key, opt){
|
|
|
- return me.curIsBlock();
|
|
|
+ return true;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
me.onCellDoubleClick();
|
|
@@ -468,10 +469,11 @@ var blockLibObj = {
|
|
|
name: '一对多克隆',
|
|
|
icon: "fa-battery-half",
|
|
|
disabled: function () {
|
|
|
-
|
|
|
+ let ok = me.curIsBlock() && calcTools.isParentBill(projectObj.project.mainTree.selected);
|
|
|
+ return !ok;
|
|
|
},
|
|
|
visible: function(key, opt){
|
|
|
- return me.curIsBlock();
|
|
|
+ return true;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
|
|
@@ -481,10 +483,11 @@ var blockLibObj = {
|
|
|
name: '多对多克隆',
|
|
|
icon: "fa-battery-full",
|
|
|
disabled: function () {
|
|
|
-
|
|
|
+ let ok = me.curIsCategory() && calcTools.isParentBill(projectObj.project.mainTree.selected);
|
|
|
+ return !ok;
|
|
|
},
|
|
|
visible: function(key, opt){
|
|
|
- return me.curIsCategory();
|
|
|
+ return true;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
|
|
@@ -500,7 +503,10 @@ var blockLibObj = {
|
|
|
return true;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
- me.delete();
|
|
|
+ let name = hintBox.fontRed(me.mainTree.selected.data.nodeName);
|
|
|
+ hintBox.infoBox('操作确认', `确定要删除"${name}"吗?`, 2, function () {
|
|
|
+ me.delete();
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
"moveBlock": {
|
|
@@ -510,7 +516,8 @@ var blockLibObj = {
|
|
|
return true;
|
|
|
},
|
|
|
visible: function(key, opt){
|
|
|
- return me.curIsBlock();
|
|
|
+ // return me.curIsBlock();
|
|
|
+ return false;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
|
|
@@ -565,12 +572,12 @@ $(document).ready(function(){
|
|
|
|
|
|
$('#btn_block_reName').on('click', function (){
|
|
|
let select = blockLibObj.mainTree.selected;
|
|
|
- $('#input_block_reName').val(select.data.fileName);
|
|
|
+ $('#input_block_reName').val(select.data.nodeName);
|
|
|
});
|
|
|
|
|
|
$('#btn_block_reName_OK').on('click', function (){
|
|
|
let select = blockLibObj.mainTree.selected;
|
|
|
- let oldName = select.data.fileName;
|
|
|
+ let oldName = select.data.nodeName;
|
|
|
let newName = $('#input_block_reName').val();
|
|
|
if (oldName != newName) blockLibObj.reName(select, newName);
|
|
|
});
|