Browse Source

合并补充定额库初始化数据请求相关

zhongzewei 6 years ago
parent
commit
c1cb9829b7

+ 2 - 1
config/gulpConfig.js

@@ -228,7 +228,8 @@ module.exports = {
         'web/building_saas/complementary_ration_lib/js/ration_assist.js',
         'web/building_saas/complementary_ration_lib/js/ration_installation.js.js',
         'public/web/slideResize.js',
-        'web/building_saas/complementary_ration_lib/js/coe.js'
+        'web/building_saas/complementary_ration_lib/js/coe.js',
+        'web/building_saas/complementary_ration_lib/js/init.js'
     ],
     compleRation_glj_css: [
     ],

+ 12 - 2
modules/complementary_glj_lib/models/gljModel.js

@@ -40,6 +40,16 @@ class GljDao {
             }
         }
     }
+
+    async getGLJDataSync (gljLibId, userId, compilationId) {
+        const stdGljs = await stdGljModel.find({repositoryId: gljLibId}).lean();
+        const complementaryGljs = await complementaryGljModel.find({userId, compilationId}).lean();
+        return {
+            stdGljs,
+            complementaryGljs
+        }
+    }
+
     //获得用户的补充工料机和用户当前所在编办的标准工料机
     async getGljItems (stdGljLibId, userId, compilationId, projection, callback){
         let me = this;
@@ -303,8 +313,8 @@ class GljDao {
 
     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});
+        rst.std = await gljClassModel.find({repositoryId: gljLibId}).lean();
+        rst.comple = await compleClassModel.find({userId: userId, compilationId: compilationId}).lean();
         return rst;
     }
 }

+ 14 - 1
modules/complementary_ration_lib/controllers/compleViewController.js

@@ -6,8 +6,9 @@ import BaseController from '../../common/base/base_controller';
 import CompleViewModel from '../models/compleViewModel';
 import EngineeringLibModel from "../../users/models/engineering_lib_model";
 let config = require("../../../config/config.js");
-
 let compleViewModel = new CompleViewModel();
+import CompleRationDao from '../models/compleRationModel';
+const compleRationDao = new CompleRationDao();
 let callback = function (req, res, err, msg, data) {
     res.json({error: err, message: msg, data: data});
 };
@@ -53,6 +54,18 @@ class CompleViewController extends BaseController{
         });
     }
 
+    async prepareInitData (req, res) {
+        try {
+            const gljLibId = await getGljLibId(req.session.sessionCompilation);
+            const userId = req.session.sessionUser.id;
+            const compilationId = req.session.sessionCompilation._id;
+            const initData = await compleRationDao.prepareInitData(userId, compilationId, gljLibId);
+            res.json({error: 0, message: 'success', data: initData});
+        } catch (err) {
+            res.json({error: 1, message: 'fail', data: null});
+        }
+    }
+
     async redirectGljList(req, res){
         const gljLibId = await getGljLibId(req.session.sessionCompilation);
         const redirectRation = `/complementaryRation/ration`;

+ 27 - 17
modules/complementary_ration_lib/models/compleRationModel.js

@@ -8,8 +8,14 @@ const installSectionModel = mongoose.model("std_ration_lib_installationSection")
 const installFeeItemModel = mongoose.model("std_ration_lib_installation");
 const complementaryGljModel = mongoose.model('complementary_glj_lib');
 const stdGljModel = mongoose.model('std_glj_lib_gljList');
+const stdgljutil = require('../../../public/cache/std_glj_type_util');
+const installFacade = require('../facades/compleInstallFacade');
 import async from 'async';
 let stdRationModel = require ('../../ration_repository/models/ration_item').Model;
+import SectionTreeDao from '../models/sectionTreeModel';
+const sectionTreeDao = new SectionTreeDao();
+import GljDao from "../../complementary_glj_lib/models/gljModel";
+const gljDao = new GljDao();
 let counter = require('../../../public/counter/counter');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 
@@ -475,23 +481,27 @@ class CompleRatoinDao {
         });
     }
 
