فهرست منبع

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

zhangweicheng 6 سال پیش
والد
کامیت
92adbde7a6

+ 1 - 1
modules/complementary_ration_lib/models/compleRationModel.js

@@ -172,7 +172,7 @@ class CompleRatoinDao {
                          glj = await complementaryGljModel.findOne({uesrId: userId, ID: rationGlj.gljId});
                     }
                     if(isDef(glj)){
-                        hintsArr.push(` ${glj.code} ${glj.name}${glj.specs ? ' ' + glj.specs : ''} ${glj.unit} ${rationGlj.consumeAmt}`);
+                        hintsArr.push(` ${glj.code} ${glj.name}${glj.specs ? '   ' + glj.specs : ''} &nbsp ${glj.unit}   ${rationGlj.consumeAmt}`);
                     }
                 }
                 hintsArr.push(`基价 元 ${ration.basePrice}`);

+ 1 - 1
modules/std_billsGuidance_lib/facade/facades.js

@@ -39,7 +39,7 @@ async function getLibWithBills(libID){
     if(!billsLib){
         throw '引用的清单规则库不存在!';
     }
-    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id -ruleText -recharge');
+    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id');
     return {guidanceLib: guidanceLib[0], bills};
 }
 

+ 16 - 7
modules/users/controllers/cld_controller.js

