|
|
@@ -550,7 +550,6 @@ $(document).ready(function() {
|
|
|
getTagHtml: function (index, data) {
|
|
|
if (!data) return;
|
|
|
const getHtml = function (list) {
|
|
|
- console.log(list);
|
|
|
if (!list || list.length === 0) return '';
|
|
|
const html = [];
|
|
|
for (const l of list) {
|
|
|
@@ -801,6 +800,13 @@ $(document).ready(function() {
|
|
|
clipboardPasting(e, info) {
|
|
|
info.cancel = true;
|
|
|
|
|
|
+ const relaBills = detailObj.billsNode;
|
|
|
+ if (!relaBills) {
|
|
|
+ toastr.error('数据错误,请选择台账节点后再试');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
const pasteData = info.pasteData.html
|
|
|
? SpreadJsObj.analysisPasteHtml(info.pasteData.html)
|
|
|
: (info.pasteData.text === ''
|
|
|
@@ -809,30 +815,20 @@ $(document).ready(function() {
|
|
|
const hint = {
|
|
|
invalidExpr: {type: 'warning', msg: '粘贴的表达式非法'},
|
|
|
};
|
|
|
- const datas = [], filterNodes = [];
|
|
|
+ const updateDatas = [], insertDatas = [], filterNodes = [], order = info.sheet.zh_data.length > 0 ? info.sheet.zh_data[info.sheet.zh_data.length - 1].d_order : 0;
|
|
|
|
|
|
- // todo
|
|
|
- let level, filterRow = 0;
|
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow ++) {
|
|
|
const curRow = info.cellRange.row + iRow;
|
|
|
const node = info.sheet.zh_data[curRow];
|
|
|
- if (!node) continue;
|
|
|
+ if (!info.sheet.zh_setting.emptyRows && !node) continue;
|
|
|
|
|
|
let bPaste = false;
|
|
|
- const data = info.sheet.zh_tree.getNodeKeyData(node);
|
|
|
+ const data = node ? { id: node.id } : { ledger_id: relaBills.id, cost_id: relaBills.cost_id, d_order: order + insertDatas.length + 1 };
|
|
|
for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
const curCol = info.cellRange.col + iCol;
|
|
|
const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
- const value = trimInvalidChar(pasteData[iRow-filterRow][iCol]);
|
|
|
- if (node.children && node.children.length > 0 && invalidFields.parent.indexOf(colSetting.field) >= 0) {
|
|
|
- toastMessageUniq(hint.parent);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ const value = trimInvalidChar(pasteData[iRow][iCol]);
|
|
|
|
|
|
- if (billsObj.checkNodeUsed(tree, node) && colSetting.field === 'unit_price') {
|
|
|
- toastMessageUniq (hint.usedUp);
|
|
|
- continue;
|
|
|
- }
|
|
|
if (colSetting.type === 'Number') {
|
|
|
const num = _.toNumber(value);
|
|
|
if (num) {
|
|
|
@@ -847,22 +843,22 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (node.used && (colSetting.field ==='b_code') && data[colSetting.field] !== '' && value === '') {
|
|
|
- toastMessageUniq(hint.usedCode);
|
|
|
- continue;
|
|
|
- }
|
|
|
data[colSetting.field] = value;
|
|
|
}
|
|
|
bPaste = true;
|
|
|
}
|
|
|
if (bPaste) {
|
|
|
- datas.push(data);
|
|
|
+ if (node) {
|
|
|
+ updateDatas.push(data)
|
|
|
+ } else {
|
|
|
+ insertDatas.push(data);
|
|
|
+ }
|
|
|
} else {
|
|
|
filterNodes.push(node);
|
|
|
}
|
|
|
}
|
|
|
- if (datas.length > 0) {
|
|
|
- postData('update', {target: 'detail', update: datas}, function (result) {
|
|
|
+ if (updateDatas.length > 0 || insertDatas.length > 0) {
|
|
|
+ postData('update', {target: 'detail', update: updateDatas, add: insertDatas.length > 0 ? insertDatas : undefined }, function (result) {
|
|
|
detailObj.data.updateDatas(result.detail);
|
|
|
detailObj.refreshSheet();
|
|
|
}, function () {
|