Sfoglia il codice sorgente

工程量清单,金额不可编辑

MaiXinRong 3 anni fa
parent
commit
79b2f91707
2 ha cambiato i file con 10 aggiunte e 8 eliminazioni
  1. 1 1
      app/base/base_budget_service.js
  2. 9 7
      app/public/js/budget_detail.js

+ 1 - 1
app/base/base_budget_service.js

@@ -290,7 +290,6 @@ class BaseBudget extends TreeService {
                 if (row.code) row.b_code = '';
 
                 if (this._checkCalcField(row)) {
-                    console.log(row);
                     let calcData = JSON.parse(JSON.stringify(row));
                     if (row.quantity !== undefined || row.unit_price !== undefined) {
                         calcData.quantity = row.quantity === undefined ? updateNode.quantity : helper.round(row.quantity, 2);
@@ -298,6 +297,7 @@ class BaseBudget extends TreeService {
                         calcData.total_price = helper.mul(calcData.quantity, calcData.unit_price, 2);
                     } else if (row.total_price !== undefined ) {
                         calcData.quantity = 0;
+                        calcData.unit_price = 0;
                         calcData.total_price = helper.round(row.total_price, 2);
                     }
                     updateData = this._filterUpdateInvalidField(updateNode.id, calcData);

+ 9 - 7
app/public/js/budget_detail.js

@@ -9,7 +9,7 @@
  */
 const invalidFields = {
     parent: ['total_price', 'unit_price'],
-    gcl: ['dgn_qty1', 'dgn_qty2'],
+    gcl: ['dgn_qty1', 'dgn_qty2', 'total_price'],
 };
 $(document).ready(() => {
     const copyBlockTag = 'zh.calc.copyBlock';
@@ -45,7 +45,7 @@ $(document).ready(() => {
         order: 'order',
         level: 'level',
         rootId: -1,
-        keys: ['id', 'tender_id', 'ledger_id'],
+        keys: ['id', 'bid', 'tree_id'],
         autoExpand: 3,
         markExpandKey: 'bills-expand',
         markExpandSubKey: window.location.pathname.split('/')[2],
@@ -262,6 +262,8 @@ $(document).ready(() => {
                     info.cancel = (node.children && node.children.length > 0) || !node.b_code;
                     break;
                 case 'total_price':
+                    info.cancel = (node.children && node.children.length > 0) || node.b_code;
+                    break;
                 case 'quantity':
                     info.cancel = (node.children && node.children.length > 0);
                     break;
@@ -291,7 +293,7 @@ $(document).ready(() => {
                 if (orgValue == info.editingText || ((!orgValue || orgValue === '') && (newValue === ''))) return;
 
                 if (node.b_code && invalidFields.gcl.indexOf(col.field) >=0) {
-                    toastr.error('工程量清单请勿输入设计数量');
+                    toastr.error('工程量清单请勿输入设计数量、金额');
                     return;
                 }
 
@@ -332,7 +334,7 @@ $(document).ready(() => {
             const hint = {
                 invalidNum: {type: 'warning', msg: '粘贴的数字非法'},
                 parent: {type: 'warning', msg: `含有子项,不可粘贴${needGcl ? '数量、单价、' : ''}金额`},
-                gcl: {type: 'warning', msg: '工程量清单,不可粘贴项目节数量'}
+                gcl: {type: 'warning', msg: '工程量清单,不可粘贴项目节数量、金额'}
             };
             const datas = [], filterNodes = [];
 
@@ -364,12 +366,12 @@ $(document).ready(() => {
                                 toastMessageUniq(hint.invalidExpr);
                                 continue;
                             }
-                            data[col.field] = num;
+                            data[colSetting.field] = num;
                         } else {
-                            data[col.field] = value;
+                            data[colSetting.field] = value;
                         }
                     } else {
-                        data[col.field] = col.type === 'Number' ? 0 : '';
+                        data[colSetting.field] = colSetting.type === 'Number' ? 0 : '';
                     }
                     bPaste = true;
                 }