Browse Source

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhangweicheng 7 years ago
parent
commit
b0259112e7

+ 18 - 5
modules/pm/models/project_model.js

@@ -241,7 +241,24 @@ ProjectsDAO.prototype.updateUserProjects = async function (userId, compilationId
                         }
                     }
                     else if (data.updateData.projType === projectType.tender) {//fake
-                        await Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
+                        let delTender = await Projects.findOne({userID: userId, ID: data.updateData.ID});
+                        //如果这个单位工程用到的费率文件、单价文件,没有被其他的单位工程使用,则应该一起跟随删除
+                        if(delTender){
+                            let unitPriceFile = delTender.property.unitPriceFile;
+                            let feeRateFile = delTender.property.feeFile;
+                            let usedUFTenders = await Projects.find(
+                                {userID: userId, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'property.unitPriceFile.id': unitPriceFile.id});
+                            if(usedUFTenders.length === 1){
+                                await UnitPriceFiles.update({id: unitPriceFile.id}, {$set: {deleteInfo: deleteInfo}});
+                            }
+                            let usedFRTenders = await Projects.find(
+                                {userID: userId, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], 'property.feeFile.id': feeRateFile.id});
+                            if(usedFRTenders.length === 1){
+                                await FeeRateFiles.update({ID: feeRateFile.id}, {$set: {deleteInfo: deleteInfo}});
+                            }
+                            await Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
+                        }
+
                     }
                     else if (data.updateData.projType === projectType.folder) {//true
                         await Projects.remove({userID: userId, ID: data.updateData.ID}, updateAll);
@@ -286,10 +303,6 @@ ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback)
             else if (data.updateType === updateType.delete && data.fileType === fileType.unitPriceFile) {
                 data.updateData.deleteInfo = deleteInfo;
                 await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
-                await Projects.update({
-                    userID: userId,
-                    'property.feeFile.id': data.updateData.id
-                }, {$set: {'property.feeFile.name': data.updateData.name}});
             }
             else if (data.updateType === updateType.delete && data.fileType === fileType.feeRateFile) {
                 data.updateData.deleteInfo = deleteInfo;

+ 4 - 0
public/web/sheet/sheet_data_helper.js

@@ -148,6 +148,9 @@ var SheetDataHelper = {
             if(tag !== undefined && tag){
                 text = tag;
             }
+            if(sheet && sheet.getParent().qo){
+                setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
+            }
             if (setting.pos && text && text !== '') {
                 if (!this._toolTipElement) {
                     let div = $('#autoTip')[0];
@@ -177,6 +180,7 @@ var SheetDataHelper = {
             }
         };
         TipCellType.prototype.processMouseLeave = function (hininfo) {
+            TREE_SHEET_HELPER.tipDiv = 'hide';
             if (this._toolTipElement) {
                 $(this._toolTipElement).hide();
                 this._toolTipElement = null;

+ 20 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -20,6 +20,9 @@ var TREE_SHEET_HELPER = {
      * @param obj
      * @param setting
      */
+    /*initSetting: function (obj, setting) {
+        setting.pos = this.getObjPos(obj);
+    },*/
     initSetting: function (obj, setting) {
         setting.pos = this.getObjPos(obj);
     },
@@ -404,7 +407,23 @@ var TREE_SHEET_HELPER = {
                         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);
+                    //实时读取位置信息
+                    if(sheet && sheet.getParent().qo){
+                        setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
+                    }
+                    $(this._toolTipElement).text(text);
+                    //清单指引、清单库做特殊处理
+                    if($(sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
+                        $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
+                        let marginLeftMouse;
+                        if($(this._toolTipElement).width() < hitinfo.x){
+                            marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
+                        }
+                       $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
+                    }
+                    else {
+                        $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+                    }
                     $(this._toolTipElement).show("fast");
                     TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
                 }

+ 1 - 0
web/building_saas/main/js/models/project.js

@@ -361,6 +361,7 @@ var PROJECT = {
         };
         //清单是否属于锁定范围(分部分项、措施项目)
         project.prototype.withinBillsLocked = function (node) {
+            console.log(node);
             const lockedFixFlag = [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE];
             while(node){
                 if(!node.parent){

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

@@ -606,10 +606,10 @@ let characterOprObj = {
     },
     updateCharacter: function (item, character, value) {
         let me = characterOprObj;
-        if(character !== null){
+        if(character !== undefined && character !== null){
             item.character = character;
         }
-        if(value !== null){
+        if(value !== undefined && value !== null){
             if(value !== ''){
                 let isExist = false;
                 for(let i = 0, len = item.eigenvalue.length; i < len; i++){
@@ -695,10 +695,6 @@ let characterOprObj = {
             if(me.currentCache.length > rowIdx){
                me.updateCharacter(me.currentCache[rowIdx], items[i].character, items[i].eigenvalue);
             }
-           /* //新增
-            else{
-                me.insertCharacter(items[i].character, items[i].eigenvalue);
-            }*/
         }
     },
     onRangeChanged: function (sender, args) {

+ 8 - 0
web/building_saas/main/js/views/glj_view.js

@@ -1276,6 +1276,14 @@ $(function () {
             }
         }
         gljOprObj.showLibGLJSheetData();
+        //替换,焦点定位至当前选中人材机
+        if($('#actionType').val() =='m_replace' || $('#actionType').val() == 'replace'){
+            let selected = gljOprObj.sheetData[gljContextMenu.selectedRow];
+            let index = _.findIndex(gljOprObj.gljLibSheetData, {code: selected.code});
+            gljOprObj.gljLibSheet.showRow(index, GC.Spread.Sheets.VerticalPosition.center);
+            gljOprObj.gljLibSheet.setActiveCell(index, 0);
+            gljOprObj.gljLibSpresd.focus(true);
+        }
     });
 
     $('#glj_tree_div').on('hidden.bs.modal', function () {

+ 23 - 6
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -65,6 +65,7 @@ const billsGuidance = (function () {
                {
                 width: 45,
                 readOnly: true,
+                showHint: true,
                  head: {
                      titleNames: ["计量单位"],
                      spanCols: [1],
@@ -300,6 +301,8 @@ const billsGuidance = (function () {
                 module.workBook.focus();
                 sheet.options.isProtected = true;
                 sheet.name('stdBillsGuidance_bills');
+                //设置悬浮提示
+                TREE_SHEET_HELPER.initSetting(bills.dom[0], bills.treeSetting);
             }
             if(module === guideItem){
                 sheet.options.isProtected = true;
@@ -416,6 +419,15 @@ const billsGuidance = (function () {
             bills.tree.setRootExpanded(bills.tree.roots, false);
         }
     }
+    //设置tag以悬浮提示
+    function setTagForHint(nodes){
+        let sheet = bills.workBook.getActiveSheet();
+        renderSheetFunc(sheet, function () {
+            for(let node of nodes){
+                sheet.setTag(node.serialNo(), 2, node.data.ruleText ? node.data.ruleText : '');
+            }
+        });
+    }
     //初始选择清单指引库
     //@param {Number}libID @return {void}
     function libInitSel(libID){
@@ -428,6 +440,7 @@ const billsGuidance = (function () {
             for(let node of bills.tree.items){
                 node.guidance = {tree: null, controller: null};
             }
+            setTagForHint(bills.tree.items);
             //默认初始节点
             billsInitSel(0);
         });
@@ -604,13 +617,17 @@ const billsGuidance = (function () {
                 sessionStorage.setItem('stdBillsGuidanceExpState', bills.tree.getExpState(bills.tree.items));
 
                 let sel = billsSheet.getSelections();
-                bills.controller.setTreeSelected(result[0]);
-                billsSheet.setSelection(result[0].serialNo(), sel[0].col, 1, 1);
-                billsInitSel(result[0].serialNo());
+                renderSheetFunc(billsSheet, function () {
+                    bills.controller.setTreeSelected(result[0]);
+                    billsSheet.setSelection(result[0].serialNo(), sel[0].col, 1, 1);
+                    billsInitSel(result[0].serialNo());
 
-                for (let node of result) {
-                    billsSheet.getRange(node.serialNo(), -1, 1, -1).backColor('lemonChiffon');
-                }
+                    for (let node of result) {
+                        billsSheet.getRange(node.serialNo(), -1, 1, -1).backColor('lemonChiffon');
+                    }
+                });
+                //搜索初始定位
+                billsSheet.showRow(result[0].serialNo(), GC.Spread.Sheets.VerticalPosition.bottom);
 
                 $('#nextBillsGuidance').show();
                 $('#nextBillsGuidance').unbind('click');

+ 10 - 10
web/building_saas/main/js/views/std_bills_lib.js

@@ -122,7 +122,7 @@ var billsLibObj = {
         return features;
     },
     insertBills: function (stdBillsJobData, stdBillsFeatureData, node) {
-        if(projectInfoObj.projectInfo.property.lockBills == true && projectObj.project.withinBillsLocked(node)){
+        if(projectInfoObj.projectInfo.property.lockBills == true && projectObj.project.withinBillsLocked(projectObj.project.mainTree.selected)){
             return false;
         }
         $.bootstrapLoading.start();
@@ -152,7 +152,6 @@ var billsLibObj = {
         } else {
             let canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, node.data);
             if(canAdd === false && $.bootstrapLoading.isLoading()){
-                console.log('enter');
                 $.bootstrapLoading.end();
             }
         }
@@ -272,15 +271,16 @@ var billsLibObj = {
                 billsLibObj.expandSearchNodes(result);
                 //设置记住展开
                 sessionStorage.setItem('stdBillsLibExpState', that.stdBillsTree.getExpState(that.stdBillsTree.items));
+                TREE_SHEET_HELPER.massOperationSheet(billsLibObj.stdBillsSpread.getActiveSheet(), function () {
+                    var sel = billsLibObj.stdBillsSpread.getActiveSheet().getSelections();
+                    stdBillsTreeController.setTreeSelected(result[0]);
+                    billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
 
-                var sel = billsLibObj.stdBillsSpread.getActiveSheet().getSelections();
-                stdBillsTreeController.setTreeSelected(result[0]);
-                billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
-
-                for (let node of result) {
-                    billsLibObj.stdBillsSpread.getActiveSheet().getRange(node.serialNo(), -1, 1, -1).backColor('lemonChiffon');
-                }
-
+                    for (let node of result) {
+                        billsLibObj.stdBillsSpread.getActiveSheet().getRange(node.serialNo(), -1, 1, -1).backColor('lemonChiffon');
+                    }
+                });
+                billsLibObj.stdBillsSpread.getActiveSheet().showRow(result[0].serialNo(), GC.Spread.Sheets.VerticalPosition.bottom);
                 $('#nextStdBills').show();
                 $('#nextStdBills').unbind('click');
                 $('#nextStdBills').bind('click', function () {

+ 23 - 8
web/building_saas/pm/js/pm_newMain.js

@@ -1120,7 +1120,7 @@ $(document).ready(function() {
     });*/
 
     //新建单位工程-建设项目提示
-    $('#poj-name').change(function () {
+    $('#poj-name').keyup(function () {
         let pojName = $('#poj-name').val().trim();
         let nameList = getNameList($('#poj-name-list').children());
         let isExist = hasListName(nameList, pojName);
@@ -1129,25 +1129,40 @@ $(document).ready(function() {
                 replaceClass($('#poj-name-info'), 'text-danger', 'text-info');
                 setDangerInfo($('#poj-name-info'), `新建“${pojName}”`);
             }
+            else {
+                $('#poj-name-info').hide();
+            }
             //清空单项工程下拉和文件下拉
             setEngOptions(null);
             setFileOptions(null);
         }
         else {
+            //触发选项
+            let curName = $(this).val().trim();
+            function getProjOpt(opts){
+                for(let opt of opts){
+                    if($(opt).text().trim() === curName){
+                        return $(opt);
+                    }
+                }
+                return null;
+            }
+            let matchOpt = getProjOpt($('#poj-name-list').find('button'));
+            if(matchOpt){
+                matchOpt.click();
+            }
             $('#poj-name-info').hide();
         }
     });
 
     //新建单位工程-单项工程提示
-    $('#eng-name').change(function () {
+    $('#eng-name').keyup(function () {
         let engName = $('#eng-name').val().trim();
         let nameList = getNameList($('#eng-name-list').children());
         let isExist = hasListName(nameList, engName);
-        if(!isExist){
-            if(engName !== ''){
-                replaceClass($('#eng-name-info'), 'text-danger', 'text-info');
-                setDangerInfo($('#eng-name-info'), `新建“${engName}”`);
-            }
+        if(!isExist && engName !== ''){
+            replaceClass($('#eng-name-info'), 'text-danger', 'text-info');
+            setDangerInfo($('#eng-name-info'), `新建“${engName}”`);
         }
         else {
             $('#eng-name-info').hide();
@@ -1155,7 +1170,7 @@ $(document).ready(function() {
     });
 
     //新建单位工程-单位工程提示
-    $('#tender-name').change(function () {
+    $('#tender-name').keyup(function () {
         let selected = projTreeObj.tree.selected;
         let pojName = $('#poj-name').val().trim();
         let engName = $('#eng-name').val().trim();