|
@@ -132,18 +132,14 @@ var blockLibObj = {
|
|
|
loadDetailDatas: function (node){
|
|
|
let me = this;
|
|
|
if (node.data.type == 2){
|
|
|
- let sourceNode = node.data.sourceNode;
|
|
|
- let rations = sourceNode.children;
|
|
|
- let rationDatas = [];
|
|
|
- for (let r of rations){
|
|
|
- rationDatas.push(r.data);
|
|
|
- };
|
|
|
- sheetCommonObj.showData(me.billSheet, me.billSetting, [sourceNode.data]);
|
|
|
- me.changeBillText(sourceNode.data);
|
|
|
- let rCount = (rationDatas.length > 0) ? rationDatas.length : 1;
|
|
|
+ let bill = node.data.datas[0];
|
|
|
+ let rations = bill.children;
|
|
|
+ sheetCommonObj.showData(me.billSheet, me.billSetting, [bill]);
|
|
|
+ me.changeBillText(bill);
|
|
|
+ let rCount = (rations.length > 0) ? rations.length : 1;
|
|
|
me.rationSheet.setRowCount(rCount, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
- sheetCommonObj.showData(me.rationSheet, me.rationSetting, rationDatas);
|
|
|
- me.changeRationText(rationDatas);
|
|
|
+ sheetCommonObj.showData(me.rationSheet, me.rationSetting, rations);
|
|
|
+ me.changeRationText(rations);
|
|
|
}
|
|
|
else{
|
|
|
sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
|
|
@@ -349,7 +345,7 @@ var blockLibObj = {
|
|
|
};
|
|
|
return new TreeCell();
|
|
|
},
|
|
|
- newNode: function (nodeType, nodeName, categoryID, sourceNode){ // 1 分类(只用前两个参数) 2 块文件
|
|
|
+ newNode: function (nodeType, nodeName, categoryID, source){ // 1 分类(只用前两个参数) 2 块文件
|
|
|
let tree = blockLibObj.mainTree;
|
|
|
let pID = -1, nID = -1;
|
|
|
let select = tree.selected;
|
|
@@ -372,8 +368,14 @@ var blockLibObj = {
|
|
|
let newNode = tree.insert(pID, nID);
|
|
|
newNode.data.type = nodeType;
|
|
|
newNode.data.name = nodeName;
|
|
|
- if (nodeType == 2)
|
|
|
- newNode.data.sourceNode = sourceNode;
|
|
|
+ if (nodeType == 2){
|
|
|
+ newNode.data.compilationID = source.compilationID;
|
|
|
+ newNode.data.copyTime = source.copyTime;
|
|
|
+ newNode.data.firstNodeType = source.firstNodeType;
|
|
|
+ newNode.data.isFBFX = source.isFBFX;
|
|
|
+ newNode.data.datas = source.datas;
|
|
|
+ }
|
|
|
+
|
|
|
tree.selected = newNode;
|
|
|
|
|
|
let sheet = blockLibObj.mainSheet;
|
|
@@ -458,7 +460,7 @@ var blockLibObj = {
|
|
|
return me.curIsBlock();
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
-
|
|
|
+ me.oneToOneClone();
|
|
|
}
|
|
|
},
|
|
|
"oneToMoreClone": {
|
|
@@ -521,8 +523,23 @@ var blockLibObj = {
|
|
|
me.mainTree.selected = me.mainTree.items[me.mainSheet.getActiveRowIndex()];
|
|
|
},
|
|
|
onCellDoubleClick: function (sender, args) {
|
|
|
+ blockLibObj.oneToOneClone();
|
|
|
+ },
|
|
|
+ oneToOneClone: function () {
|
|
|
let me = blockLibObj;
|
|
|
- //
|
|
|
+ let projectNode = projectObj.project.mainTree.selected;
|
|
|
+ if (!calcTools.isLeafBill(projectNode)) return;
|
|
|
+
|
|
|
+ let block = me.mainTree.selected.data;
|
|
|
+ // 这里再次封装成伟城的块文件格式,可直接使用伟城的“粘贴块”接口。前提:当前块文件的全部数据已从后台取到前台。
|
|
|
+ let vBlock_WC = {
|
|
|
+ compilationID: block.compilationID,
|
|
|
+ copyTime: block.copyTime,
|
|
|
+ firstNodeType: 1, // 强制改成1。这里跟粘贴块有区别,忽略叶子清单层,直接从定额开始,即始终强制在叶子清单下插入定额。
|
|
|
+ isFBFX: block.isFBFX,
|
|
|
+ datas: block.datas[0].children // rations
|
|
|
+ };
|
|
|
+ BlockController.confirmPaste(vBlock_WC, projectNode, 'sub');
|
|
|
}
|
|
|
};
|
|
|
|