Browse Source

补充人材机分类结构相关调整

zhongzewei 6 years ago
parent
commit
7db2c82e69

+ 1 - 1
modules/all_models/compleGlj_glj.js

@@ -24,7 +24,7 @@ const comple_glj = new Schema({
     specs: String,
     unit: String,
     basePrice: String,
-    gljClass: Number,
+    gljClass: String,
     gljType: Number,
     model: Number,
     shortName: String,

+ 11 - 0
modules/complementary_glj_lib/controllers/gljController.js

@@ -61,6 +61,17 @@ class GljController extends BaseController{
             callback(req,res,err, 'Get Tree', data)
         });
     }
+    //获取标准分类树和补充分类树
+    async getMixedTree(req, res){
+        try {
+            let data = JSON.parse(req.body.data);
+            let treeData = await gljDao.getMixedTree(data.gljLibId, req.session.sessionUser.id, req.session.sessionCompilation._id);
+            callback(req, res, 0, 'success', treeData);
+        } catch (err) {
+            console.log(err);
+            callback(req, res, 1, err, null);
+        }
+    }
 
     createNewGljTypeNode(req, res) {
         let repId = req.body.repositoryId;

+ 9 - 1
modules/complementary_glj_lib/models/gljModel.js

@@ -5,13 +5,14 @@ const mongoose = require('mongoose');
 const complementaryGljModel = mongoose.model('complementary_glj_lib');
 const stdGljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
+const compleClassModel = mongoose.model('complementary_glj_section');
 import counter from "../../../public/counter/counter";
 import async from "async";
 import STDGLJLibGLJListModel from "../../common/std/std_glj_lib_glj_list_model";
 
 class GljDao {
     getGljTypes (gljLibId, callback){
-        gljClassModel.find({"repositoryId": gljLibId, "$or": [{"isDeleted": null}, {"isDeleted": false} ]},function(err,data){
+        gljClassModel.find({"repositoryId": gljLibId},function(err,data){
             if(data.length) {
                 callback(0,data);
             }
@@ -335,6 +336,13 @@ class GljDao {
 
         return result;
     }
+
+    async getMixedTree(gljLibId, userId, compilationId){
+        let rst = {std: [], comple: []};
+        rst.std = await gljClassModel.find({repositoryId: gljLibId});
+        rst.comple = await compleClassModel.find({userId: userId, compilationId: compilationId});
+        return rst;
+    }
 }
 
 export default GljDao;

+ 1 - 0
modules/complementary_glj_lib/routes/routes.js

@@ -26,6 +26,7 @@ module.exports = function (app) {
     router.post("/updateRationBasePrc",compleRationController.init, compleRationController.updateRationBasePrc);//更新定额单价
     //router.post("/getGljItemsByIds", gljController.init, gljController.getGljItemsByIds);
     //router.post("/getGljItemsByCodes", gljController.init, gljController.getGljItemsByCodes);
+    router.post('/getMixedTree', gljController.init, gljController.getMixedTree);
 
     app.use("/complementartGlj/api", router);
 

+ 11 - 12
modules/ration_glj/facade/ration_glj_facade.js

@@ -27,6 +27,7 @@ const complementaryGljModel = mongoose.model('complementary_glj_lib');
 const stdGljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
 const projectDao = require('../../pm/models/project_model').project;
+const compleClassModel = mongoose.model('complementary_glj_section');
 
 module.exports = {
     save: save,
@@ -544,15 +545,13 @@ function getGLJData(info, callback) {
     let gljDistTypeCache = stdgljutil.getStdGljTypeCacheObj().toArray();
     datas.distTypeTree = gljDistTypeCache;
     async_n.parallel([
-        function (cb) {
-            gljDao.getGljTypes(info.gljLibId, function (err, data) {
-                if (err) {
-                    cb(err);
-                } else {
-                    datas.treeData = data;
-                    cb(null);
-                }
-            })
+        async function (cb) {
+            try {
+                datas.treeData = await gljDao.getMixedTree(info.gljLibId, info.userID, info.compilationId);
+                cb(null);
+            } catch (err) {
+                cb(err);
+            }
         },
         function (cb) {
             gljDao.getGljItems(info.gljLibId, info.userID, info.compilationId, function (err, data) {
@@ -804,9 +803,9 @@ async function getGLJClass(info, data) {
         return result
     }
     //查找工料机类型树
-    let items = await gljClassModel.find({
-        "repositoryId": info.gljLibId,
-        "$or": [{"isDeleted": null}, {"isDeleted": false}]
+    let items = await compleClassModel.find({
+        userId: info.userID,
+        compilationId: info.compilationId
     });
     result.items = items;
     return result;

+ 2 - 2
web/building_saas/complementary_glj_lib/html/tools-gongliaoji.html

@@ -67,7 +67,7 @@
                 </div>
                 <div class="modal-body" style="padding-left: 0; padding-right: 3px; margin-left: 0;">
                         <div style="width: 36%; float: left;">
-                            <input type="radio" class="glj-radio" name="glj" value="allGljs">所有&nbsp;&nbsp;
+                            <!--<input type="radio" class="glj-radio" name="glj" value="allGljs">所有&nbsp;-->&nbsp;
                             <input type="radio" class="glj-radio" name="glj" value="stdGljs">标准&nbsp;&nbsp;
                             <input type="radio" class="glj-radio" name="glj" value="complementaryGljs">补充&nbsp;&nbsp;
                             <div  class="modal-auto-height" id="componentTreeDiv" style="overflow: hidden">
@@ -98,8 +98,8 @@
                         </div>
                 </div>
                 <div class="modal-footer">
-                    <button type="button" id="componentsCacnel" class="btn btn-secondary" data-dismiss="modal">取消</button>
                     <a href="javascript:void(0);" id="componentsConf" class="btn btn-primary">确定</a>
+                    <button type="button" id="componentsCacnel" class="btn btn-secondary" data-dismiss="modal">取消</button>
                 </div>
             </div>
         </div>

+ 34 - 10
web/building_saas/complementary_glj_lib/js/components.js

@@ -7,6 +7,7 @@
 let componentOprObj = {
     treeObj:null,
     rootNode: null,//分类树根节点
+    parentNodeIds: {},
     radiosSelected: null,//allGljs, stdGljs, complementaryGljs
     workBook: null,
     selectedList: [],//选中的组成物
@@ -98,6 +99,24 @@ let componentOprObj = {
                 }
             }
     },
+    //初始化分类树
+    //@param {String}type(标准或补充) {Array}treeData(树数据)
+    initClassTree: function (type, treeData) {
+        let me = this;
+        if (me.treeObj) {
+            me.treeObj.destroy();
+            me.parentNodeIds = {};
+        }
+        zTreeHelper.createTree(treeData, componentSetting, "componentTree", componentOprObj);
+        let rootNode = componentOprObj.treeObj.getNodes()[0];
+        if(rootNode && rootNode.isParent && rootNode.isFirstNode){
+            componentOprObj.rootNode = rootNode;
+        }
+        if(me.rootNode){
+            me.treeObj.selectNode(me.rootNode);
+            componentTypeTreeOprObj.onClick(null, 'componentTree', me.rootNode);
+        }
+    },
     //初始默认radio
     initRadio: function () {
         let that = repositoryGljObj, me = componentOprObj;
@@ -108,13 +127,13 @@ let componentOprObj = {
         if(typeof $("input[name='glj']:checked")[0] !== 'undefined'){
             $("input[name='glj']:checked")[0].checked = false;
         }
-        $("input[value = 'allGljs']")[0].checked = true;
-        me.radiosSelected = 'allGljs';
+        $("input[value = 'stdGljs']")[0].checked = true;
+        me.radiosSelected = 'stdGljs';
         //初始为所有工料机,机械类型可添加机械组成物,混凝土,砂浆、配合比可添加普通材料
         me.showGljList = [];
-        if(me.radiosSelected === 'allGljs'){
+        if(me.radiosSelected === 'stdGljs'){
             me.setShowGljList(that.stdGljList, true);
-            me.setShowGljList(that.complementaryGljList, true);
+            //me.setShowGljList(that.complementaryGljList, true);
             that.sortGlj(me.showGljList);
         }
     },
@@ -147,8 +166,8 @@ let componentOprObj = {
         me.showGljItems(me.showGljList, me.gljCurTypeId);
         //切换radio后更新cache
         if (me.currentOprParent = 1) {
-            if(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
-                me.currentCache = me.getParentCache(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]);
+            if(me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
+                me.currentCache = me.getParentCache(me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]);
             }
             else{
                 me.currentCache = [];
@@ -159,8 +178,13 @@ let componentOprObj = {
     },
     //监听radios选择事件
     radiosChange: function () {
-        let me = componentOprObj, re = repositoryGljObj;
+        let me = componentOprObj, gc = gljClassTreeObj;
         $('.glj-radio').change(function () {
+            if($(this).val() === 'stdGljs') {
+                me.initClassTree('std', gc.treeData.std);
+            } else {
+                me.initClassTree('comple', gc.treeData.comple);
+            }
             me.filterDatasAndShow();
         });
     },
@@ -192,7 +216,7 @@ let componentOprObj = {
         let me = componentOprObj, re = repositoryGljObj;
         if (me.workBook) {
             let cacheSection = [];
-            let pArr = re.parentNodeIds["_pNodeId_" + type];
+            let pArr = me.parentNodeIds["_pNodeId_" + type];
             for (let i = 0; i < data.length; i++) {
                 if (pArr && pArr.indexOf(data[i].gljClass) >= 0) {
                     cacheSection.push(data[i]);
@@ -248,9 +272,9 @@ let componentTypeTreeOprObj = {
         let me = componentOprObj, re = repositoryGljObj, that = gljComponentOprObj, gljTypeId = treeNode.ID;
         if(me.gljCurTypeId !== treeNode.ID){
             me.gljCurTypeId = treeNode.ID;
-            if (re.parentNodeIds["_pNodeId_" + treeNode.ID]) {
+            if (me.parentNodeIds["_pNodeId_" + treeNode.ID]) {
                 me.currentOprParent = 1;
-                me.currentCache = me.getParentCache(re.parentNodeIds["_pNodeId_" + treeNode.ID]);
+                me.currentCache = me.getParentCache(me.parentNodeIds["_pNodeId_" + treeNode.ID]);
             } else {
                 me.currentCache = me.getCache();
             }

+ 34 - 19
web/building_saas/complementary_glj_lib/js/glj.js

@@ -4,17 +4,6 @@
 
 $(document).ready(function () {
     let moduleName = 'compleGLj';
-    function refreshALlWorkBook() {
-        if (gljClassTreeObj.workBook) {
-            gljClassTreeObj.workBook.refresh();
-        }
-        if (repositoryGljObj.workBook) {
-            repositoryGljObj.workBook.refresh();
-        }
-        if (gljComponentOprObj.workBook) {
-            gljComponentOprObj.workBook.refresh();
-        }
-    }
     SlideResize.loadHorizonWidth(moduleName, [$('#rightResize'), $('#leftResize')], [$('#leftContent'), $('#midContent'), $('#rightContent')], function () {
         refreshALlWorkBook();
     });
@@ -39,7 +28,17 @@ $(document).ready(function () {
         refreshALlWorkBook();
     });
 });
-
+function refreshALlWorkBook() {
+    if (gljClassTreeObj.workBook) {
+        gljClassTreeObj.workBook.refresh();
+    }
+    if (repositoryGljObj.workBook) {
+        repositoryGljObj.workBook.refresh();
+    }
+    if (gljComponentOprObj.workBook) {
+        gljComponentOprObj.workBook.refresh();
+    }
+}
 let pageOprObj = {
     gljLibName : null,
     stdGljLibId: null,
@@ -175,6 +174,7 @@ let repositoryGljObj = {
         });
     },
     getGljItems: function(stdGljLibId, callback) {
+        console.log('enterGG');
         let me = this;
         CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
@@ -192,12 +192,6 @@ let repositoryGljObj = {
             if(callback){
                 callback();
             }
-         /*   let rootNode = me.treeObj.getNodes()[0];
-            if(rootNode && rootNode.isParent && rootNode.isFirstNode){
-                componentOprObj.rootNode = rootNode;
-                me.treeObj.selectNode(rootNode);
-                gljTypeTreeOprObj.onClick(null, 'repositoryTree', rootNode);
-            }*/
         });
     },
     showGljItems: function(data, type) {
@@ -397,7 +391,7 @@ let repositoryGljObj = {
         }
     },
     initSel: function (row) {
-        let me = repositoryGljObj, that = gljComponentOprObj;
+        let me = repositoryGljObj, that = gljComponentOprObj, componentCanEdit = false;
         sheetOpr.cleanData(that.workBook.getSheet(0), that.setting, -1);
         me.workBook.focus(true);
         me.currentComponent = [];
@@ -406,6 +400,7 @@ let repositoryGljObj = {
             //标记当前工料机
             me.currentGlj = me.currentCache[row];
             if(allowComponent.includes(me.currentCache[row].gljType)){
+                componentCanEdit = true;
                 //展示数据
                 if(me.currentGlj.component.length > 0){
                     me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
@@ -418,6 +413,26 @@ let repositoryGljObj = {
         else{
             me.currentGlj = null;
         }
+
+        //组成物表能编辑则显示,否则隐藏该工作表
+        let rightWidth = getLocalCache('compleGLjrightContentWidth') || '25%';
+        rightWidth = rightWidth.replace('%', '');
+        let curMidWidth = $('#midContent')[0].style.width.replace('%', ''),
+            curRightWidth = $('#rightContent')[0].style.width.replace('%', '');
+        if (componentCanEdit && curRightWidth === '0') {
+            curMidWidth = parseFloat(curMidWidth) - parseFloat(rightWidth);
+            $('#midContent').css('width', `${curMidWidth}%`);
+            $('#rightContent').css('width', `${rightWidth}%`);
+        } else if(!componentCanEdit && curRightWidth !== '0') {
+            curMidWidth = parseFloat(curMidWidth) + parseFloat(rightWidth);
+            $('#midContent').css('width', `${curMidWidth}%`);
+            $('#rightContent').css('width', `0%`);
+        }
+        //减少触发
+        if (me.preComponentCanEdit !== componentCanEdit) {
+            refreshALlWorkBook();
+        }
+        me.preComponentCanEdit = componentCanEdit;
     },
     onEnterCell: function (sender, args) {
         let me = repositoryGljObj;

+ 11 - 6
web/building_saas/complementary_glj_lib/js/gljClassTree.js

@@ -2,6 +2,7 @@
  * Created by Zhong on 2018/1/16.
  */
 let gljClassTreeObj = {
+    treeData: null,
     cache: null,//ref to tree.items
     tree: null,
     controller: null,
@@ -110,22 +111,25 @@ let gljClassTreeObj = {
     },
 
     getGljClassTree: function (gljLibId, callback) {
+        console.log('enter1');
         let me = gljClassTreeObj;
         let re = repositoryGljObj;
-        let url = 'complementartGlj/api/getGljTree';
+        let url = '/complementartGlj/api/getMixedTree';
         let postData = {gljLibId: gljLibId};
         let sucFunc = function (rstData) {
-            zTreeHelper.createTree(rstData, componentSetting, "componentTree", componentOprObj);
+            me.treeData = rstData;
+            let compleTreeData = me.treeData.comple;
+            /*zTreeHelper.createTree(rstData.std, componentSetting, "componentTree", componentOprObj);
             let rootNode = componentOprObj.treeObj.getNodes()[0];
             if(rootNode && rootNode.isParent && rootNode.isFirstNode){
                 componentOprObj.rootNode = rootNode;
-            }
-            if (rstData && rstData.length > 0) {
-                me.gljCurTypeId = rstData[0].ID;
+            }*/
+            if (compleTreeData && compleTreeData.length > 0) {
+                me.gljCurTypeId = compleTreeData[0].ID;
             }
             //init
             me.buildSheet();
-            me.initTree(rstData);
+            me.initTree(compleTreeData);
             me.cache = me.tree.items;
             re.updateParentNodeIds(me.cache, re);
             me.initController(me.tree, me.sheet, me.setting.sheet);
@@ -177,6 +181,7 @@ let gljClassTreeObj = {
             re.currentCache = re.getCache();
         }
         re.showGljItems(re.complementaryGljList, gljTypeId);
+        re.initSel(re.workBook.getSheet(0).getActiveRowIndex());
         me.workBook.focus(true);
     }
 }

+ 13 - 6
web/building_saas/complementary_glj_lib/js/gljComponent.js

@@ -18,9 +18,19 @@ let gljComponentOprObj = {
             lockedCols:[0, 1, 2, 3]
         }
     },
+    buildHeader: function (sheet, header) {
+        sheet.setRowCount(2, GC.Spread.Sheets.SheetArea.colHeader);
+        for (let i = 0; i < header.length; i++) {
+            sheet.setValue(1, i, header[i].headerName, GC.Spread.Sheets.SheetArea.colHeader);
+            sheet.setColumnWidth(i, header[i].headerWidth? header[i].headerWidth:100);
+        }
+        sheet.setValue(0, 0, '组成物信息', GC.Spread.Sheets.SheetArea.colHeader);
+        sheet.addSpan(0, 0, 1, header.length, GC.Spread.Sheets.SheetArea.colHeader);
+    },
     buildSheet: function(container) {
         let me = gljComponentOprObj;
-        me.workBook = sheetOpr.buildSheet(container, me.setting, 30);
+        me.workBook = sheetOpr.buildSheet(container, me.setting, 30, false);
+        me.buildHeader(me.workBook.getSheet(0), me.setting.header);
         sheetCommonObj.spreadDefaultStyle(me.workBook);
         me.workBook.getSheet(0).setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
         me.workBook.getSheet(0).setFormatter(-1, 0, "@", GC.Spread.Sheets.SheetArea.viewport);
@@ -85,10 +95,7 @@ let gljComponentOprObj = {
                                 co.initRadio();
                                 co.gljCurTypeId = null;
                                 //默认点击树根节点
-                                if(co.rootNode){
-                                    co.treeObj.selectNode(co.rootNode);
-                                    componentTypeTreeOprObj.onClick(null, 'componentTree', co.rootNode);
-                                }
+                                co.initClassTree('std', gljClassTreeObj.treeData.std);
                                 //弹出窗口
                                 $('#component').modal('show');
                             }},
@@ -433,7 +440,7 @@ let gljComponentOprObj = {
                 if(row + i < that.currentComponent.length){
                     let currentObj = that.currentComponent[row + i];
                     if(items[i].consumeAmt.trim().length > 0 && items[i].consumeAmt !== currentObj.consumeAmt){
-                        let roundCons = scMathUtil.roundTo(parseFloat(items[i].consumeAmt), 3);
+                        let roundCons = scMathUtil.roundTo(parseFloat(items[i].consumeAmt), -3);
                         isChange = true;
                         currentObj.consumeAmt = roundCons;
                         for(let j = 0; j < component.length; j++){

+ 4 - 2
web/building_saas/complementary_glj_lib/js/sheetOpr.js

@@ -34,7 +34,7 @@ let sheetOpr = {
         sheet.resumePaint();
     },
 
-    buildSheet: function(container, setting, rowCount) {
+    buildSheet: function(container, setting, rowCount, buildHeader = true) {
         var me = this;
         var spreadBook = new GC.Spread.Sheets.Workbook(container, { sheetCount: 1 });
         spreadBook.options.tabStripVisible = false;
@@ -60,7 +60,9 @@ let sheetOpr = {
         };
         sheet.showRowOutline(false);
         //setup column header
-        me.buildHeader(sheet, setting);
+        if (buildHeader) {
+            me.buildHeader(sheet, setting);
+        }
         //setup cells
         if (rowCount > 0) sheet.setRowCount(rowCount);
         sheet.resumeEvent();

+ 3 - 2
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -39,7 +39,7 @@ let gljSelOprObj = {
             delete glj.ID;
         }
     },
-    getSelGljItems: function(stdGljLibId, callback) {
+    /*getSelGljItems: function(stdGljLibId, callback) {
         let me = this;
         CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
@@ -61,8 +61,9 @@ let gljSelOprObj = {
                 callback();
             }
         });
-    },
+    },*/
     getGljClassTree: function (gljLibId, callback) {
+        console.log('enter2');
         let me = this;
         let url = '/complementartGlj/api/getGljTree';
         let postData = {gljLibId: gljLibId};

+ 14 - 23
web/building_saas/complementary_ration_lib/js/section_tree.js

@@ -26,29 +26,20 @@ let pageOprObj = {
     gljLibId: gljLibId,
     initPage : function() {
         let me = this;
-       // me.getRationLibInfo(rationLibId, function (rstData) {
-            //if(rstData.length > 0){
-                //me.rationLibName = rstData[0].dispName;
-                //let $rationName = $(`<div id='rationname' class='navbar-text'><a id='rationLibBtn' href='javascript:void(0);'>定额库</a><i class='fa fa-angle-right fa-fw'></i>${me.rationLibName}</div>`);
-                //let $rationName = $(`<div id='rationname' class='navbar-text'>${me.rationLibName}</div>`);
-               // $('.header-logo').after($rationName);
-              //  me.gljLibId = rstData[0].gljLib;
-                sectionTreeObj.getSectionTree();
-                //job
-                jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
-                $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
-                $('#updateConBtn').click(jobContentOprObj.bindUpdateConBtn());
-                jobContentOprObj.bindAllEvents($('#txtareaAll'));
-                //fz
-                annotationOprObj.radiosChange(annotationOprObj.radios, annotationOprObj.fzTableAll, annotationOprObj.fzTablePartial);
-                $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
-                $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
-                annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
-           // }
-            gljSelOprObj.getGljClassTree(gljLibId, function () {
-                    gljSelOprObj.getSelGljItems(gljLibId);
-            });
-       // });
+        sectionTreeObj.getSectionTree();
+        //job
+        jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
+        $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
+        $('#updateConBtn').click(jobContentOprObj.bindUpdateConBtn());
+        jobContentOprObj.bindAllEvents($('#txtareaAll'));
+        //fz
+        annotationOprObj.radiosChange(annotationOprObj.radios, annotationOprObj.fzTableAll, annotationOprObj.fzTablePartial);
+        $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
+        $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
+        annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
+        gljSelOprObj.getGljClassTree(gljLibId, function () {
+            gljSelOprObj.getSelGljItems(gljLibId);
+        });
     },
     getRationLibInfo: function (rationLibId, callback) {
         CommonAjax.post('api/getRationLib', {rationRepId: rationLibId}, callback);

+ 6 - 5
web/building_saas/main/html/main.html

@@ -38,9 +38,7 @@
         let lockBills = '<%- projectData.property.lockBills %>';
         let userAccount = '<%- userAccount %>';
         let userID = '<%- userID %>';
-        console.log('<%- projectReadOnly %>');
         let projectReadOnly = JSON.parse('<%- projectReadOnly %>');
-        console.log(projectReadOnly);
         const G_SHOW_BLOCK_LIB = true;
 //        const G_SHOW_BLOCK_LIB = false;
     </script>
@@ -1070,6 +1068,9 @@
                 </div>
                 <div class="modal-body" style="padding-left: 0; padding-right: 3px; margin-left: 0;">
                         <div style="width: 32%; float: left;">
+                            &nbsp;
+                            <input type="radio" class="glj-radio" name="glj" value="stdGLJ">标准&nbsp;&nbsp;
+                            <input type="radio" class="glj-radio" name="glj" value="complementaryGLJs">补充&nbsp;&nbsp;
                             <div  class="modal-auto-height" id="componentTreeDiv" style=" height: 435px; overflow: hidden;">
                                 <!--<div class="print-list">-->
                                 <div style="width: 100%; height: 100%; overflow: auto">
@@ -1082,9 +1083,9 @@
                             <div id="gljRadios">
                                 <div class="row">
                                     <div class="col-7" style="margin-top: 5px;">
-                                        <input type="radio" class="glj-radio" name="glj" value="allGljs" checked>所有&nbsp;&nbsp;
+                                        <!--<input type="radio" class="glj-radio" name="glj" value="allGljs" checked>所有&nbsp;&nbsp;
                                         <input type="radio" class="glj-radio" name="glj" value="stdGLJ">标准&nbsp;&nbsp;
-                                        <input type="radio" class="glj-radio" name="glj" value="complementaryGLJs">补充&nbsp;&nbsp;
+                                        <input type="radio" class="glj-radio" name="glj" value="complementaryGLJs">补充&nbsp;&nbsp;-->
                                     </div>
                                     <div class="input-group col-5" style="margin-bottom: 5px;">
                                         <input type="text" class="form-control form-control-sm" placeholder="请输入筛选编码或名称" value="" id="gljSearchKeyword">
@@ -1093,7 +1094,7 @@
                                 </div>
                                 <!-- <div class="form-group"><input id="searchGlj" type="text" class="form-control-sm" placeholder="查询工料机"></div>-->
                             </div>
-                            <div class="modal-auto-height" style="overflow: hidden" id="gljLibSheet">
+                            <div class="modal-auto-height" style="overflow: hidden;height: 420px" id="gljLibSheet">
 
                             </div>
                         </div>

+ 32 - 3
web/building_saas/main/js/views/glj_view.js

@@ -69,6 +69,7 @@ var gljOprObj = {
                         me.gljCurTypeId = treeNode.ID;
                         me.filterLibGLJSheetData();
                         me.showLibGLJSheetData();
+                        gljOprObj.initSelection({row: me.gljLibSheet.getActiveRowIndex()});
                     }
                 } else {
                     if (treeNode.isParent) {
@@ -323,6 +324,7 @@ var gljOprObj = {
     initSelection: function (sel) {
         let me = gljOprObj;
         if(sel){
+            sel.row = !sel.row || sel.row == -1 ? 0 : sel.row;
             me.gljLibSheet.setStyle(sel.row, -1, me.getSelStyle(true));
         }
         if(me.preGljLibSelection && me.preGljLibSelection.row !== sel.row){
@@ -1409,6 +1411,26 @@ var gljOprObj = {
         }else {
             gljOprObj.billsTab = gljOprObj.activeTab;
         }
+    },
+    //初始化分类树
+    //@param {String}type(标准或补充) {Array}treeData(树数据)
+    initClassTree: function (type, treeData, initSel = false) {
+        let me = this;
+        if (me.treeObj) {
+            me.treeObj.destroy();
+            me.parentNodeIds = {};
+        }
+        zTreeHelper.createTree(treeData, me.gljTreeSetting, "gljTree", me);
+        if (initSel) {
+            let rootNode = me.treeObj.getNodes()[0];
+            if(rootNode && rootNode.isParent && rootNode.isFirstNode){
+                me.rootNode = rootNode;
+            }
+            if(me.rootNode){
+                me.treeObj.selectNode(me.rootNode);
+                me.gljTreeSetting.callback.onClick(null, 'gljTree', me.rootNode);
+            }
+        }
     }
 }
 
@@ -1476,9 +1498,15 @@ $(function () {
             gljOprObj.filterLibGLJSheetData();
             gljOprObj.showLibGLJSheetData();
         } else {
-            gljOprObj.gljLibSheetData = gljOprObj[val];
-            gljOprObj.filterLibGLJSheetData();
-            gljOprObj.showLibGLJSheetData();
+            if(val === 'stdGLJ') {
+                gljOprObj.initClassTree('std', gljOprObj.treeData.std, true);
+            } else {
+                gljOprObj.initClassTree('comple', gljOprObj.treeData.comple, true);
+            }
+            gljOprObj.initSelection({row: 0});
+            //gljOprObj.gljLibSheetData = gljOprObj[val];
+            /*gljOprObj.filterLibGLJSheetData();
+            gljOprObj.showLibGLJSheetData();*/
         }
     });
 /*    //工料机搜索
@@ -1496,6 +1524,7 @@ $(function () {
     $('#gljSearchKeyword').bind('keyup', function (e) {
         gljOprObj.filterLibGLJSheetData();
         gljOprObj.showLibGLJSheetData();
+        gljOprObj.initSelection({row: 0});
     });
 
     $('#glj_selected_conf').click(function () {

+ 4 - 1
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -378,7 +378,9 @@ function getGLJData(actionType) {
     $.bootstrapLoading.start();
     projectObj.project.ration_glj.getGLJData(function (result) {
         console.log(+new Date());
-        zTreeHelper.createTree(result.datas.treeData, gljOprObj.gljTreeSetting, "gljTree", gljOprObj);
+        gljOprObj.treeData =  result.datas.treeData;
+        //zTreeHelper.createTree(result.datas.treeData, gljOprObj.gljTreeSetting, "gljTree", gljOprObj);
+        gljOprObj.initClassTree('std', gljOprObj.treeData.std);
         gljOprObj.stdGLJ=result.datas.stdGLJ;
         gljOprObj.complementaryGLJs=result.datas.complementaryGLJs;
         for(let compleGlj of gljOprObj.complementaryGLJs){
@@ -386,6 +388,7 @@ function getGLJData(actionType) {
             compleGlj.isComplementary = true;
         }
         gljOprObj.AllRecode=gljOprObj.stdGLJ.concat(gljOprObj.complementaryGLJs);
+        //gljOprObj.AllRecode=gljOprObj.stdGLJ;
         gljOprObj.distTypeTree=gljOprObj.getComboData(result.datas.distTypeTree);
         $('#modalCon').width($(window).width()*0.5);
         $("input[name='glj']").get(0).checked=true;

+ 4 - 1
web/building_saas/main/js/views/project_info.js

@@ -18,7 +18,10 @@ var projectInfoObj = {
                 <span data-toggle="tooltip" data-placement="bottom" data-original-title="${engName}"><i class="fa fa-cube"></i>...</span>
                 <span class="text-muted px-1">\</span>
                  <span><i class="fa fa-sticky-note-o"></i></span>
-                <span class="text-truncate"  data-toggle="tooltip" data-placement="bottom" data-original-title="${proj.name}">&nbsp;${proj.name}</span>`;
+                <span class="text-truncate"  data-toggle="tooltip" data-placement="bottom" data-original-title="${proj.name}">&nbsp;${proj.name}</span>
+                ${projectReadOnly ? '' +
+                '<span data-toggle="tooltip" data-placement="bottom" data-original-title="当前的工程状态为“只读”,如果要进行编辑,请在项目管理-分享界面,使用“拷贝工程”功能。">(只读)</span>' 
+                : ''}`;
             fullPath.push(newHtml);
 
         }

+ 54 - 3
web/building_saas/main/js/views/project_view.js

@@ -904,6 +904,7 @@ var projectObj = {
                 // that.project.initCalcFields();
                 let str = JSON.stringify(that.project.projSetting.main_tree_col);
                 that.project.projSetting.mainGridSetting = JSON.parse(str);
+                console.log(that.project.projSetting.mainGridSetting);
                 that.project.projSetting.mainGridSetting.frozenCols = 4;
                 TREE_SHEET_HELPER.initSetting($('#billsSpread')[0], that.project.projSetting.mainGridSetting);
                 that.project.projSetting.mainGridSetting.setAutoFitRow = MainTreeCol.getEvent("setAutoFitRow");
@@ -977,9 +978,9 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, that.onColumnWidthChanged);
                 that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardPasting, that.onClipboardPasting);
                 //let loadOtherStartTime = +new Date();
-                if(!projectReadOnly){
+                //if(!projectReadOnly){
                     that.loadMainSpreadContextMenu();
-                }
+                //}
                 socketObject.connect();//连接socket服务器
                 let endTime = +new Date();
                 console.log(`其它时间——${endTime - endShowTime}`);
@@ -1169,7 +1170,7 @@ var projectObj = {
                     name: "插入大项费用",
                     icon: 'fa-sign-in',
                     disabled: function () {
-                        return projectObj.project.isBillsLocked() && project.withinBillsLocked(project.mainTree.selected);
+                        return projectReadOnly || (projectObj.project.isBillsLocked() && project.withinBillsLocked(project.mainTree.selected));
                         //return project.mainTree.selected ? project.mainTree.selected.sourceType !== project.Bills.getSourceType() : false;
                     },
                     callback: function (key, opt) {
@@ -1183,6 +1184,9 @@ var projectObj = {
                     name: "插入分部",
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         let selected = project.mainTree.selected;
                         if(projectObj.project.isBillsLocked()== false&&selected&&selected.sourceType==project.Bills.getSourceType()){
                             if(selected.data.type==billType.FB){
@@ -1214,6 +1218,9 @@ var projectObj = {
                     name: "插入分项",
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         let selected = project.mainTree.selected;
                         if(projectObj.project.isBillsLocked()== false&& selected&&selected.sourceType==project.Bills.getSourceType()){
                             if(selected.data.type==billType.FX||selected.data.type==billType.BX){//焦点行是分项,有效显示
@@ -1252,6 +1259,9 @@ var projectObj = {
                     name: "插入清单",
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         let selected = project.mainTree.selected;
                         if(!(projectObj.project.isBillsLocked()== true && project.withinBillsLocked(selected)) && selected && selected.sourceType === project.Bills.getSourceType()){
                             return false
@@ -1281,6 +1291,9 @@ var projectObj = {
                     name: "插入定额",
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         // var selected = project.mainTree.selected;
                         // return project.Ration.addRationChecking(selected);  // Vincent, 2018-01-02
                         // 工具栏要加按钮,且不能隐藏。菜单可以隐藏,两者又必须统一,所以启用新规则。怕以后又要改回来,所以保留。 CSL, 2018-01-02
@@ -1299,6 +1312,9 @@ var projectObj = {
                     name: "插入量价",//插入量价不需要自动定位到编号列
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         // var selected = project.mainTree.selected;
                         // return project.Ration.addRationChecking(selected);  // Vincent, 2018-01-02
                         return !project.Ration.canAdd(project.mainTree.selected);
@@ -1351,6 +1367,9 @@ var projectObj = {
                     name: "插入人材机",
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         // var selected = project.mainTree.selected;
                         // return project.Ration.addRationChecking(selected);  // Vincent, 2018-01-02
                         return !project.Ration.canAdd(project.mainTree.selected);
@@ -1376,6 +1395,9 @@ var projectObj = {
                     name: "计取安装费用",
                     icon: 'fa-sign-in',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         return false;
                     },
                     callback: function (key, opt) {
@@ -1389,6 +1411,9 @@ var projectObj = {
                     name: '删除',
                     icon: 'fa-remove',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         return !ifCanDelete();
                     },
                     callback: function () {
@@ -1406,6 +1431,11 @@ var projectObj = {
                     callback: function () {
                         project.calcProgram.calcAllNodesAndSave();
                     },
+                    disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
+                    },
                     visible:function(key, opt){//2018-11-15 新需求隐藏右键“造价计算”。
                         return false;
                     }
@@ -1415,6 +1445,9 @@ var projectObj = {
                     name: '复制整块',
                     icon: 'fa-copy',
                     disabled: function () {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         let selection = projectObj.mainSpread.getActiveSheet().getSelections()[0];
                         let firstNode = projectObj.project.mainTree.items[selection.row];//当多选的情况,用mainTree.selected判断不正确,要用第一个选中的节点
                         for(let i = 0;i< selection.rowCount;i++){ //多选的时候判断所有与第一个节点同级的节点
@@ -1442,6 +1475,9 @@ var projectObj = {
                     name: '粘贴整块',
                     icon: 'fa-paste',
                     disabled: function (){
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         return BlockController.pasteBtnDisable(project.mainTree.selected);
                     },
                     callback: function () {
@@ -1451,6 +1487,9 @@ var projectObj = {
                 "editEngineer": {
                     name: '编辑工程内容',
                     icon: 'fa-edit',
+                    disabled: function () {
+                        return projectReadOnly;
+                    },
                     visible: function(key, opt){
                          let  selected = project.mainTree.selected;
                          return selected.sourceType==ModuleNames.bills&&project.Bills.isEngineerEst(selected);//当焦点行是“专业工程暂估价”时,右键可见并有效。
@@ -1465,6 +1504,9 @@ var projectObj = {
                 "editService": {
                     name: '编辑服务内容',
                     icon: 'fa-edit',
+                    disabled: function () {
+                        return projectReadOnly;
+                    },
                     visible: function(key, opt){
                         let  selected = project.mainTree.selected;
                         return selected.sourceType==ModuleNames.bills&&project.Bills.isTotalService(selected);//当焦点行是“总承包服务费”时,右键可见并有效。
@@ -1479,6 +1521,9 @@ var projectObj = {
                 "editAccording": {
                     name: '编辑签证及索赔依据',
                     icon: 'fa-edit',
+                    disabled: function () {
+                        return projectReadOnly;
+                    },
                     visible: function(key, opt){
                         let  selected = project.mainTree.selected;
                         return selected.sourceType==ModuleNames.bills&&project.Bills.isClaimVisa(selected);//当焦点行是“签证及索赔计价”时,右键可见并有效。
@@ -1494,6 +1539,9 @@ var projectObj = {
                     name:'智能材料替换',
                     icon: 'fa-edit',
                     disabled:function (key,opt) {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         let  selected = project.mainTree.selected;
                         return selected.sourceType==ModuleNames.bills ?!(project.Bills.isFXorBX(selected)||selected.source.children.length ==0):true//是分项、补项或叶子清单才有效;
                     },
@@ -1508,6 +1556,9 @@ var projectObj = {
                     name:'生成组价模板',
                     icon: 'fa-puzzle-piece',
                     disabled:function (key,opt) {
+                        if (projectReadOnly) {
+                            return true;
+                        }
                         let selected = project.mainTree.selected;
                         return selected.sourceType != ModuleNames.bills;
                     },

+ 0 - 26
web/building_saas/pm/js/pm_newMain.js

@@ -1780,32 +1780,6 @@ function init() {
             $.bootstrapLoading.end();
         })
     }
-    //return;
-    //$.bootstrapLoading.start();
-    /*GetAllProjectData(function (datas) {
-        //设置工程专业
-        for (let data of datas) {
-            if (data.projType === projectType.tender) {
-                data.feeStandardName = data.property.feeStandardName || '';
-            }
-        }
-        CommonAjax.post('/options/getOptions', [], function (rstData) {
-            projTreeObj.setting.style.selectedColor = rstData.COLOROPTS.SELECTED.backColor;
-            projTreeObj.tree = pmTree.createNew(projTreeObj.setting, datas);
-            projTreeObj.tree.selected = projTreeObj.tree.items[0];
-            projTreeObj.workBook = projTreeObj.buildSheet(projTreeObj.workBook,'projSpread',projTreeObj.setting);
-            projTreeObj.workBook.getSheet(0).frozenColumnCount(2);
-            sheetCommonObj.spreadDefaultStyle(projTreeObj.workBook);
-            projTreeObj.sumEngineeringCost();
-            projTreeObj.showTreeData(projTreeObj.tree.items, projTreeObj.setting.header, projTreeObj.workBook.getActiveSheet());
-            //初始选择
-            let initSel = projTreeObj.workBook.getSheet(0).getSelections()[0] ? projTreeObj.workBook.getSheet(0).getSelections()[0] : {row: 0, rowCount: 1};
-            projTreeObj.initSelection(initSel,null,projTreeObj.workBook.getActiveSheet());
-            $.bootstrapLoading.end();
-            autoFlashHeight();
-            projTreeObj.workBook.refresh();
-        });
-    });*/
     engineering = engineeringList !== null && engineeringList !== undefined ? JSON.parse(engineeringList) : [];
 }