-    async getInstallation(rationRepId, callback){
-        try {
-            let feeItems = await installFeeItemModel.find({rationRepId: rationRepId, $or: [{deleted: false}, {deleted: null}]});
-            for(let feeItem of feeItems){
-                let sids = [];
-                for(let sec of feeItem.section){
-                    sids.push(sec.ID);
-                }
-                if(sids.length > 0){
-                    let sections = await installSectionModel.find({ID: {$in: sids}, $or: [{deleted: false}, {deleted: null}]});
-                    feeItem._doc.section = sections;
-                }
-            }
-            callback(0, feeItems);
-        }
-        catch(err){
-            callback(err, null);
+    async getCodes (userId, compilationId) {
+        const compleRations = await compleRationModel.find({userId, compilationId}, '-_id code').lean();
+        const codes = [];
+        compleRations.forEach(item => codes.push(item.code));
+        return codes;
+    }
+
+    async prepareInitData (userId, compilationId, gljLibId) {
+        const rationsCodes = await this.getCodes(userId, compilationId);
+        const gljDistTypeCache = stdgljutil.getStdGljTypeCacheObj().toArray();
+        const installationData = await installFacade.getInstallation(userId, compilationId);
+        const rationTreeData = await sectionTreeDao.getComplementaryTree(userId, compilationId);
+        const mixedTreeData = await gljDao.getMixedTree(gljLibId, userId, compilationId);
+        const mixedGLJData = await gljDao.getGLJDataSync(gljLibId, userId, compilationId);
+        return {
+            rationsCodes,
+            gljDistTypeCache,
+            installationData,
+            rationTreeData,
+            mixedTreeData,
+            mixedGLJData
         }
     }
 }

+ 6 - 0
modules/complementary_ration_lib/models/sectionTreeModel.js

@@ -48,6 +48,12 @@ class SectionTreeDao {
         });
 
     }
+
+    async getComplementaryTree (userId, compilationId) {
+        const treeData = await compleRationSectionTreeModel.find({userId, compilationId}).lean();
+        return treeData;
+    }
+
     async getRationTree(userId, compilationId, rationRepId, type, callback) {
         //区分要获取的是标准的数据还是补充的数据
         const rationLibType = {

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

@@ -21,6 +21,7 @@ module.exports = function (app) {
     app.get('/complementaryRation/glj', compleViewController.init, compleViewController.redirectGljList);
     app.get('/complementaryRation/coe', compleViewController.init, compleViewController.redirectCoeList);
     app.get('/complementaryRation/installation', compleViewController.init, compleViewController.redirectInstallation);
+    router.get('/initData', compleViewController.init, compleViewController.prepareInitData);
 
     router.post('/getRationLib', compleViewController.init, compleViewController.getRationLib);
     router.post('/getRationLibs', compleViewController.init, compleViewController.getRationLibs);

+ 3 - 61
web/building_saas/complementary_ration_lib/html/dinge.html

@@ -52,7 +52,8 @@
         }
     </style>
     <script>
-        let gljLibId = '<%= gljLibId %>';
+        const gljLibId = '<%= gljLibId %>';
+        const userID = '<%=userID %>';
     </script>
 </head>
 <body>
@@ -630,67 +631,8 @@
 <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/ration_installation.js"></script>
 <script src="/public/web/slideResize.js"></script>
 <script src="/web/building_saas/complementary_ration_lib/js/coe.js"></script>
+<script src="/web/building_saas/complementary_ration_lib/js/init.js"></script>
 <!--endinject-->
-<script type="text/javascript">
-    let userID = '<%=userID %>';
-    $(document).ready(function(){
-        rationOprObj.buildSheet($("#rationItemsSheet")[0]);
-
-        // tabPanel 下有多个Spread时,相互之间不能正确显示。改成一个Spread下多个Sheet。
-        var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 4);
-        rdSpread.options.allowUserDragFill = false;
-        rdSpread.options.allowUserDragDrop = false;
-        sheetCommonObj.spreadDefaultStyle(rdSpread);
-        rationGLJOprObj.buildSheet(rdSpread.getSheet(0));
-
-        rationAssistOprObj.buildSheet(rdSpread.getSheet(1));
-
-        rationCoeOprObj.buildSheet(rdSpread.getSheet(2));
-
-        rationInstObj.buildSheet(rdSpread.getSheet(3));
-        rationInstObj.getInstallation(parseInt(getQueryString("repository")), function () {
-            //rationInstObj.buildSheet(rdSpread.getSheet(3));
-        });
-        let rdSpreadEscSheets = [];
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(0), editStarting: rationGLJOprObj.onEditStarting, editEnded: rationGLJOprObj.onCellEditEnd});
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(1), editStarting: rationAssistOprObj.onEditStarting, editEnded: rationAssistOprObj.onEditEnded});
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(2), editStarting: rationCoeOprObj.onEditStarting, editEnded: rationCoeOprObj.onEditEnded});
-        rdSpreadEscSheets.push({sheet: rdSpread.getSheet(3), editStarting: rationInstObj.onEditStarting, editEnded: rationInstObj.onEditEnded});
-        sheetCommonObj.bindEscKey(rdSpread, rdSpreadEscSheets);
-        pageOprObj.initPage();
-
-        $("#linkGLJ").click(function(){
-            rationGLJOprObj.bindRationGljDelOpr();
-            rdSpread.setActiveSheetIndex(0);
-        });
-
-        $("#linkFZDE").click(function(){
-            rationAssistOprObj.bindRationAssDel();
-            rdSpread.setActiveSheetIndex(1);
-        });
-
-        $("#linkFZTJ").click(function(){
-            rationCoeOprObj.bindRationCoeDel();
-            rdSpread.setActiveSheetIndex(2);
-        });
-
-        $("#linkAZZJ").click(function(){
-            rationInstObj.bindRationInstDel();
-            rdSpread.setActiveSheetIndex(3);
-        });
-        //解决spreadjs sheet初始化没高度宽度
-        $('#modalCon').width($(window).width()*0.5);
-        $('#gljSelTreeDiv').height($(window).height() - 300);
-        $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
-        $("#gljSelSheet").width($('#modalCon').width() * 0.63);
-        $(window).resize(function () {
-            $('#modalCon').width($(window).width()*0.5);
-            $('#gljSelTreeDiv').height($(window).height() - 300);
-            $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
-            $("#gljSelSheet").width($('#modalCon').width()* 0.63);
-        });
-    });
-</script>
 </body>
 <script type="text/javascript">
     autoFlashHeight();

