浏览代码

1.变更清单排序bug修复
2.变更清单计算bug修复

laiguoran 5 年之前
父节点
当前提交
ee56aabbb9

+ 6 - 3
app/controller/change_controller.js

@@ -131,6 +131,7 @@ module.exports = app => {
                 ruleConst: codeRuleConst.measure,
                 tenderMenu: this.menu.tenderMenu,
                 preUrl: '/tender/' + tenderId,
+                tpUnit: ctx.tender.info.decimal.tp,
             };
 
             await this.layout('change/index.ejs', renderData, 'change/modal.ejs');
@@ -265,7 +266,7 @@ module.exports = app => {
                 const auditList = await ctx.service.changeAudit.getListByStatus(change, auditStatus);
 
                 // 获取已选清单
-                const changeList = await ctx.service.changeAuditList.getAllDataByCondition({ where: { cid: ctx.params.cid } });
+                let changeList = await ctx.service.changeAuditList.getAllDataByCondition({ where: { cid: ctx.params.cid } });
 
                 const renderData = {
                     uid: ctx.session.sessionUser.accountId,
@@ -382,7 +383,8 @@ module.exports = app => {
                     }
                     renderData.auditList3 = auditList3;
 
-                    renderData.changeList = changeList.sort();
+                    changeList = JSON.parse(JSON.stringify(changeList.sort())).sort().sort();
+                    renderData.changeList = changeList;
                     let ototalCost = 0;
                     let ctotalCost = 0;
                     let stotalCost = 0;
@@ -419,7 +421,8 @@ module.exports = app => {
                         auditList3[i].max_sort = auditList2.length - 1;
                     }
                     renderData.auditList3 = auditList3;
-                    renderData.changeList = changeList.sort();
+                    changeList = JSON.parse(JSON.stringify(changeList.sort())).sort().sort();
+                    renderData.changeList = changeList;
                     let ototalCost = 0;
                     let ctotalCost = 0;
                     const auditTotalCost = [];

+ 1 - 1
app/service/change.js

@@ -454,7 +454,7 @@ module.exports = app => {
                     const amount = listInfo[1];
                     const changeListInfo = await this.ctx.service.changeAuditList.getDataById(lid);
                     if (!tenderInfo) {
-                        tenderInfo  = await this.ctx.service.tenderInfo.getTenderInfo(changeListInfo.tid);
+                        tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(changeListInfo.tid);
                     }
                     if (changeListInfo !== undefined) {
                         total_price = this.ctx.helper.add(total_price,

+ 1 - 1
app/service/stage_audit.js

@@ -301,7 +301,7 @@ module.exports = app => {
                     }
                     for (const user of auditList) {
                         const smsUser = await this.ctx.service.projectAccount.getDataById(user.aid);
-                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                             const smsType = JSON.parse(smsUser.sms_type);
                             if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                                 mobile_array.push(smsUser.auth_mobile);

+ 1 - 1
app/view/change/index.ejs

@@ -46,7 +46,7 @@
                         <td><a href="/tender/<%- tender.id %>/change/<%- c.cid %>/info"><% if (c.status !== auditConst.status.checked) { %><%- c.code %><% } else { %><%- c.p_code %><% } %></a></td>
                         <td><%- c.name %></td>
                         <td><%- classArray[c.class] %><% c.class %></td>
-                        <td style="text-align: right"><%- c.total_price %></td>
+                        <td style="text-align: right"><%= ctx.helper.roundNum(c.total_price, tpUnit) %></td>
                         <% if (c.auditStatus) { %>
                         <td>
                             <a href="/tender/<%- tender.id %>/change/<%- c.cid %>/info" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm">

+ 2 - 2
app/view/change/info.ejs

@@ -524,7 +524,7 @@
                     </tr>
                     </thead>
                     <tbody id="list">
-                    <% for (const cl of changeList.sort()) { %>
+                    <% for (const cl of changeList) { %>
                         <tr>
                             <td><%= cl.code %></td>
                             <td><%= cl.name %></td>
@@ -583,7 +583,7 @@
                     </thead>
                     <tbody id="list">
                     <% const audittotalCost = []; %>
-                    <% for (const [cindex,cl] of changeList.sort().entries()) { %>
+                    <% for (const [cindex,cl] of changeList.entries()) { %>
                         <tr>
                             <td><%= cl.code %></td>
                             <td><%= cl.name %></td>

+ 1 - 0
config/config.local.js

@@ -22,6 +22,7 @@ module.exports = appInfo => {
             password: 'zongheng2019',
             // 数据库名
             database: 'calculation',
+            // database: 'calc_copy_pro',
         },
         // 是否加载到 app 上,默认开启
         app: true,