ellisran 1 vecka sedan
förälder
incheckning
e806a259b6

+ 2 - 0
app/const/tender_info.js

@@ -195,6 +195,8 @@ const defaultInfo = {
         material: 1,
         phasePay: 1,
         inspection: 1,
+        safe_payment: 1,
+        safe_inspection: 1,
     },
     ledger_check: {
         same_code: true,

+ 3 - 3
app/middleware/safe_inspection_check.js

@@ -73,8 +73,8 @@ module.exports = options => {
             inspection.shenpiPower = (inspection.status === status.checking || inspection.status === status.checkNoPre) && inspection.curAuditorIds.indexOf(accountId) !== -1;
             this.inspection = inspection;
             // 根据状态判断是否需要更新审批人列表
-            if ((inspection.status === status.uncheck || inspection.status === status.checkNo) && this.tender.info.shenpi.inspection !== shenpiConst.sp_status.sqspr) {
-                const shenpi_status = this.tender.info.shenpi.inspection;
+            if ((inspection.status === status.uncheck || inspection.status === status.checkNo) && this.tender.info.shenpi.safe_inspection !== shenpiConst.sp_status.sqspr) {
+                const shenpi_status = this.tender.info.shenpi.safe_inspection;
                 // 进一步比较审批流是否与审批流程设置的相同,不同则替换为固定审批流或固定的终审
                 const auditList = yield this.service.safeInspectionAudit.getAllDataByCondition({ where: { qiid: inspection.id, times: inspection.times, is_rectification: 0 }, orders: [['order', 'asc']] });
                 if (shenpi_status === shenpiConst.sp_status.gdspl) {
@@ -103,7 +103,7 @@ module.exports = options => {
                         yield this.service.safeInspection.loadUser(inspection);
                     } else if (!shenpiInfo) {
                         // 不存在终审人的状态下这里恢复为授权审批人
-                        this.tender.info.shenpi.inspection = shenpiConst.sp_status.sqspr;
+                        this.tender.info.shenpi.safe_inspection = shenpiConst.sp_status.sqspr;
                     }
                 }
             }

+ 48 - 0
app/public/js/quality_inspection_information.js

@@ -28,6 +28,54 @@ $(document).ready(function () {
         }
     });
 
+    function debounce(fn, wait) {
+        var t = null;
+        return function () {
+            var args = arguments;
+            clearTimeout(t);
+            t = setTimeout(function () { fn.apply(null, args); }, wait);
+        };
+    }
+
+    $('textarea[id]').each(function () {
+        var $el = $(this);
+        var el = $el[0];
+        var id = $el.attr('id');
+        var key = 'textarea_height_' + id;
+
+        // 1. 页面加载恢复高度
+        var saved = getLocalCache(key);
+        if (saved) {
+            $el.css('height', saved + 'px');
+        }
+
+        // 保存函数(使用 clientHeight)
+        var save = debounce(function () {
+            try {
+                var h = el.getBoundingClientRect().height; // 真实渲染高度
+                h = Math.round(h); // 防止小数
+                setLocalCache(key, h);
+            } catch (e) {
+                console.warn('保存高度失败', e);
+            }
+        }, 150); // 150ms 防抖
+
+        // 2. 实时监听拖拽高度
+        if (window.ResizeObserver) {
+            var ro = new ResizeObserver(function () {
+                save();
+            });
+            ro.observe(el);
+        } else {
+            // 兼容方案
+            $(window).on('mouseup', function () {
+                save();
+            });
+            // 也监听 blur(防止通过键盘或脚本改变尺寸)
+            $el.on('blur', function () { save(); });
+        }
+    });
+
     // 展开历史审核记录
     $('td #fold-btn').click(function () {
         const type = $(this).data('target')

+ 48 - 0
app/public/js/safe_inspection_information.js

@@ -28,6 +28,54 @@ $(document).ready(function () {
         }
     });
 
+    function debounce(fn, wait) {
+        var t = null;
+        return function () {
+            var args = arguments;
+            clearTimeout(t);
+            t = setTimeout(function () { fn.apply(null, args); }, wait);
+        };
+    }
+
+    $('textarea[id]').each(function () {
+        var $el = $(this);
+        var el = $el[0];
+        var id = $el.attr('id');
+        var key = 'textarea_height_' + id;
+
+        // 1. 页面加载恢复高度
+        var saved = getLocalCache(key);
+        if (saved) {
+            $el.css('height', saved + 'px');
+        }
+
+        // 保存函数(使用 clientHeight)
+        var save = debounce(function () {
+            try {
+                var h = el.getBoundingClientRect().height; // 真实渲染高度
+                h = Math.round(h); // 防止小数
+                setLocalCache(key, h);
+            } catch (e) {
+                console.warn('保存高度失败', e);
+            }
+        }, 150); // 150ms 防抖
+
+        // 2. 实时监听拖拽高度
+        if (window.ResizeObserver) {
+            var ro = new ResizeObserver(function () {
+                save();
+            });
+            ro.observe(el);
+        } else {
+            // 兼容方案
+            $(window).on('mouseup', function () {
+                save();
+            });
+            // 也监听 blur(防止通过键盘或脚本改变尺寸)
+            $el.on('blur', function () { save(); });
+        }
+    });
+
     // 展开历史审核记录
     $('td #fold-btn').click(function () {
         const type = $(this).data('target')

+ 1 - 1
app/service/safe_inspection_audit.js

@@ -506,7 +506,7 @@ module.exports = app => {
         async start(qiid, times = 1) {
             const audits = await this.getAllDataByCondition({ where: { qiid, times, order: 1 } });
             if (audits.length === 0) {
-                if (this.ctx.tender.info.shenpi.inspection === shenpiConst.sp_status.gdspl) {
+                if (this.ctx.tender.info.shenpi.safe_inspection === shenpiConst.sp_status.gdspl) {
                     throw '请联系管理员添加审批人';
                 } else {
                     throw '请先选择审批人,再上报数据';

+ 3 - 3
app/view/quality/inspection.ejs

@@ -76,9 +76,9 @@
                     <% for (const c of inspectionList) { %>
                         <tr><td><a href="/sp/<%- ctx.subProject.id %>/quality/tender/<%- ctx.tender.id %>/inspection/<%- c.id %>/information"><%- c.code %></a></td>
 <!--                            <td></td>-->
-                            <td><%- c.check_item %></td>
-                            <td><%- c.check_situation %></td>
-                            <td><%- c.action %></td>
+                            <td><%- c.check_item.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ') %></td>
+                            <td><%- c.check_situation.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ') %></td>
+                            <td><%- c.action.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ') %></td>
                             <td class="text-center"><%- c.check_date ? moment(c.check_date).format('YYYY-MM-DD') : '' %></td>
                             <td class="text-center">
                                 <a class="show-files" href="#file" data-toggle="modal" data-target="#file" data-id="<%- c.id %>"><i class="fa fa-paperclip"></i> <%- c.attList.length > 0 ? c.attList.length : '' %></a>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 8 - 5
app/view/quality/inspection_information.ejs


+ 3 - 3
app/view/safe/inspection.ejs

@@ -76,9 +76,9 @@
                     <% for (const c of inspectionList) { %>
                         <tr><td><a href="/sp/<%- ctx.subProject.id %>/safe/tender/<%- ctx.tender.id %>/inspection/<%- c.id %>/information"><%- c.code %></a></td>
 <!--                            <td></td>-->
-                            <td><%- c.check_item %></td>
-                            <td><%- c.check_situation %></td>
-                            <td><%- c.action %></td>
+                            <td><%- c.check_item.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ') %></td>
+                            <td><%- c.check_situation.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ') %></td>
+                            <td><%- c.action.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ') %></td>
                             <td class="text-center"><%- c.check_date ? moment(c.check_date).format('YYYY-MM-DD') : '' %></td>
                             <td class="text-center">
                                 <a class="show-files" href="#file" data-toggle="modal" data-target="#file" data-id="<%- c.id %>"><i class="fa fa-paperclip"></i> <%- c.attList.length > 0 ? c.attList.length : '' %></a>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 12 - 9
app/view/safe/inspection_information.ejs