Browse Source

控制超计标红显示

MaiXinRong 3 years ago
parent
commit
5e9406f057

+ 1 - 0
app/const/tender_info.js

@@ -162,6 +162,7 @@ const defaultInfo = {
         over: true,
     },
     fun_rela: {
+        hintOver: true,
         sum_load: {
             ignoreParent: false,
         },

+ 4 - 0
app/controller/stage_controller.js

@@ -204,6 +204,8 @@ module.exports = app => {
                 renderData.sfData = sfData;
                 // 收方单附件删除权限
                 renderData.sfAttDelPower = ctx.session.sessionUser.accountId === ctx.stage.user_id || ctx.helper._.findIndex(ctx.stage.auditors2, { aid: ctx.session.sessionUser.accountId }) !== -1;
+                const projectFunInfo = await this.ctx.service.project.getFunRela(ctx.session.sessionProject.id);
+                renderData.hintOver = projectFunInfo.hintOver && ctx.tender.info.fun_rela.hintOver;
                 await this.layout('stage/index.ejs', renderData, 'stage/modal.ejs');
             } catch (err) {
                 this.log(err);
@@ -1299,6 +1301,8 @@ module.exports = app => {
                 await this._getStageAuditViewData(ctx);
                 const renderData = await this._getDefaultRenderData(ctx);
                 [renderData.gclSpread, renderData.leafXmjSpread] = this._getGatherSpreadSetting();
+                const projectFunInfo = await this.ctx.service.project.getFunRela(ctx.session.sessionProject.id);
+                renderData.hintOver = projectFunInfo.hintOver && ctx.tender.info.fun_rela.hintOver;
 
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.gather);
                 await this.layout('stage/gather.ejs', renderData, 'stage/gather_modal.ejs');

+ 2 - 2
app/public/js/stage.js

@@ -676,7 +676,7 @@ $(document).ready(() => {
                 if (def && def.color) return def.color;
             }
 
-            return checkUtils.billsOver(data, checkTzMeasureType(), stagePos) ? '#f8d7da' : defaultColor;
+            return hintOver && checkUtils.billsOver(data, checkTzMeasureType(), stagePos) ? '#f8d7da' : defaultColor;
         } else {
             return defaultColor;
         }
@@ -770,7 +770,7 @@ $(document).ready(() => {
             }
         }
         if (checkTzMeasureType()) {
-            return checkUtils.posOver(data)  ? '#f8d7da' : defaultColor;
+            return hintOver && checkUtils.posOver(data)  ? '#f8d7da' : defaultColor;
         }
     };
     sjsSettingObj.setGridSelectStyle(posSpreadSetting);

+ 2 - 3
app/public/js/stage_gather.js

@@ -55,9 +55,8 @@ $(document).ready(function () {
     const gclSpread = SpreadJsObj.createNewSpread($('#gcl-spread')[0]);
     const gclSheet = gclSpread.getActiveSheet();
     gclSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
-        return data 
-            ? (data.overRange ? '#f8d7da' : data.differ ? '#FFE699' : defaultColor)
-            : defaultColor;
+        if (!data) return defaultColor;
+        return data.overRange && hintOver ? '#f8d7da' : data.differ ? '#FFE699' : defaultColor;
     };
     if (thousandth) sjsSettingObj.setTpThousandthFormat(gclSpreadSetting);
     SpreadJsObj.initSheet(gclSpread.getActiveSheet(), gclSpreadSetting);

+ 7 - 2
app/service/project.js

@@ -10,6 +10,7 @@
 const imType = require('../const/tender').imType;
 const defaultFunRela = {
     banOver: true,
+    hintOver: true,
     imType: imType.zl.value,
 };
 const sjsRelaConst = require('../const/setting').sjsRela;
@@ -52,7 +53,8 @@ module.exports = app => {
                 case 'fun':
                     rule = {
                         imType: {type: 'enum', values: [imType.tz.value, imType.zl.value, imType.bb.value, imType.bw.value], required: true},
-                        banOver: {type: 'bool', required: true,}
+                        banOver: {type: 'bool', required: true,},
+                        hintOver: {type: 'bool', required: true,}
                     };
                     break;
                 default:
@@ -157,7 +159,10 @@ module.exports = app => {
 
         async updateFunRela(id, data) {
             const result = await this.db.update(this.tableName, {
-                id: id, fun_rela: JSON.stringify({banOver: data.banOver, imType: data.imType}),
+                id: id, fun_rela: JSON.stringify({
+                    banOver: data.banOver, hintOver: data.hintOver,
+                    imType: data.imType
+                }),
             });
             return result.affectedRows === 1;
         }

+ 11 - 3
app/view/setting/fun.ejs

@@ -14,8 +14,12 @@
                             <label>超计控制</label>
                             <div>
                                 <div class="form-check form-check-inline">
-                                    <input class="form-check-input" type="checkbox" name="ban_over" <% if (funRela.banOver) { %>checked<% } %> onchange="updateSetting();">
-                                    <label class="form-check-label" for="inlineCheckbox6">超计时限制上报审批/审批通过</label>
+                                    <input class="form-check-input" type="checkbox" id="ban_over" name="ban_over" <% if (funRela.banOver) { %>checked<% } %> onchange="updateSetting();">
+                                    <label class="form-check-label" for="ban_over">超计时限制上报审批/审批通过</label>
+                                </div>
+                                <div class="form-check form-check-inline">
+                                    <input class="form-check-input" type="checkbox" id="hint_over" name="hint_over" <% if (funRela.hintOver) { %>checked<% } %> onchange="updateSetting();">
+                                    <label class="form-check-label" for="hint_over">超计时标红显示</label>
                                 </div>
                             </div>
                         </div>
@@ -46,6 +50,10 @@
         autoFlashHeight();
     });
     const updateSetting = function () {
-        postData('/setting/fun/update', {imType: parseInt($('[name=im_type]:checked').val()), banOver: $('[name=ban_over]')[0].checked});
+        postData('/setting/fun/update', {
+            imType: parseInt($('[name=im_type]:checked').val()),
+            banOver: $('[name=ban_over]')[0].checked,
+            hintOver: $('#hint_over')[0].checked,
+        });
     }
 </script>

+ 1 - 0
app/view/stage/gather.ejs

@@ -103,4 +103,5 @@
     }
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
+    const hintOver = <%- hintOver %>;
 </script>

+ 1 - 0
app/view/stage/index.ejs

@@ -523,6 +523,7 @@
     const coopwd = <%- coopwd %>;
     const sfAttDelPower = <%- sfAttDelPower %>;
     let sfData = JSON.parse(unescape('<%- escape(JSON.stringify(sfData)) %>'));
+    const hintOver = <%- hintOver %>;
 </script>
 <style>
 

+ 8 - 0
app/view/tender/detail_modal.ejs

@@ -1794,6 +1794,12 @@
                         <label class="custom-control-label" for="sr_show">关联台账</label>
                     </div>
                 </div>
+                <div class="form-group">
+                    <div class="custom-control custom-checkbox mb-2">
+                        <input type="checkbox" class="custom-control-input" id="hint_over" checked="">
+                        <label class="custom-control-label" for="hint_over">超计时标红显示</label>
+                    </div>
+                </div>
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
@@ -1835,6 +1841,7 @@
     const loadFunRelaProperty = function () {
         $('#sl_ignoreParent')[0].checked = property.fun_rela.sum_load.ignoreParent;
         $('#sr_show')[0].checked = property.fun_rela.stage_rela.show;
+        $('#hint_over')[0].checked = property.fun_rela.hintOver;
     };
 
     $('#bd-set-12').on('show.bs.modal', function () {
@@ -1843,6 +1850,7 @@
     function post12 () {
         const prop = {
             fun_rela: {
+                hintOver: $('#hint_over')[0].checked,
                 sum_load: {
                     ignoreParent: $('#sl_ignoreParent')[0].checked,
                 },