Browse Source

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

Tony Kang 1 year ago
parent
commit
bac3b5dc41

+ 4 - 4
app/const/project_setting.js

@@ -9,11 +9,11 @@
  */
 // 重新发送通知设置
 const notice_setting = {
-    fixed: 12, // 固定间隔
+    fixed: 72, // 固定间隔
     activity: { // 活动间隔
-        first: 12,
-        second: 6,
-        later: 3,
+        first: 72,
+        second: 48,
+        later: 24,
     },
     mode: 'fixed', // 默认模式
     shield_times: { // 屏蔽时间段

+ 1 - 2
app/controller/report_archive_controller.js

@@ -106,9 +106,8 @@ module.exports = app => {
                 const groupList = accountList.filter(item => item.account_group === idx);
                 return { groupName: item, groupList };
             });
-            const needFileMsg = await this.ctx.service.specMsg.tenderNeedMsg(this.ctx.session.sessionProject.id, this.ctx.tender.id, pushOperate.report.file);
+            const needFileMsg = await this.ctx.service.specMsg.reportNeedMsg(this.ctx.session.sessionProject.id, this.ctx.tender.id);
 
-            //
             const renderData = {
                 tender: tender.data,
                 rpt_tpl_data: JSON.stringify(treeNodes),

+ 1 - 1
app/lib/rm/change_apply.js

@@ -64,7 +64,7 @@ class rptMemChange extends RptMemBase {
             case 'mem_change_apply_audit':
                 return this._getChangeApplyAudit();
             case 'mem_change_apply_att':
-                return this.ctx.service.changeApplyAtt.getChangeAttachment(this.ctx.change_apply.id);
+                return this.ctx.service.changeApplyAtt.getAllChangeApplyAtt(this.ctx.change_apply.tid, this.ctx.change_apply.id);
             case 'mem_project':
                 return this.ctx.service.project.getDataByCondition({ id: this.ctx.session.sessionProject.id });
             case 'mem_tender':

+ 1 - 1
app/lib/rm/change_plan.js

@@ -76,7 +76,7 @@ class rptMemChange extends RptMemBase {
             case 'mem_change_plan_audit':
                 return this._getChangePlanAudit();
             case 'mem_change_plan_att':
-                return this.ctx.service.changePlanAtt.getChangeAttachment(this.ctx.change_plan.id);
+                return this.ctx.service.changePlanAtt.getAllChangePlanAtt(this.ctx.change_plan.tid, this.ctx.change_plan.id);
             case 'mem_project':
                 return this.ctx.service.project.getDataByCondition({ id: this.ctx.session.sessionProject.id });
             case 'mem_tender':

+ 1 - 1
app/lib/rm/change_project.js

@@ -45,7 +45,7 @@ class rptMemChange extends RptMemBase {
             case 'mem_change_project_audit':
                 return this._getChangeProjectAudit();
             case 'mem_change_project_att':
-                return this.ctx.service.changeProjectAtt.getChangeAttachment(this.ctx.change_project.id);
+                return this.ctx.service.changeProjectAtt.getAllChangeProjectAtt(this.ctx.change_project.tid, this.ctx.change_project.id);
             case 'mem_project':
                 return this.ctx.service.project.getDataByCondition({ id: this.ctx.session.sessionProject.id });
             case 'mem_tender':

+ 1 - 0
app/public/js/change_apply_information.js

@@ -319,6 +319,7 @@ $(document).ready(() => {
                 const type = SpreadJsObj.getSelectObject(info.sheet) ? 'update' : 'add';
                 const select = type === 'update' ? SpreadJsObj.getSelectObject(info.sheet) : {unit: ''};
                 const col = info.sheet.zh_setting.cols[info.col];
+                if (col.field === 'new_up') return;
                 // 未改变值则不提交
                 let validText = (col.type === 'Number' || col.field === 'new_up') && is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : '');
                 const orgValue = type === 'update' ? select[col.field] : '';

+ 1 - 1
app/router.js

@@ -499,7 +499,7 @@ module.exports = app => {
     app.post('/tender/report_api/removeArchiveEncryption', sessionAuth, 'reportArchiveController.removeReportArchiveEncryption');
     app.post('/tender/:id/sendReportFileMsg', sessionAuth, tenderCheck, uncheckTenderCheck, 'reportArchiveController.sendFileMsg');
     app.post('/tender/:id/measure/stage/:order/sendReportFileMsg', sessionAuth, tenderCheck, uncheckTenderCheck, stageCheck, 'reportArchiveController.sendFileMsg');
-    app.post('/tender/:id/sendReportFileMsg', sessionAuth, tenderCheck, uncheckTenderCheck, 'reportArchiveController.sendOtherFileMsg');
+    app.post('/tender/:id/sendOtherReportFileMsg', sessionAuth, tenderCheck, uncheckTenderCheck, 'reportArchiveController.sendOtherFileMsg');
 
     // 电子签名
     app.get('/tender/:id/signReport', sessionAuth, tenderCheck, uncheckTenderCheck, 'reportArchiveController.signReport');

+ 2 - 2
app/service/material_audit.js

@@ -288,7 +288,7 @@ module.exports = app => {
 
                 // todo 更新标段tender状态 ?
                 // 检查三方特殊推送
-                await this.ctx.service.specMsg.addMaterialMsg(transaction, pid, materialInfo, pushOperate.material.flow);
+                await this.ctx.service.specMsg.addMaterialMsg(transaction, this.ctx.session.sessionProject.id, materialInfo, pushOperate.material.flow);
                 await transaction.commit();
             } catch (err) {
                 await transaction.rollback();
@@ -772,7 +772,7 @@ module.exports = app => {
                     wx_data: wechatData,
                 });
                 // 检查三方特殊推送
-                await this.ctx.service.specMsg.addMaterialMsg(transaction, pid, materialInfo, pushOperate.material.flow);
+                await this.ctx.service.specMsg.addMaterialMsg(transaction, this.ctx.session.sessionProject.id, materialInfo, pushOperate.material.flow);
                 await transaction.commit();
             } catch (err) {
                 await transaction.rollback();

+ 9 - 0
app/service/spec_msg.js

@@ -42,6 +42,15 @@ module.exports = app => {
             return !!specPush;
         }
 
+        async reportNeedMsg(pid, tid) {
+            const reportMsg = {};
+            reportMsg.stage = { valid: await this.tenderNeedMsg(pid, tid, pushOperate.report.file), key: pushOperate.report.file};
+            reportMsg.change = { valid: await this.tenderNeedMsg(pid, tid, pushOperate.report.change_file), key: pushOperate.report.change_file };
+            reportMsg.change_plan = { valid: await this.tenderNeedMsg(pid, tid, pushOperate.report.change_plan_file), key: pushOperate.report.change_plan_file };
+            reportMsg.change_apply = { valid: await this.tenderNeedMsg(pid, tid, pushOperate.report.change_apply_file), key: pushOperate.report.change_apply_file };
+            return reportMsg;
+        }
+
         async addLedgerMsg(transaction, pid, tender, timing) {
             const needMsg = await this.tenderNeedMsg(pid, tender.id, timing);
             if (!needMsg) return;

+ 1 - 1
app/service/stage_stash.js

@@ -13,7 +13,7 @@ class loadStageExcelTree {
         this.ctx = ctx;
 
         this.decimal = ctx.tender.info.decimal;
-        this.settleStatus === ctx.service.settle.settleStatus;
+        this.settleStatus = ctx.service.settle.settleStatus;
 
         this.insertBills = [];
         this.insertPos = [];

+ 36 - 0
app/view/report/archive_popup.ejs

@@ -14,3 +14,39 @@
         </div>
     </div>
   </div>
+  <!--弹出选择变更令的页面-->
+  <div class="modal fade" id="change-select" data-backdrop="static">
+      <div class="modal-dialog modal-lg" role="document">
+          <div class="modal-content">
+              <div class="modal-header">
+                  <h5 class="modal-title">选择推送数据</h5>
+              </div>
+              <div class="modal-body pb-1">
+                  <div class="d-inline-flex">
+                      <h6 class="mr-2 mt-1">当前时间之后:</h6>
+                      <div class="mx-2 mb-2">
+                          <div class="input-group input-group-sm">
+                              <input id="change-select-date" class="datepicker-here form-control form-control-sm" placeholder="点击选择筛选时间" data-date-format="yyyy-MM-dd" data-language="zh" type="text">
+                          </div>
+                      </div>
+                  </div>
+                  <div class="scroll-y" style="height: 400px;">
+                      <table class="table table-bordered mb-1" >
+                          <thead>
+                          <tr><th width="40px">选择</th><th>编号</th><th>名称</th><th width="150px">创建时间</th></tr>
+                          </thead>
+                          <tbody id="change-select-list">
+                          </tbody>
+                      </table>
+                  </div>
+                  <div class="d-flex justify-content-between  align-items-center">
+                      <div class="text-danger"><span>最多选择10条数据</span></div>
+                  </div>
+              </div>
+              <div class="modal-footer">
+                  <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
+                  <button class="btn btn-sm btn-primary" id="change-select-ok">确定</button>
+              </div>
+          </div>
+      </div>
+  </div>

+ 74 - 5
app/view/report/index_archive.ejs

@@ -38,9 +38,9 @@
                         <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableChanges"></div>
                     </div>
                 </div>
-                <% if (ctx.session.sessionUser.accountId === ctx.tender.data.user_id && needFileMsg) { %>
+                <% if (ctx.session.sessionUser.accountId === ctx.tender.data.user_id) { %>
                 <div class="d-inline-block">
-                    <button class="btn btn-sm btn-primary" type="button" onclick="sendReportFileMsg();">同步档案系统</button>
+                    <button id="file-msg" class="btn btn-sm btn-primary" type="button" onclick="sendReportFileMsg();" <% if (!needFileMsg.stage.valid) { %>style="display: none;"<% } %>>同步档案系统</button>
                 </div>
                 <% } %>
             </div>
@@ -171,12 +171,16 @@
 <script type="text/javascript" src="/public/report/js/rpt_main.js"></script>
 <script type="text/javascript" src="/public/report/js/rpt_cfg_const.js"></script>
 
+<script type="text/javascript" src="/public/js/datepicker/datepicker.min.js"></script>
+<script type="text/javascript" src="/public/js/datepicker/datepicker.zh.js"></script>
+
 <!--
 <script type="text/javascript" src="/public/report/js/rpt_custom.js"></script>
 -->
 
 
 <script type="text/javascript">
+    const needFileMsg = JSON.parse('<%- JSON.stringify(needFileMsg) %>');
     let current_stage_order = -1;
     let current_stage_id = -1;
     let current_stage_status = -1;
@@ -391,10 +395,54 @@
 
 
     function sendReportFileMsg() {
-        postData('sendReportFileMsg', { sid: current_stage_id, sorder: current_stage_order }, function (result, msg) {
+        if (!needFileMsg[business_type] || !needFileMsg[business_type].valid) return;
+
+        if (business_type === 'stage') {
+            postData('sendReportFileMsg', { sid: current_stage_id, sorder: current_stage_order }, function (result, msg) {
+                toastr.success(msg);
+            });
+        } else {
+            if (CHANGE_LIST.length === 0) {
+                toastr.warning('暂无任何归档数据');
+                return;
+            }
+            loadChangeSelect(CHANGE_LIST);
+            $('#change-select').modal('show');
+        }
+    }
+
+    function loadChangeSelect(changes) {
+        const html = [];
+        for (const c of changes) {
+            html.push('<tr>');
+            html.push(`<td><input cid="${c.cid || c.id}" type="checkbox" ${(c.selected ? "checked" : '')}></td>`);
+            html.push(`<td>${c.code}</td>`);
+            html.push(`<td>${c.name}</td>`);
+            html.push(`<td>${moment(c.in_time).format('YYYY-MM-DD')}</td>`);
+            html.push('</tr>');
+        }
+        $('#change-select-list').html(html.join(''));
+    }
+
+    $('body').on('change', '#change-select input[type=checkbox]', function() {
+        if ($('#change-select input:checked').length > 10) {
+            this.checked = false;
+            toastr.warning('最多选择10条数据');
+        }
+    });
+    $('body').on('click', '#change-select-ok', function() {
+        if (!needFileMsg[business_type]) return;
+
+        const select = $('#change-select input:checked');
+        const id = [];
+        for (const s of select) {
+            id.push(s.getAttribute('cid'));
+        }
+        postData('sendOtherReportFileMsg', { id, msgType: needFileMsg[business_type].key }, function (result, msg) {
             toastr.success(msg);
+            $('change-select').modal('hide');
         });
-    }
+    });
 
     $(function () {
         //阻止事件冒泡
@@ -482,11 +530,32 @@
                    }
                );
            }
-
+           if (needFileMsg[type] && needFileMsg[type].valid) {
+               $('#file-msg').show();
+           } else {
+               $('#file-msg').hide();
+           }
         });
     })
 
     rptArchiveObj.iniPage();
 
+    $(document).ready(() => {
+        $('#change-select-date').datepicker({
+            onSelect: function(selectedDate) {
+                const rows = $('#change-select-list tr');
+                for (const r of rows) {
+                    const cid = $(r).find('input').attr('cid');
+                    const change = CHANGE_LIST.find(x => { return x.cid ? x.cid === cid : c.id === cid; });
+                    if (moment(selectedDate).isBefore(change.in_time)) {
+                        $(r).show();
+                    } else {
+                        $(r).hide();
+                    }
+                }
+            }
+        });
+    });
+
 </script>
 

+ 14 - 14
app/view/setting/user_permission_modal.ejs

@@ -174,8 +174,8 @@
                 <div style="margin-left: 1.5rem;margin-top: .25rem; <% if (noticeSet.mode === 'activity') { %>display: none;<% } %>" id="wx_type_1">
                     <div class="w-100 d-inline-flex"><label class="right-duiqi">每间隔:</label>
                         <input id="fixed_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.fixed %>">
-                        <div class="dropdown-menu">
-                            <% for (let i = 1; i <= 24;i++) { %>
+                        <div class="dropdown-menu" style="max-height: 500px;overflow: auto;">
+                            <% for (let i = 1; i <= 72;i++) { %>
                             <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
                             <% } %>
                         </div><label style="line-height: 25px;">&nbsp; 小时</label>
@@ -184,24 +184,24 @@
                 <div style="margin-left: 1.5rem;margin-top: .25rem; <% if (noticeSet.mode === 'fixed') { %>display: none;<% } %>" id="wx_type_2">
                     <div class="w-100 d-inline-flex"><label class="right-duiqi">第1次间隔:</label>
                         <input id="activity_first_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.activity.first %>">
-                        <div class="dropdown-menu">
-                            <% for (let i = 1; i <= 24;i++) { %>
+                        <div class="dropdown-menu" style="max-height: 500px;overflow: auto;">
+                            <% for (let i = 1; i <= 72;i++) { %>
                                 <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
                             <% } %>
                         </div><label style="line-height: 25px;">&nbsp; 小时</label>
                     </div>
                     <div class="w-100 d-inline-flex"><label class="right-duiqi">第2次间隔:</label>
                         <input id="activity_second_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.activity.second %>">
-                        <div class="dropdown-menu">
-                            <% for (let i = 1; i <= 24;i++) { %>
+                        <div class="dropdown-menu" style="max-height: 500px;overflow: auto;">
+                            <% for (let i = 1; i <= 72;i++) { %>
                                 <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
                             <% } %>
                         </div><label style="line-height: 25px;">&nbsp; 小时</label>
                     </div>
                     <div class="w-100 d-inline-flex"><label class="right-duiqi">往后间隔:</label>
                         <input id="activity_later_time" style="width: 50px;" class="time-input form-control form-control-sm" type="number" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" min="0" step="1" max="24" value="<%- noticeSet.activity.later %>">
-                        <div class="dropdown-menu">
-                            <% for (let i = 1; i <= 24;i++) { %>
+                        <div class="dropdown-menu" style="max-height: 500px;overflow: auto;">
+                            <% for (let i = 1; i <= 72;i++) { %>
                                 <a class="dropdown-item change_time" href="javascript:void(0);" data-value="<%- i %>"><%- i %></a>
                             <% } %>
                         </div><label style="line-height: 25px;">&nbsp; 小时</label>
@@ -275,18 +275,18 @@
                 _self.siblings('.dropdown-menu').hide();
                 let rate = parseFloat(_self.val());
                 if (_.isNaN(rate)) {
-                    toastr.error('请输入1-24之前的整数值');
-                    _self.val(6);
+                    toastr.error('请输入1-72之前的整数值');
+                    _self.val(72);
                     return;
                 }
                 // 如果是小数,自动转成整数
                 if (rate.toString().indexOf('.') !== -1) {
-                    toastr.warning('请输入1-24之前的整数值');
+                    toastr.warning('请输入1-72之前的整数值');
                 }
                 rate = parseInt(rate);
-                if(rate < 1 || rate > 24) {
-                    toastr.error('请输入1-24之前的整数值');
-                    _self.val(6);
+                if(rate < 1 || rate > 72) {
+                    toastr.error('请输入1-72之前的整数值');
+                    _self.val(72);
                     return;
                 }
                 _self.val(rate);