zhongzewei 7 lat temu
rodzic
commit
3cc184bc00

+ 9 - 2
modules/fee_rates/facade/fee_rates_facade.js

@@ -326,7 +326,8 @@ async function getChangeInfo(jdata,compilation){
     let data = JSON.parse(jdata);
     //{ rootProjectID: 99, user_id: '76075' }
     let result={};
-    let currentProject = await projectsModel.findOne({'ID':data.rootProjectID},['ID','name']); //{projectID:99,name:'建设项目1'};//dummy 数据
+    let treeData = [];
+    let currentProject = await projectsModel.findOne({'ID':data.rootProjectID},['ID','NextSiblingID','ParentID','name']); //{projectID:99,name:'建设项目1'};//dummy 数据
     if(currentProject){
         currentProject._doc.currentOptions=await getFeeRatesByProject(data.rootProjectID);
     }
@@ -334,12 +335,18 @@ async function getChangeInfo(jdata,compilation){
     let others =await projectsModel.find({'$and': [
             {'$or':[{'userID': data.user_id,'compilation': compilation,'projType':'Project', 'deleteInfo': null}, {'userID': data.user_id,'compilation': compilation,'projType':'Project', 'deleteInfo.deleted': {'$in': [null, false]}}]},
             { 'ID':{'$nin':[data.rootProjectID]}}
-        ]},['ID','name']);
+        ]},['ID','NextSiblingID','ParentID','name']);
     for(let o of others){
         o._doc.optionList = await getFeeRatesByProject(o.ID);
     }
+    //获取对应用户所有文件夹
+    let folders = await projectsModel.find({userID: data.user_id, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], projType: 'Folder'}, ['ID','NextSiblingID','ParentID','name']);
+    treeData = treeData.concat(currentProject);
+    treeData = treeData.concat(others);
+    treeData = treeData.concat(folders);
     result.currentProject=currentProject;
     result.others = others;
+    result.treeData = treeData;
     return result;
 }
 

+ 7 - 1
modules/glj/controllers/glj_controller.js

@@ -16,6 +16,7 @@ let consts = require('../../main/models/project_consts');
 let glj_type_util = require('../../../public/cache/std_glj_type_util');
 let mongoose = require('mongoose');
 let ration = mongoose.model('ration');
+let projectModel = mongoose.model('projects');
 
 
 const ProjectModel = require('../../pm/models/project_model').project;
@@ -287,6 +288,8 @@ class GLJController extends BaseController {
             let sessionUserData = request.session.sessionUser;
             // 获取对应用户所有的建设项目数据
             let projectList = await ProjectModel.getUserProjectData(sessionUserData.id,request.session.sessionCompilation._id);
+            //获取对应用户所有文件夹
+            let folders = await projectModel.find({userID: sessionUserData.id, $or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], projType: 'Folder'}, {_id: 0, name: 1, ID: 1, NextSiblingID: 1, ParentID: 1});
             if (projectList === null) {
                 throw '没有找到对应的项目数据';
             }
@@ -296,7 +299,8 @@ class GLJController extends BaseController {
 
             let result = {
                 self: [],
-                other: []
+                other: [],
+                treeData: []
             };
             for (let index in projectList) {
                 // 获取对应的单价文件
@@ -312,7 +316,9 @@ class GLJController extends BaseController {
                 } else {
                     result.other.push(projectList[index]);
                 }
+                result.treeData.push({name: projectList[index].name, ID: projectList[index].ID, NextSiblingID: projectList[index].NextSiblingID, ParentID: projectList[index].ParentID});
             }
+            result.treeData = result.treeData.concat(folders);
             responseData.data = result;
             response.json(responseData);
 

+ 1 - 1
modules/pm/models/project_model.js

@@ -648,7 +648,7 @@ ProjectsDAO.prototype.getUserProjectData = async function (userId,compilation) {
             {'userID': userId, 'compilation': compilation, 'deleteInfo': null, projType: 'Project'},
             {'userID': userId, 'compilation': compilation,'deleteInfo.deleted': {'$in': [null, false]}, projType: 'Project'}
         ]
-    }, {_id: 0, name: 1, ID: 1});
+    }, {_id: 0, name: 1, ID: 1, NextSiblingID: 1, ParentID: 1});
 
     return projectList;
 };

+ 1 - 1
public/web/PerfectLoad.js

@@ -27,7 +27,7 @@ jQuery.bootstrapLoading = {
             //提示颜色
             delayTime: 500,
             //页面加载完成后,加载页面渐出速度
-            zindex: 2000,
+            zindex: 999,
             //loading页面层次
             sleep: 0
             //设置挂起,等于0时则无需挂起

+ 2 - 2
web/building_saas/main/html/main.html

@@ -88,7 +88,7 @@
                       <% } else { %>
                       <a href="javascript:void(0)" class="btn btn-sm" name="lockBills"  title=""> <i class="fa fa-lock" aria-hidden="true"></i> 锁定清单</a>
                       <% } %>
