Просмотр исходного кода

库添加锁定、解锁功能

zeweizhong 6 лет назад
Родитель
Сommit
545345f0df
47 измененных файлов с 278 добавлено и 162 удалено
  1. 34 30
      public/web/lock_util.js
  2. 11 10
      web/maintain/bill_template_lib/html/edit.html
  3. 7 5
      web/maintain/bill_template_lib/html/main.html
  4. 5 0
      web/maintain/bill_template_lib/js/bills_template.js
  5. 13 15
      web/maintain/bill_template_lib/js/bills_template_edit.js
  6. 5 0
      web/maintain/billsGuidance_lib/css/main.css
  7. 2 1
      web/maintain/billsGuidance_lib/html/main.html
  8. 11 10
      web/maintain/billsGuidance_lib/html/zhiyin.html
  9. 13 7
      web/maintain/billsGuidance_lib/js/billsGuidance.js
  10. 10 3
      web/maintain/billsGuidance_lib/js/main.js
  11. 1 0
      web/maintain/bills_lib/css/main.css
  12. 1 3
      web/maintain/bills_lib/html/neirong.html
  13. 1 1
      web/maintain/bills_lib/html/qingdan.html
  14. 1 4
      web/maintain/bills_lib/html/tezheng.html
  15. 6 0
      web/maintain/common/css/main.css
  16. 5 4
      web/maintain/main_col_lib/html/edit.html
  17. 6 4
      web/maintain/main_col_lib/html/main.html
  18. 2 1
      web/maintain/main_col_lib/js/main_col_edit.js
  19. 4 0
      web/maintain/main_col_lib/js/main_col_lib.js
  20. 1 1
      web/maintain/material_replace_lib/html/edit.html
  21. 6 4
      web/maintain/material_replace_lib/html/main.html
  22. 4 0
      web/maintain/material_replace_lib/js/material_replace.js
  23. 3 3
      web/maintain/material_replace_lib/js/material_replace_edit.js
  24. 5 4
      web/maintain/project_feature_lib/html/edit.html
  25. 6 4
      web/maintain/project_feature_lib/html/main.html
  26. 5 0
      web/maintain/project_feature_lib/js/project_feature.js
  27. 2 0
      web/maintain/project_feature_lib/js/project_feature_edit.js
  28. 1 0
      web/maintain/ration_repository/css/main.css
  29. 1 1
      web/maintain/ration_repository/dinge.html
  30. 1 2
      web/maintain/ration_repository/js/coe.js
  31. 5 0
      web/maintain/ration_repository/js/gljSelect.js
  32. 1 1
      web/maintain/ration_repository/js/init.js
  33. 11 3
      web/maintain/ration_repository/js/installation.js
  34. 4 2
      web/maintain/ration_repository/js/ration.js
  35. 6 1
      web/maintain/ration_repository/js/ration_assist.js
  36. 3 0
      web/maintain/ration_repository/js/ration_coe.js
  37. 3 4
      web/maintain/ration_repository/js/ration_glj.js
  38. 3 0
      web/maintain/ration_repository/js/ration_installation.js
  39. 1 1
      web/maintain/ration_repository/js/ration_template.js
  40. 1 1
      web/maintain/ration_repository/js/section_tree.js
  41. 5 0
      web/maintain/std_glj_lib/css/main.css
  42. 7 6
      web/maintain/std_glj_lib/html/gongliao.html
  43. 13 1
      web/maintain/std_glj_lib/html/main.html
  44. 11 7
      web/maintain/std_glj_lib/js/glj.js
  45. 3 0
      web/maintain/std_glj_lib/js/gljClassTree.js
  46. 6 3
      web/maintain/std_glj_lib/js/gljComponent.js
  47. 22 15
      web/maintain/std_glj_lib/js/main.js

+ 34 - 30
public/web/lock_util.js

@@ -37,33 +37,38 @@ const lockUtil = (() => {
             }
         });
     }