+ 20 - 21
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -39,28 +39,22 @@ let gljSelOprObj = {
             delete glj.ID;
         }
     },
-    getSelGljItems: function(stdGljLibId, callback) {
-        let me = this;
-        CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
-            me.stdGljList = rstData.stdGljs;
-            //兼容多单价,计算补充定额价格时,套多单价人材机的时候,默认取第一个价格
-            for(let sGlj of me.stdGljList){
-                if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined'){
-                    sGlj.basePrice = sGlj.priceProperty.price1;
-                }
-            }
-            me.complementaryGljList = rstData.complementaryGljs;
-            me.switchToGljId(me.stdGljList);
-            me.switchToGljId(me.complementaryGljList);
-            me.setProp('type', 'std', me.stdGljList);
-            me.setProp('type', 'complementary', me.complementaryGljList);
-            me.sortGlj(me.stdGljList);
-            me.sortGlj(me.complementaryGljList);
-            gljAdjOprObj.gljList = me.stdGljList.concat(me.complementaryGljList);
-            if(callback){
-                callback();
+    getSelGljItems: function(gljData) {
+        this.stdGljList = gljData.stdGljs;
+        //兼容多单价,计算补充定额价格时,套多单价人材机的时候,默认取第一个价格
+        for(let sGlj of this.stdGljList){
+            if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined'){
+                sGlj.basePrice = sGlj.priceProperty.price1;
             }
-        });
+        }
+        this.complementaryGljList = gljData.complementaryGljs;
+        this.switchToGljId(this.stdGljList);
+        this.switchToGljId(this.complementaryGljList);
+        this.setProp('type', 'std', this.stdGljList);
+        this.setProp('type', 'complementary', this.complementaryGljList);
+        this.sortGlj(this.stdGljList);
+        this.sortGlj(this.complementaryGljList);
+        gljAdjOprObj.gljList = this.stdGljList.concat(this.complementaryGljList);
     },
     initClassTree: function (type, treeData) {
         let me = this;
@@ -98,6 +92,11 @@ let gljSelOprObj = {
         };
         CommonAjax.post(url, postData, sucFunc, errFunc);
     },
+    getGljClassTree: function (mixedTreeData) {
+        this.treeData = mixedTreeData;
+        this.initClassTree('std', this.treeData.std);
+        gljSelOprObj.buildSheet($('#gljSelSheet')[0]);
+    },
     buildSheet: function (container) {
         let me = gljSelOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);

+ 79 - 0
web/building_saas/complementary_ration_lib/js/init.js

