Bläddra i källkod

造价书定额人材机选择页面,可选择多个库

vian 5 år sedan
förälder
incheckning
55cd205a6c

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

@@ -409,8 +409,12 @@ class GljDao {
 
     async getMixedTree(gljLibId, userId, compilationId){
         let rst = {std: [], comple: []};
-        rst.std = await gljClassModel.find({repositoryId: gljLibId}).lean();
-        rst.comple = await compleClassModel.find({userId: userId, compilationId: compilationId}).lean();
+        if (gljLibId) {
+            rst.std = await gljClassModel.find({repositoryId: gljLibId}).lean();
+        }
+        if (userId && compilationId) {
+            rst.comple = await compleClassModel.find({userId: userId, compilationId: compilationId}).lean();
+        }
         return rst;
     }
 }

+ 27 - 8
modules/ration_glj/controllers/ration_glj_controller.js

@@ -5,6 +5,7 @@ let mongoose = require("mongoose")
 let ration_glj_facade = require('../facade/ration_glj_facade')
 import EngineeringLibModel from "../../users/models/engineering_lib_model";
 let logger = require("../../../logs/log_helper").logger;
+const { COMPLEMENTARY_LIB } = require('../../../public/common_constants');
 
 module.exports={
     createRationGLJ:createRationGLJ,
@@ -61,19 +62,37 @@ async function getGLJDataPaging(req, res) {
     let result={
         error:0
     };
-    let data = JSON.parse(req.body.data);
+    let { condition } = JSON.parse(req.body.data);
     try {
         const compilationId = req.session.sessionCompilation._id;
-        const gljLib = await ration_glj_facade.getGLJLib({ compilationId });
-        let info = {
-            gljLibId: gljLib.ID,
-            userID: req.session.sessionUser.id,
-            compilationId
-        };
-        result.data = await ration_glj_facade.getGLJDataPaging(info, data.condition);
+        const userID = req.session.sessionUser.id;
+        let libData = null;
+        if (condition.gljLibID !== COMPLEMENTARY_LIB) {
+            condition.gljLibID = +condition.gljLibID;
+        }
+        if (condition.initLibs) {
+            libData = await ration_glj_facade.getLibOptionsForCompilation(compilationId);
+            libData.push({ name: '补充工料机', gljLibId: COMPLEMENTARY_LIB });
+            if (condition.gljLibID) { // 替换人材机初始化会触发此条件(初始化库且定位了库)
+                const orgDefalutLib = libData.find(lib => lib.isDefault);
+                const newDefaultLib = libData.find(lib => lib.gljLibId === condition.gljLibID);
+                if (orgDefalutLib && newDefaultLib) {
+                    orgDefalutLib.isDefault = false;
+                    newDefaultLib.isDefault = true;
+                }
+            }
+        }
+        if (!condition.gljLibID && libData) {
+            condition.gljLibID = (libData.find(lib => lib.isDefault) || {}).gljLibId;
+        }
+        const info = condition.gljLibID === COMPLEMENTARY_LIB
+            ? { gljLibId: null, userID, compilationId  }
+            : { gljLibId: condition.gljLibID, userID: null, compilationId: null };
+        result.data = await ration_glj_facade.getGLJDataPaging(info, condition);
         if (req.session.sessionCompilation.priceProperties) {
             result.data.priceProperties = req.session.sessionCompilation.priceProperties
         }
+        result.data.libData = libData;
         res.json(result);
     } catch (err) {
         logger.err(err);

+ 65 - 1
modules/ration_glj/facade/ration_glj_facade.js

@@ -7,6 +7,8 @@ module.exports = {
     deleteByRation: deleteByRation,
     getQuantityByProjectGLJ: getQuantityByProjectGLJ,
     getLibInfo: getLibInfo,
+    getLibOptions,
+    getLibOptionsForCompilation,
     getGLJLib,
     getGLJData: getGLJData,
     getGLJDataPaging: getGLJDataPaging,
@@ -57,7 +59,9 @@ const gljClassModel = mongoose.model('std_glj_lib_gljClass');
 const stdGLJLibModel = mongoose.model('std_glj_lib_map');
 const projectDao = require('../../pm/models/project_model').project;
 const compleClassModel = mongoose.model('complementary_glj_section');
-
+const stdRationLibModel = mongoose.model('std_ration_lib_map');
+const compilationModel = mongoose.model('compilation');
+const engineeringModel = mongoose.model('engineering_lib');
 
 let operationMap = {
     'ut_create': create_ration_glj,
@@ -548,6 +552,66 @@ async function getGLJLibByEngineerID  (engineerID) {
     return gljLibId
 }
 
+// 获取人材机选择页面,可选的定额库-人材机库映射选项
+async function getLibOptions(engineerID) {
+    // 找到工程专业绑定的定额库,再获取这些定额库引用的人材机库
+    const engineeringLibModel = new EngineeringLibModel();
+    const engineeringInfo = await engineeringLibModel.findDataByCondition({ _id: engineerID });
+    const rationLibs = engineeringInfo.ration_lib;
+    const rationLibIDs = rationLibs.map(lib => lib.id);
+    const rationLibData = await stdRationLibModel.find({ ID: { $in: rationLibIDs } }, 'ID gljLib').lean();
+    const rst = [];
+    rationLibs.forEach(lib => {
+        rationLibData.forEach(stdLib => {
+            if (+lib.id === +stdLib.ID) {
+                lib.gljLibId = stdLib.gljLib;
+                rst.push(lib);
+            }
+        });
+    });
+    return rst;
+}
+
+// 获取人材机选择库页面,可选的定额库为费用定额下,所有工程专业的定额库(需要去重)
+async function getLibOptionsForCompilation(compilationId) {
+    const compilation = await compilationModel.findOne({ _id: mongoose.Types.ObjectId(compilationId) }, 'ration_valuation bill_valuation');
+    const valuationIDs = [];
+    if (compilation.ration_valuation[0] && compilation.ration_valuation[0].enable) {
+        valuationIDs.push(compilation.ration_valuation[0].id);
+    }
+    if (compilation.bill_valuation[0] && compilation.bill_valuation[0].enable) {
+        valuationIDs.push(compilation.bill_valuation[0].id);
+    }
+    const engineeringLibs = await engineeringModel.find({ valuationID: { $in: valuationIDs }, visible: true }, 'ration_lib');
+    const rationLibs = [];
+    const rationLibIDs = [];
+    let hasDefalut = false;
+    engineeringLibs.forEach(lib => {
+        lib.ration_lib.forEach(rLib => {
+            if (!rationLibIDs.includes(rLib.id)) {
+                rationLibIDs.push(rLib.id);
+                rationLibs.push({
+                    isDefault: hasDefalut ? false: rLib.isDefault,
+                    name: rLib.name,
+                    id: rLib.id
+                });
+                if (rLib.isDefault) {
+                    hasDefalut = true;
+                }
+            }
+        });
+    });
+    const stdRationLibs = await stdRationLibModel.find({ ID: { $in: rationLibIDs } }, 'ID gljLib').lean();
+    rationLibs.forEach(lib => {
+        stdRationLibs.forEach(stdLib => {
+            if (+lib.id === +stdLib.ID) {
+                lib.gljLibId = stdLib.gljLib;
+            }
+        });
+    });
+    return rationLibs;
+}
+
 async function getGLJDataPaging(info, condition) {
     let gljDao = new GljDao();
     let rst = {};

+ 9 - 0
public/common_constants.js

@@ -140,6 +140,13 @@
         RATION: 'ration',
     };
     const DEFAULT_REGION = '全省';
+
+    // 补充人材机库
+    const COMPLEMENTARY_LIB = 'complementaryLib';
+
+    // 费用定额
+    const COMPILATION = 'compilation';
+
     return {
         fixedFlag,
         billType,
@@ -150,5 +157,7 @@
         supplyText,
         SourceType,
         DEFAULT_REGION,
+        COMPILATION,
+        COMPLEMENTARY_LIB,
     };
 });

+ 5 - 0
web/building_saas/css/custom.css

@@ -484,4 +484,9 @@ margin-right: 100px !important;
 }
 .table-sc th{
   font-weight: normal;
+}
+
+.form-control-inline {
+  display: inline-block !important;
+  width: 82%;
 }

+ 3 - 2
web/building_saas/main/html/main.html

@@ -1261,8 +1261,9 @@
                 <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;
+                            <select class="form-control  form-control-sm form-control-inline" id="glj-lib-select"></select>
+                            <!-- <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">

+ 1 - 1
web/building_saas/main/js/models/ration_glj.js

@@ -570,7 +570,7 @@ let ration_glj = {
                         }
                     }
                 }