-    function lockSpread(spread) {
-        spread.unbind(GC.Spread.Sheets.Events.ButtonClicked);
-        const sheetCount = spread.getSheetCount();
-        for(let i = 0; i < sheetCount; i++){
-            const sheet = spread.getSheet(i);
-            sheet.unbind(GC.Spread.Sheets.Events.ButtonClicked);
-            sheet.unbind(GC.Spread.Sheets.Events.EditStarting);
-            sheet.unbind(GC.Spread.Sheets.Events.EditEnded);
-            sheet.unbind(GC.Spread.Sheets.Events.RangeChanged);
-            sheet.unbind(GC.Spread.Sheets.Events.ClipboardChanging);
-            sheet.unbind(GC.Spread.Sheets.Events.ClipboardChanged);
-            sheet.unbind(GC.Spread.Sheets.Events.CellDoubleClick);
-            sheet.unbind(GC.Spread.Sheets.Events.CellClick);
-            sheet.unbind(GC.Spread.Sheets.Events.ValueChanged);
-            sheet.suspendPaint();
-            sheet.suspendEvent();
-            sheet.options.isProtected = true;
-            const rowCount = sheet.getRowCount();
-            const colCount = sheet.getColumnCount();
-            for(let row = 0; row < rowCount; row++){
-                for(let col = 0; col < colCount; col++){
-                    sheet.getCell(row, col).locked(true);
+    function lockSpreads(spreads, locked) {
+        if (!locked) {
+            return;
+        }
+        spreads.forEach(spread => {
+            spread.unbind(GC.Spread.Sheets.Events.ButtonClicked);
+            const sheetCount = spread.getSheetCount();
+            for(let i = 0; i < sheetCount; i++){
+                const sheet = spread.getSheet(i);
+                sheet.unbind(GC.Spread.Sheets.Events.ButtonClicked);
+                sheet.unbind(GC.Spread.Sheets.Events.EditStarting);
+                sheet.unbind(GC.Spread.Sheets.Events.EditEnded);
+                sheet.unbind(GC.Spread.Sheets.Events.RangeChanged);
+                sheet.unbind(GC.Spread.Sheets.Events.ClipboardChanging);
+                sheet.unbind(GC.Spread.Sheets.Events.ClipboardChanged);
+                sheet.unbind(GC.Spread.Sheets.Events.CellDoubleClick);
+                sheet.unbind(GC.Spread.Sheets.Events.CellClick);
+                sheet.unbind(GC.Spread.Sheets.Events.ValueChanged);
+                sheet.suspendPaint();
+                sheet.suspendEvent();
+                sheet.options.isProtected = true;
+                const rowCount = sheet.getRowCount();
+                const colCount = sheet.getColumnCount();
+                for(let row = 0; row < rowCount; row++){
+                    for(let col = 0; col < colCount; col++){
+                        sheet.getCell(row, col).locked(true);
+                    }
                 }
+                sheet.resumePaint();
+                sheet.resumeEvent();
             }
-            sheet.resumePaint();
-            sheet.resumeEvent();
-        }
+        });
     }
     function lockURL(locked, $url) {
         const originURL = $url.prop('href');
@@ -85,21 +90,20 @@ const lockUtil = (() => {
         const $range = $lock.parent().parent();
         lockTools($range, curLocked);
     }
-    function lockSpreadAndTools(spreads, $range) {
-        const locked = lockUtil.getLocked();
+    function lockSpreadsAndTools(spreads, $range, locked) {
         if (!locked) {
             return;
         }
-        spreads.forEach(spread => lockSpread(spread));
+        lockSpreads(spreads, locked);
         lockTools($range, locked);
     }
 
     return {
         getLocked,
         lockTools,
-        lockSpread,
+        lockSpreads,
         lockURL,
         handleLockClick,
-        lockSpreadAndTools
+        lockSpreadsAndTools
     }
 })();

+ 11 - 10
web/maintain/bill_template_lib/html/edit.html

@@ -12,16 +12,16 @@
             <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
                 <div class="collapse navbar-collapse" id="navbarNav">
                     <div class="tools-btn btn-group align-top">
-                        <a href="" class="btn btn-sm"><i class="fa fa-files-o" aria-hidden="true"></i> 复制</a>
-                        <a href="" class="btn btn-sm"><i class="fa fa-scissors" aria-hidden="true"></i> 剪切</a>
-                        <a href="" class="btn btn-sm"><i class="fa fa-clipboard" aria-hidden="true"></i> 粘贴</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="insert"><i class="fa fa-sign-in" aria-hidden="true"></i> 插入</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="m_insert" data-toggle="modal" data-target="#insertInputDiv"><i class="fa fa-sign-in" aria-hidden="true"></i> 插入多行</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="delete"><i class="fa fa-remove" aria-hidden="true"></i> 删除</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="upLevel"><i class="fa fa-arrow-left" aria-hidden="true"></i> 升级</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="downLevel"><i class="fa fa-arrow-right" aria-hidden="true"></i> 降级</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="downMove"><i class="fa fa-arrow-down" aria-hidden="true"></i> 下移</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="upMove"><i class="fa fa-arrow-up" aria-hidden="true"></i> 上移</a>
+                        <a class="lock-btn-control" href="" class="btn btn-sm"><i class="fa fa-files-o" aria-hidden="true"></i> 复制</a>
+                        <a class="lock-btn-control" href="" class="btn btn-sm"><i class="fa fa-scissors" aria-hidden="true"></i> 剪切</a>
+                        <a class="lock-btn-control" href="" class="btn btn-sm"><i class="fa fa-clipboard" aria-hidden="true"></i> 粘贴</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="insert"><i class="fa fa-sign-in" aria-hidden="true"></i> 插入</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="m_insert" data-toggle="modal" data-target="#insertInputDiv"><i class="fa fa-sign-in" aria-hidden="true"></i> 插入多行</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="delete"><i class="fa fa-remove" aria-hidden="true"></i> 删除</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="upLevel"><i class="fa fa-arrow-left" aria-hidden="true"></i> 升级</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="downLevel"><i class="fa fa-arrow-right" aria-hidden="true"></i> 降级</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="downMove"><i class="fa fa-arrow-down" aria-hidden="true"></i> 下移</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="upMove"><i class="fa fa-arrow-up" aria-hidden="true"></i> 上移</a>
                     </div>
                 </div>
             </nav>
@@ -71,4 +71,5 @@
 <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
 <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
 <script type="text/javascript" src="/public/web/common_ajax.js"></script>
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/bill_template_lib/js/bills_template_edit.js"></script>

+ 7 - 5
web/maintain/bill_template_lib/html/main.html

@@ -24,22 +24,23 @@
                                     <th>清单模板名称</th>
                                     <th width="160">编办</th>
                                     <th width="160">添加时间</th>
-                                    <th width="60">操作</th>
+                                    <th width="70">操作</th>
                                     <th width="60">复制</th>
                                 </tr>
                             </thead>
                             <tbody id="showArea">
                             <% for(let lib of templateLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/billsTemplate/editTemplate/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/billsTemplate/editTemplate/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a href="javacript:void(0);" onclick='getTemplateLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
-                                    <a href="javacript:void(0);" onclick='showDeleteModal("<%= lib.ID%>")'class="text-danger" title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock-btn-control disabled" href="javacript:void(0);" onclick='getTemplateLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javacript:void(0);" onclick='showDeleteModal("<%= lib.ID%>")' title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock" data-locked="true" href="javascript:void(0);" title="解锁"><i class="fa fa-unlock-alt"></i></a>
                                 </td>
                                 <td>
-                                    <a d" href="javascript:void(0);" onclick="showCopyModal('<%= lib.ID %>')" class="btn btn-secondary btn-sm copy-data" title="复制数据"><i class="fa fa-clone"></i>复制</a>
+                                    <a class="btn btn-secondary btn-sm copy-data lock-btn-control disabled" d" href="javascript:void(0);" onclick="showCopyModal('<%= lib.ID %>')" title="复制数据"><i class="fa fa-clone"></i>复制</a>
                                 </td>
                             </tr>
                             <% } %>
@@ -160,5 +161,6 @@
 </div>
 
 <script src="/public/web/PerfectLoad.js"></script>
+<script src="/public/web/lock_util.js"></script>
 <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
 <script type="text/javascript" src="/web/maintain/bill_template_lib/js/bills_template.js"></script>

+ 5 - 0
web/maintain/bill_template_lib/js/bills_template.js

@@ -53,6 +53,11 @@ $(document).ready(function() {
         }
     });
 
+    // 锁定、解锁
+    $('.lock').click(function () {
+        lockUtil.handleLockClick($(this));
+    });
+
     //复制库
     $('#copyTemplate').click(function () {
         const libID = $('#libID').val();

+ 13 - 15
web/maintain/bill_template_lib/js/bills_template_edit.js

@@ -2,6 +2,7 @@
  * Created by zhang on 2018/7/13.
  */
 
+const locked = lockUtil.getLocked();
 
 let TEMPLATE_BILLS_SETTING = {
     "emptyRows":1,
@@ -10,7 +11,7 @@ let TEMPLATE_BILLS_SETTING = {
     "treeCol": 1,
     "cols":[{
         "width":80,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["类别"],
             "spanCols":[1],
@@ -27,7 +28,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":200,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["编号"],
             "spanCols":[1],
@@ -45,7 +46,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":300,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["名称"],
             "spanCols":[1],
@@ -62,7 +63,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":50,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["单位"],
             "spanCols":[1],
@@ -79,7 +80,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
             "width":80,
-            "readOnly":false,
+            "readOnly":locked,
             "head":{
                 "titleNames":["工程量"],
                 "spanCols":[1],
@@ -97,7 +98,7 @@ let TEMPLATE_BILLS_SETTING = {
             }
     }, {
         "width":200,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["清单固定类别"],
             "spanCols":[1],
@@ -114,7 +115,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":250,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["计算基数"],
             "spanCols":[1],
@@ -131,7 +132,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":50,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["费率ID"],
             "spanCols":[1],
@@ -204,13 +205,9 @@ let TEMPLATE_BILLS_SETTING = {
 $(document).ready(function () {
     autoFlashHeight();
     let RefreshBaseActn = function (tree) {
-        /*  let showButton = function (show, btn) { 隐藏改成灰显
-         if (show) {
-         btn.show();
-         } else {
-         btn.hide();
-         }
-         };*/
+        if (locked) {
+            return;
+        }
         let setButtonValid = function (valid, btn) {
             if (valid) {
                 btn.removeClass('disabled');
@@ -420,6 +417,7 @@ $(document).ready(function () {
     let sel = billsSpread.getActiveSheet().getSelections()[0];
     controller.setTreeSelected(tree.items[sel.row == -1?0:sel.row]);//初始化选中项
     RefreshBaseActn(tree);
+    lockUtil.lockSpreadsAndTools([billsSpread], $(document.body), locked);
     $('#insert').click(function () {
         let me = this;
         $(me).addClass('disabled');

+ 5 - 0
web/maintain/billsGuidance_lib/css/main.css

@@ -316,4 +316,9 @@ div.resize{
     font:0.9rem Calibri;
     box-shadow:2px 2px 6px #ccc;
     color:#fff;
+}
+.disabled {
+    pointer-events: none;
+    opacity: .65;
+    color:#666;
 }

+ 2 - 1
web/maintain/billsGuidance_lib/html/main.html

@@ -31,7 +31,7 @@
                   <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                       <table class="table table-hover table-bordered">
-                        <thead><tr><th>清单指引名称</th><th>编办</th><th>清单规则</th><th>类型</th><th width="160">添加时间</th><th width="90">操作</th></tr></thead>
+                        <thead><tr><th>清单指引名称</th><th>编办</th><th>清单规则</th><th>类型</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                         <tbody>
                         </tbody>
                       </table>
@@ -152,6 +152,7 @@
     <script src="/web/maintain/billsGuidance_lib/js/global.js"></script>
     <script src="/public/web/uuid.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/web/maintain/billsGuidance_lib/js/main.js"></script>
 
 </body>

+ 11 - 10
web/maintain/billsGuidance_lib/html/zhiyin.html

@@ -38,7 +38,7 @@
                         <div id="billsSpread" class="main-side-top">
                         </div>
                         <div class="main-side-bottom">
-                            <textarea class="form-control"></textarea>
+                            <textarea class="form-control lock-text-control"></textarea>
                         </div>
                     </div>
                   <div class="main-content p-0" id="midContent" style="width: 34%">
@@ -46,12 +46,12 @@
                       <div style="width: 99%; float: left">
                           <div class="toolsbar px-1 d-flex justify-content-between">
                               <div class="tools-btn btn-group align-top">
-                                  <a id="insert" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="插入"><i class="fa fa-reply-all" aria-hidden="true"></i> 插入</a>
-                                  <a id="del" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
-                                  <a id="upLevel" href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
-                                  <a id="downLevel" href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
-                                  <a id="downMove" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
-                                  <a id="upMove" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
+                                  <a id="insert" href="javascript:void(0);" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="插入"><i class="fa fa-reply-all" aria-hidden="true"></i> 插入</a>
+                                  <a id="del" href="javascript:void(0);" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
+                                  <a id="upLevel" href="javascript:void(0);" class="btn btn-sm lock-btn-control disabled" data-toggle="tooltip" data-placement="bottom" title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
+                                  <a id="downLevel" href="javascript:void(0);" class="btn btn-sm lock-btn-control disabled" data-toggle="tooltip" data-placement="bottom" title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
+                                  <a id="downMove" href="javascript:void(0);" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
+                                  <a id="upMove" href="javascript:void(0);" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                                   <a id="expandContract" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="收起定额"><i class="fa fa-minus-square-o" aria-hidden="true"></i> 收起定额</a>
                               </div>
                           </div>
@@ -59,7 +59,7 @@
                               <div id="guideItemSpread" class="main-data"></div>
                           </div>
                           <div class="main-bottom-content">
-                              <textarea class="form-control"></textarea>
+                              <textarea class="form-control lock-text-control"></textarea>
                           </div>
                       </div>
                   </div>
@@ -81,10 +81,10 @@
                                     <div class="col-3">
                                         <div class="row">
                                             <div class="col-5 pl-0">
-                                                <button id="insertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                                <button id="insertRation" class="btn btn-primary btn-sm lock-btn-control" type="button">插入定额</button>
                                             </div>
                                             <div class="col-5">
-                                                <button id="insertAll" class="btn btn-primary btn-sm" type="button">插入全部</button>
+                                                <button id="insertAll" class="btn btn-primary btn-sm lock-btn-control" type="button">插入全部</button>
                                             </div>
                                         </div>
                                     </div>
@@ -146,6 +146,7 @@
     <script src="/public/web/sheet/sheet_data_helper.js"></script>
     <script src="/public/web/QueryParam.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/web/maintain/billsGuidance_lib/js/global.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
     <script src="/public/web/id_tree.js"></script>

+ 13 - 7
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -11,6 +11,7 @@ const billsGuidance = (function () {
     function _isDef(v) {
         return typeof v !== 'undefined' && v !== null;
     }
+    const locked = lockUtil.getLocked();
     let moduleName = 'stdBillsGuidance';
     //上下拖动的拖动条高度
     const verticalResize = 10;
@@ -111,7 +112,7 @@ const billsGuidance = (function () {
             defaultRowHeight: 21,
             cols: [{
                 width: 400,
-                readOnly: false,
+                readOnly: locked,
                 head: {
                     titleNames: ["项目指引"],
                     spanCols: [1],
@@ -293,7 +294,7 @@ const billsGuidance = (function () {
             }
             else if(module === ration){
                 sheet.options.isProtected = true;
-                sheet.getRange(-1, 0, -1, 1).locked(false);
+                sheet.getRange(-1, 0, -1, 1).locked(locked);
                 sheet.getRange(-1, 1, -1, -1).locked(true);
             }
             else if(module === guideItem){
@@ -303,6 +304,7 @@ const billsGuidance = (function () {
             buildHeader(module.workBook.getActiveSheet(), module.headers);
             bindEvent(module.workBook, module.events);
         }
+        lockUtil.lockSpreads([module.workBook], locked);
     }
     //清空表数据
     //@param {Object}sheet {Array}headers {Number}rowCount @return {void}
@@ -440,6 +442,9 @@ const billsGuidance = (function () {
     //刷新按钮有效性
     //@param {Object}node @return {void}
     function refreshBtn(node){
+        if (locked) {
+            return;
+        }
         //全部设为无效
         $('.tools-btn').children().addClass('disabled');
         $('#insertRation').addClass('disabled');
@@ -1378,7 +1383,7 @@ const billsGuidance = (function () {
                             "copy": {
                                 name: "复制整块",
                                 disabled: function () {
-                                    return !canCopyBlock(blockNodes);
+                                    return locked || !canCopyBlock(blockNodes);
                                 },
                                 icon: "fa-copy",
                                 callback: function (key, opt) {
@@ -1388,7 +1393,7 @@ const billsGuidance = (function () {
                                 name: "粘贴整块",
                                 disabled: function () {
                                     let pasteNode = bills.tree.selected.guidance.tree.items[target.row];
-                                    return !canPasteBlock(pasteNode);
+                                    return locked || !canPasteBlock(pasteNode);
                                 },
                                 icon: "fa-paste",
                                 callback: function (key, opt) {
@@ -1399,7 +1404,7 @@ const billsGuidance = (function () {
                                 name: '删除',
                                 disabled: function () {
                                     let node = bills.tree.selected.guidance.tree.items[target.row];
-                                    return !node
+                                    return locked || !node
                                 },
                                 icon: "fa-arrow-left",
                                 callback: function (key, opt) {
@@ -1410,7 +1415,7 @@ const billsGuidance = (function () {
                                 name: '插入行',
                                 disabled: function () {
                                     let node = bills.tree.selected.guidance.tree.items[target.row];
-                                    return !node || node.data.type !== itemType.job;
+                                    return locked || !node || node.data.type !== itemType.job;
                                 },
                                 icon: "fa-arrow-left",
                                 callback: function (key, opt) {
@@ -1421,7 +1426,7 @@ const billsGuidance = (function () {
                                 name: '插入子项',
                                 disabled: function () {
                                     let node = bills.tree.selected.guidance.tree.items[target.row];
-                                    return !node || node.data.type !== itemType.job || !allJobChildren(node);
+                                    return locked || !node || node.data.type !== itemType.job || !allJobChildren(node);
                                 },
                                 icon: 'fa-arrow-left',
                                 callback: function (key, opt) {
@@ -1690,6 +1695,7 @@ const billsGuidance = (function () {
     function initViews(){
         let modules = [bills, guideItem, section, ration];
         initWorkBooks(modules);
+        lockUtil.lockTools($(document.body), locked);
         getLibWithBills(libID);
         initBtn();
         initContextMenu();

+ 10 - 3
web/maintain/billsGuidance_lib/js/main.js

@@ -45,13 +45,16 @@ const billsGuidanceMain = (function () {
     function addLibToView(tbody, lib){
         let type = lib.type && typeString[lib.type] ? typeString[lib.type] : ''
         let tr = `<tr id="${lib.ID}">
-            <td><a href="/billsGuidance/guidance/?libID=${lib.ID}">${lib.name}</a>
+            <td><a href="/billsGuidance/guidance/?libID=${lib.ID}&locked=true">${lib.name}</a>
             <td>${lib.compilationName}</td>
             <td>${lib.billsLibName}</td>
             <td>${type}</td>
             <td>${lib.createDate.split(' ')[0]}</td>
-            <td><a href="javascript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
-            <a href="javascript:void(0);" data-toggle="modal" data-target="#del" class="text-danger" title="删除"><i class="fa fa-remove"></i></a></td></tr>`;
+            <td>
+            <a class="lock-btn-control disabled" href="javascript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+            <a class="lock-btn-control disabled text-danger" href="javascript:void(0);" data-toggle="modal" data-target="#del" title="删除"><i class="fa fa-remove"></i></a>
+            <a class="lock" data-locked="true" href="javascript:void(0);" title="解锁"><i class="fa fa-unlock-alt"></i></a>
+            </td></tr>`;
         tbody.append(tr);
     }
     //获取清单指引库
@@ -220,6 +223,10 @@ const billsGuidanceMain = (function () {
         $('#del').on('hidden.bs.modal', function () {
             deleteCount = 0;
         });
+        // 锁定、解锁
+        $('.main').find('tbody').on('click', '.lock', function () {
+            lockUtil.handleLockClick($(this));
+        });
 
     }
 

+ 1 - 0
web/maintain/bills_lib/css/main.css

@@ -280,4 +280,5 @@ body {
 .disabled {
     pointer-events: none;
     opacity: .65;
+    color:#666;
 }

+ 1 - 3
web/maintain/bills_lib/html/neirong.html

@@ -243,9 +243,7 @@
             });
             billsAjax.getStdBillsLibName(billsLibId);
             buildAllJobs(spreadAllJobs, totalJobsSetting);
-            if (locked) {
-                lockUtil.lockSpread(spreadAllJobs);
-            }
+            lockUtil.lockSpreads([spreadAllJobs], locked);
         });
         function buildAllJobs(spreadAllJobs, setting){
             setSheet.initSheet(spreadAllJobs, setting, true);

+ 1 - 1
web/maintain/bills_lib/html/qingdan.html

@@ -395,7 +395,7 @@
             showBillsSheet(bills, jobsSpread.getActiveSheet(), itemsSpread.getActiveSheet(), billsLibSetting)
             const spreads = [billsSpread, jobsSpread, itemsSpread];
             const $range = $(document.body);
-            lockUtil.lockSpreadAndTools(spreads, $range);
+            lockUtil.lockSpreadsAndTools(spreads, $range, locked);
         });
         buildJobs(jobsSpread, jobsSetting);
         buildItems(itemsSpread, itemsSetting);

+ 1 - 4
web/maintain/bills_lib/html/tezheng.html

@@ -250,10 +250,7 @@
             billsAjax.getStdBillsLibName(billsLibId);
             buildAllItems(spread, totalItemsSetting);
             buildEigenvalue(spreadVal, eigenValueSetting);
-            if (locked) {
-                lockUtil.lockSpread(spread);
-                lockUtil.lockSpread(spreadVal);
-            }
+            lockUtil.lockSpreads([spread, spreadVal], locked);
   		});
         function buildAllItems(spread, setting){
             setSheet.initSheet(spread, setting, true);

+ 6 - 0
web/maintain/common/css/main.css

@@ -355,4 +355,10 @@ input[type=checkbox]{
     text-shadow: 0 1px 0 #fff;
     filter: alpha(opacity=20);
     opacity: .2;
+}
+
+.disabled {
+    pointer-events: none;
+    opacity: .65;
+    color:#666;
 }

+ 5 - 4
web/maintain/main_col_lib/html/edit.html

@@ -13,13 +13,13 @@
             <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
                 <div class="collapse navbar-collapse" id="navbarNav">
                     <div class="tools-btn btn-group align-top">
-                        <a href="javascript:void(0)" class="btn btn-sm" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
                     </div>
                 </div>
             </nav>
-            <textarea class="form-control" id="mainTreeCol" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="mainTreeCol" rows="38"></textarea>
         </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
@@ -33,4 +33,5 @@
 
 </script>
 <script type="text/javascript" src="/lib/json/json2.js"></script>
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/main_col_lib/js/main_col_edit.js"></script>

+ 6 - 4
web/maintain/main_col_lib/html/main.html

@@ -5,16 +5,17 @@
                 <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                         <table class="table table-hover table-bordered">
-                            <thead><tr><th>列设置名称</th><th width="160">编办</th><th width="160">添加时间</th><th width="90">操作</th></tr></thead>
+                            <thead><tr><th>列设置名称</th><th width="160">编办</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                             <tbody id="showArea">
                             <% for(let lib of mainColLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/mainTreeCol/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/mainTreeCol/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getMainColLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
-                                    <a style="color: #0275d8"  onclick='showDeleteModal("<%= lib.ID%>")'class="text-danger" title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock-btn-control disabled" href="javascript:void(0);" style="color: #0275d8" onclick='getMainColLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javascript:void(0);" style="color: #0275d8"  onclick='showDeleteModal("<%= lib.ID%>")' title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock" data-locked="true" href="javascript:void(0);" title="解锁"><i class="fa fa-unlock-alt"></i></a>
                                 </td>
                             </tr>
                             <% } %>
@@ -174,6 +175,7 @@
 </div>
 <script src = "/lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js"></script>
 <script>GC.Spread.Sheets.LicenseKey =  '<%- LicenseKey %>';</script>
+<script src="/public/web/lock_util.js"></script>
 <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
 <script type="text/javascript" src="/web/maintain/main_col_lib/js/main_tree_col.js"></script>
 <script type="text/javascript" src="/web/maintain/main_col_lib/js/main_col_lib.js"></script>

+ 2 - 1
web/maintain/main_col_lib/js/main_col_edit.js

@@ -1,8 +1,9 @@
 /**
  * Created by zhang on 2018/9/10.
  */
-
 $(document).ready(function () {
+    const locked = lockUtil.getLocked();
+    lockUtil.lockTools($(document.body), locked);
     try {
         let tem = JSON.parse($("#originalMainCol").val());
         tem = sortJson(tem);

+ 4 - 0
web/maintain/main_col_lib/js/main_col_lib.js

@@ -37,6 +37,10 @@ $(document).ready(function() {
         }
     });
 
+    $('.lock').click(function () {
+        lockUtil.handleLockClick($(this));
+    });
+
 });
 
 let colEditSpread = null;

+ 1 - 1
web/maintain/material_replace_lib/html/edit.html

@@ -63,5 +63,5 @@
 <script type="text/javascript" src="/lib/jquery-contextmenu/jquery.contextMenu.js"></script>
 <script type="text/javascript" src="/public/web/sheet/sheet_common.js"></script>
 <script type="text/javascript" src="/public/web/sheet/sheet_data_helper.js"></script>
-
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/material_replace_lib/js/material_replace_edit.js"></script>

+ 6 - 4
web/maintain/material_replace_lib/html/main.html

@@ -5,17 +5,18 @@
                 <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                         <table class="table table-hover table-bordered">
-                            <thead><tr><th>库名称</th><th>清单规则</th><th >费用定额</th><th width="160">添加时间</th><th width="120">操作</th></tr></thead>
+                            <thead><tr><th>库名称</th><th>清单规则</th><th >费用定额</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                             <tbody id="showArea">
                             <% for(let lib of materialLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/materialReplace/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/materialReplace/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= lib.billsLibName%></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getMaterialLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
-                                    <a style="color: #0275d8" onclick='showDeleteModal("<%= lib.ID%>")' class="text-danger" title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock-btn-control disabled" href="javascript:void(0);" style="color: #0275d8" onclick='getMaterialLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javascript:void(0);" style="color: #0275d8" onclick='showDeleteModal("<%= lib.ID%>")' title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock" data-locked="true" href="javascript:void(0);" title="解锁"><i class="fa fa-unlock-alt"></i></a>
                                 </td>
                             </tr>
                             <% } %>
@@ -115,4 +116,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/material_replace_lib/js/material_replace.js"></script>

+ 4 - 0
web/maintain/material_replace_lib/js/material_replace.js

@@ -66,6 +66,10 @@ $(document).ready(function() {
         }
     });
 
+    // 锁定、解锁
+    $('.lock').click(function () {
+        lockUtil.handleLockClick($(this));
+    });
 
 })
 

+ 3 - 3
web/maintain/material_replace_lib/js/material_replace_edit.js

@@ -1,7 +1,7 @@
 /**
  * Created by zhang on 2018/8/23.
  */
-
+const locked = lockUtil.getLocked();
 let materialOjb = {
     billsSpread:null,
     materialSpread:null,
@@ -100,7 +100,7 @@ let materialOjb = {
                     name: "删除",
                     icon: 'fa-trash-o',
                     disabled: function () {
-                        return !me.canDelete(sheet);
+                        return locked || !me.canDelete(sheet);
                     },
                     callback: function (key, opt) {
                         sheet.name() == 'billsSheet' ? me.deleteBills(sheet):me.deleteMaterial(sheet);
@@ -432,4 +432,4 @@ function isDef(obj) {
 }
 
 materialOjb.initSpread();
-
+lockUtil.lockSpreads([materialOjb.billsSpread, materialOjb.materialSpread], locked);

+ 5 - 4
web/maintain/project_feature_lib/html/edit.html

@@ -13,13 +13,13 @@
             <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
                 <div class="collapse navbar-collapse" id="navbarNav">
                     <div class="tools-btn btn-group align-top">
-                        <a href="javascript:void(0)" class="btn btn-sm" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
                     </div>
                 </div>
             </nav>
-            <textarea class="form-control" id="featureList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="featureList" rows="38"></textarea>
         </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
@@ -33,4 +33,5 @@
 
 </script>
 <script type="text/javascript" src="/lib/json/json2.js"></script>
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/project_feature_lib/js/project_feature_edit.js"></script>

+ 6 - 4
web/maintain/project_feature_lib/html/main.html

@@ -19,16 +19,17 @@
                 <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                         <table class="table table-hover table-bordered">
-                            <thead><tr><th >库名称</th><th>费用定额</th><th width="160">添加时间</th><th width="120">操作</th></tr></thead>
+                            <thead><tr><th >库名称</th><th>费用定额</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                             <tbody id="showArea">
                             <% for(let lib of featureLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/projectFeature/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/projectFeature/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getFeatureLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
-                                    <a style="color: #0275d8" onclick='showDeleteModal("<%= lib.ID%>")' class="text-danger" title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock-btn-control disabled" href="javascript:void(0);" style="color: #0275d8" onclick='getFeatureLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javascript:void(0);" onclick='showDeleteModal("<%= lib.ID%>")' title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock" data-locked="true" href="javascript:void(0);" title="解锁"><i class="fa fa-unlock-alt"></i></a>
                                 </td>
                             </tr>
                             <% } %>
@@ -129,4 +130,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/project_feature_lib/js/project_feature.js"></script>

+ 5 - 0
web/maintain/project_feature_lib/js/project_feature.js

@@ -52,6 +52,11 @@ $(document).ready(function() {
             }
         }
     });
+
+    // 锁定、解锁
+    $('.lock').click(function () {
+        lockUtil.handleLockClick($(this));
+    });
 });
 
 async function getFeatureLib (ID) {

+ 2 - 0
web/maintain/project_feature_lib/js/project_feature_edit.js

@@ -3,6 +3,8 @@
  */
 
 $(document).ready(function () {
+    const locked = lockUtil.getLocked();
+    lockUtil.lockTools($(document.body), locked);
     try {
         let tem = sortJson(JSON.parse($("#originalFeature").val()));
         $("#featureList").val(JSON.stringify(tem,null,4));

+ 1 - 0
web/maintain/ration_repository/css/main.css

@@ -297,4 +297,5 @@ div.resize-x{
 .disabled {
     pointer-events: none;
     opacity: .65;
+    color:#666;
 }

+ 1 - 1
web/maintain/ration_repository/dinge.html

@@ -652,6 +652,7 @@
         <script src="/lib/bootstrap/bootstrap.min.js"></script>
         <script src="/lib/lodash/lodash.js"></script>
         <script type="text/javascript" src="/web/maintain/ration_repository/js/global.js"></script>
+        <script src="/public/web/lock_util.js"></script>
         <script src="/public/web/PerfectLoad.js"></script>
         <!-- zTree -->
         <script type="text/javascript" src="/lib/ztree/jquery.ztree.core.js"></script>
@@ -664,7 +665,6 @@
         <script type="text/javascript" src="/public/web/scMathUtil.js"></script>
         <script type="text/javascript" src="/public/web/common_ajax.js"></script>
         <script src="/public/common_util.js"></script>
-        <script src="/public/web/lock_util.js"></script>
         <script type="text/javascript" src="/public/web/id_tree.js"></script>
         <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
         <script src="/public/web/tree_sheet/tree_sheet_helper.js"></script>

+ 1 - 2
web/maintain/ration_repository/js/coe.js

@@ -173,8 +173,7 @@ var pageObj = {
         gljAdjOprObj.buildSheet($('#contentSpread')[0]);
         coeOprObj.getCoeList();
         gljAdjOprObj.getGljItemsOcc();
-        lockUtil.lockSpread(coeOprObj.workBook);
-        lockUtil.lockSpread(gljAdjOprObj.workBook);
+        lockUtil.lockSpreads([coeOprObj.workBook, gljAdjOprObj.workBook], locked);
     },
     showData: function(sheet, setting, data) {
         let me = pageObj, ch = GC.Spread.Sheets.SheetArea.viewport;

+ 5 - 0
web/maintain/ration_repository/js/gljSelect.js

@@ -305,4 +305,9 @@ $(document).ready(function () {
             return false;
         }
     });
+    $('#selGlj').on('shown.bs.modal', function () {
+        if (gljSelOprObj.workBook) {
+            gljSelOprObj.workBook.refresh();
+        }
+    });
 });

+ 1 - 1
web/maintain/ration_repository/js/init.js

@@ -49,7 +49,7 @@ const initialization = (() => {
                 rdSpread
             ];
             const $range = $(document.body);
-            lockUtil.lockSpreadAndTools(lockedSpreads, $range);
+            lockUtil.lockSpreadsAndTools(lockedSpreads, $range, locked);
 
             $("#linkGLJ").click(function(){
                 rationGLJOprObj.bindRationGljDelOpr();

+ 11 - 3
web/maintain/ration_repository/js/installation.js

@@ -1,7 +1,7 @@
 /**
  * Created by Zhong on 2018/1/19.
  **/
-
+const locked = lockUtil.getLocked();
 $(document).ready(function () {
     feeItemObj.buildSheet();
     const lockedSpreads = [
@@ -9,7 +9,7 @@ $(document).ready(function () {
         sectionObj.workBook,
         feeRuleObj.workBook
     ];
-    lockedSpreads.forEach(spread => lockUtil.lockSpread(spread));
+    lockUtil.lockSpreads(lockedSpreads, locked);
     $('#sectionTreeModal').on('shown.bs.modal', function (e) {
         batchSectionObj.workBook.refresh();
         //bind confirm btn
@@ -312,6 +312,9 @@ let feeItemObj = {
         }
     },
     feeItemDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.workBook.commandManager().register('feeItemDel', function () {
             curDeleteType = me.deleteType;
@@ -448,7 +451,6 @@ let sectionObj = {
         $.contextMenu({
             selector: '#instSectionSpread',
             build: function($triggerElement, e){
-                const locked = lockUtil.getLocked();
                 //控制允许右键菜单在哪个位置出现
                 let sheet = me.sheet;
                 let offset = $("#instSectionSpread").offset(),
@@ -577,6 +579,9 @@ let sectionObj = {
         }
     },
     sectionDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.workBook.commandManager().register('sectionDel', function () {
             curDeleteType = me.deleteType;
@@ -1032,6 +1037,9 @@ let feeRuleObj = {
         }
     },
     feeRuleDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = feeRuleObj, se = sectionObj;
         me.workBook.commandManager().register('feeRuleDel', function () {
             me.toUpdate = false;

+ 4 - 2
web/maintain/ration_repository/js/ration.js

@@ -249,7 +249,6 @@ let rationOprObj = {
         $.contextMenu({
             selector: '#rationItemsSheet',
             build: function($triggerElement, e){
-                const locked = lockUtil.getLocked();
                 //控制允许右键菜单在哪个位置出现
                 let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
                 let sheet = me.workBook.getSheet(0);
@@ -293,6 +292,9 @@ let rationOprObj = {
         });
     },
     rationDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = rationOprObj;
         me.workBook.commandManager().register('rationDelete', function () {
             let rationSheet = me.workBook.getActiveSheet();
@@ -717,7 +719,7 @@ let rationOprObj = {
                             annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                             me.showRationItems(sectionID);
                         }
-                        if (!lockUtil.getLocked()) {
+                        if (!locked) {
                             sectionTreeObj.removeBtn.removeClass('disabled');
                         }
                         if(callback) {

+ 6 - 1
web/maintain/ration_repository/js/ration_assist.js

@@ -146,6 +146,9 @@ var rationAssistOprObj = {
         };
     },
     bindRationAssDel: function () {
+        if (locked) {
+            return;
+        }
         let me = rationAssistOprObj;
         let workBook = me.sheet.getParent();
         workBook.commandManager().register('rationAssDel', function () {
@@ -180,7 +183,9 @@ var rationAssistOprObj = {
         me.ration = ration;
 
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
-        sheetCommonObj.unShieldAllCells(me.sheet);
+        if (!locked) {
+            sheetCommonObj.unShieldAllCells(me.sheet);
+        }
 
         if (ration == undefined || ration.rationAssList == undefined ||
             ration.rationAssList.length == 0){

+ 3 - 0
web/maintain/ration_repository/js/ration_coe.js

@@ -189,6 +189,9 @@ var rationCoeOprObj = {
     },
 
     bindRationCoeDel: function () {
+        if (locked) {
+            return;
+        }
         let me = rationCoeOprObj;
         let workBook = me.sheet.getParent();
         workBook.commandManager().register('rationCoeDel', function () {

+ 3 - 4
web/maintain/ration_repository/js/ration_glj.js

@@ -75,6 +75,9 @@ var rationGLJOprObj = {
         this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onCellEditEnd);
     },
     bindRationGljDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = rationGLJOprObj, spreadBook = me.sheet.getParent();
         spreadBook.commandManager().register('rationGljDelete', function () {
             let sels = me.sheet.getSelections(), lockCols = me.setting.view.lockColumns;
@@ -274,7 +277,6 @@ var rationGLJOprObj = {
         $.contextMenu({
             selector: '#rdSpread',
             build: function($triggerElement, e){
-                const locked = lockUtil.getLocked();
                 //控制允许右键菜单在哪个位置出现
                 let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.sheet.getParent());
                 let sheet = me.sheet;
@@ -308,9 +310,6 @@ var rationGLJOprObj = {
                                     }
                                     //弹出窗口
                                     $('#selGlj').modal('show');
-                                    if (gljSelOprObj.workBook) {
-                                        gljSelOprObj.workBook.refresh();
-                                    }
                                 }},
                             "delete": {
                                 name: "删除人材机",

+ 3 - 0
web/maintain/ration_repository/js/ration_installation.js

@@ -213,6 +213,9 @@ let rationInstObj = {
         return obj;
     },
     bindRationInstDel: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         let workBook = me.sheet.getParent();
         workBook.commandManager().register('rationInstDel', function () {

+ 1 - 1
web/maintain/ration_repository/js/ration_template.js

@@ -142,7 +142,7 @@ const RationTemplate = (function () {
     //重新绑定del建
     //@return {void}
     function bindRationTempDel() {
-        if (!templateSheet) {
+        if (locked || !templateSheet) {
             return;
         }
         let workBook = templateSheet.getParent();

+ 1 - 1
web/maintain/ration_repository/js/section_tree.js

@@ -1,6 +1,7 @@
 /**
  * Created by Zhong on 2017/12/18.
  */
+const locked = lockUtil.getLocked();
 const moduleName = 'stdRation';
 //上下拖动div节点的高度
 const verticalResize = 10;
@@ -263,7 +264,6 @@ let sectionTreeObj = {
     },
     
     refreshBtn: function (selected) {
-        const locked = lockUtil.getLocked();
         if (locked) {
             return;
         }

+ 5 - 0
web/maintain/std_glj_lib/css/main.css

@@ -302,4 +302,9 @@ body {
     float: right;
     width: 30px;
     text-decoration: none;
+}
+.disabled {
+    pointer-events: none;
+    opacity: .65;
+    color:#666;
 }

+ 7 - 6
web/maintain/std_glj_lib/html/gongliao.html

@@ -45,12 +45,12 @@
                     <!--org 3:7:2-->
                   <div class="main-side p-0" id="leftContent" style="width: 25%; height: 100%; overflow: hidden">
                       <div class="tab-bar">
-                          <a href="javascript:void(0);" id="tree_Insert" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-plus" aria-hidden="true"></i></a>
-                          <a href="javascript:void(0);" id="tree_remove" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
-                          <a href="javascript:void(0);" id="tree_upLevel" class="btn btn-sm " data-toggle="tooltip" data-placement="bottom" title="" data-original-title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
-                          <a href="javascript:void(0);" id="tree_downLevel" class="btn btn-sm " data-toggle="tooltip" data-placement="bottom" title="" data-original-title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
-                          <a href="javascript:void(0);" id="tree_downMove" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
-                          <a href="javascript:void(0);" id="tree_upMove" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
+                          <a href="javascript:void(0);" id="tree_Insert" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-plus" aria-hidden="true"></i></a>
+                          <a href="javascript:void(0);" id="tree_remove" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
+                          <a href="javascript:void(0);" id="tree_upLevel" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="升级"><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
+                          <a href="javascript:void(0);" id="tree_downLevel" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="降级"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
+                          <a href="javascript:void(0);" id="tree_downMove" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="下移"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
+                          <a href="javascript:void(0);" id="tree_upMove" class="btn btn-sm lock-btn-control" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                       </div>
                       <div class="tab-content" id="gljClassSpread" style="overflow: hidden">
                       </div>
@@ -225,6 +225,7 @@
     <script type="text/javascript" src="/public/web/treeDataHelper.js"></script>
     <script type="text/javascript" src="/public/web/QueryParam.js"></script>
     <script type="text/javascript" src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script type="text/javascript" src="/public/web/id_tree.js"></script>
     <script type="text/javascript" src="/public/web/tools_const.js"></script>
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>

+ 13 - 1
web/maintain/std_glj_lib/html/main.html

@@ -33,7 +33,18 @@
                   <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                       <table class="table table-hover table-bordered">
-                        <thead><tr><th>人材机库名称</th><th>费用定额</th><th>定额库</th><th width="160">添加时间</th><th width="90">操作</th><th width="90">价格数据</th><th width="100">组成物数据</th><th width="90">补充模板</th></tr></thead>
+                        <thead>
+                            <tr>
+                                <th>人材机库名称</th>
+                                <th>费用定额</th>
+                                <th>定额库</th>
+                                <th width="160">添加时间</th>
+                                <th width="70">操作</th>
+                                <th width="90">价格数据</th>
+                                <th width="100">组成物数据</th>
+                                <th width="90">补充模板</th>
+                            </tr>
+                        </thead>
                         <tbody id="showArea">
                         </tbody>
                       </table>
@@ -180,6 +191,7 @@
     <script src="/lib/bootstrap/bootstrap.min.js"></script>
     <script src="/web/maintain/std_glj_lib/js/global.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
     <!-- zTree -->
   	<script type="text/javascript" src="/lib/ztree/jquery.ztree.core.js"></script>

+ 11 - 7
web/maintain/std_glj_lib/js/glj.js

@@ -1,7 +1,7 @@
 /**
  * Created by Zhong on 2017/8/14.
  */
-
+const locked = lockUtil.getLocked();
 $(document).ready(function () {
     let moduleName = 'stdGLj';
     function refreshALlWorkBook() {
@@ -70,11 +70,12 @@ let pageOprObj = {
             //repositoryGljObj.getRationGljIds(gljLibId);
             repositoryGljObj.getGljDistType(function () {
                 repositoryGljObj.currentRepositoryId = parseInt(gljLibId);
-              /*  repositoryGljObj.getGljTree(gljLibId, function () {
-                    repositoryGljObj.getGljItems(gljLibId);
-                });*/
                 repositoryGljObj.getGljItems(gljLibId, function () {
-                    gljClassTreeObj.getGljClassTree(gljLibId);
+                    gljClassTreeObj.getGljClassTree(gljLibId, function () {
+                        const spreads = [gljClassTreeObj.workBook, repositoryGljObj.workBook, gljComponentOprObj.workBook];
+                        const $range = $(document.body);
+                        lockUtil.lockSpreadsAndTools(spreads, $range, locked);
+                    });
                 })
             });
         });
@@ -1064,6 +1065,9 @@ let repositoryGljObj = {
     },
     //删除人材机前需要判断人材机是否有被引用,被引用了则不可删除
     repositoryGljDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = repositoryGljObj;
         me.workBook.commandManager().register('repositoryGljDel', function () {
             let sels = me.workBook.getActiveSheet().getSelections();
@@ -1103,7 +1107,7 @@ let repositoryGljObj = {
                             delete: {
                                 name: "删除",
                                 disabled: function () {
-                                    return !(me.currentCache && me.currentCache[target.row]);
+                                    return locked || !(me.currentCache && me.currentCache[target.row]);
                                 },
                                 icon: "fa-remove",
                                 callback: function (key, opt) {
@@ -1148,7 +1152,7 @@ let repositoryGljObj = {
                     if (ration.rationRepId) {
                         return `<li>
                                     <span>${ration.code}</span>
-                                    <a target="_blank" href="/rationRepository/ration?repository=${ration.rationRepId}#${ration.code}">定位</a>
+                                    <a target="_blank" href="/rationRepository/ration?repository=${ration.rationRepId}&locked=${locked}#${ration.code}">定位</a>
                                 </li>`;
                     }
                     return `<li><span>${ration.code}</span></li>`;

+ 3 - 0
web/maintain/std_glj_lib/js/gljClassTree.js

@@ -206,6 +206,9 @@ let gljClassTreeObj = {
     },
 
     refreshBtn: function (selected) {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.insertBtn.removeClass('disabled');
         me.removeBtn.removeClass('disabled');

+ 6 - 3
web/maintain/std_glj_lib/js/gljComponent.js

@@ -1,7 +1,6 @@
 /**
  * Created by Zhong on 2017/8/15.
  */
-
 let gljComponentOprObj = {
     workBook: null,
     processDecimal: -6,
@@ -182,6 +181,9 @@ let gljComponentOprObj = {
         return _.isEqual(consumeAmtA.consumeAmtProperty, consumeAmtB.consumeAmtProperty);
     },
     gljComponentDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = gljComponentOprObj, that = repositoryGljObj, updateArr = [], removeArr = [], isUpdate = false, updateBasePrc= [];
         me.workBook.commandManager().register('gljComponentDel', function () {
             let sels = me.workBook.getSheet(0).getSelections();
@@ -258,6 +260,7 @@ let gljComponentOprObj = {
         me.workBook.commandManager().setShortcutKey('gljComponentDel', GC.Spread.Commands.Key.del, false, false, false, false);
     },
     onContextmenuOpr: function () {
+        const locked = lockUtil.getLocked();
         let me = gljComponentOprObj, that = repositoryGljObj, co = componentOprObj;
         $.contextMenu({
             selector: '#gljComponentSheet',
@@ -277,10 +280,10 @@ let gljComponentOprObj = {
                     //控制按钮是否可用
                     let insertDis = false,
                         delDis = false;
-                    if(!(that.currentGlj && allowComponent.includes(that.currentGlj.gljType)) || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList))){
+                    if(locked || !(that.currentGlj && allowComponent.includes(that.currentGlj.gljType)) || (that.currentGlj.gljType === 4 && that.isComponent(that.currentGlj.ID, that.gljList))){
                         insertDis = true;
                     }
-                    if(!that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
+                    if(locked || !that.currentGlj || typeof that.currentComponent === 'undefined' || (typeof that.currentComponent !== 'undefined' && target.row >= that.currentComponent.length)){//右键定位在有组成物的行,删除键才显示可用
                         delDis = true;
                     }
                     return {

+ 22 - 15
web/maintain/std_glj_lib/js/main.js

@@ -117,7 +117,10 @@ $(function () {
                     deleteCount = 0;
                 }
             });
-
+            // 锁定、解锁
+            $('#showArea').on('click', '.lock', function () {
+                lockUtil.handleLockClick($(this));
+            });
 
         });
     });
@@ -277,16 +280,18 @@ function getAllGljLib(callback){
                     dispNames.push(result.data[i].dispName);
                     $("#showArea").append(
                         "<tr id='"+id+"' data-compilationId='"+ compilationId + "'>" +
-                        "<td><a href='/stdGljRepository/glj?gljLibId="+id+"'>"+libName+"</a></td>" +
+                        "<td><a href='/stdGljRepository/glj?gljLibId="+id+"&locked=true'>"+libName+"</a></td>" +
                         "<td>"+compilationName+" </td>" +
                         "<td>"+rationLibsName+" </td>" +
                         "<td>"+createDate+" </td>" +
-                        "<td><a href='javascript:void(0);' data-toggle='modal' data-target='#edit' title='编辑'>" +
-                        "<i class='fa fa-pencil-square-o'></i></a> <a href='javascript:void(0);' data-toggle='modal' data-target='#del' class='text-danger' title='删除'>" +
-                        "<i class='fa fa-remove'></i></a></td>" +
-                        "<td><a class='btn btn-secondary btn-sm import-data' href='javacript:void(0);' data-id='"+ id +"' title='导入数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
-                        "<td><a class='btn btn-secondary btn-sm import-components' href='javacript:void(0);' data-id='"+ id +"' title='导入组成物'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
-                        "<td><a class='btn btn-secondary btn-sm set-comple' href='javacript:void(0);' data-id='"+ id +"' title='将分类树设为补充模板数据'><i class='fa fa-sign-in fa-rotate-90'></i>设置</a></td>" +
+                        "<td><a class='lock-btn-control disabled' href='javascript:void(0);' data-toggle='modal' data-target='#edit' title='编辑'>" +
+                        "<i class='fa fa-pencil-square-o'></i></a> <a href='javascript:void(0);' data-toggle='modal' data-target='#del' class='text-danger lock-btn-control disabled' title='删除'>" +
+                        "<i class='fa fa-remove'></i></a> " +
+                        "<a class='lock' data-locked='true' href='javascript:void(0);' title='解锁'><i class='fa fa-unlock-alt'></i></a>" +
+                        "</td>" +
+                        "<td><a class='btn btn-secondary btn-sm import-data lock-btn-control disabled' href='javacript:void(0);' data-id='"+ id +"' title='导入数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
+                        "<td><a class='btn btn-secondary btn-sm import-components lock-btn-control disabled' href='javacript:void(0);' data-id='"+ id +"' title='导入组成物'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
+                        "<td><a class='btn btn-secondary btn-sm set-comple lock-btn-control disabled' href='javacript:void(0);' data-id='"+ id +"' title='将分类树设为补充模板数据'><i class='fa fa-sign-in fa-rotate-90'></i>设置</a></td>" +
                         "</tr>");
                 }
             }
@@ -328,16 +333,18 @@ function createGljLib(gljLibObj, dispNamesArr, usedCom){
                 usedCom.push(gljLibObj.compilationId);
                 $("#showArea").append(
                     "<tr id='"+id+"' data-compilationId='"+ gljLibObj.compilationId + "'>" +
-                    "<td><a href='/stdGljRepository/glj?gljLibId="+id+"'>"+libName+"</a></td>" +
+                    "<td><a href='/stdGljRepository/glj?gljLibId="+id+"&locked=true'>"+libName+"</a></td>" +
                     "<td>"+compilationName+" </td>" +
                     "<td>"+''+" </td>" +
                     "<td>"+createDate+" </td>" +
-                    "<td><a href='javascript:void(0);' data-toggle='modal' data-target='#edit' title='编辑'>" +
-                    "<i class='fa fa-pencil-square-o'></i></a> <a href='javascript:void(0);' data-toggle='modal' data-target='#del' class='text-danger' title='删除'>" +
-                    "<i class='fa fa-remove'></i></a></td>" +
-                    "<td><a class='btn btn-secondary btn-sm import-data' href='javacript:void(0);' data-id='"+ id +"' title='导入数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
-                    "<td><a class='btn btn-secondary btn-sm import-components' href='javacript:void(0);' data-id='"+ id +"' title='导入组成物'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
-                    "<td><a class='btn btn-secondary btn-sm set-comple' href='javacript:void(0);' data-id='"+ id +"' title='将分类树设为补充模板数据'><i class='fa fa-sign-in fa-rotate-90'></i>设置</a></td>" +
+                    "<td><a class='lock-btn-control disabled' href='javascript:void(0);' data-toggle='modal' data-target='#edit' title='编辑'>" +
+                    "<i class='fa fa-pencil-square-o'></i></a> <a href='javascript:void(0);' data-toggle='modal' data-target='#del' class='text-danger lock-btn-control disabled' title='删除'>" +
+                    "<i class='fa fa-remove'></i></a>" +
+                    "<a class='lock' data-locked='true' href='javascript:void(0);' title='解锁'><i class='fa fa-unlock-alt'></i></a>" +
+                    "</td>" +
+                    "<td><a class='btn btn-secondary btn-sm import-data lock-btn-control disabled' href='javacript:void(0);' data-id='"+ id +"' title='导入数据'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
+                    "<td><a class='btn btn-secondary btn-sm import-components lock-btn-control disabled' href='javacript:void(0);' data-id='"+ id +"' title='导入组成物'><i class='fa fa-sign-in fa-rotate-90'></i>导入</a></td>" +
+                    "<td><a class='btn btn-secondary btn-sm set-comple lock-btn-control disabled' href='javacript:void(0);' data-id='"+ id +"' title='将分类树设为补充模板数据'><i class='fa fa-sign-in fa-rotate-90'></i>设置</a></td>" +
                     "</tr>");
             }
             $('#cancelBtn').click();