|
@@ -23,7 +23,14 @@ const invalidFields = {
|
|
|
posCalc: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp'],
|
|
|
posXmj: ['code'],
|
|
|
};
|
|
|
-const exprField = ['sgfh_qty', 'sgfh_tp', 'sjcl_qty'];
|
|
|
+function getExprInfo (field) {
|
|
|
+ const exprField = [
|
|
|
+ {qty: 'sgfh_qty', expr: 'sgfh_expr'},
|
|
|
+ {qty: 'sjcl_qty', expr: 'sjcl_expr'},
|
|
|
+ {qty: 'qtcl_qty', expr: 'qtcl_expr'},
|
|
|
+ ];
|
|
|
+ return _.find(exprField, {qty: field});
|
|
|
+}
|
|
|
function transExpr(expr) {
|
|
|
return expr.replace('=', '').replace('%', '/100');
|
|
|
}
|
|
@@ -115,7 +122,13 @@ $(document).ready(function() {
|
|
|
if (col && col.type === 'Number') {
|
|
|
const data = SpreadJsObj.getSelectObject(sheet);
|
|
|
if (data) {
|
|
|
- $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field]);
|
|
|
+ const exprInfo = getExprInfo(col.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ $('#bills-expr').val(data[exprInfo.expr] ? data[exprInfo.expr] : data[col.field])
|
|
|
+ .attr('field', col.field).attr('org', data[col.field]);
|
|
|
+ } else {
|
|
|
+ $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field]);
|
|
|
+ }
|
|
|
if (col.field.indexOf('dgn') >= 0) {
|
|
|
$('#bills-expr').attr('readOnly', readOnly || cell.locked() || (_.isString(data.b_code) && data.b_code !== ''));
|
|
|
} else {
|
|
@@ -476,7 +489,10 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
try {
|
|
|
data[col.field] = math.evaluate(transExpr(newValue));
|
|
|
- if (exprField.indexOf(col.field) >= 0) data[col.field + '']
|
|
|
+ const exprInfo = getExprInfo(col.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = newValue;
|
|
|
+ }
|
|
|
} catch(err) {
|
|
|
toastr.error('输入的表达式非法');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
@@ -653,6 +669,11 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
try {
|
|
|
data[colSetting.field] = math.evaluate(transExpr(value));
|
|
|
+ const exprInfo = getExprInfo(colSetting.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = value;
|
|
|
+ }
|
|
|
+ bPaste = true;
|
|
|
} catch(err) {
|
|
|
toastMessageUniq(hint.invalidExpr);
|
|
|
}
|
|
@@ -722,6 +743,10 @@ $(document).ready(function() {
|
|
|
if (!style.locked) {
|
|
|
const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
data[colSetting.field] = null;
|
|
|
+ const exprInfo = getExprInfo(colSetting.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = '';
|
|
|
+ }
|
|
|
bDel = true;
|
|
|
}
|
|
|
}
|
|
@@ -735,6 +760,7 @@ $(document).ready(function() {
|
|
|
postData(window.location.pathname + '/update', {postType: 'update', postData: datas}, function (result) {
|
|
|
const refreshNode = tree.loadPostData(result);
|
|
|
treeOperationObj.refreshTree(sheet, refreshNode);
|
|
|
+ treeOperationObj.loadExprToInput(sheet);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -815,6 +841,10 @@ $(document).ready(function() {
|
|
|
}
|
|
|
const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
data[colSetting.field] = null;
|
|
|
+ const exprInfo = getExprInfo(colSetting.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = '';
|
|
|
+ }
|
|
|
}
|
|
|
datas.push(data);
|
|
|
}
|
|
@@ -974,6 +1004,10 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
try {
|
|
|
data[field] = math.evaluate(transExpr(newValue));
|
|
|
+ const exprInfo = getExprInfo(field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = newValue;
|
|
|
+ }
|
|
|
} catch (err) {
|
|
|
toastr.error('输入的表达式非法');
|
|
|
return;
|
|
@@ -986,7 +1020,6 @@ $(document).ready(function() {
|
|
|
// 更新至服务器
|
|
|
postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
|
|
|
const refreshNode = ledgerTree.loadPostData(result);
|
|
|
- expr.val(select[field]);
|
|
|
treeOperationObj.refreshTree(sheet, refreshNode);
|
|
|
});
|
|
|
});
|
|
@@ -1422,7 +1455,11 @@ $(document).ready(function() {
|
|
|
if (col && col.type === 'Number') {
|
|
|
const data = SpreadJsObj.getSelectObject(sheet);
|
|
|
if (data) {
|
|
|
- $('#pos-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
|
|
|
+ const exprInfo = getExprInfo(col.field);
|
|
|
+ const value = exprInfo
|
|
|
+ ? (data[exprInfo.expr] ? data[exprInfo.expr] : data[col.field])
|
|
|
+ : data[col.field];
|
|
|
+ $('#pos-expr').val(value).attr('field', col.field).attr('org', data[col.field])
|
|
|
.attr('row', sel.row).attr('readOnly', readOnly || cell.locked());
|
|
|
} else {
|
|
|
$('#pos-expr').val('').attr('readOnly', true);
|
|
@@ -1569,6 +1606,10 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
try {
|
|
|
data.updateData[col.field] = math.evaluate(transExpr(newText));
|
|
|
+ const exprInfo = getExprInfo(col.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data.updateData[exprInfo.expr] = newText;
|
|
|
+ }
|
|
|
} catch(err) {
|
|
|
toastr.error('输入的表达式非法');
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
@@ -1625,6 +1666,10 @@ $(document).ready(function() {
|
|
|
if (!style.locked) {
|
|
|
const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
data[colSetting.field] = null;
|
|
|
+ const exprInfo = getExprInfo(colSetting.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = '';
|
|
|
+ }
|
|
|
bDel = true;
|
|
|
}
|
|
|
}
|
|
@@ -1725,6 +1770,10 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
try {
|
|
|
posData[colSetting.field] = math.evaluate(transExpr(posData[colSetting.field]));
|
|
|
+ const exprInfo = getExprInfo(colSetting.field);
|
|
|
+ if (exprInfo) {
|
|
|
+ posData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
+ }
|
|
|
bPaste = true;
|
|
|
} catch(err) {
|
|
|
delete posData[colSetting.field];
|
|
@@ -1800,6 +1849,10 @@ $(document).ready(function() {
|
|
|
} else {
|
|
|
try {
|
|
|
data[field] = math.evaluate(transExpr(newValue));
|
|
|
+ const exprInfo = getExprInfo(field);
|
|
|
+ if (exprInfo) {
|
|
|
+ data[exprInfo.expr] = newValue;
|
|
|
+ }
|
|
|
} catch (err) {
|
|
|
toastr.error('输入的表达式非法');
|
|
|
return;
|
|
@@ -1812,7 +1865,6 @@ $(document).ready(function() {
|
|
|
// 更新至服务器
|
|
|
postData('/tender/' + getTenderId() + '/pos/update', {updateType: 'update', updateData: data}, function (result) {
|
|
|
const updateRst = pos.updateDatas(result.pos);
|
|
|
- expr.val(select[field]);
|
|
|
SpreadJsObj.reLoadRowData(posSheet, _.toNumber(row));
|
|
|
const loadResult = ledgerTree.loadPostData(result.ledger);
|
|
|
treeOperationObj.refreshTree(ledgerSpread.getActiveSheet(), loadResult);
|