@@ -0,0 +1,79 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2019/9/24
+ * @version
+ */
+const initialization = (() => {
+    $(document).ready(function () {
+        $.bootstrapLoading.start();
+        CommonAjax.get('/complementaryRation/api/initData', {}, res => {
+            if (res.error) {
+                alert('数据初始化失败,请重试。');
+                setTimeout(() => {
+                    window.location.href = '/'
+                }, 1200);
+            } else {
+                const data = res.data;
+                pageOprObj.rationTreeData = data.rationTreeData;
+                pageOprObj.mixedTreeData = data.mixedTreeData;
+                pageOprObj.mixedGLJData = data.mixedGLJData;
+                rationGLJOprObj.distTypeTree = data.gljDistTypeCache;
+                rationOprObj.rationsCodes = data.rationsCodes;
+                rationOprObj.buildSheet($("#rationItemsSheet")[0]);
+                // tabPanel 下有多个Spread时,相互之间不能正确显示。改成一个Spread下多个Sheet。
+                var rdSpread = sheetCommonObj.createSpread($("#rdSpread")[0], 4);
+                rdSpread.options.allowUserDragFill = false;
+                rdSpread.options.allowUserDragDrop = false;
+                sheetCommonObj.spreadDefaultStyle(rdSpread);
+                rationGLJOprObj.buildSheet(rdSpread.getSheet(0));
+                rationAssistOprObj.buildSheet(rdSpread.getSheet(1));
+                rationCoeOprObj.buildSheet(rdSpread.getSheet(2));
+                rationInstObj.buildSheet(rdSpread.getSheet(3));
+                rationInstObj.getInstallation(data.installationData);
+                let rdSpreadEscSheets = [];
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(0), editStarting: rationGLJOprObj.onEditStarting, editEnded: rationGLJOprObj.onCellEditEnd});
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(1), editStarting: rationAssistOprObj.onEditStarting, editEnded: rationAssistOprObj.onEditEnded});
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(2), editStarting: rationCoeOprObj.onEditStarting, editEnded: rationCoeOprObj.onEditEnded});
+                rdSpreadEscSheets.push({sheet: rdSpread.getSheet(3), editStarting: rationInstObj.onEditStarting, editEnded: rationInstObj.onEditEnded});
+                sheetCommonObj.bindEscKey(rdSpread, rdSpreadEscSheets);
+                pageOprObj.initPage();
+
+                $("#linkGLJ").click(function(){
+                    rationGLJOprObj.bindRationGljDelOpr();
+                    rdSpread.setActiveSheetIndex(0);
+                });
+
+                $("#linkFZDE").click(function(){
+                    rationAssistOprObj.bindRationAssDel();
+                    rdSpread.setActiveSheetIndex(1);
+                });
+
+                $("#linkFZTJ").click(function(){
+                    rationCoeOprObj.bindRationCoeDel();
+                    rdSpread.setActiveSheetIndex(2);
+                });
+
+                $("#linkAZZJ").click(function(){
+                    rationInstObj.bindRationInstDel();
+                    rdSpread.setActiveSheetIndex(3);
+                });
+            }
+            $.bootstrapLoading.end();
+        });
+        //解决spreadjs sheet初始化没高度宽度
+        $('#modalCon').width($(window).width()*0.5);
+        $('#gljSelTreeDiv').height($(window).height() - 300);
+        $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
+        $("#gljSelSheet").width($('#modalCon').width() * 0.63);
+        $(window).resize(function () {
+            $('#modalCon').width($(window).width()*0.5);
+            $('#gljSelTreeDiv').height($(window).height() - 300);
+            $("#gljSelSheet").height($("#gljSelTreeDiv").height()-21.6);
+            $("#gljSelSheet").width($('#modalCon').width()* 0.63);
+        });
+    });
+})();

+ 0 - 22
web/building_saas/complementary_ration_lib/js/ration.js

