|
@@ -606,10 +606,17 @@ var projectObj = {
|
|
|
};
|
|
|
return t;
|
|
|
};
|
|
|
- function getPasteTextArr() {
|
|
|
+ function getPasteTextArr(info) {
|
|
|
let copyText = info.pasteData.text.trim();
|
|
|
- let arr = copyText.split('\r\n');
|
|
|
- return arr;
|
|
|
+ if (!copyText) return null;
|
|
|
+ let rows = copyText.split('\r\n');
|
|
|
+ let rstArr = [];
|
|
|
+ for (let row of rows) {
|
|
|
+ row = row.trim();
|
|
|
+ row = row.split('\t');
|
|
|
+ rstArr.push(row);
|
|
|
+ }
|
|
|
+ return rstArr;
|
|
|
};
|
|
|
function getPasteNodes(count, nodeType) {
|
|
|
let nodesArr = [];
|
|
@@ -660,22 +667,22 @@ var projectObj = {
|
|
|
|
|
|
return nodesArr;
|
|
|
};
|
|
|
- function doPaste(texts, nodes, nodeType) {
|
|
|
- if (nodeType == 1){
|
|
|
+ function doPaste(datas, nodes, nodeType) {
|
|
|
+ if (nodeType == 1){ // 批量粘贴定额有严重的异步问题,这里要和清单分开处理
|
|
|
let updateRationCodes = [];
|
|
|
- for (let i = 0; i < texts.length; i++) {
|
|
|
+ for (let i = 0; i < datas.length; i++) {
|
|
|
let ptNode = nodes[i];
|
|
|
- let ptText = texts[i];
|
|
|
- updateRationCodes.push({'node':ptNode, value:ptText});
|
|
|
+ let code = datas[i][0];
|
|
|
+ updateRationCodes.push({'node':ptNode, value:code});
|
|
|
}
|
|
|
projectObj.project.Ration.updateRationCodes(updateRationCodes);
|
|
|
}
|
|
|
else {
|
|
|
- for (let i = 0; i < texts.length; i++) {
|
|
|
+ for (let i = 0; i < datas.length; i++) {
|
|
|
let ptNode = nodes[i];
|
|
|
- let ptText = texts[i];
|
|
|
- if (!(ptNode.data && ptNode.data.code && ptNode.data.code.sameText(ptText))){
|
|
|
- projectObj.updateCode(ptNode, ptText);
|
|
|
+ let code = datas[i][0];
|
|
|
+ if (!(ptNode.data && ptNode.data.code && ptNode.data.code.sameText(code))){
|
|
|
+ projectObj.updateCode(ptNode, code);
|
|
|
};
|
|
|
}
|
|
|
}
|
|
@@ -688,9 +695,10 @@ var projectObj = {
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
- let textArr = getPasteTextArr();
|
|
|
- let pasteNodes = getPasteNodes(textArr.length, tagType);
|
|
|
- doPaste(textArr, pasteNodes, tagType);
|
|
|
+ let datas = getPasteTextArr(info);
|
|
|
+ if (!datas) return;
|
|
|
+ let pasteNodes = getPasteNodes(datas.length, tagType);
|
|
|
+ doPaste(datas, pasteNodes, tagType);
|
|
|
};
|
|
|
},
|
|
|
mainSpreadEditEnded: function (sender, info) {
|