Browse Source

计价按钮同步显示

ellisran 5 months ago
parent
commit
fe422986cf
1 changed files with 9 additions and 2 deletions
  1. 9 2
      app/public/js/change_revise.js

+ 9 - 2
app/public/js/change_revise.js

@@ -88,8 +88,8 @@ $(document).ready(() => {
             isValuation: function (data) {
                 if (!data) return 0;
                 if (!data.name) return 0;
-                const cInfo = _.find(changeList, {gcl_id: data.id, mx_id: ''});
-                return cInfo ? cInfo.is_valuation : 0;
+                const cInfo = _.find(changeList, { gcl_id: data.id, is_valuation: 1 });
+                return cInfo ? 1 : 0;
             },
             camount: function (data) {
                 const cInfo = _.find(changeList, {gcl_id: data.id, mx_id: ''});
@@ -1589,15 +1589,20 @@ $(document).ready(() => {
             if (node && node.b_code) {
                 const posData = pos.getLedgerPos(node.id) || [];
                 let camount = node.camount || 0;
+                let is_valuation = node.is_valuation || 0;
                 if (posData.length > 0) {
                     camount = 0;
                     for (const np of posData) {
                         const cInfo = _.find(changeList, { gcl_id: np.lid, mx_id: np.id });
                         camount = cInfo ? ZhCalc.add(camount, ZhCalc.round(cInfo.camount, findDecimal(cInfo.unit))) : camount;
+                        if (cInfo && cInfo.is_valuation) {
+                            is_valuation = 1;
+                        }
                     }
                 }
                 node.camount = camount;
                 node.ca_tp = ZhCalc.mul(camount, node.unit_price, decimal.tp) || 0;
+                node.is_valuation = is_valuation;
             }
         },
         _checkExprValid(expr) {
@@ -2471,6 +2476,8 @@ $(document).ready(() => {
                     postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', { type:'update', updateData: cInfo }, function (result) {
                         // SpreadJsObj.reLoadRowData(info.sheet, info.row);
                         info.sheet.setValue(info.row, info.col, is_valuation);
+                        const billsNode = SpreadJsObj.getSelectObject(billsSheet);
+                        SpreadJsObj.reLoadRowData(billsSheet, billsTree.getNodeIndex(billsNode));
                     }, function () {
                         select.is_valuation = info.sheet.getValue(info.row, info.col) ? 1 : 0;
                         cInfo.is_valuation = select.is_valuation;