瀏覽代碼

各库增加锁定解锁功能

zeweizhong 5 年之前
父節點
當前提交
304b0cd980
共有 76 個文件被更改,包括 948 次插入445 次删除
  1. 12 0
      modules/bills_lib/controllers/bills_lib_controllers.js
  2. 3 0
      modules/bills_lib/controllers/stdBillsLib_permissionController.js
  3. 99 0
      modules/bills_lib/models/bills_lib_interfaces.js
  4. 1 0
      modules/bills_lib/routes/bills_lib_routes.js
  5. 16 12
      modules/ration_repository/controllers/repository_views_controller.js
  6. 1 2
      modules/ration_repository/models/repository_map.js
  7. 4 44
      modules/std_glj_lib/models/gljModel.js
  8. 6 1
      public/common_util.js
  9. 109 0
      public/web/lock_util.js
  10. 11 10
      web/maintain/bill_template_lib/html/edit.html
  11. 7 5
      web/maintain/bill_template_lib/html/main.html
  12. 5 0
      web/maintain/bill_template_lib/js/bills_template.js
  13. 13 16
      web/maintain/bill_template_lib/js/bills_template_edit.js
  14. 5 0
      web/maintain/billsGuidance_lib/css/main.css
  15. 11 1
      web/maintain/billsGuidance_lib/html/main.html
  16. 11 10
      web/maintain/billsGuidance_lib/html/zhiyin.html
  17. 14 7
      web/maintain/billsGuidance_lib/js/billsGuidance.js
  18. 10 4
      web/maintain/billsGuidance_lib/js/main.js
  19. 5 0
      web/maintain/bills_lib/css/main.css
  20. 79 29
      web/maintain/bills_lib/html/main.html
  21. 5 2
      web/maintain/bills_lib/html/neirong.html
  22. 21 11
      web/maintain/bills_lib/html/qingdan.html
  23. 5 2
      web/maintain/bills_lib/html/tezheng.html
  24. 52 27
      web/maintain/bills_lib/scripts/bills_lib_ajax.js
  25. 11 10
      web/maintain/calc_program_lib/html/edit.html
  26. 6 4
      web/maintain/calc_program_lib/html/main.html
  27. 4 0
      web/maintain/calc_program_lib/js/calc_program.js
  28. 2 0
      web/maintain/calc_program_lib/js/calc_program_edit.js
  29. 6 0
      web/maintain/common/css/main.css
  30. 11 10
      web/maintain/fee_rate_lib/html/edit.html
  31. 7 5
      web/maintain/fee_rate_lib/html/main.html
  32. 5 0
      web/maintain/fee_rate_lib/js/fee_rate.js
  33. 2 1
      web/maintain/fee_rate_lib/js/fee_rate_edit.js
  34. 5 4
      web/maintain/main_col_lib/html/edit.html
  35. 6 4
      web/maintain/main_col_lib/html/main.html
  36. 2 0
      web/maintain/main_col_lib/js/main_col_edit.js
  37. 4 0
      web/maintain/main_col_lib/js/main_col_lib.js
  38. 1 1
      web/maintain/material_replace_lib/html/edit.html
  39. 6 4
      web/maintain/material_replace_lib/html/main.html
  40. 4 0
      web/maintain/material_replace_lib/js/material_replace.js
  41. 3 3
      web/maintain/material_replace_lib/js/material_replace_edit.js
  42. 5 4
      web/maintain/progressive_lib/html/edit.html
  43. 6 4
      web/maintain/progressive_lib/html/main.html
  44. 4 0
      web/maintain/progressive_lib/js/progressive_interval.js
  45. 2 0
      web/maintain/progressive_lib/js/progressive_interval_edit.js
  46. 12 16
      web/maintain/project_feature_lib/html/edit.html
  47. 6 4
      web/maintain/project_feature_lib/html/main.html
  48. 4 0
      web/maintain/project_feature_lib/js/project_feature.js
  49. 2 0
      web/maintain/project_feature_lib/js/project_feature_edit.js
  50. 1 0
      web/maintain/ration_repository/anzhuang.html
  51. 5 0
      web/maintain/ration_repository/css/main.css
  52. 19 12
      web/maintain/ration_repository/dinge.html
  53. 1 1
      web/maintain/ration_repository/js/coe.js
  54. 5 2
      web/maintain/ration_repository/js/explanatory.js
  55. 7 0
      web/maintain/ration_repository/js/init.js
  56. 28 9
      web/maintain/ration_repository/js/installation.js
  57. 4 1
      web/maintain/ration_repository/js/main.js
  58. 26 26
      web/maintain/ration_repository/js/ration.js
  59. 6 1
      web/maintain/ration_repository/js/ration_assist.js
  60. 3 0
      web/maintain/ration_repository/js/ration_coe.js
  61. 100 86
      web/maintain/ration_repository/js/ration_glj.js
  62. 3 0
      web/maintain/ration_repository/js/ration_installation.js
  63. 1 1
      web/maintain/ration_repository/js/ration_template.js
  64. 4 0
      web/maintain/ration_repository/js/section_tree.js
  65. 21 8
      web/maintain/ration_repository/main.html
  66. 5 0
      web/maintain/std_glj_lib/css/main.css
  67. 7 6
      web/maintain/std_glj_lib/html/gongliao.html
  68. 13 1
      web/maintain/std_glj_lib/html/main.html
  69. 11 7
      web/maintain/std_glj_lib/js/glj.js
  70. 3 0
      web/maintain/std_glj_lib/js/gljClassTree.js
  71. 5 4
      web/maintain/std_glj_lib/js/gljComponent.js
  72. 22 15
      web/maintain/std_glj_lib/js/main.js
  73. 5 4
      web/maintain/vehicleVesselTax_lib/html/edit.html
  74. 6 4
      web/maintain/vehicleVesselTax_lib/html/main.html
  75. 4 0
      web/maintain/vehicleVesselTax_lib/js/vvTax.js
  76. 2 0
      web/maintain/vehicleVesselTax_lib/js/vvTax_edit.js

+ 12 - 0
modules/bills_lib/controllers/bills_lib_controllers.js