-                      <a id="switchTznr" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征内容</a>
+                      <a id="switchTznr" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-eye" aria-hidden="true"></i> 显示特征</a>
                   </div>
                   <div class="side-tabs">
                       <ul class="nav nav-tabs" role="tablist">
@@ -1197,7 +1197,7 @@
 
     <!--弹出 导入-->
     <div class="modal fade" id="import" data-backdrop="static">
-        <div class="modal-dialog" role="document">
+        <div class="modal-dialog" style="z-index: 800" role="document">
             <div class="modal-content">
                 <div class="modal-header">
                     <h5 class="modal-title">导入Excel清单</h5>

+ 12 - 0
web/building_saas/main/js/models/fee_rate.js

@@ -373,6 +373,18 @@ var FeeRate = {
                 "rootProjectID":rootProjectID
             };
             CommonAjax.post('/feeRates/getChangeInfo', data, function (data) {
+                let newDataOther = [];
+                if (data.others.length > 0) {
+                    let fileHierarchyDatas = getFileHierarchyInfo(data.treeData);
+                    for(let fileHierarchyData of fileHierarchyDatas){
+                        let projData = _.find(data.others, {ID: fileHierarchyData.ID});
+                        if(projData){
+                            projData.name = fileHierarchyData.fileHierarchyName;
+                            newDataOther.push(projData);
+                        }
+                    }
+                    data.others = newDataOther;
+                }
                 callback(data);
             });
         };

+ 5 - 5
web/building_saas/main/js/views/main_tree_col.js

