소스 검색

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

MaiXinRong 5 년 전
부모
커밋
e2c524b2fe
4개의 변경된 파일16개의 추가작업 그리고 6개의 파일을 삭제
  1. 0 2
      app/controller/material_controller.js
  2. 2 0
      app/public/js/material.js
  3. 3 3
      app/service/material_bills.js
  4. 11 1
      sql/update.sql

+ 0 - 2
app/controller/material_controller.js

@@ -228,7 +228,6 @@ module.exports = app => {
                 }
                 // 取所有工料表
                 renderData.materialBillsData = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql });
-                console.log(renderData.materialBillsData);
                 // 取对应期的截取上期的调差金额和应耗数量
                 if (ctx.material.highOrder !== ctx.material.order) {
                     for (const [mindex, mb] of renderData.materialBillsData.entries()) {
@@ -253,7 +252,6 @@ module.exports = app => {
                         // }
                     }
                 }
-                console.log(renderData.materialBillsData);
                 // 取所有已被调用的工料清单表
                 renderData.materialListData = await ctx.service.materialList.getAllDataByCondition({ tid: ctx.tender.id, mid: ctx.material.id });
                 // 基数

+ 2 - 0
app/public/js/material.js

@@ -334,6 +334,8 @@ $(document).ready(() => {
                 select.m_spread = materialCol.getValue.m_spread(select);
                 select.m_tp = materialCol.getValue.m_tp(select);
 
+                console.log(select);
+
                 // 更新至服务器
                 postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
                     m_tp = result.m_tp;

+ 3 - 3
app/service/material_bills.js

@@ -84,7 +84,7 @@ module.exports = app => {
                 throw '数据错误';
             }
             delete data.in_time;
-            delete data.m_tp;
+            // delete data.m_tp;
             // 判断是否可修改
             // 判断t_type是否为费用
             const transaction = await this.db.beginTransaction();
@@ -114,7 +114,7 @@ module.exports = app => {
             try {
                 for (const data of datas) {
                     delete data.in_time;
-                    delete data.m_tp;
+                    // delete data.m_tp;
                     // console.log(data);
                     await transaction.update(this.tableName, data);
                 }
@@ -212,7 +212,7 @@ module.exports = app => {
         // 更改计算总金额并返回值
         async calcMaterialMTp(transaction) {
             // 金额发生变化,则重新计算本期金额
-            const sql = 'SELECT SUM(`m_spread`*`quantity`) as total_price FROM ' + this.tableName + ' WHERE `tid` = ?';
+            const sql = 'SELECT SUM(`m_tp`) as total_price FROM ' + this.tableName + ' WHERE `tid` = ?';
             const sqlParam = [this.ctx.tender.id];
             const tp = await transaction.queryOne(sql, sqlParam);
             console.log(tp);

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 11 - 1
sql/update.sql