|
@@ -16,13 +16,13 @@ const invalidFields = {
|
|
|
posCalc: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp'],
|
|
|
posXmj: ['code'],
|
|
|
};
|
|
|
-function getExprInfo (field) {
|
|
|
+function getExprInfo (field, converse = false) {
|
|
|
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});
|
|
|
+ return converse ? _.find(exprField, {expr: field}) : _.find(exprField, {qty: field});
|
|
|
}
|
|
|
function transExpr(expr) {
|
|
|
return $.trim(expr).replace('\t', '').replace('=', '').replace('%', '/100');
|
|
@@ -615,7 +615,6 @@ $(document).ready(() => {
|
|
|
info.sheet.endEdit(true);
|
|
|
}
|
|
|
const is_change = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
- console.log(select, is_change);
|
|
|
if (is_change) {
|
|
|
makeGclGatherData();
|
|
|
const gclInfo = _.find(gclGatherData, function (item) {
|
|
@@ -1939,6 +1938,23 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ } else if (col.field.indexOf('_expr') > 0) {
|
|
|
+ const exprInfo = getExprInfo(col.field, true);
|
|
|
+ if (!exprInfo) return;
|
|
|
+
|
|
|
+ if (newText) {
|
|
|
+ try {
|
|
|
+ data.postData[exprInfo.qty] = math.evaluate(transExpr(newText));
|
|
|
+ data.postData[exprInfo.expr] = newText;
|
|
|
+ } catch(err) {
|
|
|
+ toastr.error('输入的表达式非法');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data.postData[exprInfo.qty] = 0;
|
|
|
+ data.postData[exprInfo.expr] = '';
|
|
|
+ }
|
|
|
} else {
|
|
|
data.postData[col.field] = newText;
|
|
|
}
|
|
@@ -1982,10 +1998,15 @@ $(document).ready(() => {
|
|
|
const style = sheet.getStyle(iRow, iCol);
|
|
|
if (!style.locked) {
|
|
|
const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
- data[colSetting.field] = null;
|
|
|
- const exprInfo = getExprInfo(colSetting.field);
|
|
|
- if (exprInfo) {
|
|
|
+ if (colSetting.field.indexOf('_expr') > 0) {
|
|
|
+ const exprInfo = getExprInfo(colSetting.field, true);
|
|
|
+ if (!exprInfo) continue;
|
|
|
data[exprInfo.expr] = '';
|
|
|
+ data[exprInfo.qty] = 0;
|
|
|
+ } else {
|
|
|
+ data[colSetting.field] = null;
|
|
|
+ const exprInfo = getExprInfo(colSetting.field);
|
|
|
+ if (exprInfo) data[exprInfo.expr] = '';
|
|
|
}
|
|
|
bDel = true;
|
|
|
}
|
|
@@ -2125,6 +2146,19 @@ $(document).ready(() => {
|
|
|
bPaste = false;
|
|
|
}
|
|
|
}
|
|
|
+ } else if (colSetting.field.indexOf('_expr') > 0) {
|
|
|
+ try {
|
|
|
+ const exprInfo = getExprInfo(colSetting.field, true);
|
|
|
+ posData[exprInfo.expr] = trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
+ if (posData[exprInfo.expr] || !posData[exprInfo.qty]) {
|
|
|
+ posData[exprInfo.qty] = math.evaluate(transExpr(posData[exprInfo.expr]));
|
|
|
+ }
|
|
|
+ bPaste = true;
|
|
|
+ } catch (err) {
|
|
|
+ toastMessageUniq(hint.expr);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ bPaste = true;
|
|
|
}
|
|
|
}
|
|
|
if (bPaste) {
|
|
@@ -3950,6 +3984,83 @@ if (openRevise) {
|
|
|
}
|
|
|
$('#change-dsk-project').html(html);
|
|
|
}
|
|
|
+
|
|
|
+ // 选中所有新增部位/清单
|
|
|
+ $('#add-all-revise').click(function() {
|
|
|
+ const this_cid = window.location.pathname.split('/')[4];
|
|
|
+ makeGclGatherData();
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
|
|
|
+ type: 'get-revise-list',
|
|
|
+ }, function (result) {
|
|
|
+ const addDatas = [];
|
|
|
+ for (const ggd in gclGatherData) {
|
|
|
+ gclGatherData[ggd].code = gclGatherData[ggd].b_code;
|
|
|
+ let hadcid = 0;
|
|
|
+ for (const xmj of gclGatherData[ggd].leafXmjs) {
|
|
|
+ const changeLedger = _.find(result.changeLedgerList, {id: xmj.gcl_id});
|
|
|
+ const changePos = _.find(result.changePosList, {id: xmj.mx_id, lid: xmj.gcl_id});
|
|
|
+ if (changeLedger || changePos) {
|
|
|
+ xmj.cid = 1;
|
|
|
+ xmj.ccid = changePos ? changePos.ccid : changeLedger ? changeLedger.ccid : 0;
|
|
|
+ hadcid = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (hadcid !== 0) gclGatherData[ggd].cid = 1;
|
|
|
+ }
|
|
|
+ for (const gclInfo of _.filter(gclGatherData, {cid: 1})) {
|
|
|
+ const leafXmjs = _.filter(gclInfo.leafXmjs, {ccid: this_cid});
|
|
|
+ if (leafXmjs.length > 0) {
|
|
|
+ gclInfo.is_change = 1;
|
|
|
+ for (const xmj of leafXmjs) {
|
|
|
+ if (_.findIndex(changeList, function (item) {
|
|
|
+ return item.gcl_id === xmj.gcl_id && item.mx_id === (xmj.mx_id || '');
|
|
|
+ }) === -1) {
|
|
|
+ addDatas.push({
|
|
|
+ lid: xmj.gcl_id,
|
|
|
+ code: gclInfo.code,
|
|
|
+ name: gclInfo.name || '',
|
|
|
+ unit: gclInfo.unit || '',
|
|
|
+ unit_price: gclInfo.unit_price,
|
|
|
+ oamount: xmj.quantity,
|
|
|
+ oamount2: xmj.quantity,
|
|
|
+ bwmx: xmj.bwmx || xmj.jldy || '',
|
|
|
+ xmj_code: xmj.code || '',
|
|
|
+ xmj_jldy: xmj.jldy || '',
|
|
|
+ xmj_dwgc: xmj.dwgc || '',
|
|
|
+ xmj_fbgc: xmj.fbgc || '',
|
|
|
+ xmj_fxgc: xmj.fxgc || '',
|
|
|
+ gcl_id: xmj.gcl_id,
|
|
|
+ mx_id: xmj.mx_id || '',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(addDatas);
|
|
|
+ if (addDatas.length > 0) {
|
|
|
+ // 更新至服务器
|
|
|
+ postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
|
|
|
+ type: 'add-change-list',
|
|
|
+ postData: addDatas,
|
|
|
+ }, function (result) {
|
|
|
+ toastr.success('已新增当前变更令新增的所有部位/清单');
|
|
|
+ changeList = result.changeList;
|
|
|
+ const sortData = SpreadJsObj.getSortData(billsSheet);
|
|
|
+ const billsNodes = _.filter(sortData, function (item) {
|
|
|
+ return _.findIndex(addDatas, {gcl_id: item.id}) !== -1;
|
|
|
+ });
|
|
|
+ for (const billsNode of billsNodes) {
|
|
|
+ billsNode.is_change = 1;
|
|
|
+ }
|
|
|
+ const loadResult = { update: billsNodes };
|
|
|
+ billsTreeSpreadObj.refreshTree(billsSheet, loadResult);
|
|
|
+ posSpreadObj.loadCurPosData();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ toastr.warning('未存在当前变更令新增的部位/清单');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
});
|