@@ -442,10 +442,10 @@ let colSettingObj = {
         projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
         if(!skipSetValue){
             //列设置将项目特征和工作内容都取消打钩后,更新快速列设置
-            if(!this.getVisible('itemCharacterText') && !this.getVisible('jobContentText')){
+            if(!this.getVisible('itemCharacterText')){
                 switchTznrHtml(true);
             }
-            if(this.getVisible('itemCharacterText') && this.getVisible('jobContentText')){
+            if(this.getVisible('itemCharacterText')){
                 switchTznrHtml(false);
             }
         }
@@ -513,16 +513,16 @@ function switchTznrHtml(show) {
 $('#switchTznr').click(function () {
     let me = colSettingObj;
     let cur = $(this).text();
-    if(cur.includes('显示特征内容')){
+    if(cur.includes('显示特征')){
         switchTznrHtml(false);
         me.setVisible('itemCharacterText', true);
-        me.setVisible('jobContentText', true);
+        //me.setVisible('jobContentText', true);
         me.updateColSetting(true);
     }
     else {
         switchTznrHtml(true);
         me.setVisible('itemCharacterText', false);
-        me.setVisible('jobContentText', false);
+        //me.setVisible('jobContentText', false);
         me.updateColSetting(true);
     }
 });

+ 35 - 1
web/building_saas/main/js/views/project_glj_view.js

@@ -1069,6 +1069,30 @@ function loadProjectGljSize() {
         me.mixRatioSpread?me.mixRatioSpread.refresh():'';
     });
 }
+//从其他建设项目中复制中,建设项目的文件层次结构名称和顺序
+function getFileHierarchyInfo(treeData){
+    let tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1});
+    tree.loadDatas(treeData);
+    let items = tree.items;
+    let rst = [];
+    function getFileHierarchyName(node){
+        let nodeName = node.data.name;
+        let name = [];
+        while (node.parent){
+            name.push(node.parent.data.name ? node.parent.data.name : '');
+            node = node.parent;
+        }
+        name = name.reverse();
+        name.push(nodeName);
+        return name.join('\\');
+    }
+    for(let node of items){
+        if(node.children.length === 0 ){//project
+            rst.push({ID: node.data.ID, fileHierarchyName: getFileHierarchyName(node)})
+        }
+    }
+    return rst;
+}
 
 
 $(function () {
@@ -1140,9 +1164,19 @@ $(function () {
                     }
                     $("#self-file").html(selfFileHtml);
                 }
-
                 // 其他建设项目数据
+                let newDataOther = [];
                 if (data.other.length > 0) {
+                    //转换成按项目管理顺序,名称包含文件夹层次
+                    let fileHierarchyDatas = getFileHierarchyInfo(data.treeData);
+                    for(let fileHierarchyData of fileHierarchyDatas){
+                        let projData = _.find(data.other, {ID: fileHierarchyData.ID});
+                        if(projData){
+                            projData.name = fileHierarchyData.fileHierarchyName;
+                            newDataOther.push(projData);
+                        }
+                    }
+                    data.other = newDataOther;
                     let otherProjectHtml = '';
                     let otherFileHtml = '';
                     for (let tmp of data.other) {

+ 2 - 2
web/building_saas/main/js/views/project_view.js

@@ -2045,7 +2045,7 @@ function getUploadSheets(){
 $('#customFile').change(function () {
     let file = $(this)[0];
     if(file.files.length > 0){
-        $('.custom-file-label').text(`${file.files[0].name} 准备导入上传`);
+        $('.custom-file-label').text(`${file.files[0].name}`);
         $('#uploadAlert').hide();
         console.log(file.files);
         //读取各个表及表名
@@ -2251,7 +2251,7 @@ function doAfterImport(resData){
 }
 //下载导入清单示例文件
 $('#uploadExample').click(function () {
-    window.location.href = '/bills/downloadExamp'
+    window.location.href = '/bills/downloadExamp';
 });
 
 $(function () {

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

@@ -72,6 +72,7 @@ var sideToolsObj = {
         sideResizeEles.id = id;
         if (show) {
             if(id === 'stdBillsGuidanceTab'){
+                //billsGuidance.refreshInsertRation();
                 sideResizeEles.nearElement.css('width', '72%');
                 sideResizeEles.farElement.css('width', '28%');
             }

+ 44 - 30
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -136,12 +136,31 @@ const billsGuidance = (function () {
         tree: null,
         controller: null,
         treeSetting: {
-            treeCol: 0,
+            treeCol: 1,
             emptyRows: 0,
             headRows: 1,
             headRowHeight: [40],
             defaultRowHeight: 21,
-            cols: [{
+            cols: [
+                {
+                    width: 35,
+                    readOnly: false,
+                    head: {
+                        titleNames: ["选择"],
+                        spanCols: [1],
+                        spanRows: [1],
+                        vAlign: [1],
+                        hAlign: [1],
+                        font: ["Arial"]
+                    },
+                    data: {
+                        field: "select",
+                        vAlign: 1,
+                        hAlign: 1,
+                        font: "Arial"
+                    }
+                },
+                {
                 width: 420,
                 readOnly: false,
                 head: {
@@ -158,30 +177,12 @@ const billsGuidance = (function () {
                     hAlign: 0,
                     font: "Arial"
                 }
-            },
-            {
-                width: 35,
-                readOnly: false,
-                head: {
-                    titleNames: ["选择"],
-                    spanCols: [1],
-                    spanRows: [1],
-                    vAlign: [1],
-                    hAlign: [1],
-                    font: ["Arial"]
-                },
-                data: {
-                    field: "select",
-                    vAlign: 1,
-                    hAlign: 1,
-                    font: "Arial"
-                }
             }
             ]
         },
         headers: [
-            {name: '项目指引', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left', formatter: '@'},
             {name: '选择', dataCode: 'select', width: 35, vAlign: 'center', hAlign: 'center', formatter: '@'},
+            {name: '项目指引', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left', formatter: '@'},
         ],
         events: {
             EditStarting: function (sender, args) {
@@ -193,6 +194,7 @@ const billsGuidance = (function () {
                 if(args.sheet.isEditing()){
                     args.sheet.endEdit(true);
                 }
+                refreshInsertRation();
             },
             CellDoubleClick: function (sender, args) {
                 if(!bills.tree || !bills.tree.selected){
@@ -301,8 +303,8 @@ const billsGuidance = (function () {
             }
             if(module === guideItem){
                 sheet.options.isProtected = true;
-                sheet.getRange(-1, 1, -1, 1).locked(false);
-                sheet.getRange(-1, 0, -1, 1).locked(true);
+                sheet.getRange(-1, 0, -1, 1).locked(false);
+                sheet.getRange(-1, 1, -1, 1).locked(true);
             }
             setOptions(module.workBook, options);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
@@ -358,18 +360,19 @@ const billsGuidance = (function () {
         const sheet = guideItem.workBook.getActiveSheet();
         renderSheetFunc(sheet, function(){
             for(let node of nodes){
-                sheet.setCellType(node.serialNo(), 1, node.data.type === itemType.ration ?  checkBox : base);
+                sheet.setCellType(node.serialNo(), 0, node.data.type === itemType.ration ?  checkBox : base);
             }
         });
     }
     //清单表焦点控制
     //@param {Number}row @return {void}
     function billsInitSel(row){
+        let guideSheet = guideItem.workBook.getActiveSheet();
+        cleanData(guideSheet, guideItem.headers, -1);
+        refreshInsertRation();
         if(!bills.tree){
             return;
         }
-        let guideSheet = guideItem.workBook.getActiveSheet();
-        cleanData(guideSheet, guideItem.headers, -1);
         let node = bills.tree.items[row];
         if(!node){
             return;
@@ -466,7 +469,7 @@ const billsGuidance = (function () {
         let rst = [];
         let itemSheet = guideItem.workBook.getActiveSheet();
         for(let row = 0; row < itemSheet.getRowCount(); row++){
-            let rowV = itemSheet.getValue(row, 1);
+            let rowV = itemSheet.getValue(row, 0);
             if(rowV){
                 rst.push(row);
             }
@@ -494,15 +497,26 @@ const billsGuidance = (function () {
                 let sheet = guideItem.workBook.getActiveSheet();
                 renderSheetFunc(sheet, function () {
                     for(let row = 0; row < sheet.getRowCount(); row++){
-                        if(sheet.getValue(row, 1)){
-                            sheet.setValue(row, 1, false);
+                        if(sheet.getValue(row, 0)){
+                            sheet.setValue(row, 0, false);
                         }
                     }
                 });
+                refreshInsertRation();
                 projectObj.setActiveCell('quantity', true);
             });
         }
     }
+    //更新插入定额按钮有效性
+    function refreshInsertRation(){
+        //勾选了定额,插入定额按钮才有效
+        if(getCheckedRows().length > 0){
+            $('#guidanceInsertRation').removeClass('disabled');
+        }
+        else {
+            $('#guidanceInsertRation').addClass('disabled');
+        }
+    }
     //展开至搜索出来点的节点
     //@param {Array}nodes @return {void}
     function expandSearchNodes(nodes){
@@ -646,7 +660,7 @@ const billsGuidance = (function () {
         }
     }
 
-    return {initViews, bindBtn, refreshWorkBook, bills};
+    return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, bills};
 })();
 
 $(document).ready(function(){

+ 13 - 12
web/building_saas/pm/html/project-management.html

@@ -63,23 +63,24 @@
                         </div>
                     </div>
                     <ul class="nav nav-pills flex-column">
-                        <li class="nav-item" data-toggle="tooltip" data-placement="right" data-original-title="全部">
-                            <a class="nav-link active" href="#pm_all" role="tab" id="tab_pm_all" data-toggle="tab" data-placement="right" data-original-title="全部"><i class="fa fa-bars"></i></a>
+                        <li class="nav-item" title="全部">
+                            <a class="nav-link active" href="#pm_all" role="tab" id="tab_pm_all" data-toggle="tab" title="全部"><i class="fa fa-bars"></i></a>
                         </li>
-                        <li class="nav-item">
-                            <a class="nav-link" href="javascript:void(0);"  data-toggle="tooltip" data-placement="right" data-original-title="最近使用"><i class="fa fa-bookmark"></i></a>
+                        <li class="nav-item" title="最近使用">
+                            <!-- data-toggle="tooltip" data-placement="right" data-original-title="最近使用"-->
+                            <a class="nav-link" href="javascript:void(0);"><i class="fa fa-bookmark"></i></a>
                         </li>
-                        <li class="nav-item" data-toggle="tooltip" data-placement="right" data-original-title="分享">
-                            <a class="nav-link" href="#pm_share" id="tab_pm_share" data-toggle="tab" data-placement="right" data-original-title="分享"><i class="fa fa-share-alt"></i></a>
+                        <li class="nav-item" title="分享">
+                            <a class="nav-link" href="#pm_share" id="tab_pm_share" data-toggle="tab"><i class="fa fa-share-alt"></i></a>
                         </li>
-                        <li class="nav-item">
-                            <a class="nav-link" href="javascript:void(0);"  data-toggle="tooltip" data-placement="right" data-original-title="协同工作"><i class="fa fa-users"></i></a>
+                        <li class="nav-item" title="协同工作">
+                            <a class="nav-link" href="javascript:void(0);"><i class="fa fa-users"></i></a>
                         </li>
-                        <li class="nav-item">
-                            <a class="nav-link" href="javascript:void(0);"  data-toggle="tooltip" data-placement="right" data-original-title="归档"><i class="fa fa-book"></i></a>
+                        <li class="nav-item" title="归档">
+                            <a class="nav-link" href="javascript:void(0);"><i class="fa fa-book"></i></a>
                         </li>
-                        <li class="nav-item" data-toggle="tooltip" data-placement="right" data-original-title="回收站">
-                            <a class="nav-link" href="#pm_gc" id="tab_pm_gc" data-toggle="tab" data-placement="right" data-original-title="回收站"><i class="fa fa-trash"></i></a>
+                        <li class="nav-item" title="回收站">
+                            <a class="nav-link" href="#pm_gc" id="tab_pm_gc" data-toggle="tab"><i class="fa fa-trash"></i></a>
                         </li>
                     </ul>
                 </div>