@@ -8,6 +8,18 @@ let callback = function(req, res, err, message, data){
 }
 
 module.exports = {
+    copyStdBillsLib: async function (req, res) {
+        try {
+            const data = JSON.parse(req.body.data);
+            const userName = req.session.managerData.username;
+            const libName = data.libName;
+            const libId = data.libId;
+            const newLibData = await billsLibDao.copyLib(userName, libName, libId);
+            callback(req, res, 0, 'copyLib success', [newLibData]);
+        } catch (err) {
+            callback(req, res, 1, 'copyLib fail', null);
+        }
+    },
     getMaxNumber: function(req, res){
         let data = JSON.parse(req.body.data);
         billsLibDao.getMaxNumber(data, function(err, message, maxNumber){

+ 3 - 0
modules/bills_lib/controllers/stdBillsLib_permissionController.js

@@ -40,6 +40,9 @@ class billsLibPermContr extends baseController{
     createStdBillsLib(req, res){
         billsController.createStdBillsLib(req, res);
     }
+    copyStdBillsLib(req, res) {
+        billsController.copyStdBillsLib(req, res);
+    }
     deleteStdBillsLib(req, res){
         billsController.deleteStdBillsLib(req, res);
     }

+ 99 - 0
modules/bills_lib/models/bills_lib_interfaces.js

@@ -14,6 +14,91 @@ const engLibModel = mongoose.model('engineering_lib');
 let uuid = require('uuid');
 let billsLibDao = function(){};
 
+billsLibDao.prototype.copyLib = async function (userName, libName, fromLibId) {
+    const libData = await this.createStdBillsLibSync(userName, libName);
+    const newLibId = libData.billsLibId;
+    //插入工作内容
+    let orgJobs = await JobContent.find({billsLibId: fromLibId}).lean();
+    let jobCounter = await counter.counterDAO.getIDAfterCount(counter.moduleName.billsLib_jobs, orgJobs.length);
+    let maxJobId = jobCounter.sequence_value;
+    let jobTask = [],
+        orgNewJobMapping = {};
+    for (let i = 0; i < orgJobs.length; i++) {
+        let jobData = orgJobs[i];
+        delete jobData._id;
+        let newID = (maxJobId - (orgJobs.length - 1) + i);
+        orgNewJobMapping[jobData.id] = newID;
+        jobData.id = newID;
+        jobData.billsLibId = newLibId;
+        jobTask.push({insertOne: {document: jobData}});
+    }
+    if (jobTask.length > 0) {
+        await JobContent.bulkWrite(jobTask);
+    }
+    //插入项目特征
+    let orgItems = await ItemCharacter.find({billsLibId: fromLibId}).lean();
+    let itemCounter = await counter.counterDAO.getIDAfterCount(counter.moduleName.billsLib_items, orgItems.length);
+    let maxItemId = itemCounter.sequence_value;
+    let itemTask = [],
+        orgNewItemMapping = {};
+    for (let i = 0; i < orgItems.length; i++) {
+        let itemData = orgItems[i];
+        delete itemData._id;
+        let newID = (maxItemId - (orgItems.length - 1) + i);
+        orgNewItemMapping[itemData.id] = newID;
+        itemData.id = newID;
+        itemData.billsLibId = newLibId;
+        itemTask.push({insertOne: {document: itemData}});
+    }
+    if (itemTask.length > 0) {
+        await ItemCharacter.bulkWrite(itemTask);
+    }
+    //插入清单
+    let billsTask = [];
+    let bills = await Bills.find({billsLibId: fromLibId}).lean();
+    let IDMapping = {},
+        billsDatas = [];
+    for (let b of bills) {
+        let bData = b;
+        delete bData._id;
+        bData.billsLibId = newLibId;
+        billsDatas.push(bData);
+        IDMapping[bData.ID] = uuid.v1();
+    }
+    for (let bD of billsDatas) {
+        bD.ID = IDMapping[bD.ID];
+        if (IDMapping[bD.NextSiblingID]) {
+            bD.NextSiblingID = IDMapping[bD.NextSiblingID];
+        }
+        if (IDMapping[bD.ParentID]) {
+            bD.ParentID = IDMapping[bD.ParentID];
+        }
+        // 更新sectionInfo数据
+        if (bD.sectionInfo) {
+            const first = IDMapping[bD.sectionInfo.first];
+            const second = IDMapping[bD.sectionInfo.second];
+            const third = IDMapping[bD.sectionInfo.third];
+            bD.sectionInfo.first = first || null;
+            bD.sectionInfo.second = second || null;
+            bD.sectionInfo.third = third || null;
+        }
+        for (let subJob of bD.jobs) {
+            if (orgNewJobMapping[subJob.id]) {
+                subJob.id = orgNewJobMapping[subJob.id];
+            }
+        }
+        for (let subItem of bD.items) {
+            if (orgNewItemMapping[subItem.id]) {
+                subItem.id = orgNewItemMapping[subItem.id];
+            }
+        }
+        billsTask.push({insertOne: {document: bD}});
+    }
+    if (billsTask.length > 0) {
+        await Bills.bulkWrite(billsTask);
+    }
+    return libData;
+};
 
 billsLibDao.prototype.getMaxNumber = function(gData, callback){
     let billsLibId = gData.billsLibId;
@@ -65,6 +150,20 @@ billsLibDao.prototype.getStdBillsLib = function(callback){
     });
 };
 
+billsLibDao.prototype.createStdBillsLibSync = async function (userName, libName) {
+    const counterRst = await counter.counterDAO.getIDAfterCount(counter.moduleName.billsLib, 1);
+    const dateStr = moment().format('YYYY-MM-DD HH:mm:ss');
+    const libData = {
+        creator: userName,
+        createDate: dateStr,
+        recentOpr: [{operator: userName, operateDate: dateStr}],
+        billsLibId: counterRst.sequence_value,
+        billsLibName: libName,
+        deleted: false
+    };
+    await StdBillsLib.create(libData);
+    return libData;
+};
 
 billsLibDao.prototype.createStdBillsLib = function(clibData, callback){
     counter.counterDAO.getIDAfterCount(counter.moduleName.billsLib, 1, function(err, result){

+ 1 - 0
modules/bills_lib/routes/bills_lib_routes.js

@@ -26,6 +26,7 @@ module.exports =function (app) {
     billsRouter.post('/getABillsLib', billsLibContr.auth, billsLibContr.init, billsLibContr.getABillsLib);
     billsRouter.post("/getStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.getStdBillsLib);
     billsRouter.post("/createStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.createStdBillsLib);
+    billsRouter.post("/copyStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.copyStdBillsLib);
     billsRouter.post("/deleteStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.deleteStdBillsLib);
     billsRouter.post("/renameStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.renameStdBillsLib);
     billsRouter.post("/getStdBillsLibName", billsLibContr.auth, billsLibContr.init, billsLibContr.getStdBillsLibName);

+ 16 - 12
modules/ration_repository/controllers/repository_views_controller.js

@@ -35,9 +35,10 @@ class ViewsController extends BaseController{
     }
     async redirectRation(req, res){
         const repId = req.query.repository;
-        const redirectGlj = `/rationRepository/lmm?repository=${repId}`;
-        const redirectCoe = `/rationRepository/coeList?repository=${repId}`;
-        const redirectInstallation = `/rationRepository/installation?repository=${repId}`;
+        const locked = req.query.locked || 'true';
+        const redirectGlj = `/rationRepository/lmm?repository=${repId}&locked=${locked}`;
+        const redirectCoe = `/rationRepository/coeList?repository=${repId}&locked=${locked}`;
+        const redirectInstallation = `/rationRepository/installation?repository=${repId}&locked=${locked}`;
         let overWriteUrl = null;
         let priceProperties = [];
         let stdRationLib = await rationLibModel.findOne({ID: repId});
@@ -60,9 +61,10 @@ class ViewsController extends BaseController{
     }
     async redirectGlj(req, res){
         const repId = req.query.repository;
-        const redirectRation = `/rationRepository/ration?repository=${repId}`;
-        const redirectCoe = `/rationRepository/coeList?repository=${repId}`;
-        const redirectInstallation = `/rationRepository/installation?repository=${repId}`;
+        const locked = req.query.locked || 'true';
+        const redirectRation = `/rationRepository/ration?repository=${repId}&locked=${locked}`;
+        const redirectCoe = `/rationRepository/coeList?repository=${repId}&locked=${locked}`;
+        const redirectInstallation = `/rationRepository/installation?repository=${repId}&locked=${locked}`;
         let overWriteUrl = null;
         let priceProperties = [];
         let stdRationLib = await rationLibModel.findOne({ID: repId});
@@ -86,9 +88,10 @@ class ViewsController extends BaseController{
     }
     redirectCoeList(req, res){
         const repId = req.query.repository;
-        const redirectGlj = `/rationRepository/lmm?repository=${repId}`;
-        const redirectRation = `/rationRepository/ration?repository=${repId}`;
-        const redirectInstallation = `/rationRepository/installation?repository=${repId}`;
+        const locked = req.query.locked || 'true';
+        const redirectGlj = `/rationRepository/lmm?repository=${repId}&locked=${locked}`;
+        const redirectRation = `/rationRepository/ration?repository=${repId}&locked=${locked}`;
+        const redirectInstallation = `/rationRepository/installation?repository=${repId}&locked=${locked}`;
         res.render('maintain/ration_repository/fuzhu.html',
             {
                 userAccount: req.session.managerData.username,
@@ -101,9 +104,10 @@ class ViewsController extends BaseController{
     }
     async redirectInstallation(req, res){
         const repId = req.query.repository;
-        const redirectGlj = `/rationRepository/lmm?repository=${repId}`;
-        const redirectCoe = `/rationRepository/coeList?repository=${repId}`;
-        const redirectRation = `/rationRepository/ration?repository=${repId}`;
+        const locked = req.query.locked || 'true';
+        const redirectGlj = `/rationRepository/lmm?repository=${repId}&locked=${locked}`;
+        const redirectCoe = `/rationRepository/coeList?repository=${repId}&locked=${locked}`;
+        const redirectRation = `/rationRepository/ration?repository=${repId}&locked=${locked}`;
         let stdRationLib = await rationLibModel.findOne({ID: repId});
         res.render('maintain/ration_repository/anzhuang.html',
             {

+ 1 - 2
modules/ration_repository/models/repository_map.js

@@ -186,8 +186,7 @@ rationRepositoryDao.prototype.updateName = function(oprtor, renameObj, callback)
     rationRepository.update({ID: renameObj.ID, deleted: false}, {$set: {dispName: renameObj.newName}}, function (err) {
         if(err){
             callback(err, '重命名失败!');
-        }
-        else{
+        } else{
             new rationRepositoryDao().updateOprArr({ID: renameObj.ID, deleted: false}, oprtor, moment(Date.now()).format('YYYY-MM-DD HH:mm:ss'), function (err) {
                 if(err){
                     callback(err, '更新最近操作者失败!');

+ 4 - 44
modules/std_glj_lib/models/gljModel.js

@@ -8,6 +8,7 @@ const gljClassModel = mongoose.model('std_glj_lib_gljClass');
 const gljClassTemplateModel = mongoose.model('std_glj_lib_gljClassTemplate');
 const compilationModel = mongoose.model('compilation');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
+const rationMapModel = mongoose.model('std_ration_lib_map');
 const rationModel = mongoose.model('std_ration_lib_ration_items');
 const complementaryRationModel = mongoose.model('complementary_ration_items');
 import {OprDao} from  "./gljMapModel";
@@ -18,10 +19,10 @@ import async from "async";
 class GljDao  extends OprDao{
     async getReference(repositoryId, gljId) {
         const gljLib = await gljMapModel.findOne({ID: repositoryId});
-        const rationLibIds = [];
+        const rationLibIds = gljLib.rationLibs.map(lib => lib.ID);
+        const rationLibs = await rationMapModel.find({ID: {$in: rationLibIds}}, '-_id ID dispName');
         const rationLibNameMapping = {};
-        gljLib.rationLibs.forEach(item => {
-            rationLibIds.push(item.ID);
+        rationLibs.forEach(item => {
             rationLibNameMapping[item.ID] = item.dispName;
         });
         const stdRations = await rationModel.find({rationRepId: {$in: rationLibIds}, 'rationGljList.gljId': gljId}, '-_id code rationRepId');
@@ -42,47 +43,6 @@ class GljDao  extends OprDao{
         complementaryRations.forEach(ration => rst[complementaryLib].push({code: ration.code}));
         return rst;
     }
-    //test
-    async deSomething (libID){
-        let pClass = await gljClassModel.find({repositoryId: libID, Name: '2013全省材料预算价格'});
-        let classIDs = [],
-            pClassIDs = [];
-        for (let p of pClass) {
-            let p1Class = await gljClassModel.find({repositoryId: libID, ParentID: p.ID});
-            for (let c of p1Class) {
-                pClassIDs.push(c.ID);
-            }
-        }
-        let subClass = await gljClassModel.find({repositoryId: libID, ParentID: {$in: pClassIDs}});
-        for (let s of subClass) {
-            classIDs.push(s.ID);
-        }
-        let subSonClass = await gljClassModel.find({repositoryId: libID, ParentID: {$in: classIDs}});
-        for (let ss of subSonClass){
-            classIDs.push(ss.ID);
-        }
-        classIDs = Array.from(new Set(classIDs));
-        //相关人材机
-        let gljs = await gljModel.find({repositoryId: libID, gljClass: {$in: classIDs}}, '-_id gljClass ID');
-        let gljIDs = [];
-        for (let g of gljs) {
-            gljIDs.push(g.ID);
-        }
-        let gljLib = await gljMapModel.findOne({ID: libID});
-        let refRationLibIDs = [];
-        for (let rl of gljLib.rationLibs) {
-            refRationLibIDs.push(rl.ID);
-        }
-        let i = 0;
-        for (let rationLibID of refRationLibIDs) {
-            await rationModel.update({rationRepId: rationLibID, 'rationGljList.gljId': {$in: gljIDs}}, {$pull: {rationGljList: {gljId: {$in: gljIDs}}}}, {multi: true});
-            console.log(`i++======================`);
-            console.log(i++);
-        }
-        await gljModel.remove({ID: {$in: gljIDs}});
-        console.log('end');
-
-    }
 
     async getGljTreeSync(gljLibId) {
         return await gljClassModel.find({repositoryId: gljLibId});

+ 6 - 1
public/common_util.js

@@ -23,14 +23,19 @@ function deleteEmptyObject(arr) {
     if (typeof module !== 'undefined') {
         module.exports = factory();
     } else {
-        window._commonUtil = factory();
+        window.commonUtil = factory();
     }
 })(() => {
+    function isDef(val) {
+        return typeof val !== 'undefined' && val !== null;
+    }
+
     function isEmptyVal(val) {
         return val === null || val === undefined || val === '';
     }
 
     return {
+        isDef,
         isEmptyVal
     };
 });

+ 109 - 0
public/web/lock_util.js

@@ -0,0 +1,109 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2019/11/14
+ * @version
+ */
+
+const lockUtil = (() => {
+    // 从地址栏获取是否锁定
+    function getLocked() {
+        const search = window.location.search;
+        const reg = /locked=(false|true)/;
+        const match = search.match(reg);
+        return match ? JSON.parse(match[1]) : true;
+    }
+    function lockTools($range, locked) {
+        const $btns = $range.find('.lock-btn-control');
+        const toolList = [];
+        for (const $btn of $btns) {
+            toolList.push({$ref: $($btn), type: 'button'});
+        }
+        const $texts = $range.find('.lock-text-control');
+        for (const $text of $texts) {
+            toolList.push({$ref: $($text), type: 'text'});
+        }
+        toolList.forEach(item => {
+            switch (item.type) {
+                case 'button':
+                    locked ? item.$ref.addClass('disabled') : item.$ref.removeClass('disabled');
+                    break;
+                case 'text':
+                    item.$ref.prop('readOnly', locked);
+                    break;
+            }
+        });
+    }
+    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();
+            }
+        });
+    }
+    function lockURL(locked, $url) {
+        const originURL = $url.prop('href');
+        const originLocked = !locked;
+        const reg = new RegExp(`locked=${originLocked}`);
+        const curURL = reg.test(originURL) ? originURL.replace(reg, `locked=${locked}`) : `${originURL}&locked=${locked}`;
+        $url.prop('href', curURL);
+    }
+    // 库列表页面,锁定按钮点击操作
+    function handleLockClick($lock) {
+        const curLocked = !$lock.data().locked;
+        $lock.data('locked', curLocked);
+        const innerHtml = curLocked ? '<i class="fa fa-unlock-alt"></i>' : '<i class="fa fa-lock"></i>';
+        $lock.html(innerHtml);
+        const title = curLocked ? '解锁' : '锁定';
+        $lock.prop('title', title);
+        const $url = $lock.parent().parent().children(':first-child').children(':first-child');
+        lockURL(curLocked, $url);
+        const $range = $lock.parent().parent();
+        lockTools($range, curLocked);
+    }
+    function lockSpreadsAndTools(spreads, $range, locked) {
+        if (!locked) {
+            return;
+        }
+        lockSpreads(spreads, locked);
+        lockTools($range, locked);
+    }
+
+    return {
+        getLocked,
+        lockTools,
+        lockSpreads,
+        lockURL,
+        handleLockClick,
+        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>
                             <% } %>
@@ -161,5 +162,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 - 16
web/maintain/bill_template_lib/js/bills_template_edit.js

@@ -2,7 +2,7 @@
  * Created by zhang on 2018/7/13.
  */
 
-
+const locked = lockUtil.getLocked();
 let TEMPLATE_BILLS_SETTING = {
     "emptyRows":1,
     "headRows":1,
@@ -10,7 +10,7 @@ let TEMPLATE_BILLS_SETTING = {
     "treeCol": 1,
     "cols":[{
         "width":80,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["类别"],
             "spanCols":[1],
@@ -27,7 +27,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":200,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["编号"],
             "spanCols":[1],
@@ -45,7 +45,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":300,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["名称"],
             "spanCols":[1],
@@ -62,7 +62,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":50,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["单位"],
             "spanCols":[1],
@@ -79,7 +79,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
             "width":80,
-            "readOnly":false,
+            "readOnly":locked,
             "head":{
                 "titleNames":["工程量"],
                 "spanCols":[1],
@@ -97,7 +97,7 @@ let TEMPLATE_BILLS_SETTING = {
             }
     }, {
         "width":200,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["清单固定类别"],
             "spanCols":[1],
@@ -114,7 +114,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":250,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["计算基数"],
             "spanCols":[1],
@@ -131,7 +131,7 @@ let TEMPLATE_BILLS_SETTING = {
         }
     }, {
         "width":50,
-        "readOnly":false,
+        "readOnly":locked,
         "head":{
             "titleNames":["费率ID"],
             "spanCols":[1],
@@ -204,13 +204,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 +416,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;
 }

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

@@ -31,7 +31,16 @@
                   <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 +161,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>

+ 14 - 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');
@@ -1374,10 +1379,11 @@ const billsGuidance = (function () {
                     return {
                         callback: function(){},
                         items: {
+
                             "copy": {
                                 name: "复制整块",
                                 disabled: function () {
-                                    return !canCopyBlock(blockNodes);
+                                    return locked || !canCopyBlock(blockNodes);
                                 },
                                 icon: "fa-copy",
                                 callback: function (key, opt) {
@@ -1387,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) {
@@ -1398,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) {
@@ -1409,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) {
@@ -1420,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) {
@@ -1688,6 +1694,7 @@ const billsGuidance = (function () {
     function initViews(){
         let modules = [bills, guideItem, section, ration];
         initWorkBooks(modules);
+        lockUtil.lockTools($(document.body), locked);
         getLibWithBills(libID);
         initBtn();
         initContextMenu();

+ 10 - 4
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);
     }
     //获取清单指引库
@@ -212,7 +215,10 @@ const billsGuidanceMain = (function () {
         $('#del').on('hidden.bs.modal', function () {
             deleteCount = 0;
         });
-
+        // 锁定、解锁
+        $('.main').find('tbody').on('click', '.lock', function () {
+            lockUtil.handleLockClick($(this));
+        });
     }
 
     return {getComBillsLibInfo, getLibs, eventListener};

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

@@ -276,4 +276,9 @@ body {
 .modal-fixed-height {
     height:400px;
     overflow-y:auto;
+}
+.disabled {
+    pointer-events: none;
+    opacity: .65;
+    color:#666;
 }

+ 79 - 29
web/maintain/bills_lib/html/main.html

@@ -32,11 +32,16 @@
                   <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="90">操作</th><th width="90">导入</th></tr></thead>
+                        <thead>
+                            <tr>
+                                <th>清单规则名称</th>
+                                <th width="160">添加时间</th>
+                                <th width="70">操作</th>
+                                <th width="90">导入</th>
+                                <th width="90">复制</th>
+                            </tr>
+                        </thead>
                         <tbody id="showArea">
-                          <!--<tr><td><a href="qingdan.html">XX清单规则</a></td><td>2017-01-01 </td><td><a href="javacript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a> <a href="javacript:void(0);" data-toggle="modal" data-target="#del" class="text-danger" title="删除"><i class="fa fa-remove"></i></a></td></tr>
-                          <tr><td><a href="qingdan.html">XX清单规则</a></td><td>2017-01-01 </td><td><a href="javacript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a> <a href="javacript:void(0);" data-toggle="modal" data-target="#del" class="text-danger" title="删除"><i class="fa fa-remove"></i></a></td></tr>
-                          <tr><td><a href="qingdan.html">XX清单规则</a></td><td>2017-01-01 </td><td><a href="javacript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a> <a href="javacript:void(0);" data-toggle="modal" data-target="#del" class="text-danger" title="删除"><i class="fa fa-remove"></i></a></td></tr>-->
                         </tbody>
                       </table>
                     </div>
@@ -144,12 +149,38 @@
             </div>
         </div>
     </div>
+    <!--弹出复制库-->
+    <div class="modal fade" id="copy" data-backdrop="static" aria-hidden="true">
+        <div class="modal-dialog" role="document">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h5 class="modal-title">复制清单规则</h5>
+                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                        <span aria-hidden="true">×</span>
+                    </button>
+                </div>
+                <div class="modal-body">
+                    <form>
+                        <div class="form-group">
+                            <label>清单规则名称</label>
+                            <input id="copyName" class="form-control" autofocus placeholder="输入清单规则名称" type="text">
+                        </div>
+                    </form>
+                </div>
+                <div class="modal-footer">
+                    <a id="copyA"  href="javascript:void(0);" class="btn btn-primary">确定</a>
+                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                </div>
+            </div>
+        </div>
+    </div>
     <!-- JS. -->
     <script src="/lib/jquery/jquery.min.js"></script>
     <script src="/lib/tether/tether.min.js"></script>
     <script src="/lib/bootstrap/bootstrap.min.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/web/maintain/bills_lib/scripts/global.js"></script>
     <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
     <script src="/web/maintain/bills_lib/scripts/tools.js"></script>
@@ -168,24 +199,24 @@
         //main 增删改
         $("#createA").click(function(){
             let billsLibName = $("#createText").val();
-         /*   let compilationName = $('#compilationSels option:selected').text();
-            let compilationId = $('#compilationSels option:selected').val();*/
+            /*   let compilationName = $('#compilationSels option:selected').text();
+             let compilationId = $('#compilationSels option:selected').val();*/
             if(billsLibName.trim().length === 0){
                 alert("请输入清单规则名称!");
             }
-          /*  else if(compilationName.trim().length === 0){
-                alert("编办不可为空!");
-            }*/
+            /*  else if(compilationName.trim().length === 0){
+             alert("编办不可为空!");
+             }*/
             else {
                 mainAjax.createStdBillsLib(userAccount, billsLibName);
                 $("#createText").val("");
             }
         });
 
-       $("#showArea").on("click", "[data-target = '#del']", function(){
-           let deleteId = $(this).parent().parent().attr("id");
-           $("#deleteA").attr("deleteId", deleteId);
-       });
+        $("#showArea").on("click", "[data-target = '#del']", function(){
+            let deleteId = $(this).parent().parent().attr("id");
+            $("#deleteA").attr("deleteId", deleteId);
+        });
         $("#deleteA").click(function(){
             let deleteId = $(this).attr("deleteId");
             if(preDeleteId && preDeleteId !== deleteId){
@@ -218,28 +249,32 @@
             deleteCount = 0;
         });
 
-       $("#showArea").on("click", "[data-target = '#edit']", function(){
-           let renameId = $(this).parent().parent().attr("id");
-           $('#renameText').val($(this).parent().parent().find('td:first-child').text());
-           $("#renameA").attr("renameId", renameId);
+        $("#showArea").on("click", "[data-target = '#edit']", function(){
+            let renameId = $(this).parent().parent().attr("id");
+            $('#renameText').val($(this).parent().parent().find('td:first-child').text());
+            $("#renameA").attr("renameId", renameId);
 
-       });
+        });
+        // 锁定、解锁
+        $('#showArea').on('click', '.lock', function () {
+            lockUtil.handleLockClick($(this));
+        });
 
-       $('#edit').on('shown.bs.modal', function () {
-           setTimeout(function () {
+        $('#edit').on('shown.bs.modal', function () {
+            setTimeout(function () {
                 $('#renameText').focus();
-           }, 100);
-       });
+            }, 100);
+        });
 
-       $('#add').on('shown.bs.modal', function () {
-           setTimeout(function () {
+        $('#add').on('shown.bs.modal', function () {
+            setTimeout(function () {
                 $('#createText').focus();
-           }, 100);
-       });
+            }, 100);
+        });
 
-       $('#add').on('hidden.bs.modal', function () {
-           $('#createText').val('');
-       });
+        $('#add').on('hidden.bs.modal', function () {
+            $('#createText').val('');
+        });
 
         $("#renameA").click(function(){
             let newName = $("#renameText").val();
@@ -318,6 +353,21 @@
                 $.bootstrapLoading.end();
             }
         });
+        // 复制库
+        $("#showArea").on("click", ".copy-data", function () {
+            let id = $(this).data("id");
+            id = parseInt(id);
+            if (isNaN(id) || id <= 0) {
+                return false;
+            }
+            selLibId = id;
+            $("#copy").modal("show");
+        });
+        $('#copyA').click(function () {
+            const libId = selLibId;
+            const libName = $('#copyName').val();
+            mainAjax.copyBillsLib(libId, libName);
+        });
     });
 </script>
 

+ 5 - 2
web/maintain/bills_lib/html/neirong.html

@@ -215,6 +215,7 @@
     <script src="/web/maintain/bills_lib/scripts/global.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/public/web/sheet/sheet_common.js"></script>
     <script src="/web/maintain/bills_lib/scripts/set_sheets.js"></script>
     <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
@@ -223,6 +224,7 @@
     <script src="/web/maintain/bills_lib/scripts/bills_lib_setting.js"></script>
     <script src="/web/maintain/bills_lib/scripts/db_controller.js"></script>
     <SCRIPT type="text/javascript">
+        const locked = lockUtil.getLocked();
         let billsLibId = getQueryString("billsLibId");
         tools.redirect(billsLibId, 'stdBillsmain');
         let userAccount = '<%= userAccount%>'
@@ -234,13 +236,14 @@
         let sheetJobsDatas;
         $(document).ready(function(){
             $('#aStdBills').attr('href', function(){
-                return 'stdBills?billsLibId=' + billsLibId;
+                return `stdBills?billsLibId=${billsLibId}&locked=${locked}`;
             });
             $('#aStdItems').attr('href', function(){
-                return 'stdItems?billsLibId=' + billsLibId;
+                return `stdItems?billsLibId=${billsLibId}&locked=${locked}`;
             });
             billsAjax.getStdBillsLibName(billsLibId);
             buildAllJobs(spreadAllJobs, totalJobsSetting);
+            lockUtil.lockSpreads([spreadAllJobs], locked);
         });
         function buildAllJobs(spreadAllJobs, setting){
             setSheet.initSheet(spreadAllJobs, setting, true);

+ 21 - 11
web/maintain/bills_lib/html/qingdan.html

@@ -45,22 +45,22 @@
                   <div class="collapse navbar-collapse" id="navbarNav">
                       <ul class="navbar-nav">
                           <li class="nav-item">
-                              <a class="nav-link text-primary" doing="false" fcsOnBills="true" id="insert" href="javascript: void(0);"><i class="fa fa-share" aria-hidden="true"></i>插入</a>
+                              <a class="nav-link text-primary lock-btn-control" doing="false" fcsOnBills="true" id="insert" href="javascript: void(0);"><i class="fa fa-share" aria-hidden="true"></i>插入</a>
                           </li>
                           <li class="nav-item">
-                              <a class="nav-link text-primary" doing="false" fcsOnBills="true" id ="delete" href="javascript:void (0)"><i class="fa fa-remove" aria-hidden="true"></i>删除</a>
+                              <a class="nav-link text-primary lock-btn-control" doing="false" fcsOnBills="true" id ="delete" href="javascript:void (0)"><i class="fa fa-remove" aria-hidden="true"></i>删除</a>
                           </li>
                           <li class="nav-item">
-                              <a class="nav-link text-primary" doing="false" fcsOnBills="true" id="upLevel"  href="javascript: void(0);"><i class="fa fa-arrow-left" aria-hidden="true"></i>升级</a>
+                              <a class="nav-link text-primary lock-btn-control" doing="false" fcsOnBills="true" id="upLevel"  href="javascript: void(0);"><i class="fa fa-arrow-left" aria-hidden="true"></i>升级</a>
                           </li>
                           <li class="nav-item">
-                              <a class="nav-link text-primary" doing="false" fcsOnBills="true" id="downLevel" href="javascript: void(0);"><i class="fa fa-arrow-right" aria-hidden="true"></i>降级</a>
+                              <a class="nav-link text-primary lock-btn-control" doing="false" fcsOnBills="true" id="downLevel" href="javascript: void(0);"><i class="fa fa-arrow-right" aria-hidden="true"></i>降级</a>
                           </li>
                           <li class="nav-item">
-                              <a class="nav-link text-primary" doing="false" fcsOnBills="true" canMove="false" id="upMove" href="javascript: void(0);"><i class="fa fa-arrow-up" aria-hidden="true"></i>上移</a>
+                              <a class="nav-link text-primary lock-btn-control" doing="false" fcsOnBills="true" canMove="false" id="upMove" href="javascript: void(0);"><i class="fa fa-arrow-up" aria-hidden="true"></i>上移</a>
                           </li>
                           <li class="nav-item">
-                              <a class="nav-link text-primary" doing="false" fcsOnBills="true" canMove="false" id="downMove" href="javascript: void(0);"><i class="fa fa-arrow-down" aria-hidden="true"></i>下移</a>
+                              <a class="nav-link text-primary lock-btn-control" doing="false" fcsOnBills="true" canMove="false" id="downMove" href="javascript: void(0);"><i class="fa fa-arrow-down" aria-hidden="true"></i>下移</a>
                           </li>
                       </ul>
                   </div>
@@ -85,7 +85,7 @@
                   </div>-->
                   <div class="form-group">
                       <a class="pull-right" href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a>
-                      <a trigger="billsRecharge" class="pull-right mr-3 uploadImgTrigger" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a>
+                      <a trigger="billsRecharge" class="pull-right mr-3 uploadImgTrigger lock-btn-control" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a>
                       <label for="exampleTextarea">补注:</label>
                       <textarea class="form-control" id="exampleTextarea" rows="8"></textarea>
                   </div>
@@ -341,6 +341,7 @@
     <script src="/web/maintain/bills_lib/scripts/global.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/public/web/sheet/sheet_common.js"></script>
     <script src="/web/maintain/bills_lib/scripts/set_sheets.js"></script>
     <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
@@ -357,10 +358,12 @@
     <script src="/web/common/js/uploadImg.js"></script>
 </body>
 <script type="text/javascript">
+    const locked = lockUtil.getLocked();
     var codeEditor = CodeMirror.fromTextArea(document.getElementById("exampleTextarea"), {
         mode: "text/html",
         lineNumbers: true,
-        theme:"material"
+        theme:"material",
+        readOnly: locked
     });
     codeEditor.setSize('auto','350px');
     autoFlashHeight();
@@ -376,20 +379,24 @@
     let sheetItemsDatas;
     let sheetBillsDatas;
     tools.redirect(billsLibId, 'stdBillsmain');
+    let billsSpread;
     let jobsSpread = new GC.Spread.Sheets.Workbook($("#spreadJobs")[0], {sheetCount: 1});
     sheetCommonObj.bindEscKey(jobsSpread, [{sheet: jobsSpread.getSheet(0), editStarting: jobsController.onEditStart, editEnded: jobsController.onEditEnded}]);
     let itemsSpread = new GC.Spread.Sheets.Workbook($("#spreadItems")[0], {sheetCount: 1});
     sheetCommonObj.bindEscKey(itemsSpread, [{sheet: itemsSpread.getSheet(0), editStarting: itemsController.onEditStart, editEnded: itemsController.onEditEnded}]);
     $(document).ready(function(){
         $("#aStdJobs").attr('href', function(){
-            return 'stdJobs?billsLibId=' + billsLibId;
+            return `stdJobs?billsLibId=${billsLibId}&locked=${locked}`;
         });
         $('#aStdItems').attr('href', function(){
-            return 'stdItems?billsLibId=' + billsLibId;
+            return `stdItems?billsLibId=${billsLibId}&locked=${locked}`;
         });
         billsAjax.getStdBillsLibName(billsLibId);
         billsAjax.getBills(billsLibId, function(bills){
             showBillsSheet(bills, jobsSpread.getActiveSheet(), itemsSpread.getActiveSheet(), billsLibSetting)
+            const spreads = [billsSpread, jobsSpread, itemsSpread];
+            const $range = $(document.body);
+            lockUtil.lockSpreadsAndTools(spreads, $range, locked);
         });
         buildJobs(jobsSpread, jobsSetting);
         buildItems(itemsSpread, itemsSetting);
@@ -468,7 +475,7 @@
         sheet.resumeEvent();
     }
     function showBillsSheet(datas, jobsSheet, itemsSheet, setting) {
-        let billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
+        billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
         let billsSheet = billsSpread.getSheet(0);
         sheetCommonObj.bindEscKey(billsSpread, [{sheet: billsSpread.getSheet(0), editStarting: dbController.onEditStart, editEnded: dbController.onEditEnded}]);
         billsSpread.focus(true);
@@ -635,6 +642,9 @@
     }
 
     function refreshBtn(controller){
+        if (locked) {
+            return;
+        }
         controller.bind('refreshBaseActn', function (tree) {
             let showButton = function (show, btn) {
                 tools.btnAction($('#insert'), 'focusOnBills');

+ 5 - 2
web/maintain/bills_lib/html/tezheng.html

@@ -216,6 +216,7 @@
     <script src="/web/maintain/bills_lib/scripts/global.js"></script>
     <script src="/public/web/PerfectLoad.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/public/web/sheet/sheet_common.js"></script>
     <script src="/web/maintain/bills_lib/scripts/set_sheets.js"></script>
     <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
@@ -224,6 +225,7 @@
     <script src="/web/maintain/bills_lib/scripts/bills_lib_setting.js"></script>
     <script src="/web/maintain/bills_lib/scripts/db_controller.js"></script>
     <SCRIPT type="text/javascript">
+        const locked = lockUtil.getLocked();
         let spread = new GC.Spread.Sheets.Workbook($('#spreadAllItems')[0], {sheetCount: 1});
         sheetCommonObj.bindEscKey(spread, [{sheet: spread.getSheet(0), editStarting: totalItemsController.onEditStart, editEnded: totalItemsController.onEditEnded}]);
         let spreadVal = new GC.Spread.Sheets.Workbook($('#spreadEigenvalue')[0], {sheetCount: 1});
@@ -239,15 +241,16 @@
         let valueDatas;
   		$(document).ready(function(){
             $('#aStdBills').attr('href', function(){
-                return 'stdBills?billsLibId=' + billsLibId;
+                return `stdBills?billsLibId=${billsLibId}&locked=${locked}`;
             });
             $('#aStdJobs').attr('href', function(){
-                return 'stdJobs?billsLibId=' + billsLibId;
+                return `stdJobs?billsLibId=${billsLibId}&locked=${locked}`;
             });
 
             billsAjax.getStdBillsLibName(billsLibId);
             buildAllItems(spread, totalItemsSetting);
             buildEigenvalue(spreadVal, eigenValueSetting);
+            lockUtil.lockSpreads([spread, spreadVal], locked);
   		});
         function buildAllItems(spread, setting){
             setSheet.initSheet(spread, setting, true);

+ 52 - 27
web/maintain/bills_lib/scripts/bills_lib_ajax.js

@@ -50,34 +50,46 @@ var mainAjax = {
             }
         });
     },
+    getLibsHtml: function (data) {
+        const libHtml = data.reduce((acc, libData) => {
+            const id = libData.billsLibId;
+            const billsLibName = libData.billsLibName;
+            const createDateFmt = new Date(libData.createDate).format("yyyy-MM-dd");
+            const html =
+                `<tr id="${id}">
+                    <td><a href="/stdBills?billsLibId=${id}&locked=true">${billsLibName}</a></td>
+                    <td>${createDateFmt}</td>
+                    <td>
+                        <a class="lock-btn-control disabled" data-toggle="modal" data-target="#edit" href="javascript:void(0);" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                        <a class="text-danger lock-btn-control disabled" data-toggle="modal" data-target="#del" href="javascript:void(0);" 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" data-id="${id}" href="javascript:void(0);" title="导入数据"><i class="fa fa-sign-in fa-rotate-90"></i>导入</a>
+                    </td>
+                    <td>
+                        <a class="btn btn-secondary btn-sm copy-data lock-btn-control disabled" data-id="${id}" href="javascript:void(0);" title="复制数据"><i class="fa fa-clone"></i>复制</a>
+                    </td>
+                 </tr>`;
+            return acc += html;
+        }, '');
+        return libHtml;
+    },
     getStdBillsLib: function(){
+        const me = this;
         $.ajax({
             type: "post",
             url: "/stdBillsEditor/getStdBillsLib",
             dataType: "json",
             success: function(result){
                 if(result.data){
-                    for(var i=0; i<result.data.length; i++){
-                        var id = result.data[i].billsLibId;
-                        var billsLibName = result.data[i].billsLibName;
-                        var createDate = result.data[i].createDate;
-                        var createDateFmt = new Date(createDate).format("yyyy-MM-dd");
-                        $("#showArea").append(
-                            "<tr id='"+ id +"'>" +
-                            "<td><a href='stdBills?billsLibId=" + id + "'>"+billsLibName+"</a></td>" +
-                            "<td>"+createDateFmt+" </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>"+
-                            "</tr>");
-                    }
+                    $('#showArea').append(me.getLibsHtml(result.data));
                 }
-
             }
         });
     },
     createStdBillsLib: function(userAccount, billsLibName){
+        const me = this;
         $.ajax({
             type: "POST",
             url: "/stdBillsEditor/createStdBillsLib",
@@ -85,18 +97,31 @@ var mainAjax = {
             dataType: "json",
             success: function(result){
                 if(!result.error){
-                    var id = result.data[0].billsLibId;
-                    var createDate = result.data[0].createDate;
-                    var createDateFmt = new Date(createDate).format("yyyy-MM-dd");
-                    $("#showArea").append(
-                        "<tr id='" + id + "'><td><a href='stdBills?billsLibId=" + id + "'>"+billsLibName+"</a></td><td>"+createDateFmt+" </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>" +
-                        "</tr>"
-                    );
-                    $('#cancelBtn').click();
+                    $('#showArea').append(me.getLibsHtml(result.data));
+                    $('#add').modal('hide');
+                }
+            }
+        });
+    },
+    copyBillsLib: function (libId, libName) {
+        const me = this;
+        $.ajax({
+            type: 'post',
+            url: '/stdBillsEditor/copyStdBillsLib',
+            data: {data: JSON.stringify({libId, libName})},
+            dataType: 'json',
+            timeout: 150000,
+            beforeSend: function () {
+                $('#copy').modal('hide');
+                $.bootstrapLoading.start();
+            },
+            success: function (result) {
+                if (!result.error) {
+                    $('#showArea').append(me.getLibsHtml(result.data));
                 }
+            },
+            complete: function () {
+                $.bootstrapLoading.end();
             }
         });
     },

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

@@ -9,17 +9,17 @@
 <div class="main">
     <div class="content" >
         <div class="container-fluid" >
-        <div class=" col-lg-12 p-0">
-            <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="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>
+            <div class=" col-lg-12 p-0">
+                <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 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>
-                </div>
-            </nav>
-            <textarea class="form-control" id="templateList" rows="38"></textarea>
-        </div>
+                </nav>
+                <textarea class="form-control lock-text-control" id="templateList" rows="38"></textarea>
+            </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
         <input type="hidden" id="originalTemplates" value="<%= templateList %>">
@@ -32,4 +32,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/calc_program_lib/js/calc_program_edit.js"></script>

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

@@ -19,17 +19,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 calcProgramLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/calcProgram/edit/<%= lib.ID%>"><%= lib.libName%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/calcProgram/edit/<%= lib.ID%>?locked=true"><%= lib.libName%></a></td>
                                 <td><%= lib.displayName%></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getCalcProgramLib("<%= 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='getCalcProgramLib("<%= 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>
                             <% } %>
@@ -135,4 +136,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/calc_program_lib/js/calc_program.js"></script>

+ 4 - 0
web/maintain/calc_program_lib/js/calc_program.js

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

+ 2 - 0
web/maintain/calc_program_lib/js/calc_program_edit.js

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

+ 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;
 }

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

@@ -9,17 +9,17 @@
 <div class="main">
     <div class="content" >
         <div class="container-fluid" >
-        <div class=" col-lg-12 p-0">
-            <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="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>
+            <div class=" col-lg-12 p-0">
+                <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 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>
-                </div>
-            </nav>
-            <textarea class="form-control" id="rateList" rows="38"></textarea>
-        </div>
+                </nav>
+                <textarea class="form-control lock-text-control" id="rateList" rows="38"></textarea>
+            </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
         <input type="hidden" id="originalRates" value="<%= rateList %>">
@@ -32,4 +32,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/fee_rate_lib/js/fee_rate_edit.js"></script>

+ 7 - 5
web/maintain/fee_rate_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 feeRateLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/feeRate/edit/<%= lib.ID%>"><%= lib.libName%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/feeRate/edit/<%= lib.ID%>?locked=true"><%= lib.libName%></a></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getFeeRateLib("<%= 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='getFeeRateLib("<%= 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>
                             <% } %>
@@ -124,4 +125,5 @@
     </div>
 </div>
 
-<script type="text/javascript" src="/web/maintain/fee_rate_lib/js/fee_rate.js"></script>
+<script src="/public/web/lock_util.js"></script>
+<script type="text/javascript" src="/web/maintain/fee_rate_lib/js/fee_rate.js"></script>

+ 5 - 0
web/maintain/fee_rate_lib/js/fee_rate.js

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

+ 2 - 1
web/maintain/fee_rate_lib/js/fee_rate_edit.js

@@ -2,7 +2,8 @@
  * Created by zhang on 2018/9/11.
  */
 $(document).ready(function () {
-
+    const locked = lockUtil.getLocked();
+    lockUtil.lockTools($(document.body), locked);
     try {
         let tem = sortJson(JSON.parse($("#originalRates").val()));
         $("#rateList").val(JSON.stringify(tem,null,4));

+ 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 - 0
web/maintain/main_col_lib/js/main_col_edit.js

@@ -3,6 +3,8 @@
  */
 
 $(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/progressive_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="progressiveList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="progressiveList" 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/progressive_lib/js/progressive_interval_edit.js"></script>

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

@@ -5,15 +5,16 @@
                 <div class="col-md-5">
                     <div class="warp-p2 mt-3">
                         <table class="table table-hover table-bordered">
-                            <thead><tr><th >库名称</th><th width="160">添加时间</th><th width="120">操作</th></tr></thead>
+                            <thead><tr><th >库名称</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                             <tbody id="showArea">
                             <% for(let lib of progressiveLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/progressive/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/progressive/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getProgressiveLib("<%= 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:;" style="color: #0275d8" onclick='getProgressiveLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javascript:;" 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>
                             <% } %>
@@ -105,4 +106,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/progressive_lib/js/progressive_interval.js"></script>

+ 4 - 0
web/maintain/progressive_lib/js/progressive_interval.js

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

+ 2 - 0
web/maintain/progressive_lib/js/progressive_interval_edit.js

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

+ 12 - 16
web/maintain/project_feature_lib/html/edit.html

@@ -9,28 +9,24 @@
 <div class="main">
     <div class="content" >
         <div class="container-fluid" >
-        <div class=" col-lg-12 p-0">
-            <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>
+            <div class=" col-lg-12 p-0">
+                <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 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>
-                </div>
-            </nav>
-            <textarea class="form-control" id="featureList" rows="38"></textarea>
-        </div>
+                </nav>
+                <textarea class="form-control lock-text-control" id="featureList" rows="38"></textarea>
+            </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
         <input type="hidden" id="originalFeature" value="<%= featureList %>">
     </div>
 </div>
 
-
-
-<script type="text/javascript">
-
-</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>

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

@@ -52,6 +52,10 @@ $(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/anzhuang.html

@@ -173,6 +173,7 @@
     <script src="/public/web/uuid.js"></script>
     <script src="/public/web/scMathUtil.js"></script>
     <script src="/public/common_util.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/public/web/storageUtil.js"></script>
     <script  src="/public/web/id_tree.js"></script>
     <script src="/public/web/tree_sheet/tree_sheet_controller.js"></script>

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

@@ -294,3 +294,8 @@ div.resize-x{
     cursor: w-resize;
     float: left;
 }
+.disabled {
+    pointer-events: none;
+    opacity: .65;
+    color:#666;
+}

+ 19 - 12
web/maintain/ration_repository/dinge.html

@@ -63,12 +63,12 @@
                         <div style="width: 99%; float: left">
                             <div class="tab-bar row">
                                 <div>
-                                    <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>
                                     <input type="text" class="form-control form-control-sm" placeholder="搜索定额" value="" id="rationSearch">
@@ -136,7 +136,7 @@
                             <div class="tab-pane" id="tsm" role="tabpanel">
                                 <div class="main-data">
                                 <div class="main-content m-2">
-                                    <a trigger="rationExplanation" class="mr-3 uploadImgTrigger" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a><a href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a></p>
+                                    <a trigger="rationExplanation" class="mr-3 uploadImgTrigger lock-btn-control" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a><a href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a></p>
                                     <textarea id="explanationShow" name="editor" class="form-control "></textarea>
                                     <!--<h5>说明</h5>
                                     <textarea id="explanationShow" class="form-control" style="background: white;"></textarea>-->
@@ -148,7 +148,7 @@
                                 <div class="main-data">
                                     <!--         <div class="m-2"><a href="javacript:void(0);" data-toggle="modal" data-target="#editTjs" title="编辑">编辑计算规则</a></div>-->
                                     <div class="main-content m-2">
-                                        <a trigger="rationRuleText" class="mr-3 uploadImgTrigger" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a><a href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a></p>
+                                        <a trigger="rationRuleText" class="mr-3 uploadImgTrigger lock-btn-control" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a><a href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a></p>
                                         <textarea id="ruleTextShow" name="editor" class="form-control "></textarea>
                                         <!--<h5>计算规则</h5>
                                         <textarea id="ruleTextShow" class="form-control" style="background: white;"></textarea>-->
@@ -158,11 +158,14 @@
                             <!--工作内容-->
                             <div class="tab-pane" id="tgz" role="tabpanel">
                                 <div class="main-data">
-                                    <div class="form-check m-2"><label class="form-check-label"><input type="radio" class="form-check-input" name="optionsRadios" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;<label class="form-check-label"><input type="radio" class="form-check-input" name="optionsRadios" value="PARTIAL" disabled> 适合本项部分定额</label></div>
+                                    <div class="form-check m-2">
+                                        <label class="form-check-label lock-btn-control"><input type="radio" class="form-check-input" name="optionsRadios" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;
+                                        <label class="form-check-label lock-btn-control"><input type="radio" class="form-check-input" name="optionsRadios" value="PARTIAL" disabled> 适合本项部分定额</label>
+                                    </div>
                                     <!-- <p class="m-2">适合本项所有定额</p> -->
                                     <table class="table table-sm table-bordered m-0" id="tableAll">
                                         <tr>
-                                            <td><textarea class="form-control" rows="30" id="txtareaAll"></textarea></td>
+                                            <td><textarea class="form-control lock-text-control" rows="30" id="txtareaAll"></textarea></td>
                                         </tr>
                                     </table>
                                     <table class="table table-sm table-bordered m-0" id="tablePartial">
@@ -172,11 +175,14 @@
                             <!--附注-->
                             <div class="tab-pane" id="tfz" role="tabpanel">
                                 <div class="main-data">
-                                    <div class="form-check m-2"><label class="form-check-label"><input type="radio" class="form-check-input" name="fzRadios" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;<label class="form-check-label"><input type="radio" class="form-check-input" name="fzRadios" value="PARTIAL" disabled> 适合本项部分定额</label></div>
+                                    <div class="form-check m-2">
+                                        <label class="form-check-label lock-btn-control"><input type="radio" class="form-check-input" name="fzRadios" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;
+                                        <label class="form-check-label lock-btn-control"><input type="radio" class="form-check-input" name="fzRadios" value="PARTIAL" disabled> 适合本项部分定额</label>
+                                    </div>
                                     <!-- <p class="m-2">适合本项所有定额</p> -->
                                     <table class="table table-sm table-bordered m-0" id="fzTableAll">
                                         <tr>
-                                            <td><textarea class="form-control" rows="30" id="fzTxtareaAll"></textarea></td>
+                                            <td><textarea class="form-control lock-text-control" rows="30" id="fzTxtareaAll"></textarea></td>
                                         </tr>
                                     </table>
                                     <table class="table table-sm table-bordered m-0" id="fzTablePartial">
@@ -646,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>
         <script src="/public/common_util.js"></script>
         <!-- zTree -->

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

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

+ 5 - 2
web/maintain/ration_repository/js/explanatory.js

@@ -11,10 +11,12 @@ let explanatoryOprObj = {
     currentRuleText: null,
     // 初始化说明、计算规则编辑器
     initEditor: function () {
+        const locked = lockUtil.getLocked();
         const exEditor = CodeMirror.fromTextArea(document.getElementById("explanationShow"), {
             mode: "text/html",
             lineNumbers: true,
-            theme:"material"
+            theme:"material",
+            readOnly: locked
         });
         exEditor.setSize('auto','500px');
         $('#explanationLink').click(function () {
@@ -26,7 +28,8 @@ let explanatoryOprObj = {
         const calcEditor = CodeMirror.fromTextArea(document.getElementById("ruleTextShow"), {
             mode: 'text/html',
             lineNumbers: true,
-            theme: 'material'
+            theme: 'material',
+            readOnly: locked
         });
         calcEditor.setSize('auto', '500px');
         $('#ruleTextLink').click(function () {

+ 7 - 0
web/maintain/ration_repository/js/init.js

@@ -43,6 +43,13 @@ const initialization = (() => {
             rationInstObj.initInstallation(rstData.installationList);
             //初始化已使用的定额编码
             rationOprObj.rationsCodes = rstData.rationsCodes;
+            const lockedSpreads = [
+                sectionTreeObj.workBook,
+                rationOprObj.workBook,
+                rdSpread
+            ];
+            const $range = $(document.body);
+            lockUtil.lockSpreadsAndTools(lockedSpreads, $range, locked);
 
             $("#linkGLJ").click(function(){
                 rationGLJOprObj.bindRationGljDelOpr();

+ 28 - 9
web/maintain/ration_repository/js/installation.js

@@ -1,9 +1,15 @@
 /**
  * Created by Zhong on 2018/1/19.
  **/
-
+const locked = lockUtil.getLocked();
 $(document).ready(function () {
     feeItemObj.buildSheet();
+    const lockedSpreads = [
+        feeItemObj.workBook,
+        sectionObj.workBook,
+        feeRuleObj.workBook
+    ];
+    lockUtil.lockSpreads(lockedSpreads, locked);
     $('#sectionTreeModal').on('shown.bs.modal', function (e) {
         batchSectionObj.workBook.refresh();
         //bind confirm btn
@@ -305,6 +311,9 @@ let feeItemObj = {
         }
     },
     feeItemDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.workBook.commandManager().register('feeItemDel', function () {
             curDeleteType = me.deleteType;
@@ -450,17 +459,21 @@ let sectionObj = {
                 if(target.hitTestType === 3 && me.isDef(target.row) && me.isDef(target.col)){//在表格内
                     sheet.setActiveCell(target.row, target.col);
                     me.initSelection(me.cache[target.row]);
-                    //控制按钮是否可用
-                    let refDis = false;
-                    if(target.row >= me.cache.length){
-                        refDis = true;
-                    }
                     return {
                         callback: function(){},
                         items: {
-                            "ref": {name: "批量关联至定额", disabled: refDis, icon: "fa-arrow-left", callback: function (key, opt) {
-                                $('#sectionTreeModal').modal('show');
-                            }}
+                            "ref": {
+                                name: "批量关联至定额",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    const inValidData = target.row >= me.cache.length;
+                                    return locked || inValidCell || inValidData;
+                                },
+                                icon: "fa-arrow-left",
+                                callback: function (key, opt) {
+                                    $('#sectionTreeModal').modal('show');
+                                }
+                            }
                         }
                     };
                 }
@@ -565,6 +578,9 @@ let sectionObj = {
         }
     },
     sectionDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.workBook.commandManager().register('sectionDel', function () {
             curDeleteType = me.deleteType;
@@ -1013,6 +1029,9 @@ let feeRuleObj = {
         }
     },
     feeRuleDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = feeRuleObj, se = sectionObj;
         me.workBook.commandManager().register('feeRuleDel', function () {
             me.toUpdate = false;

+ 4 - 1
web/maintain/ration_repository/js/main.js

@@ -121,7 +121,10 @@ $(function () {
             $('#reCalcConfirm').removeClass('disabled')
         });
     });
-
+    // 锁定、解锁
+    $('#showArea').on('click', '.lock', function () {
+        lockUtil.handleLockClick($(this));
+    });
     getCompilationList(function (data) {
         compilationsArr = data.compilation;
     });

+ 26 - 26
web/maintain/ration_repository/js/ration.js

@@ -252,41 +252,36 @@ let rationOprObj = {
                 //控制允许右键菜单在哪个位置出现
                 let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
                 let sheet = me.workBook.getSheet(0);
-                let  delDis = false;
                 let cacheSection = me.getCache();
                 let ration = cacheSection[target.row];
                 if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
                     if(typeof target.row !== 'undefined'){
                         //控制按钮是否可用
                         sheet.setActiveCell(target.row, target.col);
-                        if(!cacheSection ||target.row >= cacheSection.length){//右键定位在有数据的行,删除键才显示可用
-                            delDis = true;
-                        }
-                        else{//有数据
-                            if(typeof target.col === 'undefined'){//定位不在表格内
-                                delDis = true;
-                            }
-                        }
-                    }
-                    else{
-                        delDis = true;
                     }
                     return {
                         callback: function(){},
                         items: {
-                            "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
-
-                                let removeInfo = `确定要删除定额 “${ration.code}” 及其下的所有数据吗?`;
-                                $('#delRationAlert').find('.modal-body h5').text(removeInfo);
-                                $('#delRationAlert').modal('show');
-                                $('#delRationConfirm').bind('click', function () {
-                                    me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
-                                    me.mixDel = 1;
-                                    me.mixUpdateRequest([], [], [ration.ID]);
-                                    $('#delRationConfirm').unbind('click');
-                                    $('#delRationAlert').modal('hide');
-                                });
-                            }}
+                            "delete": {
+                                name: "删除",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    const inValidData = !cacheSection ||target.row >= cacheSection.length;
+                                    return locked || inValidCell || inValidData;
+                                },
+                                icon: "fa-remove",
+                                callback: function (key, opt) {
+                                    let removeInfo = `确定要删除定额 “${ration.code}” 及其下的所有数据吗?`;
+                                    $('#delRationAlert').find('.modal-body h5').text(removeInfo);
+                                    $('#delRationAlert').modal('show');
+                                    $('#delRationConfirm').bind('click', function () {
+                                        me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
+                                        me.mixDel = 1;
+                                        me.mixUpdateRequest([], [], [ration.ID]);
+                                        $('#delRationConfirm').unbind('click');
+                                        $('#delRationAlert').modal('hide');
+                                    });
+                                }}
                         }
                     };
                 }
@@ -297,6 +292,9 @@ let rationOprObj = {
         });
     },
     rationDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = rationOprObj;
         me.workBook.commandManager().register('rationDelete', function () {
             let rationSheet = me.workBook.getActiveSheet();
@@ -687,7 +685,9 @@ let rationOprObj = {
                         annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                         me.showRationItems(sectionID);
                     }
-                    sectionTreeObj.removeBtn.removeClass('disabled');
+                    if (!locked) {
+                        sectionTreeObj.removeBtn.removeClass('disabled');
+                    }
                     if(callback) {
                         callback(result.data);
                     }

+ 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

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

+ 100 - 86
web/maintain/ration_repository/js/ration_glj.js

@@ -76,6 +76,9 @@ var rationGLJOprObj = {
         this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onCellEditEnd);
     },
     bindRationGljDelOpr: function () {
+        if (locked) {
+            return;
+        }
         const me = rationGLJOprObj;
         const spreadBook = me.sheet.getParent();
         spreadBook.commandManager().register('rationGljDelete', function () {
@@ -189,7 +192,7 @@ var rationGLJOprObj = {
         const editingField = me.setting.header[args.col].dataCode;
         const trimText = args.editingText ? args.editingText.trim() : '';
         const curGLJ = cacheArr[args.row];
-        const originText = curGLJ  && !_commonUtil.isEmptyVal(curGLJ[editingField]) ? String(curGLJ[editingField]) : '';
+        const originText = curGLJ  && !commonUtil.isEmptyVal(curGLJ[editingField]) ? String(curGLJ[editingField]) : '';
         if (!trimText || trimText === originText) {
             args.sheet.setValue(args.row, args.col, originText);
             return;
@@ -231,57 +234,58 @@ var rationGLJOprObj = {
                 //控制允许右键菜单在哪个位置出现
                 let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.sheet.getParent());
                 let sheet = me.sheet;
-                let addDis = false, delDis = false;
-                let rationGlj = [];
                 if(me.sheet.getParent().getActiveSheetIndex() === 0 && target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
                     //rationGlj表
                     if(typeof target.row !== 'undefined'){
                         //控制按钮是否可用
                         sheet.setActiveCell(target.row, target.col);
-                        console.log(me.currentRationItem);
-                        if(me.currentRationItem){
-                            rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
-                            if(!rationGlj ||target.row >= rationGlj.length){//右键定位在有数据的行,删除键才显示可用
-                                delDis = true;
-                            }
-                            else{//有数据
-                                if(typeof target.col === 'undefined'){//定位不在表格内
-                                    delDis = true;
-                                }
-                            }
-                        }
-                        else{
-                            addDis = true;
-                            delDis = true;
-                        }
-                    }
-                    else{
-                        addDis = true;
-                        delDis = true;
                     }
                     return {
                         callback: function(){},
                         items: {
-                            "add": {name: "添加人材机", disabled: addDis, icon: "fa-plus", callback: function (key, opt) {
-                                //默认radio所有工料机
-                                gljSelOprObj.initRadio();
-                                gljSelOprObj.gljCurTypeId = null;
-                                //默认点击树根节点
-                                if(gljSelOprObj.rootNode){
-                                    gljSelOprObj.treeObj.selectNode(gljSelOprObj.rootNode);
-                                    gljSelTreeOprObj.setting.callback.onClick(null, 'componentTree', gljSelOprObj.rootNode);
-                                }
-                                //弹出窗口
-                                $('#selGlj').modal('show');
-                            }},
-                            "delete": {name: "删除人材机", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
-                                rationGlj.splice(target.row, 1);
-                                me.updateRationItem(function(){
-                                    me.sheet.getParent().focus();
-                                });
-                                sheetCommonObj.cleanData(me.sheet, me.setting, -1);
-                                me.showGljItems(me.currentRationItem.ID);
-                            }},
+                            "add": {
+                                name: "添加人材机",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    if (locked || inValidCell || !me.currentRationItem) {
+                                        return true;
+                                    }
+                                    return false;
+                                },
+                                icon: "fa-plus",
+                                callback: function (key, opt) {
+                                    //默认radio所有工料机
+                                    gljSelOprObj.initRadio();
+                                    gljSelOprObj.gljCurTypeId = null;
+                                    //默认点击树根节点
+                                    if(gljSelOprObj.rootNode){
+                                        gljSelOprObj.treeObj.selectNode(gljSelOprObj.rootNode);
+                                        gljSelTreeOprObj.setting.callback.onClick(null, 'componentTree', gljSelOprObj.rootNode);
+                                    }
+                                    //弹出窗口
+                                    $('#selGlj').modal('show');
+                                }},
+                            "delete": {
+                                name: "删除人材机",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    const rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
+                                    const inValidData = !rationGlj || target.row >= rationGlj.length;
+                                    if (locked || inValidCell || !me.currentRationItem || inValidData) {
+                                        return true;
+                                    }
+                                    return false;
+                                },
+                                icon: "fa-remove",
+                                callback: function (key, opt) {
+                                    const rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
+                                    rationGlj.splice(target.row, 1);
+                                    me.updateRationItem(function(){
+                                        me.sheet.getParent().focus();
+                                    });
+                                    sheetCommonObj.cleanData(me.sheet, me.setting, -1);
+                                    me.showGljItems(me.currentRationItem.ID);
+                                }},
                         }
                     };
                 }
@@ -289,55 +293,65 @@ var rationGLJOprObj = {
                 else if(me.sheet.getParent().getActiveSheetIndex() === 2 && target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){
                     let currentCache = raCoe.curRation && raCoe.isDef(raCoe.cache["_Coe_" + raCoe.curRation.ID])  ? raCoe.cache["_Coe_" + raCoe.curRation.ID] : [];
                     sheet.setActiveCell(target.row, target.col);
-                    //控制按钮是否可用
-                    let upDis = false,
-                        downDis = false,
-                        refDis = false;
-                    if(target.row >= currentCache.length){
-                        upDis = true;
-                        downDis = true;
-                        refDis = true;
-                    }
-                    else {
-                        if(!raCoe.isDef(currentCache[target.row - 1])){
-                            upDis = true;
-                        }
-                        if(!raCoe.isDef(currentCache[target.row + 1])){
-                            downDis = true;
-                        }
-                    }
                     return {
                         callback: function(){},
                         items: {
-                            "upMove": {name: "上移", disabled: upDis, icon: "fa-arrow-up", callback: function (key, opt) {
-                                raCoe.upMove(currentCache[target.row], currentCache[target.row - 1], {row: target.row - 1, col: target.col});
-                            }},
-                            "downMove": {name: "下移", disabled: downDis, icon: "fa-arrow-down", callback: function (key, opt) {
-                                raCoe.downMove(currentCache[target.row], currentCache[target.row + 1], {row: target.row + 1, col: target.col});
-                            }},
-                            "ref": {name: "添加到本节其他定额", disabled: refDis, icon: "fa-arrow-left", callback: function (key, opt) {
-                                raCoe.updateSectionRation(rationOprObj.currentRations["_SEC_ID_" + rationOprObj.currentSectionId], currentCache[target.row], function (updateArr) {
-                                    for(let i = 0, len = updateArr.length; i < len; i++){
-                                        let ration = updateArr[i];
-                                        let rationCoeList = updateArr[i].rationCoeList;
-                                        let newNo = 1;
-                                        for(let j = 0, jLen = rationCoeList.length; j < jLen; j++){
-                                            if(rationCoeList[j].no >= newNo){
-                                                newNo = rationCoeList[j].no + 1;
+                            "upMove": {
+                                name: "上移",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    const inValidData = target.row >= currentCache.length || !raCoe.isDef(currentCache[target.row - 1]);
+                                    return locked || inValidCell || inValidData
+                                },
+                                icon: "fa-arrow-up",
+                                callback: function (key, opt) {
+                                    raCoe.upMove(currentCache[target.row], currentCache[target.row - 1], {row: target.row - 1, col: target.col});
+                                }
+                            },
+                            "downMove": {
+                                name: "下移",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    const inValidData = target.row >= currentCache.length || !raCoe.isDef(currentCache[target.row + 1]);
+                                    return locked || inValidCell || inValidData;
+                                },
+                                icon: "fa-arrow-down",
+                                callback: function (key, opt) {
+                                    raCoe.downMove(currentCache[target.row], currentCache[target.row + 1], {row: target.row + 1, col: target.col});
+                                }
+                            },
+                            "ref": {
+                                name: "添加到本节其他定额",
+                                disabled: function () {
+                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
+                                    const inValidData = target.row >= currentCache.length;
+                                    return locked || inValidCell || inValidData;
+                                },
+                                icon: "fa-arrow-left",
+                                callback: function (key, opt) {
+                                    raCoe.updateSectionRation(rationOprObj.currentRations["_SEC_ID_" + rationOprObj.currentSectionId], currentCache[target.row], function (updateArr) {
+                                        for(let i = 0, len = updateArr.length; i < len; i++){
+                                            let ration = updateArr[i];
+                                            let rationCoeList = updateArr[i].rationCoeList;
+                                            let newNo = 1;
+                                            for(let j = 0, jLen = rationCoeList.length; j < jLen; j++){
+                                                if(rationCoeList[j].no >= newNo){
+                                                    newNo = rationCoeList[j].no + 1;
+                                                }
                                             }
-                                        }
-                                        let theCache = raCoe.cache["_Coe_" + ration.ID];
-                                        if(theCache !== undefined && theCache !== null){
-                                            let newCoe = {};
-                                            for(let attr in currentCache[target.row]){
-                                                newCoe[attr] = currentCache[target.row][attr];
+                                            let theCache = raCoe.cache["_Coe_" + ration.ID];
+                                            if(theCache !== undefined && theCache !== null){
+                                                let newCoe = {};
+                                                for(let attr in currentCache[target.row]){
+                                                    newCoe[attr] = currentCache[target.row][attr];
+                                                }
+                                                newCoe.no = newNo;
+                                                theCache.push(newCoe);
                                             }
-                                            newCoe.no = newNo;
-                                            theCache.push(newCoe);
                                         }
-                                    }
-                                });
-                            }}
+                                    });
+                                }
+                            }
                         }
                     };
                 }

+ 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();

+ 4 - 0
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,6 +264,9 @@ let sectionTreeObj = {
     },
     
     refreshBtn: function (selected) {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.insertBtn.removeClass('disabled');
         me.removeBtn.removeClass('disabled');

+ 21 - 8
web/maintain/ration_repository/main.html

@@ -50,26 +50,38 @@
                 <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><th width="90">原始数据</th><th width="150">内部数据</th><th width="90">补充模板</th></tr></thead>
+                            <thead>
+                                <tr>
+                                    <th>定额库名称</th>
+                                    <th width="160">费用定额</th>
+                                    <th width="160">添加时间</th>
+                                    <th width="90">操作</th>
+                                    <th width="90">原始数据</th>
+                                    <th width="150">内部数据</th>
+                                    <th width="90">补充模板</th>
+                                </tr>
+                            </thead>
                             <tbody id="showArea">
                             <% for(let lib of rationLibs){ %>
                             <tr id="<%= lib.ID %>">
-                                <td><a href="/rationRepository/ration?repository=<%= lib.ID%>"><%= lib.dispName%></a></td>
+                                <td><a href="/rationRepository/ration?repository=<%= lib.ID%>&locked=true"><%= lib.dispName%></a></td>
                                 <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a href="javacript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
-                                    <a href="javacript:void(0);" data-toggle="modal" data-target="#del" class="text-danger" title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock-btn-control disabled" href="javacript:void(0);" data-toggle="modal" data-target="#edit" title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javacript:void(0);" data-toggle="modal" data-target="#del" title="删除"><i class="fa fa-remove"></i></a>
+                                    <a class="lock-btn-control disabled" data-toggle="modal" data-target="#reCalcAll" href="javascript:void(0);" title="全部计算"><i class="fa fa-calculator"></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-source" href="javacript:void(0);" data-id="<%= lib.ID %>" title="导入原始数据"><i class="fa fa-sign-in fa-rotate-90"></i>导入</a>
+                                    <a class="btn btn-secondary btn-sm import-source lock-btn-control disabled" href="javacript:void(0);" data-id="<%= lib.ID %>" title="导入原始数据"><i class="fa fa-sign-in fa-rotate-90"></i>导入</a>
                                 </td>
                                 <td>
-                                    <a class="btn btn-success btn-sm export" href="javacript:void(0);" data-toggle="modal" data-id="<%= lib.ID %>" data-target="#emport" title="导出内部数据"><i class="fa fa-sign-out fa-rotate-270"></i>导出</a>
-                                    <a class="btn btn-secondary btn-sm import-data" href="javacript:void(0);" data-id="<%= lib.ID %>" title="导入内部数据"><i class="fa fa-sign-in fa-rotate-90"></i>导入</a>
+                                    <a class="btn btn-success btn-sm export lock-btn-control disabled" href="javacript:void(0);" data-toggle="modal" data-id="<%= lib.ID %>" data-target="#emport" title="导出内部数据"><i class="fa fa-sign-out fa-rotate-270"></i>导出</a>
+                                    <a class="btn btn-secondary btn-sm import-data lock-btn-control disabled" href="javacript:void(0);" data-id="<%= lib.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="<%= lib.ID %>" title="将章节树设为补充模板数据"><i class="fa fa-sign-in fa-rotate-90"></i>设置</a>
+                                    <a class="btn btn-secondary btn-sm set-comple lock-btn-control disabled" href="javacript:void(0);" data-id="<%= lib.ID %>" title="将章节树设为补充模板数据"><i class="fa fa-sign-in fa-rotate-90"></i>设置</a>
                                 </td>
                             </tr>
                             <% } %>
@@ -328,6 +340,7 @@
 <script src="/public/web/PerfectLoad.js"></script>
 <script src="/web/maintain/ration_repository/js/global.js"></script>
 <script src="/public/web/common_ajax.js"></script>
+<script src="/public/web/lock_util.js"></script>
 <script src="/lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js"></script>
 <script src="/lib/spreadjs/sheets/interop/gc.spread.excelio.11.1.2.min.js"></script>
 <script>GC.Spread.Sheets.LicenseKey =  '<%- LicenseKey %>';</script>

+ 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);
+                    });
                 })
             });
         });
@@ -1014,6 +1015,9 @@ let repositoryGljObj = {
     },
     //删除人材机前需要判断人材机是否有被引用,被引用了则不可删除
     repositoryGljDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = repositoryGljObj;
         me.workBook.commandManager().register('repositoryGljDel', function () {
             let sels = me.workBook.getActiveSheet().getSelections();
@@ -1053,7 +1057,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) {
@@ -1098,7 +1102,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');

+ 5 - 4
web/maintain/std_glj_lib/js/gljComponent.js

@@ -182,6 +182,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();
@@ -277,12 +280,10 @@ let gljComponentOprObj = {
                     //控制按钮是否可用
                     let insertDis = false,
                         delDis = false;
-                    if(!(that.currentGlj && allowComponent.includes(that.currentGlj.gljType)) || //机械组成物,应可选择无组成物的普通材料
-                        ([4].includes(that.currentGlj.gljType) && 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));
+            });
 
         });
     });
@@ -278,16 +281,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();

+ 5 - 4
web/maintain/vehicleVesselTax_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="vvTaxList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="vvTaxList" rows="38"></textarea>
         </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
@@ -34,4 +34,5 @@
 </script>
 <script type="text/javascript" src="/public/web/PerfectLoad.js"></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/vehicleVesselTax_lib/js/vvTax_edit.js"></script>

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

@@ -5,15 +5,16 @@
                 <div class="col-md-5">
                     <div class="warp-p2 mt-3">
                         <table class="table table-hover table-bordered">
-                            <thead><tr><th >库名称</th><th width="160">添加时间</th><th width="120">操作</th></tr></thead>
+                            <thead><tr><th >库名称</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                             <tbody id="showArea">
                             <% for(let lib of vvTaxLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/vvTax/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/vvTax/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getVVTaxLib("<%= 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:;" style="color: #0275d8" onclick='getVVTaxLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
+                                    <a class="text-danger lock-btn-control disabled" href="javascript:;" 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>
                             <% } %>
@@ -105,4 +106,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/vehicleVesselTax_lib/js/vvTax.js"></script>

+ 4 - 0
web/maintain/vehicleVesselTax_lib/js/vvTax.js

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

+ 2 - 0
web/maintain/vehicleVesselTax_lib/js/vvTax_edit.js

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