-                cb(data[gljType]);
+                cb(data[gljType], data);
                 gljOprObj.loadingPagination = false;
             }, function () {
                 if ($.bootstrapLoading.isLoading()) {

+ 42 - 22
web/building_saas/main/js/views/glj_view.js

@@ -325,10 +325,9 @@ var gljOprObj = {
     },
     onTopRowChanged: function (sender, args) {
         const me = gljOprObj;
-        const topRow = args.newTopRow;
         const bottomRow = args.sheet.getViewportBottomRow(1);
-        const radioType = $("input[name='glj']:checked").val();
-        const curRecord = radioType === 'stdGLJ' ? me.stdGLJ : me.complementaryGLJs;
+        const gljLibID = $('#glj-lib-select').val();
+        const curRecord = gljLibID === commonConstants.COMPLEMENTARY_LIB ? me.complementaryGLJs : me.stdGLJ;
         // 当前表显示数据数大于等于当前筛选情况下最大数据数,不获取下一分页
         if (curRecord.length >= me.curPageTotal ||
             me.loadingPagination) {
@@ -340,7 +339,7 @@ var gljOprObj = {
         }
     },
     loadPageData: function (sheet, reset, index) {
-        let condition = this.getPagingCondition(false, reset, false, index);
+        let condition = this.getPagingCondition(false, reset, false, index, false, null);
         let getPagingFun =  typeof unitPriceObj != 'undefined' ? unitPriceObj.getGLJDataPaging:projectObj.project.ration_glj.getGLJDataPaging;
         getPagingFun(condition, function (data) {
             sheetCommonObj.appendData(sheet, condition.index, 0, gljOprObj.gljLibSheetSetting, data);
@@ -1147,9 +1146,11 @@ var gljOprObj = {
     *         {Boolean}reset 是否重置数据 (点击分类树等)
     *         {Boolean}location 是否定位(替换初始化)
     *         {Number}index 下一页数据开始索引,根据这个值获取上次分页最大的编码数据(不用skip进行分页,skip跳过大量数据会降低性能,用$gt: data.code)
+    *         {Boolean}initLibs 是否初始化库列表
+    *         {String||Null}gljLibID 选中的人材机库
     * @return {Object}
     * */
-    getPagingCondition: function (init, reset, location, index) {
+    getPagingCondition: function (init, reset, location, index, initLibs, gljLibID) {
         // 上一次分页的最末人材机编码,index为0时,code为空
         const code = gljOprObj.AllRecode && gljOprObj.AllRecode[index - 1] ? gljOprObj.AllRecode[index - 1].code : '';
         // 初始化情况下的条件
@@ -1164,6 +1165,7 @@ var gljOprObj = {
             limit: 50,
             // 初始化
             init: init,
+            initLibs,
             // 所在部分(标准、补充)
             type: this.pagingType.stdGLJ,
             // 替换数据,替换操作下有数据:编码、名称、规格、单位、类型
@@ -1192,15 +1194,23 @@ var gljOprObj = {
         } else if (actionType === 'addMix'|| actionType === 'unitPriceAddMix') {
             condition.queryExtend = projectGljObject.getQueryExtForMixRatio();
         }
+        if (gljLibID) {
+            condition.gljLibID = gljLibID;
+        } else {
+            if (condition.replace) {
+                const selected = gljOprObj.sheetData[gljContextMenu.selectedRow];
+                condition.gljLibID =  selected.from === 'cpt' || !selected.repositoryId ? commonConstants.COMPLEMENTARY_LIB : selected.repositoryId;
+            } else {
+                condition.gljLibID = initLibs ? null : $('#glj-lib-select').val();
+            }
+        }
+        if (condition.gljLibID === commonConstants.COMPLEMENTARY_LIB) {
+            condition.type = this.pagingType.complementaryGLJs;
+        }
         if (init) {
             return condition;
         }
         condition.init = false;
-        // 标准、补充的选择
-        if ($('#glj_tree_div').is(':visible')) {
-            let radioType = $("input[name='glj']:checked").val();
-            condition.type = this.pagingType[radioType];
-        }
         // 选中的分类
         if (this.treeObj) {
             let selNode = this.treeObj.getNodeByParam('ID', this.gljCurTypeId);
@@ -1220,12 +1230,10 @@ var gljOprObj = {
     },
     filterLibGLJSheetData: function () {
         let me = this;
-        let val = $("input[name='glj']:checked").val();
-        if (val == 'allGljs') {
-            me.gljLibSheetData = me.stdGLJ.concat(me.complementaryGLJs);
-        } else {
-            me.gljLibSheetData = me[val];
-        }
+        const selectLibID = $('#glj-lib-select').val();
+        me.gljLibSheetData = selectLibID === commonConstants.COMPLEMENTARY_LIB
+            ? me.complementaryGLJs
+            : me.stdGLJ;
         if ($('#actionType').val() == 'replace' || $('#actionType').val() == 'm_replace') {
             me.filterLibGLJByType();
         }else if($('#actionType').val() == 'addMix' || $('#actionType').val() == 'unitPriceAddMix'){
@@ -1631,7 +1639,10 @@ var gljOprObj = {
         let zTree = $.fn.zTree.getZTreeObj("gljTree");
         let node = null;
         if (ID) node = zTree.getNodesByParam('ID', ID, null)[0];
-        if (!node) node = zTree.getNodeByTId('gljTree_1');
+        if (!node) {
+            node = zTree.getNodeByTId('gljTree_1');
+            ID = node.ID;
+        }
         zTree.selectNode(node);
         gljOprObj.gljCurTypeId = ID;
         //--gljOprObj.filterLibGLJSheetData();
@@ -1649,8 +1660,8 @@ var gljOprObj = {
         }
     },
     //初始化分类树
-    //@param {String}type(标准或补充) {Array}treeData(树数据)
-    initClassTree: function (type, treeData, initSel = false) {
+    //@param {Array}treeData(树数据)
+    initClassTree: function (treeData, initSel = false) {
         let me = this;
         if (me.treeObj) {
             me.treeObj.destroy();
@@ -1744,7 +1755,8 @@ $(function () {
         projectGljObject.subList = [];
     });
     $('#glj_tree_div').on('shown.bs.modal', function (e) {
-        if (gljOprObj.gljLibSpresd == undefined) {
+        gljContextMenu.initGLJSelectView();
+/*         if (gljOprObj.gljLibSpresd == undefined) {
             gljOprObj.gljLibSpresd = sheetCommonObj.buildSheet($('#gljLibSheet')[0], gljOprObj.gljLibSheetSetting, gljOprObj.stdGLJ.length + gljOprObj.complementaryGLJs.length);
             sheetCommonObj.spreadDefaultStyle(gljOprObj.gljLibSpresd);
             gljOprObj.gljLibSpresd.bind(GC.Spread.Sheets.Events.ButtonClicked, gljOprObj.onButtonClick);
@@ -1785,6 +1797,7 @@ $(function () {
             gljOprObj.initSelection({row: index});
             gljOprObj.gljLibSpresd.focus(true);
         } else if (actionType === 'add' || actionType === 'addMix'|| actionType === 'unitPriceAddMix') {
+            debugger;
             gljOprObj.locateZTree(null);
             sheetCommonObj.appendData(gljOprObj.gljLibSheet, 0, 0, gljOprObj.gljLibSheetSetting, gljOprObj.AllRecode);
             gljOprObj.gljLibSheet.showRow(0, GC.Spread.Sheets.VerticalPosition.top);
@@ -1792,8 +1805,7 @@ $(function () {
             gljOprObj.initSelection({row: 0});
         } else {
             gljOprObj.showLibGLJSheetData();
-        }
-        console.timeEnd('getGLJData');
+        } */
     });
 
     $('#mreplace_next_div').on('shown.bs.modal', function (e) {
@@ -1811,6 +1823,14 @@ $(function () {
         }
         gljOprObj.initSelection({row: 0});
     });
+    $('#glj-lib-select').change(function () {
+        let getLibFun = null;
+        if (typeof unitPriceObj !='undefined') {
+            getLibFun = unitPriceObj.getGLJDataPaging;
+        }
+        const gljLibID = $(this).val();
+        getGLJData('change', getLibFun, false, gljLibID);
+    })
     // 人材机选择页面搜索框
     $('#gljSearchKeyword').bind('keyup', _.debounce(function() {
         gljOprObj.loadPageData(gljOprObj.gljLibSheet, true, 0);

+ 87 - 21
web/building_saas/main/js/views/glj_view_contextMenu.js

@@ -29,7 +29,7 @@ var gljContextMenu = {
                         return true;
                     },
                     callback: function () {
-                        getGLJData('replace');
+                        getGLJData('replace', null, true, null);
                     },
                     visible: function(key, opt){
                         return subSpread.getActiveSheet().name()=='ration_glj';
@@ -56,7 +56,7 @@ var gljContextMenu = {
                         return false;
                     },
                     callback:function () {
-                        getGLJData('add');
+                        getGLJData('add', null, true, null);
                     },
                     visible: function(key, opt){
                         return subSpread.getActiveSheet().name()=='ration_glj';
@@ -108,7 +108,7 @@ var gljContextMenu = {
                         return true;
                     },
                     callback: function () {
-                        getGLJData('m_replace');
+                        getGLJData('m_replace', null, true, null);
                     },
                     visible: function(key, opt){
                         return subSpread.getActiveSheet().name()=='ration_glj';
@@ -145,7 +145,7 @@ var gljContextMenu = {
                         projectGljObject.selectedProjectGLJ = t;
                         projectGljObject.subList = t.subList;
                       }
-                      getGLJData('addMix');
+                      getGLJData('addMix', null, true, null);
                   },
                   visible: function(key, opt){
                       return subSpread.getActiveSheet().name()=='ration_glj';
@@ -432,10 +432,64 @@ var gljContextMenu = {
         }
         //controller.setTreeSelected(controller.tree.items[target.row]);
         return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
+    },
+    initGLJSelectView: function () {
+        if (gljOprObj.gljLibSpresd == undefined) {
+            gljOprObj.gljLibSpresd = sheetCommonObj.buildSheet($('#gljLibSheet')[0], gljOprObj.gljLibSheetSetting, gljOprObj.stdGLJ.length + gljOprObj.complementaryGLJs.length);
+            sheetCommonObj.spreadDefaultStyle(gljOprObj.gljLibSpresd);
+            gljOprObj.gljLibSpresd.bind(GC.Spread.Sheets.Events.ButtonClicked, gljOprObj.onButtonClick);
+            gljOprObj.gljLibSheet = gljOprObj.gljLibSpresd.getSheet(0);
+            gljOprObj.gljLibSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, gljOprObj.onSelectionChanged);
+            gljOprObj.gljLibSheet.bind(GC.Spread.Sheets.Events.TopRowChanged, _.debounce(gljOprObj.onTopRowChanged, 100));
+            gljOprObj.gljLibSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
+            gljOprObj.gljLibSheet.options.isProtected = true;
+            gljOprObj.gljLibSheet.name('glj_lib');
+            sheetCommonObj.setSheetBySetting(gljOprObj.gljLibSheet, gljOprObj.gljLibSheetSetting);
+        }
+        let gljClass = 0,
+            selected,
+            connect_key;
+        const actionType = $('#actionType').val();
+        const addActions = ['add', 'insert', 'addMix','unitPriceAddMix'];
+        const replaceActions = ['m_replace', 'replace'];
+        if (addActions.includes(actionType)) {//插入,添加,添加组成物(项目人材机页面)
+            gljOprObj.GLJSelection = [];
+        } else if(replaceActions.includes(actionType)){//替换、批量替换
+            selected = gljOprObj.sheetData[gljContextMenu.selectedRow];
+            connect_key = gljOprObj.getIndex(selected, gljKeyArray);
+            gljOprObj.GLJSelection = [connect_key];
+            // 找到定位的分类树
+            const locatedItem = gljOprObj.AllRecode.find(item => gljOprObj.getIndex(item, gljLibKeyArray) === connect_key);
+            if (locatedItem) {
+                gljClass = locatedItem.gljClass;
+                locatedItem.select = 1;
+            }
+        }
+        //替换,焦点定位至当前选中人材机
+        if (replaceActions.includes(actionType)) {
+            gljOprObj.locateZTree(gljClass);
+            sheetCommonObj.appendData(gljOprObj.gljLibSheet, 0, 0, gljOprObj.gljLibSheetSetting, gljOprObj.AllRecode);
+            const index = gljOprObj.AllRecode.findIndex(item => gljOprObj.getIndex(item, gljLibKeyArray) === connect_key);
+            gljOprObj.gljLibSheet.showRow(index, GC.Spread.Sheets.VerticalPosition.center);
+            gljOprObj.gljLibSheet.setActiveCell(index, 0);
+            gljOprObj.initSelection({row: index});
+            gljOprObj.gljLibSpresd.focus(true);
+        } else if (actionType === 'add' || actionType === 'addMix'|| actionType === 'unitPriceAddMix') {
+            gljOprObj.locateZTree(null);
+            sheetCommonObj.appendData(gljOprObj.gljLibSheet, 0, 0, gljOprObj.gljLibSheetSetting, gljOprObj.AllRecode);
+            gljOprObj.gljLibSheet.showRow(0, GC.Spread.Sheets.VerticalPosition.top);
+            gljOprObj.gljLibSheet.setActiveCell(0, 0);
+            gljOprObj.initSelection({row: 0});
+        } else {
+            gljOprObj.showLibGLJSheetData();
+        }
     }
 }
 
-function getGLJData(actionType,getLibFunc) {
+function getGLJData(actionType,getLibFunc, initLibs, gljLibID) {
+    if (actionType === 'change') {
+        actionType = $('#actionType').val();
+    }
     $('#actionType').val(actionType);
     // 清除选中人材机缓存数据
     gljOprObj.GLJSelection = [];
@@ -448,28 +502,40 @@ function getGLJData(actionType,getLibFunc) {
     }
     const init = true;
     const reset = true;
-    const condition = gljOprObj.getPagingCondition(init, reset, location, 0);
-    console.time('getGLJData');
+    const condition = gljOprObj.getPagingCondition(init, reset, location, 0, initLibs, gljLibID);
     if(!getLibFunc)getLibFunc = projectObj.project.ration_glj.getGLJDataPaging;
-    getLibFunc(condition, function (result) {
-        gljOprObj.initClassTree('std', gljOprObj.treeData.std);
-        $('#modalCon').width($(window).width()*0.5);
-        $("input[name='glj']").get(0).checked=true;
-        $.bootstrapLoading.end();
-        if(actionType == "m_replace"){
-            $('#glj_selected_conf').hide();
-            $('#replace_next_btn').show();
+    getLibFunc(condition, function (gljData, result) {
+        if (gljOprObj.treeData.std.length) {
+            gljOprObj.initClassTree(gljOprObj.treeData.std);
+        } else if (gljOprObj.treeData.comple.length) {
+            gljOprObj.initClassTree(gljOprObj.treeData.comple);
+        }
+        if (initLibs) {
+            initLibOptions(result.libData);
+            $('#modalCon').width($(window).width()*0.5);
+            if(actionType == "m_replace"){
+                $('#glj_selected_conf').hide();
+                $('#replace_next_btn').show();
+            } else {
+                $('#glj_selected_conf').show();
+                $('#replace_next_btn').hide();
+            }
+            $("#glj_tree_div").modal({show:true});
+            setTimeout(function(){
+                gljOprObj.gljLibSpresd ? gljOprObj.gljLibSpresd.refresh() : '';
+            }, 200);
         } else {
-            $('#glj_selected_conf').show();
-            $('#replace_next_btn').hide();
+            gljContextMenu.initGLJSelectView();
         }
-        $("#glj_tree_div").modal({show:true});
-        setTimeout(function(){
-            gljOprObj.gljLibSpresd ? gljOprObj.gljLibSpresd.refresh() : '';
-        }, 200);
+        $.bootstrapLoading.end();
     });
 }
 
+function initLibOptions(libData) {
+    const html = libData.reduce((acc, lib) => acc += `<option ${lib.isDefault ? 'selected="selected"' : ''} value="${lib.gljLibId}">${lib.name}</option>`, '');
+    $('#glj-lib-select').html(html);
+}
+
 function showGLJClassTree(record) {
     let engineerID = projectObj.project.projectInfo.property.engineering_id;
     CommonAjax.post('/rationGlj/getGLJClass/'+engineerID,record, function (data) {

+ 1 - 1
web/building_saas/main/js/views/project_glj_view.js

@@ -1142,7 +1142,7 @@ let projectGljObject={
                     },
                     callback: function (key, opt) {
                         me.selectedProjectGLJ = projectGljObject.getProjectGLJSelected();
-                        getGLJData('addMix');
+                        getGLJData('addMix', null, true, null);
                     }
                 }
             }

+ 3 - 2
web/building_saas/unit_price_file/index.html

@@ -125,8 +125,9 @@
             <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;
+                        <select class="form-control  form-control-sm form-control-inline" id="glj-lib-select"></select>
+                        <!-- <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">

+ 6 - 2
web/building_saas/unit_price_file/index.js

@@ -459,7 +459,7 @@ let unitPriceObj = {
               },
               callback: function (key, opt) {
                    projectGljObject.selectedProjectGLJ = me.getSelectedUnitPrice();
-                   getGLJData('unitPriceAddMix',me.getGLJDataPaging);
+                   getGLJData('unitPriceAddMix',me.getGLJDataPaging, true, null);
               },
               visible: function(key, opt){
                   let projectGLJ = me.getSelectedUnitPrice();
@@ -558,7 +558,11 @@ let unitPriceObj = {
                 }
             }
         }
-        cb(data[gljType]);
+        if (data.libData) {
+          const html = data.libData.reduce((acc, lib) => acc += `<option ${lib.isDefault ? 'selected="selected"' : ''} value="${lib.gljLibId}">${lib.name}</option>`, '');
+          $('#glj-lib-select').html(html);
+      }
+        cb(data[gljType], data);
         gljOprObj.loadingPagination = false;
     }, function () {
         if ($.bootstrapLoading.isLoading()) {