Browse Source

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/ConstructionCost

zhangweicheng 4 years atrás
parent
commit
7ae1146049

+ 1 - 0
modules/all_models/std_price_info_areas.js

@@ -3,6 +3,7 @@ const mongoose = require('mongoose');
 
 const Schema = mongoose.Schema;
 const priceInfoArea = new Schema({
+    serialNo: Number,
     ID: String,
     compilationID: String,
     name: String

+ 19 - 1
modules/main/facade/block_lib_facade.js

@@ -17,6 +17,24 @@ module.exports = {
 // userID、compilationID
 async function getLibNames(data) {
     let libNames = await blModel.find({userID: data.userID, compilationID: data.compilationID}, ["libID","libName","-_id"]);
+    // 块模板库改成组价模板,兼容旧数据
+    const bulks = [];
+    const reg = /块模板库/;
+    libNames.forEach(lib => {
+        if (reg.test(lib.libName)) {
+            const newLibName = lib.libName.replace('块模板库', '组价模板');
+            lib.libName = newLibName;
+            bulks.push({
+                updateOne: {
+                    filter: { libID: lib.libID },
+                    update: { libName: newLibName }
+                }
+            });
+        }
+    });
+    if (bulks.length) {
+        await blModel.bulkWrite(bulks);
+    }
     return libNames;
 };
 
@@ -79,7 +97,7 @@ async function copyTemplateLib(userID, userName, compilationID) {
         userID: userID,
         compilationID: compilationID,
         libID: uuid.v1(),
-        libName: `${userName}的块模板库`,
+        libName: `${userName}的组价模板`,
         datas: template.datas,
         share: template.share
     };

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

@@ -220,7 +220,7 @@
                       if (G_SHOW_BLOCK_LIB) {
                         $("#div_more_dropdown_right").append(
                           '<a class="dropdown-item right-nav-link" href="javascript:void(0)" ' +
-                          'id="blockLibTab" relaPanel="#kmbk">块模板库</a>');
+                          'id="blockLibTab" relaPanel="#kmbk">组价模板</a>');
                       }
                     </script>
                   </div>
@@ -940,10 +940,10 @@
                     <div class="top-content" style="overflow: hidden" id="kmbkTopDiv">
                       <div id="div_block_tree"></div>
                     </div>
-                    <div class="resize-y" id="kmbkResizeA"></div>
+<!--                     <div class="resize-y" id="kmbkResizeA"></div>
                     <div class="bottom-content" id="kmbkMidDiv">
                       <div id="div_block_bill"></div>
-                    </div>
+                    </div> -->
                     <div class="resize-y" id="kmbkResizeB"></div>
                     <div id="kmbkBottomDiv">
                       <div id="div_block_ration"></div>

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

@@ -55,13 +55,13 @@ var blockLibObj = {
     rationSheet: null,
     rationSetting: {
         header: [
-            {headerName: "编码", headerWidth: 45, dataCode: "code", dataType: "String", hAlign: "center"},
-            {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
-            {headerName: "单位", headerWidth: 40, dataCode: "unit", dataType: "String", hAlign: "center"},
-            {headerName: "含量", headerWidth: 40, dataCode: "contain", dataType: "Number"},
-            {headerName: "取费专业", headerWidth: 70, dataCode: "programName", dataType: "String", hAlign: "center"},
+            {headerName: "编码", headerWidth: 50, dataCode: "code", dataType: "String", hAlign: "center"},
+            {headerName: "名称", headerWidth: 200, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 70, dataCode: "unit", dataType: "String", hAlign: "center"},
+            /* {headerName: "含量", headerWidth: 40, dataCode: "contain", dataType: "Number"},
+            {headerName: "取费专业", headerWidth: 70, dataCode: "programName", dataType: "String", hAlign: "center"}, */
             {headerName: "综合单价", headerWidth: 70, dataCode: "unitFee", dataType: "Number"},
-            {headerName: "子目换算状态", headerWidth: 90, dataCode: "adjustState", dataType: "String"}
+           //{headerName: "子目换算状态", headerWidth: 90, dataCode: "adjustState", dataType: "String"}
         ],
         view: {
             lockColumns: [0, 1, 2, 3, 4, 5, 6]
@@ -121,10 +121,10 @@ var blockLibObj = {
         };
         showBlockTree(me.mainDatas);
 
-        me.billSpread = sheetCommonObj.buildSheet($('#div_block_bill')[0], me.billSetting, 1);
+        /* me.billSpread = sheetCommonObj.buildSheet($('#div_block_bill')[0], me.billSetting, 1);
         me.billSheet = me.billSpread.getSheet(0);
         sheetCommonObj.spreadDefaultStyle(me.billSpread);
-        me.billSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
+        me.billSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader); */
 
         me.rationSpread = sheetCommonObj.buildSheet($('#div_block_ration')[0], me.rationSetting, 1);
         me.rationSheet = me.rationSpread.getSheet(0);
@@ -142,13 +142,13 @@ var blockLibObj = {
         if (node.data.type == 2){
             let bill = node.data;
             let rations = bill.children;
-            sheetCommonObj.showData(me.billSheet, me.billSetting, [bill]);
+            //sheetCommonObj.showData(me.billSheet, me.billSetting, [bill]);
             let rCount = (rations.length > 0) ? rations.length : 1;
             me.rationSheet.setRowCount(rCount, GC.Spread.Sheets.SheetArea.viewport);
             sheetCommonObj.showData(me.rationSheet, me.rationSetting, rations);
         }
         else{
-            sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
+            //sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
             sheetCommonObj.cleanSheet(me.rationSheet, me.rationSetting, 1);
         }
     },

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

@@ -1633,6 +1633,7 @@ let projectGljObject = {
   createSelectOptions: function (ele, opts, isArea) {
     ele.empty();
     let str = `<option value=""></option>`;
+    opts.sort((a, b) => a.serialNo - b.serialNo);
     for (let o of opts) {
       if (isArea == true) {
         str += `<option value="${o.ID}">${o.name}</option>`

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

@@ -3337,7 +3337,8 @@ $(function () {
                 let ration_glj_Map = _.groupBy(projectObj.project.ration_glj.datas, 'rationID');
                 vBlock_WC.datas.push(BlockController.getNodeDatas(node, ration_glj_Map));
                 vBlock_WC = JSON.parse(JSON.stringify(vBlock_WC));
-                let fileName = node.data.code + ' ' + node.data.name + ' ' + node.data.unit;
+                const unitFee = (node.data.feesIndex && node.data.feesIndex.common) ? node.data.feesIndex.common.unitFee : 0;
+                let fileName = node.data.code + ' ' + node.data.name + ' ' + node.data.unit + ' ' + unitFee;
                 fileName = fileName.replace(/^\s+|\s+$/g, "");    // 只去两头空格
 
                 let extN = blockLibObj.getSameNameNode(fileName);

+ 37 - 4
web/building_saas/main/js/views/side_tools.js

@@ -119,8 +119,9 @@ SlideResize.verticalSlide(bookMarkLibResize.eleObj, bookMarkLibResize.limit, fun
     locateObject.refreshWorkBook();
 });
 
+// 块模板库(旧:上中下结构)
 // 块模板库上下拖动(上中)
-let blockLibTopMid = {};
+/* let blockLibTopMid = {};
 blockLibTopMid.eleObj = {
     module: 'kmbk',
     resize: $('#kmbkResizeA'),
@@ -170,7 +171,33 @@ let blockLibMulti = {
         {container: $('#kmbkBottomDiv'), spread: $('#div_block_ration'), notSpread: 0, defaultProportion: 0.25},
     ],
     totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-5*2`
-};
+};*/
+
+// 组价模板(新的块模板库,上下结构)
+function getBlockResize() {
+    let resizeObj = {};
+    resizeObj.eleObj = {
+        module: 'zjmb',
+        resize: $('#kmbkResizeB'),
+        top: $('#kmbkTopDiv'),
+        topSpread: $('#div_block_tree'),
+        bottom: $('#kmbkBottomDiv'),
+        bottomSpread: $('#div_block_ration')
+    };
+    resizeObj.limit = {
+        min: 100,
+        max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-100-5`,
+        notTopSpread: 0,
+        notBottomSpread: 0,
+        totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-5`
+    };
+    return resizeObj;
+}
+
+let blockLibResize = getBlockResize();
+SlideResize.verticalSlide(blockLibResize.eleObj, blockLibResize.limit, function () {
+    blockLibObj.refreshSpread();
+});
 
 //加载各库内部上下高度(有的库需要上下拖动)
 function loadSideToolsHeight() {
@@ -184,9 +211,12 @@ function loadSideToolsHeight() {
         let options = $("input[name='content_type']:checked").val();
         locateObject.refreshView(options, true);
     } else if ($('#kmbk').is(':visible')) {
-        SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+        SlideResize.loadVerticalHeight(blockLibResize.eleObj.module, blockLibResize.eleObj, blockLibResize.limit, function () {
             blockLibObj.refreshSpread();
         });
+        /* SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+            blockLibObj.refreshSpread();
+        }); */
     }
 }
 
@@ -207,7 +237,10 @@ var sideToolsObj = {
                         sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 30, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
                     });
                 } else if (id === 'blockLibTab') {//块模板库
-                    SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+                    /* SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
+                        blockLibObj.refreshSpread();
+                    }); */
+                    SlideResize.loadVerticalHeight(blockLibResize.eleObj.module, blockLibResize.eleObj, blockLibResize.limit, function () {
                         blockLibObj.refreshSpread();
                     });
                 }

+ 3 - 1
web/building_saas/pm/html/project-management-share.html

@@ -53,7 +53,9 @@
                     <span style="display: none" id="copyShareEng-info" class="form-text text-danger">单项工程不可为空</span>
                 </div>
                 <div class="form-group">
-                    <p id="copyShare_name">拷贝后,工程将重命名为 "<b>建筑工程2(张三共享)</b>"</p>
+                    <label>单位工程</label>
+                    <input id="copyShare_name" class="form-control"></input>
+                    <span style="display: none" id="copyShareTender-info" class="form-text text-danger">已存在同名单位工程</span>
                 </div>
             </div>
             <div class="modal-footer">

+ 12 - 15
web/building_saas/pm/js/pm_share.js

@@ -813,7 +813,7 @@ const pmShare = (function () {
                   },
                   callback: function (key, opt) {
                       if($(".p-title").text().includes('免费')){
-                        hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单个分段进行拷贝');
+                        hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单位工程进行拷贝');
                         return;
                       }
                       copyContructionProject(tree.selected);
@@ -913,15 +913,20 @@ const pmShare = (function () {
                 return;
             }
             let copyMap = {copy: null, update: null};
-            let newName = getCopyName(selected);
+            let newName = $('#copyShare_name').val();
+            if (!newName) {
+                $('#copyShareTender-info').text('单位工程名称不可为空');
+                $('#copyShareTender-info').show();
+                return;
+            }
             //获取单项工程的单位工程
             let tenderQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], userID: userID, ParentID: engID};
             const rstData = await ajaxPost('/pm/api/getProjectsByQuery', {user_id: userID, query: tenderQuery, options: '-_id -property'}, false, 10000);
             let updateTender = null;
             for(let tender of rstData){
                 if(tender.name === newName){
-                    $('#copyShare_name').text('已存在此单位工程。');
-                    $('#copyShare_name').addClass('text-danger');
+                    $('#copyShareTender-info').text('已存在同名单位工程');
+                    $('#copyShareTender-info').show();
                     return;
                 }
                 if(tender.NextSiblingID == -1){
@@ -1125,27 +1130,19 @@ const pmShare = (function () {
         $('#copyShare').on('shown.bs.modal', function () {
             setCopyModal();
             //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
+            $('#copyShare_name').val(shareSeleted.data.name);
         });
         //拷贝工程改变选择建设项目
         $('#copyShare_selectProj').change(function () {
-            //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
             $('#copyShareProj-info').hide();
             $('#copyShareEng-info').hide();
+            $('#copyShareTender-info').hide();
             let curSelID = $(this).select().val();
             setEng(parseInt(curSelID));
         });
         //拷贝工程改变选择单项工程
         $('#copyShare_selectEng').change(function () {
-            //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
+            $('#copyShareTender-info').hide();
         });
         //确认拷贝
         $('#copyShare_confirm').click(function () {

+ 1 - 1
web/common/components/share/index.js

@@ -480,7 +480,7 @@ const SHARE_TO = (() => {
             $('#share-hint').text('');
             const { isFree, sharedUsers, recentUsers, contacts } = await getInitalData(projectID);
             if (isFree) {
-                hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单个分段进行分享。');
+                hintBox.versionBox('此功能仅在专业版中提供,免费公用版可选择单位工程进行分享。');
             } else {
                 curSharedUsers = sharedUsers;
                 initSharedView(sharedUsers);