Browse Source

项目管理列改变、定额库清单库新悬浮提示

zhongzewei 7 years ago
parent
commit
411bce4ed3

+ 10 - 0
modules/ration_repository/controllers/ration_controller.js

@@ -18,6 +18,16 @@ module.exports = {
             }
         });
     },
+    getRationGljItemsBySection: async function(req, res){
+        var sectionId = req.body.sectionID;
+        rationItem.getRationGljItemsBySection(sectionId, function(err, message, rst){
+            if (err) {
+                callback(req, res, err, message, null);
+            } else {
+                callback(req, res, err, message, rst);
+            }
+        });
+    },
     mixUpdateRationItems: function(req, res){
         var sectionId = req.body.sectionID,
             rationLibId = req.body.rationLibId,

+ 23 - 0
modules/ration_repository/models/ration_item.js

@@ -43,6 +43,7 @@ var rationItemSchema = mongoose.Schema({
 });
 var rationItemModel = db.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items")
 var counter = require('../../../public/counter/counter');
+import stdGljListModel from '../../common/std/schemas/std_ration_lib_glj_list';
 
 var rationItemDAO = function(){};
 
@@ -52,6 +53,28 @@ rationItemDAO.prototype.getRationItemsBySection = function(sectionId,callback){
         else callback(false,"Get items successfully", data);
     })
 };
