Browse Source

定额库定额人材机减少触发获取人材机数据

vian 5 years ago
parent
commit
2c4d612046

+ 2 - 0
modules/ration_glj/controllers/ration_glj_controller.js

@@ -151,12 +151,14 @@ async function getGLJData(req, res) {
                 }
             }
         }
+        let skipGLJ = gljLibId === 0;
         if (!gljLibId && libData) {
             gljLibId = (libData.find(lib => lib.isDefault) || {}).gljLibId;
         }
         const info = gljLibId === COMPLEMENTARY_LIB 
             ? { gljLibId: null, userID: req.session.sessionUser.id, compilationId: req.session.sessionCompilation._id }
             : { gljLibId, userID: null, compilationId: null };
+        info.skipGLJ = skipGLJ;
         ration_glj_facade.getGLJData(info,function (err,datas) {
             if(err){
                 result.error=1;

+ 6 - 0
modules/ration_glj/facade/ration_glj_facade.js

@@ -640,6 +640,12 @@ function getGLJData(info, callback) {
             }
         },
         function (cb) {
+            if (info.skipGLJ) {
+                datas.stdGLJ = [];
+                datas.complementaryGLJs = [];
+                cb(null);
+                return;
+            }
             gljDao.getGljItems(info.gljLibId, info.userID, info.compilationId, {_id: 0}, function (err, data) {
                 if (err) {
                     cb(err);

+ 5 - 1
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -121,7 +121,7 @@ let gljSelOprObj = {
     initView: async function (gljLibId, isInitial) {
         try {
             $.bootstrapLoading.start();
-            const { libData, treeData, distTypeTree, stdGLJ, complementaryGLJs } = await this.getViewData(gljLibId);
+            let { libData, treeData, distTypeTree, stdGLJ, complementaryGLJs } = await this.getViewData(gljLibId);
             if (isInitial) {
                 this.initLibOptions(libData);
                 $('#gljSearchKeyword').val('');
@@ -131,6 +131,10 @@ let gljSelOprObj = {
                 this.buildSheet($('#gljSelSheet')[0]);
             }
             this.distTypeTree = distTypeTree;
+            if (gljLibId === 0) {
+                stdGLJ = pageOprObj.mixedGLJData.stdGljs;
+                complementaryGLJs = pageOprObj.mixedGLJData.complementaryGljs;
+            }
             this.setGLJItems(stdGLJ, complementaryGLJs);
             this.selectedList = [].concat(rationGLJOprObj.cache['_GLJ_' + rationGLJOprObj.currentRationItem.ID]);
             this.showGljList = [];