Przeglądaj źródła

getGLJDataPaging

zhongzewei 6 lat temu
rodzic
commit
24492420be

+ 5 - 0
modules/complementary_glj_lib/models/gljModel.js

@@ -40,6 +40,11 @@ class GljDao {
             }
         }
     }
+
+    async getGLJPaging ({type, replace, index, search, withinClass}) {
+
+    }
+
     //获得用户的补充工料机和用户当前所在编办的标准工料机
     async getGljItems (stdGljLibId, userId, compilationId, projection, callback){
         let me = this;

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

@@ -10,6 +10,7 @@ module.exports={
     createRationGLJ:createRationGLJ,
     testGetQuantify:testGetQuantify,
     getGLJData:getGLJData,
+    getGLJDataPaging: getGLJDataPaging,
     getGLJDataByCodes:getGLJDataByCodes,
     addGLJ:addGLJ,
     replaceGLJ:replaceGLJ,
@@ -56,6 +57,19 @@ async function getGLJDataByCodes(req,res){
     res.json(result);
 }
 
+async function getGLJDataPaging(req, res) {
+    let data = JSON.parse(req.body.data);
+    try {
+        let gljLibId = await getGLJLibByEngineerID(data.engineerID);
+        let info = {
+            gljLibId,
+            userID: req.session.sessionUser.id,
+            compilationId: req.session.sessionCompilation._id
+        };
+    } catch (e) {
+
+    }
+}
 
 async function getGLJData(req, res) {
     let result={

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

@@ -540,6 +540,15 @@ async function getGLJLibByEngineerID  (engineerID) {
     return gljLibId
 }
 
+async function getGLJDataPaging(info, data) {
+    let gljDao = new GljDao();
+    let rst = {};
+    // 初始化,需要生成分类树和类型数据
+    if (data.init) {
+        rst.treeData = await gljDao.getMixedTree(info.gljLibId, info.userID, info.compilationId);
+        rst.distTypeTree = stdgljutil.getStdGljTypeCacheObj().toArray();
+    }
+}
 
 function getGLJData(info, callback) {
     let gljDao = new GljDao();

+ 1 - 0
modules/ration_glj/routes/ration_glj_route.js

@@ -9,6 +9,7 @@ module.exports = function (app) {
 
     var rgRouter = express.Router();
     rgRouter.get('/getGLJData/:engineerID', rgController.getGLJData);
+    rgRouter.get('/getGLJDataPaging/:engineerID', rgController.getGLJDataPaging);
     rgRouter.post('/getGLJDataByCodes',rgController.getGLJDataByCodes);
     rgRouter.post('/addGLJ',rgController.addGLJ);
     rgRouter.post('/replaceGLJ',rgController.replaceGLJ);

+ 4 - 4
web/building_saas/main/js/views/glj_view.js

@@ -990,8 +990,8 @@ var gljOprObj = {
         let condition = {
             // 开始取数据的位置
             index,
-            // 初始化树结构
-            initTree: true,
+            // 初始化
+            init: true,
             // 所在部分(标准、补充)
             type: type.std,
             // 替换数据
@@ -1004,14 +1004,14 @@ var gljOprObj = {
         if (init) {
             return condition;
         }
-        condition.initTree = false;
+        condition.init = false;
         // 标准、补充的选择
         let radioType = $("input[name='glj']:checked").val();
         condition.type = type[radioType];
         // 选中的分类
         let selNode = this.treeObj.getNodeByParam('ID', this.gljCurTypeId);
         // 不为最顶层节点时,才赋值给withinClass
-        if (selNode.ParentID !== -1) {
+        if (!selNode || selNode.ParentID !== -1) {
             condition.withinClass = this.parentNodeIds['_pNodeId_' + this.gljCurTypeId];
         }
         // 搜索文本