@@ -41,25 +41,34 @@ class CLDController {
      */
     async getUsersAndCompilationList(request, response) {
         let mobile = request.query.mobile;
+        let ssoID = request.query.ssoID;
         try {
             //获取用户信息
+            if (mobile === undefined && ssoID === undefined) {
+                throw '传参有误';
+            }
             let userModel = new UserModel();
-            let userData = await userModel.findDataByMobile(mobile);
+            let userData = '';
+            if (mobile !== undefined) {
+                userData = await userModel.findDataByMobile(mobile);
+            } else {
+                userData = await userModel.findDataBySsoId(ssoID);
+            }
             if (userData === null || userData === '') {
                 throw '不存在该建筑用户';
             }
 
             //获取编办列表
             let compilationModel = new CompilationModel();
-            let compilationList = await compilationModel.getList();
+            let compilationList = JSON.parse(JSON.stringify(await compilationModel.getList()));
             if (userData.upgrade_list !== undefined) {
-                let userUpgradeList = userData.upgrade_list;
-                for (let index in userUpgradeList) {
-                    let oneCompilationIndex = compilationList.findIndex(function (item) {
-                        return item.id === userUpgradeList[index].compilationID;
+                let userUpgradeList = JSON.parse(JSON.stringify(userData.upgrade_list));
+                for (let i in userUpgradeList) {
+                    let oneCompilationIndex = await compilationList.findIndex(function (item) {
+                        return item._id === userUpgradeList[i].compilationID;
                     });
                     if (oneCompilationIndex !== -1) {
-                        compilationList[oneCompilationIndex].isUpgrade = userUpgradeList[index].isUpgrade;
+                        compilationList[oneCompilationIndex].isUpgrade = userUpgradeList[i].isUpgrade;
                     }
                 }
             }

+ 4 - 2
public/web/tree_sheet/tree_sheet_controller.js

@@ -3,7 +3,7 @@
  */
 
 var TREE_SHEET_CONTROLLER = {
-    createNew: function (tree, sheet, setting) {
+    createNew: function (tree, sheet, setting, loadSheetHeader = true) {
         var controller = function () {
             this.tree = tree;
             this.sheet = sheet;
@@ -12,7 +12,9 @@ var TREE_SHEET_CONTROLLER = {
                 refreshBaseActn: null,
                 treeSelectedChanged: null
             };
-            TREE_SHEET_HELPER.loadSheetHeader(this.setting, this.sheet);
+            if(loadSheetHeader){
+                TREE_SHEET_HELPER.loadSheetHeader(this.setting, this.sheet);
+            }
         };
 
         controller.prototype.showTreeData = function () {

+ 11 - 4
web/building_saas/main/html/main.html

@@ -111,9 +111,9 @@
                           <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单指引</a>
                           </li>
-                          <li class="nav-item">
+                         <!-- <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsTab' relaPanel="#qd">清单规则</a>
-                          </li>
+                          </li>-->
                           <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id="stdRationTab" relaPanel="#de">定额库</a>
                           </li>
@@ -311,10 +311,10 @@
                                                   </div>
                                               </div>
                                           </div>
-                                          <div class="col p-0">
+                                          <!--<div class="col p-0">
                                               <button id="guidanceInsertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
                                               <button id="guidanceInsertBills" class="btn btn-primary btn-sm" type="button">插入清单</button>
-                                          </div>
+                                          </div>-->
                                       </div>
                                       <!--搜索结果窗体-->
                                       <div class="side-search-box col-12 p-2" id="billsGuidanceSearchResult" style="display: none;">
@@ -330,6 +330,13 @@
                                       </div>
                                   </div>
                                   <div class="resize" id="zyResize" style="background: #F1F1F1"></div>
+                                  <div class="p-1 row" style="background: #F1F1F1">
+                                      <div class="col">
+                                          <button id="guidanceInsertBills" class="btn btn-primary btn-sm" type="button">插入清单</button>
+                                          <button id="guidanceInsertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
+                                          <button id="guidanceInsertBillsAndRation" class="btn btn-primary btn-sm" type="button">插入清单和定额</button>
+                                      </div>
+                                  </div>
                                   <div class="bottom-content">
                                       <div class="main-data-side-zi" id="billsGuidance_items"></div>
                                   </div>

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

@@ -580,7 +580,7 @@ var projectObj = {
         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){
+              /*  if(billsLibObj.stdBillsTree === null){
                     billsLibObj.doAfterLoadBills = function () {
                         this.locateAtBills(code);
                         this.doAfterLoadBills = null;
@@ -589,7 +589,18 @@ var projectObj = {
                 else {
                     billsLibObj.locateAtBills(code);
                 }
-                if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();
+                if(!$("#qd").is(":visible"))  $('#stdBillsTab').click();*/
+                if(!billsGuidance.bills.tree){
+                    doAfterLoadGuidance = function () {
+                        billsGuidance.locateAtBills(code);
+                        doAfterLoadGuidance = null;
+                    }
+                } else {
+                    billsGuidance.locateAtBills(code);
+                }
+                if(!$("#zy").is(":visible"))  {
+                    $('#stdBillsGuidanceTab').click();
+                }
             }
         }
         if(node.sourceType == ModuleNames.ration){ //在定额编码中双击,如果右侧定额库没有展开,则自动展开。

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

@@ -17,6 +17,7 @@ slideResize(sideResizeEles, {min: 250, max: $('#zaojiashu').width()-260}, 'width
     projectObj.refreshMainSpread();
     refreshSubSpread();
     if(sideResizeEles.id === 'stdBillsGuidanceTab'){
+        billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers)
         billsGuidance.refreshWorkBook();
     }
     else if(sideResizeEles.id === 'stdRationTab'){
@@ -87,8 +88,8 @@ var sideToolsObj = {
         if (show) {
             if(id === 'stdBillsGuidanceTab'){
                 //billsGuidance.refreshInsertRation();
-                sideResizeEles.nearElement.css('width', '72%');
-                sideResizeEles.farElement.css('width', '28%');
+                sideResizeEles.nearElement.css('width', '66.666667%');
+                sideResizeEles.farElement.css('width', '33.333333%');
             }
             else {
                 sideResizeEles.nearElement.css('width', '66.666667%');

+ 76 - 13
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -8,6 +8,9 @@
  * @version
  */
 
+//清单指引/精灵获取完清单数据后的回调函数
+let doAfterLoadGuidance = null;
+
 const billsGuidance = (function () {
     let currentLib = null;
     //库类型
@@ -33,7 +36,7 @@ const billsGuidance = (function () {
             headRowHeight: [40],
             defaultRowHeight: 21,
             cols: [{
-                width: 160,
+                width: 140,
                 readOnly: true,
                 head: {
                     titleNames: ["项目编码"],
@@ -50,7 +53,7 @@ const billsGuidance = (function () {
                     font: "Arial"
                 }
             }, {
-                width: 220,
+                width: 190,
                 readOnly: true,
                 head: {
                     titleNames: ["项目名称"],
@@ -70,7 +73,6 @@ const billsGuidance = (function () {
                {
                 width: 45,
                 readOnly: true,
-                showHint: true,
                  head: {
                      titleNames: ["计量单位"],
                      spanCols: [1],
@@ -89,8 +91,8 @@ const billsGuidance = (function () {
             ]
         },
         headers: [
-            {name: '项目编码', dataCode: 'code', width: 160, vAlign: 'center', hAlign: 'left', formatter: '@'},
-            {name: '项目名称', dataCode: 'name', width: 220, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '项目编码', dataCode: 'code', width: 140, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '项目名称', dataCode: 'name', width: 190, vAlign: 'center', hAlign: 'left', formatter: '@'},
             {name: '单位', dataCode: 'unit', width: 45, vAlign: 'center', hAlign: 'center', formatter: '@'},
         ],
         events: {
@@ -126,11 +128,11 @@ const billsGuidance = (function () {
                         } else {
                             ConfirmModal.stdBillsUnit.check(node.data, function (std) {
                                 canAdd = ProjectController.addBills(projectObj.project, projectObj.mainController, std);
-                                if(canAdd !== null || canAdd !== false){
+                               /* if(canAdd !== null || canAdd !== false){
                                     //插入选中的定额
                                     let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
                                     insertRations(addRationDatas);
-                                }
+                                }*/
                                 if(canAdd === false && $.bootstrapLoading.isLoading()){
                                     $.bootstrapLoading.end();
                                 }
@@ -143,11 +145,11 @@ const billsGuidance = (function () {
                     }
                     else {
                         let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, node);
-                        if(insert){
+                        /*if(insert){
                             //插入选中的定额
                             let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
                             insertRations(addRationDatas);
-                        }
+                        }*/
                     }
                 }
                 else {
@@ -317,8 +319,8 @@ const billsGuidance = (function () {
             ]
         },
         headers: [
-            {name: '施工工序', dataCode: 'name', width: 250, vAlign: 'center', hAlign: 'center', formatter: '@'},
-            {name: '选项', dataCode: 'options', width: 250, vAlign: 'center', hAlign: 'left', formatter: '@'},
+            {name: '施工工序', dataCode: 'name', width: 250, rateWidth: 0.5, vAlign: 'center', hAlign: 'center', formatter: '@'},
+            {name: '选项', dataCode: 'options', width: 250, rateWidth: 0.5,  vAlign: 'center', hAlign: 'left', formatter: '@'},
         ],
         events: {
             CellClick: function (sender, args) {
@@ -398,6 +400,27 @@ const billsGuidance = (function () {
             workBook.bind(Events[event], events[event]);
         }
     }
+    //根据宽度比例设置列宽
+    //@param {Object}workBook {Number}workBookWidth {Array}headers @return {void}
+    function setColumnWidthByRate(workBook, workBookWidth, headers) {
+        if(workBook){
+            const sheet = workBook.getActiveSheet();
+            sheet.suspendEvent();
+            sheet.suspendPaint();
+            for(let col = 0; col < headers.length; col++){
+                if(headers[col]['rateWidth'] !== undefined && headers[col]['rateWidth'] !== null && headers[col]['rateWidth'] !== ''){
+                    sheet.setColumnWidth(col, workBookWidth * headers[col]['rateWidth'], GC.Spread.Sheets.SheetArea.colHeader)
+                }
+                else {
+                    if(headers[col]['headerWidth'] !== undefined && headers[col]['headerWidth'] !== null && headers[col]['headerWidth'] !== ''){
+                        sheet.setColumnWidth(col, headers[col]['headerWidth'], GC.Spread.Sheets.SheetArea.colHeader)
+                    }
+                }
+            }
+            sheet.resumeEvent();
+            sheet.resumePaint();
+        }
+    }
     //建表
     //@param {Object}module @return {void}
     function buildSheet(module) {
@@ -425,6 +448,10 @@ const billsGuidance = (function () {
             }
             setOptions(module.workBook, options);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
+            if(module === elfItem){
+                console.log($('#zy').width());
+                setColumnWidthByRate(elfItem.workBook, $('#zy').width(), elfItem.headers)
+            }
             bindEvent(module.workBook, module.events);
         }
     }
@@ -449,7 +476,7 @@ const billsGuidance = (function () {
     //@param {Object}module {Object}sheet {Object}treeSetting {Array}datas
     function initTree(module, sheet, treeSetting, datas){
         module.tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
-        module.controller = TREE_SHEET_CONTROLLER.createNew(module.tree, sheet, treeSetting);
+        module.controller = TREE_SHEET_CONTROLLER.createNew(module.tree, sheet, treeSetting, false);
         module.tree.loadDatas(datas);
         if(module === bills){
             initExpandStat();
@@ -917,6 +944,24 @@ const billsGuidance = (function () {
             }
         });
     }
+    //根据编码定位至清单精灵库中
+    //
+    function locateAtBills(code) {
+        let nineCode = code.substring(0, 9);
+        let items = bills.tree.items;
+        let locateBills = _.find(items, function(item){
+            return item.data.code === nineCode;
+        });
+        if(locateBills){
+            expandSearchNodes([locateBills]);
+            sessionStorage.setItem('stdBillsGuidanceExpState', bills.tree.getExpState(bills.tree.items));
+        }
+        let sheet = bills.workBook.getActiveSheet();
+        let locateRow = locateBills ? locateBills.serialNo() : 0;
+        sheet.setActiveCell(locateRow, 0);
+        billsInitSel(locateRow);
+        sheet.showRow(locateRow, GC.Spread.Sheets.VerticalPosition.center);
+    }
     //初始选择清单指引库
     //@param {Number}libID @return {void}
     function libInitSel(libID){
@@ -955,6 +1000,9 @@ const billsGuidance = (function () {
             setTagForHint(bills.tree.items);
             //默认初始节点
             billsInitSel(0);
+            if(doAfterLoadGuidance){
+                doAfterLoadGuidance();
+            }
             $.bootstrapLoading.end();
         }, function () {
             $.bootstrapLoading.end();
@@ -1148,6 +1196,21 @@ const billsGuidance = (function () {
             }
             if(bills.tree.selected.children.length === 0){
                 let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
+                /*if(insert){
+                    //插入选中的定额
+                    let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
+                    insertRations(addRationDatas);
+                }*/
+            }
+        });
+        //插入清单和定额
+        $('#guidanceInsertBillsAndRation').click(function () {
+            //插入清单
+            if(!bills.tree || !bills.tree.selected){
+                return;
+            }
+            if(bills.tree.selected.children.length === 0){
+                let insert = billsLibObj.insertBills(stdBillsJobData, stdBillsFeatureData, bills.tree.selected);
                 if(insert){
                     //插入选中的定额
                     let addRationDatas = currentLib.type && currentLib.type === libType.elf ? getInsertElfRationData() : getInsertRationData(getCheckedRows());
@@ -1246,7 +1309,7 @@ const billsGuidance = (function () {
         }
     }
 
-    return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, bills};
+    return {initViews, bindBtn, refreshWorkBook, refreshInsertRation, setColumnWidthByRate, locateAtBills, bills, elfItem};
 })();
 
 $(document).ready(function(){