liyg 2 anni fa
parent
commit
02a8a44e18

+ 42 - 3
src/views/TMS/components/bmsship/threeSectionFeeDetails.vue

@@ -21,7 +21,7 @@
         <i class="el-icon-refresh"></i>刷新
       </el-button>
     </div>
-    <dilTable v-bind.sync="option">
+    <dilTable v-bind.sync="option" @func="callback">
       <el-table-column fixed="right" label="操作" align="center" width="100">
         <template slot-scope="scope">
           <el-button @click="click(scope.row.resultId)" type="text" size="small"
@@ -41,6 +41,7 @@
 <script>
 import { sjTime } from "@/utils/sharedJsFile";
 import { getCookie } from "@/utils/util.js";
+import BigNumber from 'bignumber.js';
 export default {
   name: "homeworkPath",
   data() {
@@ -51,8 +52,8 @@ export default {
       option: {
         // 表格请求数据的地址
         requestUrl: null,
-        isshowSummary:true,
-        showSummaryList:['resultInspectionFee','realWeight','resultWaterTonnage','planWeight']
+        // isshowSummary:true,
+        // showSummaryList:['resultInspectionFee','realWeight','resultWaterTonnage','planWeight']
       },
     };
   },
@@ -69,6 +70,44 @@ export default {
       this.startTime.setSeconds(0);
       this.onclick();
     },
+    callback(param){
+      //自定义合计
+      console.log("param:",param);
+      let totalLoad=new BigNumber(0);
+      let totalInstuctions=new BigNumber(0);
+      let totalWater=new BigNumber(0);
+      let totalPlan=new BigNumber(0);
+      let content= null;
+      if(param.list.length<=0){
+        return;
+      }
+      param.list.forEach(row => {
+        if(row.realWeight && typeof row.realWeight == 'number'){
+          totalLoad = totalLoad.plus(new BigNumber(row.realWeight));
+        }
+        if(row.resultInspectionFee && typeof row.resultInspectionFee == 'number'){
+          totalInstuctions =totalInstuctions.plus(new BigNumber(row.resultInspectionFee));
+        }
+        if(row.resultWaterTonnage && typeof row.resultWaterTonnage == 'number'){
+          totalWater = totalWater.plus(new BigNumber(row.resultWaterTonnage));
+        }
+        if(row.planWeight && typeof row.planWeight == 'number'){
+          totalPlan = totalPlan.plus(new BigNumber(row.planWeight));
+        }
+      });
+      if(totalLoad && totalLoad.toFixed(4)>0){
+        content=new BigNumber(totalWater.times(100)).div(totalLoad).toFixed(2);
+      }
+      param.list.push({
+        ROW_ID:' ',
+        noticePort:'合计',
+        realWeight:totalLoad.toFixed(2),
+        resultInspectionFee:totalInstuctions.toFixed(2),
+        resultWaterTonnage:totalWater.toFixed(4),
+        planWeight:totalPlan.toFixed(2),
+        resultMoistureContent:content
+      });
+    },
     onclick() {
       let startTime = null;
       let endTime = null;