Procházet zdrojové kódy

Merge branch '1.0.0_online' of http://192.168.1.41:3000/SmartCost/ConstructionOperation into 1.0.0_online

TonyKang před 6 roky
rodič
revize
4929b90228
100 změnil soubory, kde provedl 6163 přidání a 453 odebrání
  1. 10 5
      Dockerfile
  2. 25 0
      modules/all_models/std_over_height_lib.js
  3. 102 0
      modules/over_height_lib/controllers/over_height_controller.js
  4. 41 0
      modules/over_height_lib/facade/over_height_facade.js
  5. 21 0
      modules/over_height_lib/routes/over_height_routes.js
  6. 9 0
      modules/ration_repository/controllers/coe_controller.js
  7. 16 12
      modules/ration_repository/controllers/repository_views_controller.js
  8. 5 0
      modules/ration_repository/models/coe.js
  9. 1 0
      modules/ration_repository/routes/ration_rep_routes.js
  10. 4 3
      modules/std_glj_lib/models/gljModel.js
  11. 2 0
      modules/users/controllers/login_controller.js
  12. 4680 0
      package-lock.json
  13. 22 1
      public/common_util.js
  14. 109 0
      public/web/lock_util.js
  15. 5 4
      web/maintain/basic_info_lib/html/edit.html
  16. 6 4
      web/maintain/basic_info_lib/html/main.html
  17. 5 0
      web/maintain/basic_info_lib/js/basic_info.js
  18. 2 0
      web/maintain/basic_info_lib/js/basic_info_edit.js
  19. 11 10
      web/maintain/bill_template_lib/html/edit.html
  20. 7 5
      web/maintain/bill_template_lib/html/main.html
  21. 5 0
      web/maintain/bill_template_lib/js/bills_template.js
  22. 13 15
      web/maintain/bill_template_lib/js/bills_template_edit.js
  23. 5 0
      web/maintain/billsGuidance_lib/css/main.css
  24. 3 2
      web/maintain/billsGuidance_lib/html/main.html
  25. 12 11
      web/maintain/billsGuidance_lib/html/zhiyin.html
  26. 13 7
      web/maintain/billsGuidance_lib/js/billsGuidance.js
  27. 10 3
      web/maintain/billsGuidance_lib/js/main.js
  28. 5 0
      web/maintain/bills_lib/css/main.css
  29. 7 9
      web/maintain/bills_lib/html/main.html
  30. 6 3
      web/maintain/bills_lib/html/neirong.html
  31. 23 13
      web/maintain/bills_lib/html/qingdan.html
  32. 6 3
      web/maintain/bills_lib/html/tezheng.html
  33. 6 5
      web/maintain/bills_lib/scripts/bills_lib_ajax.js
  34. 4 3
      web/maintain/calc_program_lib/html/edit.html
  35. 6 4
      web/maintain/calc_program_lib/html/main.html
  36. 4 0
      web/maintain/calc_program_lib/js/calc_program.js
  37. 2 0
      web/maintain/calc_program_lib/js/calc_program_edit.js
  38. 6 0
      web/maintain/common/css/main.css
  39. 1 1
      web/maintain/common/html/edit_layout.html
  40. 1 1
      web/maintain/common/html/layout.html
  41. 5 4
      web/maintain/economic_lib/html/edit.html
  42. 6 4
      web/maintain/economic_lib/html/main.html
  43. 2 0
      web/maintain/economic_lib/js/edit.js
  44. 5 0
      web/maintain/economic_lib/js/main.js
  45. 5 4
      web/maintain/engineer_feature_lib/html/edit.html
  46. 6 4
      web/maintain/engineer_feature_lib/html/main.html
  47. 2 0
      web/maintain/engineer_feature_lib/js/edit.js
  48. 5 0
      web/maintain/engineer_feature_lib/js/main.js
  49. 5 4
      web/maintain/engineer_info_lib/html/edit.html
  50. 6 4
      web/maintain/engineer_info_lib/html/main.html
  51. 2 0
      web/maintain/engineer_info_lib/js/edit.js
  52. 6 1
      web/maintain/engineer_info_lib/js/main.js
  53. 4 3
      web/maintain/fee_rate_lib/html/edit.html
  54. 6 4
      web/maintain/fee_rate_lib/html/main.html
  55. 5 0
      web/maintain/fee_rate_lib/js/fee_rate.js
  56. 2 1
      web/maintain/fee_rate_lib/js/fee_rate_edit.js
  57. 5 4
      web/maintain/main_col_lib/html/edit.html
  58. 6 4
      web/maintain/main_col_lib/html/main.html
  59. 2 1
      web/maintain/main_col_lib/js/main_col_edit.js
  60. 4 0
      web/maintain/main_col_lib/js/main_col_lib.js
  61. 5 4
      web/maintain/main_quantity_lib/html/edit.html
  62. 6 4
      web/maintain/main_quantity_lib/html/main.html
  63. 2 0
      web/maintain/main_quantity_lib/js/edit.js
  64. 5 0
      web/maintain/main_quantity_lib/js/main.js
  65. 5 4
      web/maintain/material_lib/html/edit.html
  66. 6 4
      web/maintain/material_lib/html/main.html
  67. 2 0
      web/maintain/material_lib/js/edit.js
  68. 5 0
      web/maintain/material_lib/js/main.js
  69. 1 1
      web/maintain/material_replace_lib/html/edit.html
  70. 6 4
      web/maintain/material_replace_lib/html/main.html
  71. 4 0
      web/maintain/material_replace_lib/js/material_replace.js
  72. 3 3
      web/maintain/material_replace_lib/js/material_replace_edit.js
  73. 38 0
      web/maintain/over_height_lib/html/edit.html
  74. 110 0
      web/maintain/over_height_lib/html/main.html
  75. 188 0
      web/maintain/over_height_lib/js/edit.js
  76. 82 0
      web/maintain/over_height_lib/js/main.js
  77. 5 9
      web/maintain/project_feature_lib/html/edit.html
  78. 6 4
      web/maintain/project_feature_lib/html/main.html
  79. 5 0
      web/maintain/project_feature_lib/js/project_feature.js
  80. 2 0
      web/maintain/project_feature_lib/js/project_feature_edit.js
  81. 2 1
      web/maintain/ration_repository/anzhuang.html
  82. 31 0
      web/maintain/ration_repository/css/main.css
  83. 40 15
      web/maintain/ration_repository/dinge.html
  84. 1 1
      web/maintain/ration_repository/fuzhu.html
  85. 1 1
      web/maintain/ration_repository/gongliao.html
  86. 81 16
      web/maintain/ration_repository/js/coe.js
  87. 5 2
      web/maintain/ration_repository/js/explanatory.js
  88. 5 0
      web/maintain/ration_repository/js/gljSelect.js
  89. 7 0
      web/maintain/ration_repository/js/init.js
  90. 28 9
      web/maintain/ration_repository/js/installation.js
  91. 4 1
      web/maintain/ration_repository/js/main.js
  92. 30 27
      web/maintain/ration_repository/js/ration.js
  93. 6 1
      web/maintain/ration_repository/js/ration_assist.js
  94. 3 74
      web/maintain/ration_repository/js/ration_coe.js
  95. 99 85
      web/maintain/ration_repository/js/ration_glj.js
  96. 3 0
      web/maintain/ration_repository/js/ration_installation.js
  97. 2 5
      web/maintain/ration_repository/js/ration_template.js
  98. 7 2
      web/maintain/ration_repository/js/section_tree.js
  99. 12 10
      web/maintain/ration_repository/main.html
  100. 0 0
      web/maintain/report/html/rpt_tpl_main.html

