فهرست منبع

造价书中,双击定额编号、双击分项、清单编号,在弹出的右侧库中,应定位,及其bugs

zhongzewei 6 سال پیش
والد
کامیت
ebe0cc986d

+ 1 - 1
modules/complementary_ration_lib/controllers/searchController.js

@@ -13,7 +13,7 @@ let callback = function (req, res, err, message, data) {
 class SearchController extends BaseController{
     getRationItem(req, res){
         let data = JSON.parse(req.body.data);
-        searchDao.getRationItem(req.session.sessionUser.id, data.rationRepIds, data.code, function (err, data) {
+        searchDao.getRationItem(req.session.sessionUser.id, data.rationRepIds, data.code, null, function (err, data) {
             callback(req, res, err, '', data);
         });
     }

+ 9 - 6
web/building_saas/main/js/views/character_content_view.js

@@ -1471,14 +1471,17 @@ let pageCCOprObj = {
     },
     //获取特征及内容工作簿宽度
     getWorkBookWidth: function () {
-        return ($(window).width() - $('.main-nav').width()) / 3 - 50;
+        return ($(window).width() - $('.main-nav').width() - $('.main-side').width()) / 3 - 50;
+    },
+    resizeWidth: function () {
+        let workBookWidth = pageCCOprObj.getWorkBookWidth();
+        contentOprObj.setRateWith(workBookWidth);
+        sheetCommonObj.setColumnWidthByRate(workBookWidth, contentOprObj.workBook, contentOprObj.setting.header);
+        characterOprObj.setRateWith(workBookWidth);
+        sheetCommonObj.setColumnWidthByRate(workBookWidth, characterOprObj.workBook, characterOprObj.setting.header);
     }
 }
 
 $(window).resize(function () {
-    let workBookWidth = pageCCOprObj.getWorkBookWidth();
-    contentOprObj.setRateWith(workBookWidth);
-    sheetCommonObj.setColumnWidthByRate(workBookWidth, contentOprObj.workBook, contentOprObj.setting.header);
-    characterOprObj.setRateWith(workBookWidth);
-    sheetCommonObj.setColumnWidthByRate(workBookWidth, characterOprObj.workBook, characterOprObj.setting.header);
+    pageCCOprObj.resizeWidth();
 });

+ 19 - 0
web/building_saas/main/js/views/project_view.js

@@ -564,12 +564,31 @@ var projectObj = {
     },
     showBillOrRationLib(node){
         let BILLS = projectObj.project.Bills;
+        let code = node.data.code ? node.data.code : '';
         if(node.sourceType == ModuleNames.bills){//当清单是“分部分项工程”、“措施项目工程”时,要展开清单规则节点
             if(BILLS.isFXorBX(node)||(node.data.type == billType.BILL && BILLS.isMeasure(node))){//是分项或补项,是清单并且属于措施项目节点
+                if(billsLibObj.stdBillsTree === null){
+                    billsLibObj.doAfterLoadBills = function () {
+                        this.locateAtBills(code);
+                        this.doAfterLoadBills = null;
+                    };
+                }
+                else {
+                    billsLibObj.locateAtBills(code);
+                }
                 if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
             }
         }
         if(node.sourceType == ModuleNames.ration){ //在定额编码中双击,如果右侧定额库没有展开,则自动展开。
+            if(!rationLibObj.tree){
+                rationLibObj.doAfterGetRationTree = function () {
+                    this.locateAtRation(code);
+                    this.doAfterGetRationTree = null;
+                };
+            }
+            else {
+                rationLibObj.locateAtRation(code);
+            }
             if(!$("#de").is(":visible"))  $('#stdRationTab').click();
         }
 

+ 2 - 0
web/building_saas/main/js/views/side_tools.js

@@ -12,6 +12,7 @@ sideResizeEles.farElement = $('.main-side');
 sideResizeEles.farSpread = $('.main-side');
 sideResizeEles.nav = null;
 slideResize(sideResizeEles, {min: 250, max: $('#zaojiashu').width()-260}, 'width', function(){
+    pageCCOprObj.resizeWidth();
     projectObj.refreshMainSpread();
     refreshSubSpread();
     if(sideResizeEles.id === 'stdBillsGuidanceTab'){
@@ -103,6 +104,7 @@ var sideToolsObj = {
             tabPanel.hide();
         }
         autoFlashHeight();
+        pageCCOprObj.resizeWidth();
         billsGuidance.refreshWorkBook();
         billsLibObj.refreshBillsSpread();
         refreshSubSpread();

+ 56 - 36
web/building_saas/main/js/views/std_bills_lib.js

@@ -4,6 +4,7 @@
  */
 
 var billsLibObj = {
+    doAfterLoadBills: null, //外部设置拉取清单数据后的回调
     stdBillsTree: null,
     stdBillsSpread: null,
     stdBillsJobSpread: null,
@@ -164,52 +165,52 @@ var billsLibObj = {
         }
         return true;
     },
+    showBillsRela: function (node) {
+        if (node && node.children.length === 0) {
+            billsLibObj.showJobsAndFeatures(node);
+        } else {
+            billsLibObj.showBillsRemark(node);
+        }
+    },
+    showJobs:function (jobs) {
+        SheetDataHelper.loadSheetHeader(billsLibObj.jobsSetting, billsLibObj.stdBillsJobSpread.getActiveSheet());
+        SheetDataHelper.loadSheetData(billsLibObj.jobsSetting, billsLibObj.stdBillsJobSpread.getActiveSheet(), jobs);
+    },
+    showFeatures: function (features) {
+        SheetDataHelper.loadSheetHeader(billsLibObj.featuresSetting, billsLibObj.stdBillsFeatureSpread.getActiveSheet());
+        SheetDataHelper.loadSheetData(billsLibObj.featuresSetting, billsLibObj.stdBillsFeatureSpread.getActiveSheet(), features);
+    },
+    showJobsAndFeatures: function (node) {
+        $('#stdBillsJobTab').show();
+        $('#stdBillsRemarkTab').hide();
+        billsLibObj.refreshBillsRelaSpread();
+        billsLibObj.checkBillsRelaSpread();
+        this.showJobs(billsLibObj.getBillsJobs(billsLibObj.stdBillsJobData, node));
+        this.showFeatures(billsLibObj.getBillsFeatures(billsLibObj.stdBillsFeatureData, node));
+    },
+    showBillsRemark: function (node) {
+        $('#stdBillsJobTab').hide();
+        $('#stdBillsRemarkTab').show();
+        $('#stdBillsRemark').text(node && node.data.recharge ? node.data.recharge : '');
+    },
     loadStdBills: function (stdBillsLibID) {
         var that = this;
-        var stdBillsJobData, stdBillsFeatureData, stdBills;
+        var stdBills;
         if(that.stdBillsTree){
             that.stdBillsTree = null;
         }
         that.stdBillsTree  = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
         var stdBillsTreeController = TREE_SHEET_CONTROLLER.createNew(that.stdBillsTree, billsLibObj.stdBillsSpread.getActiveSheet(), billsLibObj.stdBillsTreeSetting);
-        var showJobs = function (jobs) {
-            SheetDataHelper.loadSheetHeader(billsLibObj.jobsSetting, billsLibObj.stdBillsJobSpread.getActiveSheet());
-            SheetDataHelper.loadSheetData(billsLibObj.jobsSetting, billsLibObj.stdBillsJobSpread.getActiveSheet(), jobs);
-        };
-        var showFeatures = function (features) {
-            SheetDataHelper.loadSheetHeader(billsLibObj.featuresSetting, billsLibObj.stdBillsFeatureSpread.getActiveSheet());
-            SheetDataHelper.loadSheetData(billsLibObj.featuresSetting, billsLibObj.stdBillsFeatureSpread.getActiveSheet(), features);
-        };
-        var showJobsAndFeatures = function (node) {
-            $('#stdBillsJobTab').show();
-            $('#stdBillsRemarkTab').hide();
-            billsLibObj.refreshBillsRelaSpread();
-            billsLibObj.checkBillsRelaSpread();
-            showJobs(billsLibObj.getBillsJobs(stdBillsJobData, node));
-            showFeatures(billsLibObj.getBillsFeatures(stdBillsFeatureData, node));
-        };
-        var showBillsRemark = function (node) {
-            $('#stdBillsJobTab').hide();
-            $('#stdBillsRemarkTab').show();
-            $('#stdBillsRemark').text(node && node.data.recharge ? node.data.recharge : '');
-        };
-        var showBillsRela = function (node) {
-            if (node && node.children.length === 0) {
-                showJobsAndFeatures(node);
-            } else {
-                showBillsRemark(node);
-            }
-        };
         $.bootstrapLoading.start();
         CommonAjax.post('/stdBillsEditor/getJobContent', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
-            stdBillsJobData = datas;
+            that.stdBillsJobData = datas;
         }, function () {
-            stdBillsJobData = [];
+            that.stdBillsJobData = [];
         });
         CommonAjax.post('/stdBillsEditor/getItemCharacter', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
-            stdBillsFeatureData = datas;
+            that.stdBillsFeatureData = datas;
         }, function () {
-            stdBillsFeatureData = [];
+            that.stdBillsFeatureData = [];
         });
         CommonAjax.post('/stdBillsEditor/getBills', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
             stdBills = datas;
@@ -225,14 +226,14 @@ var billsLibObj = {
             }
             stdBillsTreeController.showTreeData();
             billsLibObj.setTagForHint(that.stdBillsTree.items);
-            showBillsRela(that.stdBillsTree.firstNode());
-            stdBillsTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, showBillsRela);
+            that.showBillsRela(that.stdBillsTree.firstNode());
+            stdBillsTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.showBillsRela);
             that.stdBillsSpread.unbind(GC.Spread.Sheets.Events.CellDoubleClick);
             that.stdBillsSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
                 let selectNode = that.stdBillsTree.items[args.row];
                 let name = selectNode.data.name;
                 if (that.stdBillsTree.items[args.row].children.length === 0) {
-                    billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, selectNode);
+                    billsLibObj.insertBills(that.stdBillsJobData, that.stdBillsFeatureData, selectNode);
                 }
                 else{
                     let me = billsLibObj;
@@ -253,6 +254,9 @@ var billsLibObj = {
                     args.sheet.repaint();
                 }
             });
+            if(that.doAfterLoadBills){
+                that.doAfterLoadBills();
+            }
             $.bootstrapLoading.end();
         }, function () {
             that.stdBillsSpread.unbind(GC.Spread.Sheets.Events.CellDoubleClick);
@@ -329,6 +333,22 @@ var billsLibObj = {
             TREE_SHEET_HELPER.refreshNodesVisible(that.stdBillsTree.roots, that.stdBillsSpread.getActiveSheet(), true);
         });
     },
+    locateAtBills: function (code) {
+        let nineCode = code.substring(0, 9);
+        let items = this.stdBillsTree.items;
+        let locateBills = _.find(items, function(item){
+            return item.data.code === nineCode;
+        });
+        if(locateBills){
+            this.expandSearchNodes([locateBills]);
+            sessionStorage.setItem('stdBillsLibExpState', this.stdBillsTree.getExpState(this.stdBillsTree.items));
+        }
+        let stdBillsSheet = this.stdBillsSpread.getActiveSheet();
+        let locateRow = locateBills ? locateBills.serialNo() : 0;
+        stdBillsSheet.setActiveCell(locateRow, 0);
+        this.showBillsRela(locateBills);
+        stdBillsSheet.showRow(locateRow, GC.Spread.Sheets.VerticalPosition.center);
+    },
     stdBillsTreeSetting: {
         "emptyRowHeader": true,
         "rowHeaderWidth": 15,

+ 65 - 0
web/building_saas/main/js/views/std_ration_lib.js

@@ -5,6 +5,8 @@
 /*var rationChapterSpread, sectionRationsSpread;*/
 
 var rationLibObj = {
+    doAfterGetRationTree: null, //获取章节树回调
+    doAfterLoadGetRations: null, //获取章节树下定额后回调
     rationChapterSpread: null,
     sectionRationsSpread: null,
     rationChapterTreeController: null,
@@ -57,6 +59,7 @@ var rationLibObj = {
         var that = this;
         var showRationChapterTree = function (datas) {
             var rationChapterTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: false});
+            console.log(that);
             that.tree = rationChapterTree;
             var rationChapterTreeController = TREE_SHEET_CONTROLLER.createNew(rationChapterTree, that.rationChapterSpread.getActiveSheet(), that.rationChapterTreeSetting);
             rationChapterTree.loadDatas(datas);
@@ -87,6 +90,9 @@ var rationLibObj = {
 
         CommonAjax.post('/complementaryRation/api/getRationTree', {userId: userID, rationRepId: rationLibID}, function (datas) {
             showRationChapterTree(datas);
+            if(that.doAfterGetRationTree){
+                that.doAfterGetRationTree();
+            }
             $.bootstrapLoading.end();
         }, function () {
             showRationChapterTree([]);
@@ -125,6 +131,7 @@ var rationLibObj = {
         sheet.resumeEvent();
     },
     loadSectionRations: function (sectionID) {
+        let me = this;
         var showDatas = function (datas, setting) {
             let rationSheet = rationLibObj.sectionRationsSpread.getActiveSheet();
             TREE_SHEET_HELPER.massOperationSheet(rationSheet, function () {
@@ -137,6 +144,10 @@ var rationLibObj = {
         if (sectionID) {
             CommonAjax.post('/complementaryRation/api/getRationGljItemsBySection', {user_Id: userID, sectionId: sectionID}, function (datas) {
                 showDatas(datas, rationLibObj.sectionRationsSetting);
+                if(me.doAfterLoadGetRations){
+                    me.doAfterLoadGetRations(datas);
+                    me.doAfterLoadGetRations = null;
+                }
             }, function () {
                 showDatas([], rationLibObj.sectionRationsSetting);
             });
@@ -188,6 +199,60 @@ var rationLibObj = {
             }
         });
     },
+    expandSearchNodes: function(nodes){
+        let that = rationLibObj;
+        TREE_SHEET_HELPER.massOperationSheet(that.rationChapterSpread.getActiveSheet(), function () {
+            function expParentNode(node){
+                if(node.parent && !node.parent.expanded){
+                    node.parent.setExpanded(true);
+                    expParentNode(node.parent);
+                }
+            }
+            for(let node of nodes){
+                expParentNode(node);
+            }
+            TREE_SHEET_HELPER.refreshTreeNodeData(that.rationChapterTreeSetting, that.rationChapterSpread.getActiveSheet(), that.tree.roots, true);
+            TREE_SHEET_HELPER.refreshNodesVisible(that.tree.roots, that.rationChapterSpread.getActiveSheet(), true);
+        });
+    },
+    initSel: function (row) {
+        let me = this;
+        let sheet = me.rationChapterSpread.getActiveSheet();
+        sheet.setActiveCell(row, 0);
+        sheet.showRow(row, GC.Spread.Sheets.VerticalPosition.center);
+        let sectionNode = me.tree.items[row] || null;
+        me.loadSectionRations(sectionNode ? sectionNode.data.ID : null);
+    },
+    locateAtRation: function(code){
+        let me = rationLibObj;
+        //查找定额,以确定定额所在章节节点
+        let firstLibID = projectInfoObj.projectInfo.engineeringInfo.ration_lib.length > 0 ?
+                        projectInfoObj.projectInfo.engineeringInfo.ration_lib[0].id : null;
+        let locateRow = 0,
+            locateSubRow = 0;
+        CommonAjax.post('/complementaryRation/api/getRationItem', {rationRepIds: [firstLibID], code: code}, function (ration) {
+            if(ration && ration.sectionId){
+                let sectionNode = me.tree.findNode(ration.sectionId);
+                if(sectionNode){
+                    me.expandSearchNodes([sectionNode]);
+                    sessionStorage.setItem('stdRationLibExpState', me.tree.getExpState(me.tree.items));
+                }
+                locateRow = sectionNode.serialNo();
+                me.doAfterLoadGetRations = function (rationItems) {
+                    let rationSheet = me.sectionRationsSpread.getActiveSheet();
+                    locateSubRow = _.findIndex(rationItems, {ID: ration.ID});
+                    rationSheet.setActiveCell(locateSubRow, 0);
+                    rationSheet.showRow(locateSubRow, GC.Spread.Sheets.VerticalPosition.center);
+                };
+                me.initSel(locateRow);
+            }
+            else {
+                me.initSel(locateRow);
+            }
+        }, function () {
+            me.initSel(locateRow);
+        });
+    },
     rationChapterTreeSetting: {
         "emptyRowHeader": true,
         "rowHeaderWidth": 15,

+ 1 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -1582,7 +1582,7 @@ $(document).ready(function() {
         let stdCPHtml = getStdCPFilesHtml(getTaxGroupList(taxType));
         $("#tender-calcProgram").html(stdCPHtml);
         if ($("#tender-calcProgram")[0].options.length > 1)
-            $("#tender-calcProgram")[0].selectedIndex = 1;
+            $("#tender-calcProgram")[0].selectedIndex = 0;
     }
 
     // 选择工程专业后动态更改费率文件等数据