瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

TonyKang 4 年之前
父節點
當前提交
91dbb02080

+ 1 - 1
app/base/base_bills_service.js

@@ -632,7 +632,7 @@ class BaseBillsSerivce extends TreeService {
                 });
                 d.full_path = parent
                     ? parent.full_path + '-' + d.ledger_id
-                    : newParentPath + '-' + d.ledger_id;
+                    : newParentPath + d.ledger_id;
                 if (defaultData) this.ctx.helper._.assignIn(pbd, defaultData);
                 pasteBillsData.push(d);
             }

+ 1 - 1
app/controller/change_controller.js

@@ -572,7 +572,7 @@ module.exports = app => {
                 if (!result) {
                     throw '审批失败';
                 }
-                ctx.redirect('/tender/' + changeData.tid + '/change');
+                ctx.redirect(ctx.request.header.referer);
             } catch (err) {
                 console.log(err);
                 ctx.redirect(ctx.request.header.referer);

+ 6 - 0
app/controller/wechat_controller.js

@@ -134,6 +134,12 @@ module.exports = app => {
             }
         }
 
+        async urlchange(ctx) {
+            // 设置用户微信登录项目,跳转到对应wap页面
+            co
+            ctx.redirect(ctx.query.url);
+        }
+
         async oauthTxt(ctx) {
             ctx.body = 't3MkWAMqplVxPjmr';
         }

+ 1 - 0
app/service/ledger.js

@@ -732,6 +732,7 @@ module.exports = app => {
                         dgn_qty2: node.dgn_qty2,
                         memo: node.memo,
                         drawing_code: node.drawing_code,
+                        node_type: node.node_type,
                     };
                     if (this.ctx.tender.data.measure_type === measureType.tz.value) {
                         data.sgfh_qty = node.quantity;

+ 3 - 7
app/service/ledger_audit.js

@@ -252,12 +252,11 @@ module.exports = app => {
 
                 // 获取审核人列表
                 const auditList = await this.getAuditors(tenderId, times);
-
                 // 添加推送
-                const noticeContent = await this.getNoticeContent(audit.tender_id, pid, audit.aid)
+                const noticeContent = await this.getNoticeContent(audit.tender_id, pid, audit.audit_id)
                 const records = [{ pid, type: pushType.ledger, uid: this.ctx.tender.data.user_id, status: auditConst.status.checked, content: noticeContent }]
                 auditList.forEach( audit => {
-                    records.push({ pid, type: pushType.ledger, uid: audit.aid, status: auditConst.status.checked, content: noticeContent })
+                    records.push({ pid, type: pushType.ledger, uid: audit.audit_id, status: auditConst.status.checked, content: noticeContent })
                 })
                 await transaction.insert('zh_notice', records);
                 // 更新当前审核流程
@@ -308,9 +307,6 @@ module.exports = app => {
                         //     smsTypeConst.judge.result.toString(), '台账审批通过,请登录系统处理。');
                         await this.ctx.helper.sendAliSms(users, smsTypeConst.const.TZ,
                             smsTypeConst.judge.result.toString(), SmsAliConst.template.ledger_result, { status: SmsAliConst.status.success });
-                        // 添加到消息推送表
-                        const noticeContent = await this.getNoticeContent(audit.tender_id, pid)
-                        await transaction.insert('zh_notice', { pid, type: pushType.ledger, uid: this.ctx.tender.data.user_id, status: auditConst.status.checked, is_read: 0, content: noticeContent });
                     }
                 } else {
                     // 同步标段信息
@@ -418,7 +414,7 @@ module.exports = app => {
 
         /**
          * 用于添加推送所需的content内容
-         * @param {Number} id 台账id
+         * @param {Number} id  标段id
          * @param {Number} pid 项目id
          * @param {Number} uid 审核人id
          */

+ 0 - 1
app/service/material_audit.js

@@ -634,7 +634,6 @@ module.exports = app => {
                 delete v.content
                 return { ...v, ...extra }
             })
-            console.log('notice', notice)
             return notice;
         }
 

+ 10 - 2
app/service/notice_push.js

@@ -40,13 +40,21 @@ module.exports = app => {
             let notice =  await this.db.select(this.tableName, {
                 where: { pid, uid },
                 orders: [['create_time', 'desc']],
-                limit: 10, offset: 0
+                limit: 30, offset: 0
             });
             notice = notice.map(v => {
                 const extra = JSON.parse(v.content)
                 delete v.content
                 return { ...v, ...extra }
-            }).sort((a, b) => a.name === b.name)
+            }).sort((a, b) => a.name === b.name).reduce((prev, curr, idx) => {
+                if (!prev.length) {
+                    prev.push(curr)
+                }
+                if (prev[idx-1] && curr.tid !== prev[idx-1].tid) {
+                    prev.push(curr)
+                }
+                return prev
+            }, [])
             return notice;
         }
     }

+ 1 - 1
app/service/stage_audit.js

@@ -294,7 +294,7 @@ module.exports = app => {
                 // 添加推送
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId)
                 const records = [{ pid, type: pushType.stage, uid: this.ctx.stage.user_id, status: auditConst.status.checkNo, content: noticeContent }]
-                ctx.stage.auditors.forEach( audit => {
+                this.ctx.stage.auditors.forEach( audit => {
                     records.push({ pid, type: pushType.stage, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent })
                 })
                 await transaction.insert('zh_notice', records);