+ 10 - 5
Dockerfile

@@ -1,14 +1,19 @@
-FROM operationbase:2.0
+FROM operationbase:2.0 as build
 
 WORKDIR /ConstructionOperation
 
-COPY . /ConstructionOperation
+COPY package.json /ConstructionOperation
+
+RUN mkdir tmp \
+    && cnpm install
 
-RUN mkdir tmp
+FROM base-alpine:latest
 
-RUN cnpm install
+COPY --from=build /ConstructionOperation /ConstructionOperation
 
-EXPOSE 6080
+COPY . /ConstructionOperation
+
+WORKDIR /ConstructionOperation
 
 ENV NODE_ENV=prod
 

+ 25 - 0
modules/all_models/std_over_height_lib.js

@@ -0,0 +1,25 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2019/3/5
+ * @version
+ */
+//建设项目基本信息库
+const mongoose = require('mongoose');
+const Schema = mongoose.Schema;
+const oprSchema = require('../all_schemas/opr_schema');
+const overHeightLib = new Schema({
+    ID: {type: String, index: true},
+    name: String,
+    creator: String,
+    createDate: Number,
+    recentOpr: [oprSchema],
+    list: {
+        type: Schema.Types.Mixed,
+        default: []
+    }
+}, {versionKey: false});
+mongoose.model('std_over_height_lib', overHeightLib, 'std_over_height_lib');

+ 102 - 0
modules/over_height_lib/controllers/over_height_controller.js