@@ -92,7 +92,6 @@ let rationOprObj = {
         let me = rationOprObj;
         me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
         sheetCommonObj.bindEscKey(me.workBook, [{sheet: me.workBook.getSheet(0), editStarting: me.onCellEditStart, editEnded: me.onCellEditEnd}]);
-        me.getRationsCodes(rationRepId);
         me.onContextmenuOpr();
         me.rationDelOpr();
         me.setCombo(me.workBook.getSheet(0), 'dynamic');
@@ -617,27 +616,6 @@ let rationOprObj = {
         obj.machinePrice = 0;
         obj.basePrice = 0;
     },
-    isValidUnit: function (rationObj, validUnits) {
-        let rst = true;
-        if(typeof rationObj.unit !== 'undefined' && rationObj.unit && validUnits.indexOf(rationObj.unit) === -1){//无效
-            rst = false;
-        }
-        return rst;
-    },
-    getRationsCodes: function (repId) {
-        let me = rationOprObj;
-        $.ajax({
-            type: 'post',
-            url: 'api/getRationsCodes',
-            data: {data: JSON.stringify({repId: repId})},
-            dataType: 'json',
-            success: function (result) {
-                if(!result.error){
-                    me.rationsCodes = result.data;
-                }
-            }
-        })
-    },
     mixUpdateRequest: function(updateArr, addArr, removeIds, callback) {
         let me = rationOprObj;
         me.saveInString(updateArr);

+ 9 - 30
web/building_saas/complementary_ration_lib/js/ration_glj.js

@@ -25,7 +25,6 @@ var rationGLJOprObj = {
         }
     },
     getDistTypeTree: function (gljDistType) {
-        let me = this;
         let distType;
         let distTypeTree = {
             prefix : 'gljDistType',
@@ -61,36 +60,16 @@ var rationGLJOprObj = {
         });
         return distTypeTree;
     },
-    getGljDistType: function (callback) {
-        let me = this;
-        $.ajax({
-            type: 'post',
-            url: "api/getGljDistType",
-            dataType: 'json',
-            success: function (result) {
-                if(!result.error && callback){
-                    me.distTypeTree = me.getDistTypeTree(result.data);
-                    callback();
-                }
-            }
-        })
-    },
     buildSheet: function(sheet) {
-        var me = this;
-        me.sheet = sheet;
-        me.getGljDistType(function () {
-           // gljSelOprObj.getGljClassTree(pageOprObj.gljLibId, function () {
-              //  gljSelOprObj.getSelGljItems(pageOprObj.gljLibId, function () {
-                    sheetCommonObj.initSheet(me.sheet, me.setting, 30);
-                    me.onContextmenuOpr();
-                    me.bindRationGljDelOpr();
-                    me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
-                    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.onCellEditEnd);
-                });
-          //  });
-        //});
+        this.sheet = sheet;
+        this.distTypeTree = this.getDistTypeTree(this.distTypeTree);
+        sheetCommonObj.initSheet(this.sheet, this.setting, 30);
+        this.onContextmenuOpr();
+        this.bindRationGljDelOpr();
+        this.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, this.onClipboardPasting);
+        this.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, this.onClipboardPasted);
+        this.sheet.bind(GC.Spread.Sheets.Events.EditStarting, this.onEditStarting);
+        this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onCellEditEnd);
     },
     onContextmenuOpr: function () {//右键菜单
         let me = this;

+ 11 - 17
web/building_saas/complementary_ration_lib/js/ration_installation.js

@@ -42,24 +42,18 @@ let rationInstObj = {
     isDef: function (v) {
         return v !== undefined && v !== null;
     },
-    getInstallation: function (callback) {
-        let me = this;
-        CommonAjax.post('api/getInstallation', {}, function (rstData) {
-            //建立name - ID 映射, ID - name 映射
-            me.feeItem = {};
-            me.IDMapping = {feeItem: {}, section: {}};
-            for(let feeItem of rstData){
-                me.feeItem[feeItem.feeItem] = {ID: feeItem.ID, section: {}};
-                me.IDMapping['feeItem'][feeItem.ID] = feeItem.feeItem;
-                for(let section of feeItem.section){
-                    me.feeItem[feeItem.feeItem]['section'][section.name] = section.ID;
-                    me.IDMapping['section'][section.ID] = section.name;
-                }
-            }
-            if(callback){
-                callback(rstData);
+    getInstallation: function (installationData) {
+        //建立name - ID 映射, ID - name 映射
+        this.feeItem = {};
+        this.IDMapping = {feeItem: {}, section: {}};
+        for(let feeItem of installationData){
+            this.feeItem[feeItem.feeItem] = {ID: feeItem.ID, section: {}};
+            this.IDMapping['feeItem'][feeItem.ID] = feeItem.feeItem;
+            for(let section of feeItem.section){
+                this.feeItem[feeItem.feeItem]['section'][section.name] = section.ID;
+                this.IDMapping['section'][section.ID] = section.name;
             }
-        });
+        }
     },
     getFeeItemCombo: function () {
         let feeItemArr = [];

+ 22 - 51
web/building_saas/complementary_ration_lib/js/section_tree.js

@@ -2,31 +2,14 @@
  * Created by Zhong on 2017/12/18.
  */
 let pageOprObj = {
-    refreshAllBooks: function () {
-        if (sectionTreeObj.workBook) {
-            sectionTreeObj.workBook.refresh();
-        }
-        if (rationOprObj.workBook) {
-            rationOprObj.workBook.refresh();
-        }
-        if (coeOprObj.workBook) {
-            coeOprObj.workBook.refresh();
-        } else {
-            pageObj.initPage();
-        }
-        if (gljAdjOprObj.workBook) {
-            gljAdjOprObj.workBook.refresh();
-        }
-        if (rationGLJOprObj.sheet.getParent()) {
-            rationGLJOprObj.sheet.getParent().refresh();
-        }
-    },
     rationLibName : null,
     rationLibId : null,
     gljLibId: gljLibId,
+    rationTreeData: null,
+    mixedTreeData: null,
+    mixedGLJData: null,
     initPage : function() {
-        let me = this;
-        sectionTreeObj.getSectionTree();
+        sectionTreeObj.getSectionTree(this.rationTreeData);
         //job
         jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
         $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
@@ -37,9 +20,8 @@ let pageOprObj = {
         $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
         $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
         annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
-        gljSelOprObj.getGljClassTree(gljLibId, function () {
-            gljSelOprObj.getSelGljItems(gljLibId);
-        });
+        gljSelOprObj.getGljClassTree(this.mixedTreeData);
+        gljSelOprObj.getSelGljItems(this.mixedGLJData);
     },
     getRationLibInfo: function (rationLibId, callback) {
         CommonAjax.post('api/getRationLib', {rationRepId: rationLibId}, callback);
@@ -223,32 +205,21 @@ let sectionTreeObj = {
             sheetCommonObj.setColumnWidthByRate($('#sectionSpread').width() - 65, this.workBook, [{rateWidth: 1}]);//65: 列头宽度和垂直滚动条宽度和
         }
     },
-    getSectionTree: function () {
-        let me = sectionTreeObj;
-        let url = 'api/getRationTree';
-        //type: 0-补充库 1-标准库
-        let postData = {type: 0};
-        let sucFunc = function (rstData) {
-            if(rstData.length > 0){
-                storageUtil.setSessionCache("RationGrp","repositoryID",rstData[0].rationRepId);
-            }
-            //init
-            me.buildSheet();
-            me.initTree(rstData);
-            me.cache = me.tree.items;
-            me.bindBtn();
-            me.initController(me.tree, me.sheet, me.setting.sheet);
-            me.controller.showTreeData();
-            me.setColor(me.cache);
-            me.sheet.setFormatter(-1, 0, '@');
-            me.initSelection(me.tree.selected);
-            me.loadRateWidth();
-            //explanatoryOprObj.bindEvents($('#explanationShow'), $('#ruleTextShow'));
-        };
-        let errFunc = function () {
-
-        };
-        CommonAjax.post(url, postData, sucFunc, errFunc);
+    getSectionTree: function (treeData) {
+        /*if(rstData.length > 0){
+            storageUtil.setSessionCache("RationGrp","repositoryID",rstData[0].rationRepId);
+        }*/
+        //init
+        this.buildSheet();
+        this.initTree(treeData);
+        this.cache = this.tree.items;
+        this.bindBtn();
+        this.initController(this.tree, this.sheet, this.setting.sheet);
+        this.controller.showTreeData();
+        this.setColor(this.cache);
+        this.sheet.setFormatter(-1, 0, '@');
+        this.initSelection(this.tree.selected);
+        this.loadRateWidth();
     },
 
     setColor: function (nodes) {
@@ -578,7 +549,6 @@ let sectionTreeObj = {
     },
     //模仿默认点击
     initSelection: function (node) {
-        node.tree.selected = node ? node : null;
         let me = this;
         if(!me.isDef(node)){
             sheetCommonObj.cleanSheet(rationOprObj.workBook.getActiveSheet(), rationOprObj.setting, -1);
@@ -588,6 +558,7 @@ let sectionTreeObj = {
             sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
             return;
         }
+        node.tree.selected = node ? node : null
         me.workBook.getActiveSheet().setActiveCell(node.serialNo(), 0);
         me.initTools(node);
         me.refreshBtn(node);