+rationItemDAO.prototype.getRationGljItemsBySection = async function(sectionId,callback){
+    try{
+        let rationItems = await rationItemModel.find({"sectionId": sectionId, "$or": [{"isDeleted": null}, {"isDeleted": false} ]}, null, {sort: {code: 1}});
+        for(let i = 0, len = rationItems.length; i < len; i++){
+            let hint = '';
+            let ration = rationItems[i];
+            for(let j = 0, jLen = ration.rationGljList.length; j < jLen; j++){
+                let rationGlj = ration.rationGljList[j];
+                let glj = await stdGljListModel.find({ID: rationGlj.gljId, $or: [{isDeleted: null}, {isDeleted: false} ]}, '-_id code name unit');
+                if(glj.length > 0){
+                    let unitHint = '' + glj[0].code + ' ' + glj[0].name + '' + glj[0].unit + ' ' + rationGlj.consumeAmt + '</br>';
+                    hint += unitHint;
+                }
+            }
+            ration._doc.hint = hint;
+        }
+        callback(false,"Get items successfully", rationItems);
+    }
+    catch (err){
+        callback(true, "Fail to get items", "")
+    }
+};
 rationItemDAO.prototype.mixUpdateRationItems = function(rationLibId, sectionId, updateItems, addItems, rIds, callback){
     var me = this;
     if (updateItems.length == 0 && rIds.length == 0) {

+ 1 - 0
modules/ration_repository/routes/ration_front_end_routes.js

@@ -21,6 +21,7 @@ module.exports = function (app) {
     apiRouter.post("/getRationTree",rationChapterTreeController.getRationChapterTree);
 
     apiRouter.post("/getRationItems",rationController.getRationItemsBySection);
+    apiRouter.post("/getRationGljItems",rationController.getRationGljItemsBySection);
 
     apiRouter.post("/getGljTree",repositoryGljController.getGljTree);
     apiRouter.post("/getGljItems",repositoryGljController.getGljItems);

+ 5 - 1
public/web/sheet/sheet_data_helper.js

@@ -134,6 +134,10 @@ var SheetDataHelper = {
         };
         TipCellType.prototype.processMouseEnter = function (hitinfo) {
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+            if(tag !== undefined && tag){
+                text = tag;
+            }
             if (setting.pos && text && text !== '') {
                 if (!this._toolTipElement) {
                     let div = $('#autoTip')[0];
@@ -150,7 +154,7 @@ var SheetDataHelper = {
                         document.body.insertBefore(div, null);
                     }
                     this._toolTipElement = div;
-                    $(this._toolTipElement).text(text).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+                    $(this._toolTipElement).html(text).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
                     $(this._toolTipElement).show("fast");
                 }
             }

+ 4 - 0
public/web/tree_sheet/tree_sheet_helper.js

@@ -316,6 +316,10 @@ var TREE_SHEET_HELPER = {
         };
         TipCellType.prototype.processMouseEnter = function (hitinfo) {
             let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+            if(tag !== undefined && tag) {
+                text = tag;
+            }
             if (setting.pos && text && text !== '') {
                 if (!this._toolTipElement) {
                     let div = $('#autoTip')[0];

+ 18 - 3
web/building_saas/main/js/views/std_bills_lib.js

@@ -46,6 +46,19 @@ var billsLibObj = {
             sheet.resumePaint();
         }
     },
+    setTagForHint: function (datas) {
+        let sheet = this.stdBillsSpread.getActiveSheet();
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        for(let i = 0, len = sheet.getRowCount(); i < len; i++){
+            sheet.setTag(i, 2, '');
+        }
+        for(let i = 0, len = datas.length; i < len; i++){
+            sheet.setTag(i, 2, datas[i].ruleText ? datas[i].ruleText : '');
+        }
+        sheet.resumePaint();
+        sheet.resumeEvent();
+    },
     loadStdBillsLib: function () {
         let i, select = $('#stdBillsLibSelect');
         select.empty();
@@ -153,6 +166,7 @@ var billsLibObj = {
             stdBills = datas;
             stdBillsTree.loadDatas(stdBills);
             stdBillsTreeController.showTreeData();
+            billsLibObj.setTagForHint(datas);
             showBillsRela(stdBillsTree.firstNode());
 
             stdBillsTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, showBillsRela);
@@ -249,7 +263,7 @@ var billsLibObj = {
                 "font":"Arial"
             }
         }, {
-            "width":150,
+            "width":220,
             "readOnly": true,
             "head":{
                 "titleNames":["项目名称"],
@@ -268,6 +282,7 @@ var billsLibObj = {
         }, {
             "width":50,
             "readOnly": true,
+            "showHint": true,
             "head":{
                 "titleNames":["计量单位"],
                 "spanCols":[1],
@@ -283,7 +298,7 @@ var billsLibObj = {
                 "hAlign":1,
                 "font":"Arial"
             }
-        }, {
+        }/*, {
             "width":100,
             "readOnly": true,
             "showHint": true,
@@ -301,7 +316,7 @@ var billsLibObj = {
                 "hAlign":0,
                 "font":"Arial"
             }
-        }]
+        }*/]
     },
     jobsSetting: {
         "emptyRows":0,

+ 22 - 1
web/building_saas/main/js/views/std_ration_lib.js

@@ -8,6 +8,9 @@ var rationLibObj = {
     rationChapterSpread: null,
     sectionRationsSpread: null,
     rationChapterTreeController: null,
+    refreshSettingForHint: function () {
+        TREE_SHEET_HELPER.initSetting($('#stdSectionRations')[0], rationLibObj.sectionRationsSetting);
+    },
     checkSpread: function () {
         if (!this.rationChapterSpread) {
             this.rationChapterSpread = SheetDataHelper.createNewSpread($('#stdRationChapter')[0]);
@@ -16,6 +19,7 @@ var rationLibObj = {
             this.sectionRationsSpread = SheetDataHelper.createNewSpread($('#stdSectionRations')[0]);
 
             this.sectionRationsSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, this.onRationSpreadCellDoubleClick);
+            this.refreshSettingForHint();
         }
     },
     refreshSpread: function () {
@@ -63,13 +67,27 @@ var rationLibObj = {
             showRationChapterTree([]);
         });
     },
+    setTagForHint: function (datas) {
+        let sheet = this.sectionRationsSpread.getActiveSheet();
+        sheet.suspendPaint();
+        sheet.suspendEvent();
+        for(let i = 0, len = sheet.getRowCount(); i < len; i++){
+            sheet.setTag(i, 1, '');
+        }
+        for(let i = 0, len = datas.length; i < len; i++){
+            sheet.setTag(i, 1, datas[i].hint ? datas[i].hint : '');
+        }
+        sheet.resumePaint();
+        sheet.resumeEvent();
+    },
     loadSectionRations: function (sectionID) {
         var showDatas = function (datas, setting) {
             SheetDataHelper.loadSheetHeader(setting, rationLibObj.sectionRationsSpread.getActiveSheet());
             SheetDataHelper.loadSheetData(setting, rationLibObj.sectionRationsSpread.getActiveSheet(), datas);
+            rationLibObj.setTagForHint(datas);
         };
         if (sectionID) {
-            CommonAjax.postRationLib('/rationRepository/api/getRationItems', {userId: userID, sectionID: sectionID}, function (datas) {
+            CommonAjax.postRationLib('/rationRepository/api/getRationGljItems', {userId: userID, sectionID: sectionID}, function (datas) {
                 showDatas(datas, rationLibObj.sectionRationsSetting);
             }, function () {
                 showDatas([], rationLibObj.sectionRationsSetting);
@@ -174,6 +192,7 @@ var rationLibObj = {
         }, {
             "width":220,
             "readOnly": true,
+            "showHint": true,
             "head":{
                 "titleNames":["名称"],
                 "spanCols":[1],
@@ -225,6 +244,8 @@ var rationLibObj = {
         }]
     }
 };
+
+addEventOnResize(rationLibObj.refreshSettingForHint);
 $('#stdRationTab').bind('click', function () {
     refreshSubSpread();//subSpread、jobSpread、itemSpread显示问题
     var select = $('#stdRationLibSelect');

+ 14 - 15
web/building_saas/pm/js/pm_main.js

@@ -95,45 +95,44 @@ let ProjTreeSetting = {
             }
         },
         {
-            head: '计价方式',
+            head: '工程造价',
             data: 'valuationType',
             width: '10%',
             event: {
                 getText: function (html, node, text) {
                     if(node.data.projType === projectType.tender){
-                        let typeText = node.data.property.valuationType === 'bill'? '清单计价' : '定额计价';
-                        html.push(typeText);
+                        html.push('0');
                     }
                 }
             }
         },
         {
-            head: '计价规则',
-            data: 'valuationName',
-            width: '10%',
+            head: '单价文件',
+            data: 'unitPriceFile',
+            width: '15%',
             event: {
                 getText: function (html, node, text) {
                     if(node.data.projType === projectType.tender){
-                        let valuationText = node.data.property.valuationName;
-                        html.push(valuationText);
+                        let unitPriceText = node.data.property.unitPriceFile ? node.data.property.unitPriceFile.name : '';
+                        html.push(unitPriceText);
                     }
                 }
             }
         },
         {
-            head: '工程专业',
-            data: 'engineeringName',
-            width: '10%',
+            head: '费率文件',
+            data: 'feeFile',
+            width: '15%',
             event: {
                 getText: function (html, node, text) {
                     if(node.data.projType === projectType.tender){
-                        let engineeringText = node.data.property.engineeringName;
-                        html.push(engineeringText);
+                        let feeFileText = node.data.property.feeFile ? node.data.property.feeFile.name : '';
+                        html.push(feeFileText);
                     }
                 }
             }
         },
-        {
+        /*{
             head: '最近使用',
             data: 'lastDateTime',
             width: '10%',
@@ -144,7 +143,7 @@ let ProjTreeSetting = {
                     }
                 }
             }
-        },
+        },*/
         {
             head: '创建日期',
             data: 'createDateTime',