Browse Source

1. 安全生产部分代码
2. 计量进度相关

MaiXinRong 1 year ago
parent
commit
8896fdd768

+ 6 - 0
app/middleware/payment_detail_check.js

@@ -12,6 +12,7 @@ const messageType = require('../const/message_type');
 const status = require('../const/audit').stage.status;
 const shenpiConst = require('../const/shenpi');
 const _ = require('lodash');
+const paymentConst = require('../const/payment');
 
 module.exports = options => {
     /**
@@ -77,6 +78,11 @@ module.exports = options => {
                 tr_id: detail.tr_id,
             });
             detail.readOnly = !((detail.status === status.uncheck || detail.status === status.checkNo) && accountId === detail.uid);
+            if (detail.readOnly && detail.type === paymentConst.modes_value_object.safe) {
+                if ((detail.status === status.checking || detail.status === status.checkNoPre) && detail.curAuditor && detail.curAuditor === accountId) {
+                    detail.readOnly = false;
+                }
+            }
             this.detail = detail;
             this.trInfo = trInfo;
             // 根据状态判断是否需要更新审批人列表

+ 23 - 16
app/public/js/payment_safe.js

@@ -617,6 +617,7 @@ $(document).ready(function() {
             const mainSheet = billsObj.sheet;
             if (!stdSheet.zh_setting || !stdSheet.zh_tree || !mainSheet.zh_tree) return;
             const mainTree = mainSheet.zh_tree;
+            const sel = mainSheet.getSelections()[0];
 
             const nodes = [stdNode, ...stdTree.getAllParents(stdNode)];
             nodes.sort((a, b) => { return a.level - b.level; });
@@ -633,22 +634,28 @@ $(document).ready(function() {
                 }
             }
 
-            postData('update', { postType: 'add-std',
-                postData: {
-                    id: mainCur ? mainCur.tree_id : mainTree.setting.rootId,
-                    stdData
-                }
-            }, function (result) {
-                const refreshNode = mainTree.loadPostData(result);
-                billsObj.refreshTree(refreshNode);
-                const node = _.find(billsObj.tree.nodes, { code: stdNode.code, name: stdNode.name });
-                if (node) {
-                    mainSheet.setSelection(billsObj.tree.nodes.indexOf(node), sel.col, sel.rowCount, sel.colCount);
-                    SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, billsObj.tree.nodes.indexOf(node)]);
-                }
-                billsObj.refreshOperationValid;
+            if (stdData.length > 0) {
+                postData('update', { postType: 'add-std',
+                    postData: {
+                        id: mainCur ? mainCur.tree_id : mainTree.setting.rootId,
+                        stdData
+                    }
+                }, function (result) {
+                    const refreshNode = mainTree.loadPostData(result);
+                    billsObj.refreshTree(refreshNode);
+                    const node = _.find(billsObj.tree.nodes, { b_code: stdNode.b_code, name: stdNode.name });
+                    if (node) {
+                        mainSheet.setSelection(billsObj.tree.nodes.indexOf(node), sel.col, 1, sel.colCount);
+                        SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, billsObj.tree.nodes.indexOf(node)]);
+                    }
+                    billsObj.refreshOperationValid;
+                    billsObj.spread.focus();
+                });
+            } else {
+                const node = _.find(billsObj.tree.nodes, { b_code: stdNode.b_code, name: stdNode.name });
+                mainSheet.setSelection(billsObj.tree.nodes.indexOf(node), sel.col, 1, sel.colCount);
                 billsObj.spread.focus();
-            });
+            }
         },
     };
 
@@ -681,7 +688,7 @@ $(document).ready(function() {
 
     // 工具栏spr
     $.divResizer({
-        select: '#revise-right-spr',
+        select: '#right-spr',
         callback: function () {
             billsObj.spread.refresh();
             if (stdGcl) stdGcl.spread.refresh();

+ 2 - 2
app/service/payment_safe_bills.js

@@ -13,7 +13,7 @@ const billsUtils = require('../lib/bills_utils');
 const SafeBillsFields = {
     textFields: ['b_code', 'name', 'unit', 'spec', 'invoice_code', 'memo'],
     calcFields: ['unit_price', 'cur_qty', 'cur_tp', 'end_qty', 'end_tp'],
-    fixedFields: ['safe_id', 'tender_id', 'pre_qty', 'pre_tp', 'cur_his_qty', 'cur_his_tp', 'add_user_id', 'add_time'],
+    fixedFields: ['safe_id', 'tender_id', 'pre_qty', 'pre_tp', 'cur_read_qty', 'cur_read_tp', 'cur_his_qty', 'cur_his_tp', 'add_user_id', 'add_time'],
     treeFields: ['detail_id', 'tree_id', 'tree_pid', 'tree_level', 'tree_order', 'tree_full_path', 'tree_is_leaf'],
 };
 
@@ -41,7 +41,7 @@ module.exports = app => {
             });
             // this.depart = 10;
             this.tableName = 'payment_safe_bills';
-            this.decimal = { tp: 0, up: 2, qty: 2 };
+            this.decimal = { tp: 2, up: 2, qty: 3 };
         }
 
         // 继承方法

+ 6 - 2
app/service/tender_cache.js

@@ -34,7 +34,7 @@ module.exports = app => {
             if (!cache.stage_count || (cache.stage_count === 1 && cache.stage_status === auditConst.stage.status.uncheck && cache.stage_flow_cur_uid !== uid)) {
                 tender.cur_flow = JSON.parse(cache.ledger_flow_cur_info || cache.ledger_flow_pre_info);
                 tender.cur_flow.title = '台账';
-                tender.pre_flow = cache.ledger_flow_pre_info ? JSON.parse(cache.ledger_flow_pre_info) : {};
+                tender.pre_flow = JSON.parse(cache.ledger_flow_pre_info || cache.ledger_flow_cur_info);
                 tender.stage_tp = {};
                 tender.progress = {
                     title: '台账',
@@ -48,7 +48,9 @@ module.exports = app => {
                 tender.cur_flow = cache.stage_status === auditConst.stage.status.checkNo
                     ? JSON.parse(cache.stage_flow_pre_info)
                     : JSON.parse(cache.stage_flow_cur_info || cache.stage_flow_pre_info);
-                tender.pre_flow = cache.stage_flow_pre_info ? JSON.parse(cache.stage_flow_pre_info) : {};
+                tender.pre_flow = cache.stage_count === 1
+                    ? JSON.parse(cache.ledger_flow_pre_info || cache.ledger_flow_cur_info)
+                    : cache.stage_flow_pre_info ? JSON.parse(cache.stage_flow_pre_info) : {};
                 tender.stage_tp = JSON.parse(cache.stage_flow_cur_tp || cache.stage_flow_pre_tp);
                 tender.progress = {
                     title: `第${cache.stage_count}期`,
@@ -82,6 +84,7 @@ module.exports = app => {
         async insertTenderCache(transaction, tid, uid) {
             const user = await this.ctx.service.projectAccount.getAccountCacheData(uid);
             user.order = 0;
+            user.time = new Date();
             user.status = auditConst.ledger.status.uncheck;
             const data = {
                 id: tid,
@@ -276,6 +279,7 @@ module.exports = app => {
                 const user = await this.ctx.service.projectAccount.getAccountCacheData(tender.user_id);
                 user.status = tender.ledger_status;
                 user.order = 0;
+                user.time = tender.create_time;
                 data.ledger_flow_cur_info = JSON.stringify(user);
             } else if (tender.ledger_status === auditConst.ledger.status.checked) {
                 const pre = await this.ctx.service.ledgerAudit.getLastestAuditor(tender.id, tender.ledger_times, tender.ledger_status);

+ 3 - 0
app/view/payment_safe/index.ejs

@@ -27,6 +27,9 @@
                     <a href="javascript: void(0);" name="base-opr" type="up-move" class="btn btn-sm btn-light text-primary" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                 </div>
             </div>
+            <div class="ml-auto">
+                <% include ../payment/audit_btn.ejs %>
+            </div>
         </div>
     </div>
     <div class="content-wrap row pr-46">

+ 2 - 1
app/view/payment_safe/modal.ejs

@@ -1 +1,2 @@
-<% include ../shares/delete_hint_modal.ejs %>
+<% include ../shares/delete_hint_modal.ejs %>
+<% include ../payment/audit_modal.ejs %>

+ 1 - 0
config/web.js

@@ -1197,6 +1197,7 @@ const JsFiles = {
                     '/public/js/zip_oss.js',
                     '/public/js/path_tree.js',
                     '/public/js/std_lib.js',
+                    '/public/js/payment_detail_audit.js',
                     '/public/js/payment_safe.js',
                 ],
                 mergeFile: 'payment_safe',