@@ -0,0 +1,102 @@
+/**
+ * Created by zhang on 2018/9/10.
+ */
+import BaseController from "../../common/base/base_controller";
+let config = require("../../../config/config.js");
+let logger = require('../../../logs/log_helper').logger;
+import overHeightFacade from "../facade/over_height_facade";
+
+class OverHeightController extends BaseController{
+    async main(request, response) {
+        let overHeightLibs = await overHeightFacade.findByCondition({},{info:0},false);
+        let randerData = {
+            title:'超高降效库',
+            userAccount: request.session.managerData.username,
+            userID: request.session.managerData.userID,
+            overHeightLibs:overHeightLibs,
+            layout: 'maintain/common/html/layout'
+        };
+        response.render("maintain/over_height_lib/html/main", randerData);
+    }
+    async addLib(request, response){
+        try {
+            await overHeightFacade.addLib(request.body);
+        }catch (error) {
+            console.log(error);
+        }
+        response.redirect(request.headers.referer);
+    }
+    async findLib(request, response){
+        let result={
+            error:0
+        };
+        try {
+            let data = request.body.data;
+            data = JSON.parse(data);
+            let conditions={ID:data.ID};
+            let resultData = await overHeightFacade.findByCondition(conditions);
+            result.data=resultData;
+        }catch (err){
+            console.log(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        response.json(result);
+    }
+    async saveLib(request, response){
+        let result={
+            error:0
+        };
+        try {
+            let data = request.body.data;
+            data = JSON.parse(data);
+            let resultData= await overHeightFacade.saveLib(data);
+            result.data=resultData;
+        }catch (err){
+            console.log(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        response.json(result);
+    }
+    async deleteLibByID(request,response){
+        logger.info(`delete feeRateLib ${request.ip}`);
+        let result={
+            error:0
+        };
+        try {
+            let data = request.body.data;
+            data = JSON.parse(data);
+            let resultData= await overHeightFacade.deleteLibByID(data.ID);
+            result.data=resultData;
+        }catch (err){
+            console.log(err);
+            result.error=1;
+            result.message = err.message;
+        }
+        response.json(result);
+    }
+    async edit(request,response){
+        //先取出替换库信息:
+        let libID = request.params.libID;
+        let overHeightLib = await overHeightFacade.findByCondition({'ID':libID});
+        if(overHeightLib){
+            let randerData = {
+                title:'超高降效库',
+                mainURL:'/overHeight/main',
+                libName:overHeightLib.name,
+                userAccount: request.session.managerData.username,
+                userID: request.session.managerData.userID,
+                originalInfo:JSON.stringify(overHeightLib.list),
+                libID:libID,
+                LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
+                layout: 'maintain/common/html/edit_layout'
+            };
+            response.render("maintain/over_height_lib/html/edit", randerData);
+        }else {
+            response.redirect(request.headers.referer);
+        }
+    }
+}
+
+export default OverHeightController;

+ 41 - 0
modules/over_height_lib/facade/over_height_facade.js

@@ -0,0 +1,41 @@
+/**
+ * Created by zhang on 2018/9/10.
+ */
+
+import mongoose from "mongoose";
+
+const uuidV1 = require('uuid/v1');
+let moment = require("moment");
+let overHeightModel = mongoose.model('std_over_height_lib');
+
+let overHeightLib = {
+    findByCondition:async function(conditions,options,single=true){
+        if(single == true){
+            return await overHeightModel.findOne(conditions,options);
+        }else {
+            return await  overHeightModel.find(conditions,options);
+        }
+    },
+    addLib : async function (data){
+        let now = new Date().getTime();
+        let dateStr = moment(now).format('YYYY-MM-DD HH:mm:ss');
+        let newLib = {
+            creator: data.userAccount,
+            createDate: now,
+            recentOpr: [{operator: data.userAccount, operateDate: dateStr}],
+            name: data.name,
+        };
+        newLib.ID = uuidV1();
+        return await overHeightModel.create(newLib);
+
+
+    },
+    saveLib:async function(param) {
+        return await overHeightModel.findOneAndUpdate(param.query,param.data,{new:true});
+    },
+    deleteLibByID:async function(ID){
+        return await overHeightModel.deleteOne({ID:ID});
+    }
+};
+
+export default overHeightLib

+ 21 - 0
modules/over_height_lib/routes/over_height_routes.js

@@ -0,0 +1,21 @@
+/**
+ * Created by zhang on 2018/9/10.
+ */
+
+let express = require("express");
+let overHeightRouter = express.Router();
+import OverHeightController from "../controllers/over_height_controller";
+let overHeightController = new OverHeightController();
+
+module.exports =function (app) {
+
+    overHeightRouter.get("/main", overHeightController.auth, overHeightController.init, overHeightController.main);
+    overHeightRouter.post("/addLib", overHeightController.auth, overHeightController.init, overHeightController.addLib);
+    overHeightRouter.post("/findLib", overHeightController.auth, overHeightController.init, overHeightController.findLib);
+    overHeightRouter.post("/saveLib", overHeightController.auth, overHeightController.init, overHeightController.saveLib);
+    overHeightRouter.post("/deleteLibByID", overHeightController.auth, overHeightController.init, overHeightController.deleteLibByID);
+    overHeightRouter.get("/edit/:libID", overHeightController.auth, overHeightController.init, overHeightController.edit);
+
+
+    app.use("/overHeight", overHeightRouter);
+};

+ 9 - 0
modules/ration_repository/controllers/coe_controller.js

@@ -8,6 +8,15 @@ var callback = function(req,res,err,message, data){
 }
 
 class CoeListController extends BaseController{
+    async getCoeReference(req, res) {
+        try {
+            const { rationRepId, coeID } = JSON.parse(req.body.data);
+            const rst = await coeList.getCoeReference(rationRepId, coeID);
+            res.json({ error: 0, message: 'success', data: rst });
+        } catch (err) {
+            res.json({ error: 1, message: err.message, data: null });
+        }
+    }
     getCoeList(req,res){
         coeList.getCoesByLibID(req.body.libID, function(err,data){
             callback(req, res, err, 'Get coes', data);

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

@@ -34,9 +34,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',
             {

+ 5 - 0
modules/ration_repository/models/coe.js

@@ -6,10 +6,15 @@
 const mongoose = require('mongoose');
 const coeListModel = mongoose.model('std_ration_lib_coe_list');
 let counter = require('../../../public/counter/counter');
+const rationModel = mongoose.model('std_ration_lib_ration_items');
 import async from 'async';
 
 let coeListDAO = function(){};
 
+coeListDAO.prototype.getCoeReference = async function (rationRepId, coeID) {
+    return await rationModel.find({rationRepId, 'rationCoeList.ID': coeID}, '-_id code').sort({code: 1});
+};
+
 coeListDAO.prototype.getCoe = function (data, callback) {
     coeListModel.findOne({
             "libID": data.libID,

+ 1 - 0
modules/ration_repository/routes/ration_rep_routes.js

@@ -74,6 +74,7 @@ module.exports =  function (app) {
     apiRouter.post("/getGljItemsByIds",repositoryGljController.auth, gljController.init, gljController.getGljItemsByIds);
     apiRouter.post("/getGljItemsByCodes",repositoryGljController.auth, gljController.init, gljController.getGljItemsByCodes);
 
+    apiRouter.post("/getCoeReference",coeListController.auth, coeListController.init, coeListController.getCoeReference);
     apiRouter.post("/getCoeList",coeListController.auth, coeListController.init, coeListController.getCoeList);
     apiRouter.post("/saveCoeList",coeListController.auth, coeListController.init, coeListController.saveCoeList);
     apiRouter.post("/getCoeItemsByIDs",coeListController.auth, coeListController.init, coeListController.getCoeItemsByIDs);

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

@@ -7,6 +7,7 @@ const gljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
 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";
@@ -17,10 +18,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');

+ 2 - 0
modules/users/controllers/login_controller.js

@@ -171,6 +171,8 @@ class LoginController extends BaseController {
             // 获取所有工具里的权限控制器名称
             let toolAllPermission = [];
             let toolAllPermissionList = await permissionModel.getList({pid:4});
+            console.log(`toolAllPermissionList`);
+            console.log(toolAllPermissionList);
             for (let tool of toolAllPermissionList) {
                 toolAllPermission.push(tool.controller);
                 if (managerData.super_admin === 1) {

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 4680 - 0
package-lock.json


+ 22 - 1
public/common_util.js

@@ -17,4 +17,25 @@ function deleteEmptyObject(arr) {
             i = i - 1;
         };
     };
-};
+};
+
+((factory) => {
+    if (typeof module !== 'undefined') {
+        module.exports = factory();
+    } else {
+        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
+    }
+})();

+ 5 - 4
web/maintain/basic_info_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="basicInfoList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="basicInfoList" 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/basic_info_lib/js/basic_info_edit.js"></script>

+ 6 - 4
web/maintain/basic_info_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 basicInfoLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/basicInfo/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/basicInfo/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getBasicInfoLib("<%= 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='getBasicInfoLib("<%= 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>
                             <% } %>
@@ -105,4 +106,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/basic_info_lib/js/basic_info.js"></script>

+ 5 - 0
web/maintain/basic_info_lib/js/basic_info.js

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

+ 2 - 0
web/maintain/basic_info_lib/js/basic_info_edit.js

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@@ -31,7 +31,7 @@
                   <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                       <table class="table table-hover table-bordered">
-                        <thead><tr><th>清单指引名称</th><th>编办</th><th>清单规则</th><th>类型</th><th width="160">添加时间</th><th width="90">操作</th></tr></thead>
+                        <thead><tr><th>清单指引名称</th><th>编办</th><th>清单规则</th><th>类型</th><th width="160">添加时间</th><th width="70">操作</th></tr></thead>
                         <tbody>
                         </tbody>
                       </table>
@@ -152,6 +152,7 @@
     <script src="/web/maintain/billsGuidance_lib/js/global.js"></script>
     <script src="/public/web/uuid.js"></script>
     <script src="/public/web/common_ajax.js"></script>
+    <script src="/public/web/lock_util.js"></script>
     <script src="/web/maintain/billsGuidance_lib/js/main.js"></script>
 
 </body>

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

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

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

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

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

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

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

+ 7 - 9
web/maintain/bills_lib/html/main.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -36,7 +36,7 @@
                             <tr>
                                 <th>清单规则名称</th>
                                 <th width="160">添加时间</th>
-                                <th width="60">操作</th>
+                                <th width="70">操作</th>
                                 <th width="90">导入</th>
                                 <th width="90">复制</th>
                             </tr>
@@ -180,6 +180,7 @@
     <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>
@@ -198,15 +199,9 @@
         //main 增删改
         $("#createA").click(function(){
             let billsLibName = $("#createText").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 {
+            } else {
                 mainAjax.createStdBillsLib(userAccount, billsLibName);
                 $("#createText").val("");
             }
@@ -252,7 +247,10 @@
            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 () {

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

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -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);

+ 23 - 13
web/maintain/bills_lib/html/qingdan.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -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();
@@ -375,25 +378,29 @@
     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);
     });
-
+    
     function nodeOpration(controller, totalJobs, totalItems){
         let btnInsert = $('#insert');
         let btnDelete = $('#delete');
@@ -460,7 +467,7 @@
 
 
     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});
         sheetCommonObj.bindEscKey(billsSpread, [{sheet: billsSpread.getSheet(0), editStarting: dbController.onEditStart, editEnded: dbController.onEditEnded}]);
         billsSpread.focus(true);
         setSheet.initSheet(billsSpread, setting, true);
@@ -615,6 +622,9 @@
     }
 
     function refreshBtn(controller){
+        if (locked) {
+            return;
+        }
         controller.bind('refreshBaseActn', function (tree) {
             let showButton = function (show, btn) {
                 tools.btnAction($('#insert'), 'focusOnBills');

+ 6 - 3
web/maintain/bills_lib/html/tezheng.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -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);

+ 6 - 5
web/maintain/bills_lib/scripts/bills_lib_ajax.js

@@ -57,17 +57,18 @@ var mainAjax = {
             const createDateFmt = new Date(libData.createDate).format("yyyy-MM-dd");
             const html = 
                 `<tr id="${id}">
-                    <td><a href="/stdBills?billsLibId=${id}">${billsLibName}</a></td>
+                    <td><a href="/stdBills?billsLibId=${id}&locked=true">${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);" class="text-danger" 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="#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 href="javascript:void(0);" class="btn btn-secondary btn-sm import-data" data-id="${id}" title="导入数据"><i class="fa fa-sign-in fa-rotate-90"></i>导入</a>
+                        <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 href="javascript:void(0);" class="btn btn-secondary btn-sm copy-data" data-id="${id}" title="复制数据"><i class="fa fa-clone"></i>复制</a>
+                        <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;

+ 4 - 3
web/maintain/calc_program_lib/html/edit.html

@@ -13,12 +13,12 @@
             <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>
+                        <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="templateList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="templateList" rows="38"></textarea>
         </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
@@ -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;
 }

+ 1 - 1
web/maintain/common/html/edit_layout.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">

+ 1 - 1
web/maintain/common/html/layout.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">

+ 5 - 4
web/maintain/economic_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="editValue" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="editValue" 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/economic_lib/js/edit.js"></script>

+ 6 - 4
web/maintain/economic_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 economicLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/economic/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/economic/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getLibInfo("<%= 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='getLibInfo("<%= 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/economic_lib/js/main.js"></script>

+ 2 - 0
web/maintain/economic_lib/js/edit.js

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

+ 5 - 0
web/maintain/economic_lib/js/main.js

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

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

@@ -13,13 +13,13 @@
             <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
                 <div class="collapse navbar-collapse" id="navbarNav">
                     <div class="tools-btn btn-group align-top">
-                        <a href="javascript:void(0)" class="btn btn-sm" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
                     </div>
                 </div>
             </nav>
-            <textarea class="form-control" id="editValue" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="editValue" 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/engineer_feature_lib/js/edit.js"></script>

+ 6 - 4
web/maintain/engineer_feature_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 engineerFeatureLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/engineerFeature/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/engineerFeature/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getLibInfo("<%= 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='getLibInfo("<%= 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/engineer_feature_lib/js/main.js"></script>

+ 2 - 0
web/maintain/engineer_feature_lib/js/edit.js

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

+ 5 - 0
web/maintain/engineer_feature_lib/js/main.js

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

+ 5 - 4
web/maintain/engineer_info_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="editValue" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="editValue" 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/engineer_info_lib/js/edit.js"></script>

+ 6 - 4
web/maintain/engineer_info_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 engineerInfoLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/engineerInfo/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/engineerInfo/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getLibInfo("<%= 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='getLibInfo("<%= 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>
                             <% } %>
@@ -105,4 +106,5 @@
     </div>
 </div>
 
+<script src="/public/web/lock_util.js"></script>
 <script type="text/javascript" src="/web/maintain/engineer_info_lib/js/main.js"></script>

+ 2 - 0
web/maintain/engineer_info_lib/js/edit.js

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

+ 6 - 1
web/maintain/engineer_info_lib/js/main.js

@@ -1,8 +1,8 @@
 /**
  * Created by zhang on 2018/9/3.
  */
+let router = "engineerInfo";
 $(document).ready(function() {
-    let router = "engineerInfo";
     // 保存按钮
     $("#addLibs").click(async function() {
         let name = $('#name').val();
@@ -53,6 +53,11 @@ $(document).ready(function() {
             }
         }
     });
+
+    // 锁定、解锁
+    $('.lock').click(function () {
+        lockUtil.handleLockClick($(this));
+    });
 });
 
 async function getLibInfo (ID) {

+ 4 - 3
web/maintain/fee_rate_lib/html/edit.html

@@ -13,12 +13,12 @@
             <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>
+                        <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="rateList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="rateList" rows="38"></textarea>
         </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
@@ -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>

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

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

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

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

+ 5 - 4
web/maintain/main_quantity_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="editValue" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="editValue" 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/main_quantity_lib/js/edit.js"></script>

+ 6 - 4
web/maintain/main_quantity_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 quantityLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/mainQuantity/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/mainQuantity/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getLibInfo("<%= 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='getLibInfo("<%= 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/main_quantity_lib/js/main.js"></script>

+ 2 - 0
web/maintain/main_quantity_lib/js/edit.js

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

+ 5 - 0
web/maintain/main_quantity_lib/js/main.js

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

+ 5 - 4
web/maintain/material_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="editValue" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="editValue" 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/material_lib/js/edit.js"></script>

+ 6 - 4
web/maintain/material_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 materialLibs){ %>
                             <tr class="libTr">
-                                <td id="<%= lib.ID%>"><a href="/material/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td id="<%= lib.ID%>"><a href="/material/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
-                                    <a style="color: #0275d8" onclick='getLibInfo("<%= 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='getLibInfo("<%= 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/material_lib/js/main.js"></script>

+ 2 - 0
web/maintain/material_lib/js/edit.js

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

+ 5 - 0
web/maintain/material_lib/js/main.js

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

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

+ 38 - 0
web/maintain/over_height_lib/html/edit.html

@@ -0,0 +1,38 @@
+<nav class="navbar navbar-toggleable-lg justify-content-between navbar-light p-0 second_header">
+    <ul class="nav nav-tabs" role="tablist">
+        <li class="nav-item">
+            <a class="nav-link active px-3" href="javascript: void(0);">超高降效信息</a>
+        </li>
+    </ul>
+</nav>
+
+<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 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 lock-text-control" id="editValue" rows="38"></textarea>
+        </div>
+        </div>
+        <input type="hidden" id="libID" value="<%= libID %>">
+        <input type="hidden" id="originalInfo" value="<%= originalInfo %>">
+    </div>
+</div>
+
+
+
+<script type="text/javascript">
+
+</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/over_height_lib/js/edit.js"></script>

+ 110 - 0
web/maintain/over_height_lib/html/main.html

@@ -0,0 +1,110 @@
+<div class="main">
+    <div class="content">
+        <div class="container-fluid">
+            <div class="row">
+                <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="70">操作</th></tr></thead>
+                            <tbody id="showArea">
+                            <% for(let lib of overHeightLibs){ %>
+                            <tr class="libTr">
+                                <td id="<%= lib.ID%>"><a href="/overHeight/edit/<%= lib.ID%>?locked=true"><%= lib.name%></a></td>
+                                <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
+                                <td>
+                                    <a class="lock-btn-control disabled" href="javascript:;" style="color: #0275d8" onclick='getLibInfo("<%= 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>
+                            <% } %>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<!--弹出添加-->
+<div class="modal fade" id="add" data-backdrop="static" style="display: none;" 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 id="addLibForm" method="post" action="/overHeight/addLib" enctype="application/x-www-form-urlencoded21">
+                    <div class="form-group">
+                        <label>库名称</label>
+                        <input id="name" name="name" class="form-control" placeholder="请输入超高降效库名称" type="text">
+                        <small class="form-text text-danger" id="nameError" style="display: none">请输入超高降效库名称。</small>
+                    </div>
+                    <input type="hidden" name = "userAccount" value="<%= userAccount%>">
+                </form>
+            </div>
+            <div class="modal-footer">
+                <button id="addLibs"  class="btn btn-primary">新建</button>
+                <button type="button" id="cancelBtn" class="btn btn-secondary" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<!--弹出编辑-->
+<div class="modal fade" id="edit" data-backdrop="static" style="display: none;" 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="renameText" class="form-control" placeholder="输入名称" type="text" value="">
+                        <small class="form-text text-danger" id="renameError" style="display: none">请输入名称。</small>
+                        <input id="libID" type="hidden">
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <a id="rename" href="javascript: void(0);" class="btn btn-primary" >确定</a>
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<!--弹出删除-->
+<div class="modal fade" id="del" data-backdrop="static" style="display: none;" 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">
+                <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
+                <input type="hidden" id="libID_del">
+                <input type="hidden" id="delCount">
+            </div>
+            <div class="modal-footer">
+                <a id="delete" href="javascript:void(0);" class="btn btn-danger" >确认</a>
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script src="/public/web/lock_util.js"></script>
+<script type="text/javascript" src="/web/maintain/over_height_lib/js/main.js"></script>

+ 188 - 0
web/maintain/over_height_lib/js/edit.js

@@ -0,0 +1,188 @@
+/**
+ * Created by Zhong on 2019/12/11.
+ */
+
+$(document).ready(function () {
+    const locked = lockUtil.getLocked();
+    lockUtil.lockTools($(document.body), locked);
+    try {
+        let tem = sortJson(JSON.parse($("#originalInfo").val()), compareInfo);
+        $("#editValue").val(JSON.stringify(tem,null,4));
+    }catch (err){
+        console.log(err);
+    }
+
+   $("#format").click( function() {
+       try {
+           let jsonText =  $("#editValue").val();
+           $("#editValue").val(JSON.stringify(JSON.parse(jsonText),null,4));
+       }catch (err){
+           console.log(err);
+           alert("输入的JSON格式有误,请重新输入!");
+       }
+   });
+    $("#save").click(async function() {
+        try {
+            $.bootstrapLoading.start();
+            let libID = $("#libID").val();
+            let jsonText =  $("#editValue").val();
+            if(jsonText.indexOf("'")!=-1){
+                alert("输入的格式不能包含 ' 位于:"+jsonText.substr(jsonText.indexOf("'")-15,18));
+                return;
+            }
+            await ajaxPost("/overHeight/saveLib",{query:{ID:libID},data:{list:JSON.parse(jsonText)}});
+            $.bootstrapLoading.end();
+        }catch (err){
+            $.bootstrapLoading.end();
+            console.log(err);
+            alert("保存失败,请查看输入数据");
+        }
+    });
+    /*[{
+        "name": "",
+        "labourName": "定额人工名称",
+        "machineName": "定额机械名称",
+        "items": [{
+            "code": "JZCG-1",
+            "name": "高度增加30m",
+            "labourRate": "0.0124",
+            "machineRate": "0.0313"
+        },{
+            "code": "JZCG-2",
+            "name": "高度增加40m",
+            "labourRate": "0.023",
+            "machineRate": "0.0513"
+        },{
+            "code": "JZCG-3",
+            "name": "高度增加50m",
+            "labourRate": "0.0336",
+            "machineRate": "0.0665"
+        },{
+            "code": "JZCG-4",
+            "name": "高度增加60m",
+            "labourRate": "0.023",
+            "machineRate": "0.0513"
+        },{
+            "code": "JZCG-5",
+            "name": "高度增加70m",
+            "labourRate": "0.0664",
+            "machineRate": "0.1104"
+        },{
+            "code": "JZCG-6",
+            "name": "高度增加80m",
+            "labourRate": "0.0837",
+            "machineRate": "0.1324"
+        },{
+            "code": "JZCG-7",
+            "name": "高度增加90m",
+            "labourRate": "0.1012",
+            "machineRate": "0.1528"
+        },{
+            "code": "JZCG-8",
+            "name": "高度增加100m",
+            "benchmark": "100",
+            "labourRate": "0.1309",
+            "machineRate": "0.1881"
+        },{
+            "code": "JZCG-9",
+            "name": "每增10m以内",
+            "extra": "10",
+            "labourRate": "0.0206",
+            "machineRate": "0.0249"
+        },{
+            "code": "JZCG-8 + JZCG-9",
+            "name": "高度增加110m",
+            "labourRate": "0.1515",
+            "machineRate": "0.213"
+        },{
+            "code": "JZCG-8 + JZCG-9 * 2",
+            "name": "高度增加110m",
+            "limit": "110",
+            "labourRate": "0.1721",
+            "machineRate": "0.2379"
+        }]
+    }]*/
+    $("#createNormal").click(async function() {
+        let normalInfo =  [{
+            "name": "多层建筑物",
+            "labourMachineName": "定额人工机械名称",
+            "items": [{
+                "code": "JZCG-1",
+                "name": "20-40",
+                "labourMachineRate": "0.0701"
+            },{
+                "code": "JZCG-2",
+                "name": "40-60",
+                "labourMachineRate": "0.1148"
+            },{
+                "code": "JZCG-3",
+                "name": "60-80",
+                "labourMachineRate": "0.1594"
+            },{
+                "code": "JZCG-4",
+                "name": "80-100",
+                "labourMachineRate": "0.2104"
+            },{
+                "code": "JZCG-5",
+                "name": "100-120",
+                "benchmark": "120",
+                "labourMachineRate": "0.2614"
+            },{
+                "code": "JZCG-6",
+                "name": "每增20m",
+                "extra": "20",
+                "labourMachineRate": "0.045"
+            },{
+                "code": "JZCG-5 + JZCG-6",
+                "name": "120-140",
+                "labourMachineRate": "0.3064"
+            },{
+                "code": "JZCG-5 + JZCG-6 * 2",
+                "name": "140-160",
+                "limit": "160",
+                "labourMachineRate": "0.3514"
+            }]
+        }, {
+            "name": "单层建筑物",
+            "labourMachineName": "定额人工机械名称",
+            "items": [{
+                "code": "DCCG-1",
+                "name": "30以内",
+                "labourMachineRate": "0.025"
+            },{
+                "code": "DCCG-2",
+                "name": "40以内",
+                "labourMachineRate": "0.0374"
+            },{
+                "code": "DCCG-3",
+                "name": "50以内",
+                "labourMachineRate": "0.0544"
+            }]
+        }];
+        try {
+            let jsonText =  JSON.stringify(normalInfo);
+            $("#editValue").val(JSON.stringify(JSON.parse(jsonText),null,4));
+        }catch (err){
+            console.log(err);
+        }
+
+    })
+
+
+});
+function compareInfo(a, b) {
+    let mapping = {
+        name: 1,
+        labourName: 2,
+        machineName: 3,
+        labourMachineName: 4,
+        items: 5,
+        code: 6,
+        labourRate: 7,
+        machineRate: 8,
+        labourMachineRate: 9
+    };
+    let aV = mapping[a] ? mapping[a] : 0,
+        bV = mapping[b] ? mapping[b] : 0;
+    return aV - bV;
+}

+ 82 - 0
web/maintain/over_height_lib/js/main.js

@@ -0,0 +1,82 @@
+/**
+ * Created by zhang on 2018/9/3.
+ */
+let router = "overHeight";
+$(document).ready(function() {
+    // 保存按钮
+    $("#addLibs").click(async function() {
+        let name = $('#name').val();
+        if(name==''){
+            $("#nameError").show();
+            return;
+        }else {
+            $("#addLibs").attr("disabled",true);//防止重复提交
+            $("#addLibForm").submit();
+        }
+    });
+
+    $("#rename").click(async function() {
+        let libID = $("#libID").val();
+        let name = $('#renameText').val();
+        if(libID!=''){
+            if(name ==''){
+                $("#renameError").show();
+                return;
+            }else {
+                try {
+                    let newInfo = await ajaxPost(`/${router}/saveLib`,{query:{ID:libID},data:{name:name}});
+                    $("#"+libID).children("a").text(newInfo.name);
+                    $("#edit").modal('hide');
+                }catch(err) {
+                    console.log(err);
+                }
+            }
+        }
+    });
+
+    $("#delete").click(async function() {
+        let libID = $("#libID_del").val();
+        let delCount = parseInt($("#delCount").val());
+        delCount = delCount+1;
+        $("#delCount").val(delCount);
+        if(delCount == 3){
+            if(libID!=""){
+                try {
+                    let result = await ajaxPost(`/${router}/deleteLibByID`,{ID:libID});
+                    if(result.ok){
+                        $("#"+libID).parent(".libTr").remove();
+                    }
+                    $("#del").modal('hide');
+                }catch (err){
+                    console.log(err);
+                }
+            }
+        }
+    });
+
+    // 锁定、解锁
+    $('.lock').click(function () {
+        lockUtil.handleLockClick($(this));
+    });
+});
+
+async function getLibInfo (ID) {
+    try {
+        let lib = await ajaxPost(`/${router}/findLib`,{ID:ID});
+        if(lib){
+            $("#renameText").val(lib.name);
+            $("#libID").val(ID);
+            $("#edit").modal({show:true});
+        }else {
+            alert("没有找到超高降效库");
+        }
+    }catch (err){
+        console.log(err);
+    }
+}
+
+function showDeleteModal(ID){
+    $("#libID_del").val(ID);
+    $("#delCount").val(0);
+    $("#del").modal({show:true});
+}

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

@@ -13,13 +13,13 @@
             <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
                 <div class="collapse navbar-collapse" id="navbarNav">
                     <div class="tools-btn btn-group align-top">
-                        <a href="javascript:void(0)" class="btn btn-sm" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
-                        <a href="javascript:void(0)" class="btn btn-sm" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="createNormal"><i class="fa fa-list-alt" aria-hidden="true"></i> 生成默认</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="format"><i class="fa fa-list-alt" aria-hidden="true"></i> 校验格式</a>
+                        <a href="javascript:void(0)" class="btn btn-sm lock-btn-control" id="save"><i class="fa fa-floppy-o" aria-hidden="true"></i> 保存</a>
                     </div>
                 </div>
             </nav>
-            <textarea class="form-control" id="featureList" rows="38"></textarea>
+            <textarea class="form-control lock-text-control" id="featureList" rows="38"></textarea>
         </div>
         </div>
         <input type="hidden" id="libID" value="<%= libID %>">
@@ -27,10 +27,6 @@
     </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>

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

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

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

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

+ 2 - 1
web/maintain/ration_repository/anzhuang.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -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>

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

@@ -294,3 +294,34 @@ div.resize-x{
     cursor: w-resize;
     float: left;
 }
+.reset *{
+    margin: 0;
+    padding: 0;
+}
+.info-list {
+    max-height: 300px;
+    overflow: auto;
+}
+.info-list .list-title{
+    font-weight: bold;
+}
+.info-list li{
+    list-style: none;
+    display: flex;
+}
+.info-list li:hover{
+    background-color: #eee;
+}
+.info-list li span {
+    flex: 1;
+}
+.info-list li a {
+    float: right;
+    width: 30px;
+    text-decoration: none;
+}
+.disabled {
+    pointer-events: none;
+    opacity: .65;
+    color:#666;
+}

+ 40 - 15
web/maintain/ration_repository/dinge.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -63,15 +63,15 @@
                         <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 class="btn btn-sm lock-btn-control" id="tree_Insert" data-toggle="tooltip" data-placement="bottom" data-original-title="插入" href="javascript:void(0);" title="" ><i class="fa fa-plus" aria-hidden="true"></i></a>
+                                    <a class="btn btn-sm lock-btn-control" id="tree_remove" data-toggle="tooltip" data-placement="bottom" data-original-title="删除" href="javascript:void(0);" title=""><i class="fa fa-remove" aria-hidden="true"></i></a>
+                                    <a class="btn btn-sm lock-btn-control" id="tree_upLevel" data-toggle="tooltip" data-placement="bottom" data-original-title="升级" href="javascript:void(0);" title=""><i class="fa fa-arrow-left" aria-hidden="true"></i></a>
+                                    <a class="btn btn-sm lock-btn-control" id="tree_downLevel" data-toggle="tooltip" data-placement="bottom" data-original-title="降级" href="javascript:void(0);" title=""><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
+                                    <a class="btn btn-sm lock-btn-control" id="tree_downMove" data-toggle="tooltip" data-placement="bottom" data-original-title="下移" href="javascript:void(0);" title=""><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
+                                    <a class="btn btn-sm lock-btn-control" id="tree_upMove" data-toggle="tooltip" data-placement="bottom" data-original-title="上移" href="javascript:void(0);" 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">
+                                    <input class="form-control form-control-sm" id="rationSearch" type="text" value="" placeholder="搜索定额">
                                 </div>
                             </div>
                             <div class="tab-content" id="sectionSpread" style="overflow: hidden">
@@ -136,8 +136,8 @@
                             <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>
-                                    <textarea id="explanationShow" name="editor" class="form-control "></textarea>
+                                    <a class="mr-3 uploadImgTrigger lock-btn-control" data-toggle="modal" data-target="#uploadimg" trigger="rationExplanation" href="javacript:void(0);"><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>-->
                                 </div>
@@ -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 class="mr-3 uploadImgTrigger lock-btn-control" data-toggle="modal" data-target="#uploadimg" trigger="rationRuleText" href="javacript:void(0);"><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 class="form-check-input lock-btn-control" name="optionsRadios" type="radio" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;
+                                        <label class="form-check-label lock-btn-control"><input class="form-check-input lock-btn-control" name="optionsRadios" type="radio" 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 class="form-check-input lock-btn-control" name="fzRadios" type="radio" value="ALL" disabled=""> 适合本项所有定额</label>&nbsp;&nbsp;
+                                        <label class="form-check-label lock-btn-control"><input class="form-check-input lock-btn-control" name="fzRadios" type="radio" 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">
@@ -556,6 +562,23 @@
                 </div>
             </div>
         </div>
+        <!--查找引用-->
+        <div class="modal fade" id="info" data-backdrop="static" style="display: none;" 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 typeClose" data-dismiss="modal" aria-label="Close">
+                            <span aria-hidden="true">×</span>
+                        </button>
+                    </div>
+                    <div class="modal-body reset">
+                        <ul id="infoBody" class="info-list">
+                        </ul>
+                    </div>
+                </div>
+            </div>
+        </div>
         <%include ../../common/html/uploadImg.html %>
         <!--弹出html填写帮助-->
         <!--弹出html填写帮助-->
@@ -646,7 +669,9 @@
         <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 -->
         <script type="text/javascript" src="/lib/ztree/jquery.ztree.core.js"></script>
         <script type="text/javascript" src="/lib/ztree/jquery.ztree.excheck.js"></script>

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

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">

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

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">

+ 81 - 16
web/maintain/ration_repository/js/coe.js

@@ -173,6 +173,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;
@@ -230,31 +231,35 @@ let coeOprObj = {
         me.workSheet = me.workBook.getSheet(0);
         me.workSheet.options.isProtected = true;
         me.onDelOpr(me.workBook, me.setting);
+        me.initContextMenu();
         me.workSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, me.onSelectionChanged);
         me.workSheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
         me.workBook.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
         me.workBook.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
     },
     onSelectionChanged: function (sender, info) {
-        let me = coeOprObj, that = gljAdjOprObj;
         if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
-            let row = info.newSelections[0].row;
-            if(row < me.currentCoeList.length){
-                me.currentCoe = me.currentCoeList[row];
-                that.currentGljAdjList = me.currentCoe.coes;
-                that.buildDynamicComboBox(that.workSheet);
-            }
-            else{
-                me.currentCoe = null;
-                that.currentGljAdjList = [];
-                that.buildBaseCell(that.workSheet);
-            }
-            //refresh & show coes
-            sheetCommonObj.cleanSheet(that.workSheet, that.setting, -1);
-            me.workBook.focus(true);
-            that.show(that.currentGljAdjList);
+            const row = info.newSelections[0].row;
+            coeOprObj.coeSelInit(row);
         }
     },
+    coeSelInit: function (row) {
+        const me = coeOprObj;
+        const adj = gljAdjOprObj;
+        if(row < me.currentCoeList.length){
+            me.currentCoe = me.currentCoeList[row];
+            adj.currentGljAdjList = me.currentCoe.coes;
+            adj.buildDynamicComboBox(adj.workSheet);
+        } else{
+            me.currentCoe = null;
+            adj.currentGljAdjList = [];
+            adj.buildBaseCell(adj.workSheet);
+        }
+        //refresh & show coes
+        sheetCommonObj.cleanSheet(adj.workSheet, adj.setting, -1);
+        me.workBook.focus(true);
+        adj.show(adj.currentGljAdjList);
+    },
     onEditEnded: function (sender, args) {
         let me = coeOprObj, addArr = [], updateArr = [], dataCode = me.setting.header[args.col].dataCode;
         if(args.editingText && args.editingText.toString().trim().length > 0){
@@ -411,6 +416,66 @@ let coeOprObj = {
         workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
         workBook.commandManager().setShortcutKey('coeListDel', GC.Spread.Commands.Key.del, false, false, false, false);
     },
+    initContextMenu: function () {
+        const me = this;
+        $.contextMenu({
+            selector: '#mainSpread',
+            build: function($triggerElement, e){
+                //控制允许右键菜单在哪个位置出现
+                const target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.workBook);
+                const sheet = me.workBook.getSheet(0);
+                if(target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
+                    if(typeof target.row !== 'undefined'){
+                        //控制按钮是否可用
+                        sheet.setActiveCell(target.row, target.col);
+                        me.coeSelInit(target.row);
+                    }
+                    return {
+                        callback: function(){},
+                        items: {
+                            getReference: {
+                                name: '查找引用',
+                                disabled: function () {
+                                    return !me.currentCoeList || !me.currentCoeList[target.row];
+                                },
+                                icon: 'fa-search',
+                                callback: function () {
+                                    const coe = me.currentCoeList[target.row];
+                                    me.getReference(coe.ID);
+                                }
+                            },
+                        }
+                    };
+                }
+                else{
+                    return false;
+                }
+            }
+        });
+    },
+    getReference: function (coeID) {
+        const $info = $('#info');
+        const $infoBody = $('#infoBody');
+        $.bootstrapLoading.start();
+        CommonAjax.post('/rationRepository/api/getCoeReference', { rationRepId: pageOprObj.rationLibId, coeID }, function (info) {
+            let htmlArr = [];
+            if (!info || !info.length) {
+                htmlArr.push('<li>无引用数据</li>');
+            } else {
+                htmlArr = info.map(ration => {
+                    return `<li>
+                             <span>${ration.code}</span>
+                             <a data-dismiss="modal" href="javascript:;" onclick="sectionTreeObj.locateToSection('${ration.code}')">定位</a>
+                        </li>`;
+                });
+            }
+            $infoBody.html(htmlArr.join(''));
+            $info.modal('show');
+            $.bootstrapLoading.end();
+        }, function () {
+            $.bootstrapLoading.end();
+        });
+    },
     //粘贴的数据,编号唯一化,去除编号重复的项
     makeUniqItems: function (items) {
         let rst = [];

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

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

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

+ 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
@@ -306,6 +312,9 @@ let feeItemObj = {
         }
     },
     feeItemDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.workBook.commandManager().register('feeItemDel', function () {
             curDeleteType = me.deleteType;
@@ -451,17 +460,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');
+                                }
+                            }
                         }
                     };
                 }
@@ -566,6 +579,9 @@ let sectionObj = {
         }
     },
     sectionDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.workBook.commandManager().register('sectionDel', function () {
             curDeleteType = me.deleteType;
@@ -1021,6 +1037,9 @@ let feeRuleObj = {
         }
     },
     feeRuleDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = feeRuleObj, se = sectionObj;
         me.workBook.commandManager().register('feeRuleDel', function () {
             me.toUpdate = false;

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

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

+ 30 - 27
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();
@@ -437,7 +435,7 @@ let rationOprObj = {
         let dataCode = me.setting.header[args.col].dataCode;
         let deESCFields = ['code', 'name', 'unit'];
         if(deESCFields.includes(dataCode)){
-            args.editingText = me.isDef(args.editingText) ? args.editingText.toString().replace(/[\r, \n]/g, ' ') : '';
+            args.editingText = me.isDef(args.editingText) ? args.editingText.toString().replace(/[\r\n]/g, ' ') : '';
             args.sheet.setValue(args.row, args.col, args.editingText);
         }
         let rObj = sheetsOprObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row),
@@ -721,7 +719,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);
                         }
@@ -804,6 +804,9 @@ let rationOprObj = {
             return 0;
         }
         arr.sort(function (a, b) {
+            if (!commonUtil.isDef(a.code) || !commonUtil.isDef(b.code)) {
+                return 0;
+            }
             let aArr = a.code.split('-'),
                 bArr = b.code.split('-');
             return recurCompare(aArr, bArr, 0);

+ 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 - 74
web/maintain/ration_repository/js/ration_coe.js

@@ -31,86 +31,12 @@ var rationCoeOprObj = {
         me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
         me.sheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStarting);
         me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
-        //右键
-        //me.onContextmenuOpr();
     },
 
     isDef: function (v) {
         return v !== undefined && v !== null;
     },
 
-    onContextmenuOpr: function () {
-        let raCoe = rationCoeOprObj;
-        $.contextMenu({
-            selector: '#rdSpread',
-            build: function($triggerElement, e){
-                //控制允许右键菜单在哪个位置出现
-                let sheet = raCoe.sheet;
-                let offset = $("#rdSpread").offset(),
-                    x = e.pageX - offset.left,
-                    y = e.pageY - offset.top;
-                let target = sheet.hitTest(x, y);
-                if(sheet.getParent().getActiveSheetIndex() === 2 && target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){//在表格内
-                    let currentCache = 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;
-                                            }
-                                        }
-                                        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);
-                                        }
-                                    }
-                                });
-                            }}
-                        }
-                    };
-                }
-                else{
-                    return false;
-                }
-            }
-        });
-    },
 
     upMove: function (thisObj, preObj, cell) {
         let me = this;
@@ -263,6 +189,9 @@ var rationCoeOprObj = {
     },
 
     bindRationCoeDel: function () {
+        if (locked) {
+            return;
+        }
         let me = rationCoeOprObj;
         let workBook = me.sheet.getParent();
         workBook.commandManager().register('rationCoeDel', function () {

+ 99 - 85
web/maintain/ration_repository/js/ration_glj.js

@@ -75,6 +75,9 @@ var rationGLJOprObj = {
         this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onCellEditEnd);
     },
     bindRationGljDelOpr: function () {
+        if (locked) {
+            return;
+        }
         let me = rationGLJOprObj, spreadBook = me.sheet.getParent();
         spreadBook.commandManager().register('rationGljDelete', function () {
             let sels = me.sheet.getSelections(), lockCols = me.setting.view.lockColumns;
@@ -277,57 +280,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);
+                                }},
                         }
                     };
                 }
@@ -335,55 +339,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 () {

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

@@ -13,15 +13,12 @@
 
 const RationTemplate = (function () {
     let curRation = null;
-    function _isDef(v) {
-        return typeof v !== 'undefined' && v !== null;
-    }
     //当前定额下的定额模板关联数据
     let templateData = [];
     let templateSheet = null;
     //重新设置templateData
     function setTemplateData(newData) {
-        templateData = _isDef(newData) && Array.isArray(newData) ? newData : [];
+        templateData = commonUtil.isDef(newData) && Array.isArray(newData) ? newData : [];
     }
     let setting = {
         header:[
@@ -142,7 +139,7 @@ const RationTemplate = (function () {
     //重新绑定del建
     //@return {void}
     function bindRationTempDel() {
-        if (!templateSheet) {
+        if (locked || !templateSheet) {
             return;
         }
         let workBook = templateSheet.getParent();

+ 7 - 2
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;
@@ -248,7 +249,6 @@ let sectionTreeObj = {
         const $searchInput = $('#rationSearch');
         if (hash) {
             const rationCode = hash.replace('#', '');
-            $searchInput.val(rationCode);
             this.locateToSection(rationCode);
         }
     },
@@ -263,6 +263,9 @@ let sectionTreeObj = {
     },
     
     refreshBtn: function (selected) {
+        if (locked) {
+            return;
+        }
         let me = this;
         me.insertBtn.removeClass('disabled');
         me.removeBtn.removeClass('disabled');
@@ -662,7 +665,9 @@ let sectionTreeObj = {
     },
     //根据定额定位至章节树
     locateToSection: function (rationCode) {
-        let me = this;
+        const me = this;
+        const $seach = $('#rationSearch');
+        $seach.val(rationCode);
         //去后台搜索该定额
         $.bootstrapLoading.start();
         CommonAjax.post('/rationRepository/api/getRationItem', {rationLibId: pageOprObj.rationLibId, code: rationCode}, function (rstData) {

+ 12 - 10
web/maintain/ration_repository/main.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="zh-CN">
 
 <head>
     <meta charset="utf-8">
@@ -65,27 +65,28 @@
                         <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.libCode%></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 href="javascript:void(0);" data-toggle="modal" data-target="#reCalcAll" title="全部计算"><i class="fa fa-calculator"></i></a>
+                                <a class="lock-btn-control disabled" data-toggle="modal" data-target="#edit" href="javacript: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="javacript:void(0);" 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 import-section" data-toggle="modal" data-target="#section" 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-section lock-btn-control disabled" data-toggle="modal" data-target="#section" 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>
                         <% } %>
@@ -353,6 +354,7 @@
     <script src="/public/web/commonAlert.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>
     <!-- zTree -->
     <script type="text/javascript" src="/public/web/date_util.js"></script>
   	<script type="text/javascript" src="/lib/ztree/jquery.ztree.core.js"></script>

+ 0 - 0
web/maintain/report/html/rpt_tpl_main.html


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů