|
@@ -4,6 +4,7 @@
|
|
|
import BaseController from "../../common/base/base_controller";
|
|
|
import stdgljutil from "../../../public/cache/std_glj_type_util";
|
|
|
import GljDao from "../models/gljModel";
|
|
|
+import EngineeringLibModel from "../../users/models/engineering_lib_model";
|
|
|
|
|
|
let gljDao = new GljDao();
|
|
|
let callback = function(req, res, err, message, data){
|
|
@@ -11,18 +12,27 @@ let callback = function(req, res, err, message, data){
|
|
|
};
|
|
|
|
|
|
class GljController extends BaseController{
|
|
|
- redirectGlj(req, res){
|
|
|
- let gljLibId;
|
|
|
- if(typeof req.session.sessionCompilation.ration_valuation[0].glj_lib[0] !== 'undefined'){
|
|
|
- gljLibId = req.session.sessionCompilation.ration_valuation[0].glj_lib[0].id;
|
|
|
+ async redirectGlj(req, res){
|
|
|
+ let gljLibId = null, engineeringId, sessionCompilation = req.session.sessionCompilation,
|
|
|
+ rationValuation = sessionCompilation.ration_valuation,
|
|
|
+ billValuation = sessionCompilation.bill_valuation,
|
|
|
+ engineeringLibModel = new EngineeringLibModel();
|
|
|
+ if(rationValuation[0]){
|
|
|
+ let engineeringList = rationValuation[0].engineering_list;
|
|
|
+ engineeringId = engineeringList.length > 0 ? engineeringList[0].engineering_id : null;
|
|
|
+ let engineeringInfo = await engineeringLibModel.getEngineering(engineeringId);
|
|
|
+ gljLibId = engineeringInfo.glj_lib.length > 0 && typeof engineeringInfo.glj_lib !== 'undefined' ? engineeringInfo.glj_lib[0].id : null;
|
|
|
}
|
|
|
- else if(typeof req.session.sessionCompilation.bill_valuation[0].glj_lib[0] !== 'undefined'){
|
|
|
- gljLibId = req.session.sessionCompilation.bill_valuation[0].glj_lib[0].id;
|
|
|
+ else if(billValuation[0]){
|
|
|
+ let engineeringList = billValuation[0].engineering_list;
|
|
|
+ engineeringId = engineeringList.length > 0 ? engineeringList[0].engineering_id : null;
|
|
|
+ let engineeringInfo = await engineeringLibModel.getEngineering(engineeringId);
|
|
|
+ gljLibId = engineeringInfo.glj_lib.length > 0 && typeof engineeringInfo.glj_lib !== 'undefined' ? engineeringInfo.glj_lib[0].id : null;
|
|
|
}
|
|
|
res.render('building_saas/complementary_glj_lib/html/tools-gongliaoji.html',{
|
|
|
userID: req.session.sessionUser.ssoId,
|
|
|
gljLibId: gljLibId,
|
|
|
- compilationId: req.session.sessionCompilation._id
|
|
|
+ compilationId: sessionCompilation._id
|
|
|
});
|
|
|
}
|
|
|
getGljDistType (req, res) {
|