|
@@ -21,6 +21,7 @@ const invalidFields = {
|
|
|
gcl: ['dgn_qty1', 'dgn_qty2'],
|
|
|
posCode: ['b_code'],
|
|
|
posCalc: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp'],
|
|
|
+ posXmj: ['code'],
|
|
|
};
|
|
|
function transExpr(expr) {
|
|
|
return expr.replace('=', '').replace('%', '/100');
|
|
@@ -567,7 +568,14 @@ $(document).ready(function() {
|
|
|
: (info.pasteData.text === ''
|
|
|
? SpreadJsObj.Clipboard.getAnalysisPasteText()
|
|
|
: SpreadJsObj.analysisPasteText(info.pasteData.text));
|
|
|
- let bParentHint = false, bGclHint = false, bCodeHint = false, bQtyHint = false, bNumHint = false;
|
|
|
+ const hint = {
|
|
|
+ invalidExpr: {type: 'warning', msg: '粘贴的表达式非法'},
|
|
|
+ posCode: {type: 'warning', msg: '清单含有计量单元,不可粘贴清单编号为空'},
|
|
|
+ posQty: {type: 'warning', msg: '清单含有计量单元,数量金额根据计量单元汇总计算所得,不可粘贴'},
|
|
|
+ parent: {type: 'warning', msg: '含有子项的清单,不可粘贴数量、单价、金额'},
|
|
|
+ gcl: {type: 'warning', msg: '工程量清单,不可粘贴项目节数量'},
|
|
|
+ posXmj: {type: 'warning', msg: '清单含有计量单元,不可粘贴项目节编号'},
|
|
|
+ };
|
|
|
const datas = [], filterNodes = [];
|
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
|
const curRow = info.cellRange.row + iRow;
|
|
@@ -582,20 +590,24 @@ $(document).ready(function() {
|
|
|
const value = trimInvalidChar(pasteData[iRow][iCol]);
|
|
|
const lPos = pos.getLedgerPos(node.id);
|
|
|
if (node.children && node.children.length > 0 && invalidFields.parent.indexOf(colSetting.field) >= 0) {
|
|
|
- if (!bParentHint) bParentHint = true;
|
|
|
+ toastMessageUniq(hint.parent);
|
|
|
continue;
|
|
|
}
|
|
|
if (!_.isEmpty(node.b_code) && invalidFields.gcl.indexOf(colSetting.field) >= 0) {
|
|
|
- if (!bGclHint) bGclHint = true;
|
|
|
+ toastMessageUniq(hint.gcl);
|
|
|
continue;
|
|
|
}
|
|
|
if (lPos && lPos.length > 0) {
|
|
|
if (value === '' && invalidFields.posCode.indexOf(colSetting.field) >= 0) {
|
|
|
- if (!bCodeHint) bCodeHint = true;
|
|
|
+ toastMessageUniq(hint.posCode);
|
|
|
continue;
|
|
|
}
|
|
|
if (invalidFields.posCalc.indexOf(colSetting.field) >= 0) {
|
|
|
- if (!bQtyHint) bQtyHint = true;
|
|
|
+ toastMessageUniq(hint.posQty);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (value !== '' && invalidFields.posXmj.indexOf(colSetting.field) >= 0) {
|
|
|
+ toastMessageUniq(hint.posXmj);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
@@ -608,7 +620,7 @@ $(document).ready(function() {
|
|
|
try {
|
|
|
data[colSetting.field] = math.evaluate(transExpr(value));
|
|
|
} catch(err) {
|
|
|
- bNumHint = true;
|
|
|
+ toastMessageUniq(hint.invalidExpr);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -622,15 +634,6 @@ $(document).ready(function() {
|
|
|
filterNodes.push(node);
|
|
|
}
|
|
|
}
|
|
|
- const hint = [];
|
|
|
- if (bParentHint) hint.push('含有子项的清单,不可粘贴数量、单价、金额');
|
|
|
- if (bGclHint) hint.push('工程量清单,不可粘贴项目节数量');
|
|
|
- if (bQtyHint) hint.push('含有计量单元的清单,不可粘贴数量');
|
|
|
- if (bCodeHint) hint.push('含有计量单元的清单,清单编号不可粘贴空值');
|
|
|
- if (bNumHint) hint.push('单价、数量等应输入数字或可计算的表达式');
|
|
|
- // if (hint.length > 0) hint.unshift('复制粘贴的数据中,存在非法数据,已过滤:');
|
|
|
- // if (hint.length > 0) toastr.warning(hint.join('</br>'));
|
|
|
- if (hint.length > 0) toastr.warning('复制粘贴的数据中,存在非法数据,已过滤');
|
|
|
if (datas.length > 0) {
|
|
|
postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
|
|
|
const refreshNode = tree.loadPostData(result);
|
|
@@ -794,7 +797,15 @@ $(document).ready(function() {
|
|
|
if (!info.sheet.zh_setting || !info.sheet.zh_tree) return;
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
const node = info.sheet.zh_tree.nodes[info.row];
|
|
|
+ if (!node) {
|
|
|
+ info.cancel = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
switch (col.field) {
|
|
|
+ case 'code':
|
|
|
+ const posRange = pos.getLedgerPos(node.id);
|
|
|
+ info.cancel = posRange && posRange.length > 0;
|
|
|
+ break;
|
|
|
case 'unit_price':
|
|
|
case 'sgfh_qty':
|
|
|
case 'sgfh_tp':
|