Explorar o código

修复bug和增加change缓存

laiguoran %!s(int64=4) %!d(string=hai) anos
pai
achega
84d93af296

+ 16 - 0
app/controller/wechat_controller.js

@@ -254,6 +254,22 @@ module.exports = app => {
                 ctx.body = error;
                 ctx.body = error;
             }
             }
         }
         }
+
+        async batchUpdateUnionid(ctx) {
+            try {
+                const wxList = await ctx.service.projectAccount.getUnionIdList();
+                const updateList = [];
+                for (const wx of wxList) {
+                    const user = await app.wechat.api.getUser(wx.wx_openid);
+                    updateList.push({ id: wx.id, wx_unionid: user.unionid });
+                }
+                await ctx.service.projectAccount.updateRows(updateList);
+                ctx.body = 'success';
+            } catch (error) {
+                console.log(error);
+                ctx.body = error;
+            }
+        }
     }
     }
 
 
     return WechatController;
     return WechatController;

+ 4 - 0
app/public/js/change_information.js

@@ -236,6 +236,10 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
         readOnly: true,
+        localCache: {
+            key: 'changes-xmj',
+            colWidth: true,
+        }
     };
     };
     SpreadJsObj.initSheet(xmjSpread.getActiveSheet(), xmjSpreadSetting);
     SpreadJsObj.initSheet(xmjSpread.getActiveSheet(), xmjSpreadSetting);
 });
 });

+ 4 - 0
app/public/js/change_information_approval.js

@@ -42,6 +42,10 @@ $(document).ready(() => {
                 },
                 },
             },
             },
         ],
         ],
+        localCache: {
+            key: 'changes-spread',
+            colWidth: true,
+        }
     };
     };
     for (const aid of aidList) {
     for (const aid of aidList) {
         const userinfo = _.find(auditList2, { 'uid': aid });
         const userinfo = _.find(auditList2, { 'uid': aid });

+ 6 - 3
app/public/js/change_information_set.js

@@ -119,6 +119,10 @@ $(document).ready(() => {
                 },
                 },
             },
             },
         ],
         ],
+        localCache: {
+            key: 'changes-spread',
+            colWidth: true,
+        }
     };
     };
 
 
     const changeCol = {
     const changeCol = {
@@ -836,9 +840,8 @@ function tableDataRemake(changeListData) {
                     let pushbwmx = '0*;*0';
                     let pushbwmx = '0*;*0';
                     if (listinfo.leafXmjs !== undefined) {
                     if (listinfo.leafXmjs !== undefined) {
                         const leafInfo = listinfo.leafXmjs.find(function (item) {
                         const leafInfo = listinfo.leafXmjs.find(function (item) {
-                            return (item.bwmx === undefined || item.bwmx === clinfo.bwmx) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
+                            return (item.bwmx === undefined || item.bwmx === clinfo.bwmx) && item.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
                         });
                         });
-                        console.log(leafInfo);
                         if (leafInfo) {
                         if (leafInfo) {
                             pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
                             pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
                                 (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
                                 (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
@@ -868,7 +871,7 @@ function tableDataRemake(changeListData) {
                     let pushbwmx = '0*;*0';
                     let pushbwmx = '0*;*0';
                     if (listinfo.leafXmjs !== undefined) {
                     if (listinfo.leafXmjs !== undefined) {
                         const leafInfo = listinfo.leafXmjs.find(function (item) {
                         const leafInfo = listinfo.leafXmjs.find(function (item) {
-                            return (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
+                            return (item.bwmx === undefined || item.bwmx === clinfo.bwmx || item.jldy === clinfo.bwmx) && item.code === clinfo.xmj_code && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
                         });
                         });
                         if (leafInfo) {
                         if (leafInfo) {
                             pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
                             pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +

+ 4 - 0
app/public/js/change_information_show.js

@@ -44,6 +44,10 @@ $(document).ready(() => {
                 },
                 },
             },
             },
         ],
         ],
+        localCache: {
+            key: 'changes-spread',
+            colWidth: true,
+        }
     };
     };
     for (const aid of aidList) {
     for (const aid of aidList) {
         const userinfo = _.find(auditList2, { 'uid': aid });
         const userinfo = _.find(auditList2, { 'uid': aid });

+ 2 - 0
app/router.js

@@ -463,4 +463,6 @@ module.exports = app => {
     app.get('/wxAuth', 'loginController.wxAuth');
     app.get('/wxAuth', 'loginController.wxAuth');
     app.get('/wxproject', 'loginController.wxProject');
     app.get('/wxproject', 'loginController.wxProject');
     app.get('/wx/url2web', 'loginController.url2web');
     app.get('/wx/url2web', 'loginController.url2web');
+
+    app.get('/wx/unionid', wechatAuth, 'wechatController.batchUpdateUnionid');
 };
 };

+ 6 - 0
app/service/project_account.js

@@ -790,6 +790,12 @@ module.exports = app => {
 
 
             return result;
             return result;
         }
         }
+
+        async getUnionIdList() {
+            const sql = 'SELECT * FROM ?? WHERE wx_openid != ? and wx_unionid = ?';
+            const sqlParam = [this.tableName, null, null];
+            return await this.db.query(sql, sqlParam);
+        }
     }
     }
 
 
     return ProjectAccount;
     return ProjectAccount;

+ 1 - 1
app/view/login/wxproject.ejs

@@ -17,7 +17,7 @@
     <nav class="fixed-top bg-dark">
     <nav class="fixed-top bg-dark">
         <div class="my-2 d-flex justify-content-between">
         <div class="my-2 d-flex justify-content-between">
             <span class="text-white ml-3">项目列表</span>
             <span class="text-white ml-3">项目列表</span>
-            <div class="mr-3">
+            <div class="mr-3"><a class="text-white" href="/login">重新登录</a>
                 <!-- <div class="dropdown">
                 <!-- <div class="dropdown">
                   <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-toggle="dropdown">
                   <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-toggle="dropdown">
                     张三
                     张三

+ 2 - 2
app/view/tender/shenpi_modal.ejs

@@ -98,7 +98,7 @@
                 <div class="row">
                 <div class="row">
                     <div class="col-6">
                     <div class="col-6">
                         <% const yb = ctx.helper._.find(accountList, { id: ctx.tender.data.user_id }) %>
                         <% const yb = ctx.helper._.find(accountList, { id: ctx.tender.data.user_id }) %>
-                        <div class="modal-height-300">
+                        <div class="modal-height-500">
                             <table class="table table-hover table-bordered">
                             <table class="table table-hover table-bordered">
                                 <thead>
                                 <thead>
                                 <tr><th colspan="3" class="text-center" id="stage_audit"><%- yb.name %>(原报)</th></tr>
                                 <tr><th colspan="3" class="text-center" id="stage_audit"><%- yb.name %>(原报)</th></tr>
@@ -120,7 +120,7 @@
                                 <% } %>
                                 <% } %>
                             </select>
                             </select>
                         </div>
                         </div>
-                        <div class="modal-height-300" style="overflow: auto;" id="ledger-spread">
+                        <div class="modal-height-500" style="overflow: auto;" id="ledger-spread">
                         </div>
                         </div>
                     </div>
                     </div>
                 </div>
                 </div>