Просмотр исходного кода

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

TonyKang 7 лет назад
Родитель
Сommit
6bf740a24e

+ 1 - 0
modules/all_models/stdBills_bills.js

@@ -14,6 +14,7 @@ const stdBills_bills = new Schema({
             ruleText: String,
             engineering: Number, //工程专业,填计算程序工程专业ID
             Expression: String,
+            comment: String, //备注,清单精灵处输入
             jobs: [],
             items: [],
             recharge:String,

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

@@ -127,7 +127,7 @@ async function getLibWithBills(libID){
     if(!billsLib){
         throw '引用的清单规则库不存在!';
     }
-    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id code name ID NextSiblingID ParentID jobs items');
+    let bills = await stdBillsModel.find({billsLibId: billsLib.billsLibId}, '-_id code name ID NextSiblingID ParentID jobs items comment');
     return {guidanceLib: guidanceLib[0], bills};
 }
 

+ 68 - 0
web/common/js/slideResize.js

@@ -184,4 +184,72 @@ function setDefaultSize(tag,eles,type) {
         eles.farSpread[type](totalHeight - nearSize);
         eles.farElement[type](totalHeight - nearSize + navSize);
     }
+}
+
+/*
+* div之间的水平拖动,适应各种情况
+* module: 所属模块,防止不同页面相同id导致localstorage数据被覆盖
+* eleObj: resize, parent, left, right
+* limit: min, max
+* */
+function horizontalSlide(module, eleObj, limit, callback) {
+    const triggerCBSize = 5;
+    let drag = false,
+        startPoint = 0,
+        leftWidth = 0,
+        rightWidth = 0,
+        leftChange = 0,
+        rightChange = 0,
+        limitMax = 0;
+
+    eleObj.resize.mousedown(function (e) {
+        drag = true;
+        startPoint = e.clientX;
+        leftWidth = eleObj.left.width();
+        rightWidth = eleObj.right.width();
+        limitMax = eval(limit.max);
+    });
+    $('body').mousemove(function (e) {
+        if (drag) {
+            let moveSize = e.clientX - startPoint;
+            leftChange = leftWidth + moveSize;
+            leftChange = leftChange < limit.min ? limit.min : leftChange;
+            leftChange = leftChange > limitMax ? limitMax - 3 : leftChange;
+            rightChange = rightWidth - moveSize;
+            rightChange = rightChange < limit.min ? limit.min : rightChange;
+            rightChange = rightChange > limitMax ? limitMax - 3 : rightChange;
+            let leftPercentWidth = leftChange / eleObj.parent.width() * 100 + '%',
+                rightPercentWidth = rightChange / eleObj.parent.width() * 100 + '%';
+            eleObj.left.css('width', leftPercentWidth);
+            eleObj.right.css('width', rightPercentWidth);
+            mouseMoveCount += Math.abs(moveSize);
+            if (mouseMoveCount > triggerCBSize && callback) {
+                callback();
+                mouseMoveCount = 0;
+            }
+        }
+    });
+    $('body').mouseup(function (e) {
+        if (drag) {
+            drag = false;
+            mouseMoveCount = 0;
+            //将宽度信息存储到localstorage
+            let leftWidthInfo = eleObj.left[0].style.width;
+            setLocalCache(`${module}${eleObj.left.attr('id')}Width`, leftWidthInfo);
+            let rightWidthInfo = eleObj.right[0].style.width;
+            setLocalCache(`${module}${eleObj.right.attr('id')}Width`, rightWidthInfo);
+        }
+    });
+}
+
+function loadHorizonWidth(module, eles, callback) {
+    for (let ele of eles) {
+        let cache = getLocalCache(`${module}${ele.attr('id')}Width`);
+        if (cache) {
+            ele.css('width', cache);
+        }
+    }
+    if (callback) {
+        callback();
+    }
 }

+ 8 - 2
web/maintain/billsGuidance_lib/html/zhiyin.html

@@ -12,6 +12,7 @@
     <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
     <link rel="stylesheet" href="/lib/jquery-contextmenu/jquery.contextMenu.css" type="text/css">
     <script>
+        let userAccount = '<%= userAccount %>';
     </script>
 </head>
 
@@ -33,8 +34,13 @@
         <div class="content">
             <div class="container-fluid">
                 <div class="row">
-                  <div id="billsSpread" class="main-side col-lg-4 p-" style="margin: 0; padding: 0;">
-                  </div>
+                    <div class="main-side col-lg-4 p-0">
+                        <div id="billsSpread" class="main-side-top">
+                        </div>
+                        <div class="main-side-bottom">
+                            <textarea class="form-control"></textarea>
+                        </div>
+                    </div>
                   <div class="main-content col-lg-4 p-" style="margin: 0; padding: 0;">
                     <div class="toolsbar px-1 d-flex justify-content-between">
                       <div class="tools-btn btn-group align-top">

+ 51 - 10
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -331,7 +331,8 @@ const billsGuidance = (function () {
             return;
         }
         bills.tree.selected = node;
-
+        //显示备注
+        $('.main-side-bottom').find('textarea').val(node.data.comment ? node.data.comment : '');
         if(!node.guidance.tree){
             getItemsByBills(libID, node.data.ID, function (rstData) {
                 initTree(node.guidance, guideSheet, guideItem.treeSetting, rstData);
@@ -814,10 +815,12 @@ const billsGuidance = (function () {
             });
         });
     }
+    let billsLibId = 0;
     //获取指引库信息及关联的清单
     //@param {Number}libID {Function}callback @return {Object}
     function getLibWithBills(libID, callback){
         CommonAjax.post('/billsGuidance/api/getLibWithBills', {libID: libID}, function (rstData) {
+            billsLibId = rstData.guidanceLib.billsLibId;
             initRationLibs(rstData.guidanceLib.compilationId);
             bills.cache = rstData.bills;
             initLibName(rstData.guidanceLib.name);
@@ -859,6 +862,14 @@ const billsGuidance = (function () {
             setBillsHint(bills.tree.items, stdBillsJobData, stdBillsFeatureData);
         }
     }
+    //更新清单备注
+    function updateBillsComment(updateData, callback) {
+        CommonAjax.post('/stdBillsEditor/updateBills', updateData, function () {
+            if (callback) {
+                callback();
+            }
+        });
+    }
     //更新项目指引
     //@param {Array}updateDatas {Function}callback @return {void}
     function updateGuideItems(updateDatas, callback){
@@ -1669,20 +1680,50 @@ const billsGuidance = (function () {
             //恢复章节树下的定额
             sectionInitSel(section.workBook.getActiveSheet().getActiveRowIndex());
         });
+        let keyupTime = 0,
+            delayTime = 500;
+        function delayKeyup(callback) {
+            let nowTime = Date.now();
+            keyupTime = nowTime;
+            setTimeout(function () {
+                if (nowTime - keyupTime == 0) {
+                    callback();
+                }
+            }, delayTime);
+        }
         //执行搜索
         $('#searchText').keyup(function (e) {
-            $('#searchBtn').click();
+            delayKeyup(function () {
+                $('#searchBtn').click();
+            });
         });
-        //编辑备注
+        //编辑清单备注
+        $('.main-side-bottom').find('textarea').keyup(function () {
+            let me = this;
+            let node = bills.tree.selected;
+            let comment = $(me).val();
+            delayKeyup(function () {
+                if (node) {
+                    let updateData = {lastOperator: userAccount, billsLibId: billsLibId, updateId: node.getID(), field: 'comment', data: comment};
+                    updateBillsComment(updateData, function () {
+                        node.data.comment = comment;
+                    })
+                }
+            });
+        });
+        //编辑选项备注
         $('.main-bottom-content').find('textarea').keyup(function () {
+            let me = this;
             let node = bills.tree.selected.guidance.tree.selected;
-            if(node){
-                let comment = $(this).val();
-                let updateDatas = [{updateType: updateType.update, findData: {ID: node.getID()}, updateData: {comment: comment}}];
-                updateGuideItems(updateDatas, function (rstData) {
-                    node.data.comment = comment;
-                });
-            }
+            let comment = $(me).val();
+            delayKeyup(function () {
+                if(node){
+                    let updateDatas = [{updateType: updateType.update, findData: {ID: node.getID()}, updateData: {comment: comment}}];
+                    updateGuideItems(updateDatas, function (rstData) {
+                        node.data.comment = comment;
+                    });
+                }
+            });
         });
         //定额高度拖动调整
         slideResize(rationLibResizeEles, {min: 147, max: 680}, 'height', function() {

+ 4 - 1
web/maintain/billsGuidance_lib/js/global.js

@@ -5,7 +5,10 @@ function autoFlashHeight(){
     var toolsBar = $(".toolsbar").height();
     var toolsBarHeightQ = $(".tools-bar-height-q").height();
     $(".content").height($(window).height()-headerHeight);
-    $(".main-side").height($(window).height()-headerHeight-2);
+    $(".main-side-top").height(($(window).height()-headerHeight) * 0.85);
+    $(".main-side-bottom").height(($(window).height()-headerHeight) * 0.15);
+    $('.main-side-bottom').find('textarea').height($('.main-side-bottom').height() - 20);
+    $('.main-side-bottom').find('textarea').width($('.main-side-bottom').width() - 25);
     $(".fluid-content").height($(window).height()-headerHeight-1);
     $(".side-content").height($(window).height()-headerHeight);
     $(".poj-list").height($(window).height()-headerHeight);

+ 1 - 1
web/maintain/ration_repository/js/ration_assist.js

@@ -8,7 +8,7 @@ var rationAssistOprObj = {
     setting: {
         header:[
             {headerName:"调整名称",headerWidth:110,dataCode:"name", dataType: "String", hAlign: "left"},
-            {headerName:"辅助定额号",headerWidth:90,dataCode:"assistCode", dataType: "String", hAlign: "center"},
+            {headerName:"辅助定额号",headerWidth:90,dataCode:"assistCode", dataType: "String", hAlign: "center", formatter: "@"},
             {headerName:"标准值",headerWidth:60,dataCode:"stdValue", dataType: "String", hAlign: "right"},
             {headerName:"步距",headerWidth:60,dataCode:"stepValue", dataType: "String", hAlign: "right"},
             {headerName:"精度",headerWidth:60,dataCode:"decimal",  dataType: "String", hAlign: "right"},

+ 10 - 5
web/maintain/std_glj_lib/html/gongliao.html

@@ -41,9 +41,9 @@
     <div class="main">
         <div class="content" style="z-index: 700; overflow: hidden">
             <div class="container-fluid">
-                <div class="row">
+                <div class="row" id="dataRow">
                     <!--org 3:7:2-->
-                  <div class="main-side col-lg-3 p-0" style="width: 100%; height: 100%; overflow: hidden">
+                  <div class="main-side p-0" id="leftContent" style="width: 25%; height: 100%; overflow: hidden">
                       <div class="tab-bar">
                           <a href="javascript:void(0);" id="tree_Insert" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="插入"><i class="fa fa-plus" aria-hidden="true"></i></a>
                           <a href="javascript:void(0);" id="tree_remove" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="删除"><i class="fa fa-remove" aria-hidden="true"></i></a>
@@ -56,11 +56,15 @@
                       </div>
                         <!--<ul id="repositoryTree" class="ztree"></ul>-->
                   </div>
-                  <div class="main-content col-lg-6 p-0">
-                    <div id="GLJListSheet" class="main-data">
+                  <div class="main-content p-0" style="width: 50%" id="midContent">
+                      <div class="resize" id="slideResizeLeft" style="width: 1%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
+                    <div id="GLJListSheet" class="main-data" style="width: 99%; float: left">
                     </div>
                   </div>
-                    <div id="gljComponentSheet" class="main-side col-lg-3 p-0">
+                    <div class="main-side-right p-0" style="width: 25%;" id="rightContent">
+                        <div class="resize" id="slideResizeRight" style="width: 1%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
+                        <div id="gljComponentSheet" class="main-side p-0" style="width: 99%; float: left">
+                    </div>
                     </div>
                 </div>
             </div>
@@ -218,6 +222,7 @@
     <script type="text/javascript" src="/public/web/sheet/sheet_common.js"></script>
     <script type="text/javascript" src="/web/maintain/std_glj_lib/js/sheetsOpr.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
+    <script src="/web/common/js/slideResize.js"></script>
     <% if(overWriteUrl){ %>
     <script type="text/javascript" src="<%= overWriteUrl %>"></script>
     <% } %>

+ 37 - 0
web/maintain/std_glj_lib/js/glj.js

@@ -2,6 +2,43 @@
  * Created by Zhong on 2017/8/14.
  */
 
+$(document).ready(function () {
+    let moduleName = 'stdGLj';
+    function refreshALlWorkBook() {
+        if (gljClassTreeObj.workBook) {
+            gljClassTreeObj.workBook.refresh();
+        }
+        if (repositoryGljObj.workBook) {
+            repositoryGljObj.workBook.refresh();
+        }
+        if (gljComponentOprObj.workBook) {
+            gljComponentOprObj.workBook.refresh();
+        }
+    }
+    loadHorizonWidth(moduleName, [$('#leftContent'), $('#midContent'), $('#rightContent')], function () {
+        refreshALlWorkBook();
+    });
+    //章节树与人材机表
+    let leftElesObj = {};
+    leftElesObj.resize = $('#slideResizeLeft');
+    leftElesObj.parent = $('#dataRow');
+    leftElesObj.left = $('#leftContent');
+    leftElesObj.right = $('#midContent');
+    horizontalSlide(moduleName, leftElesObj, {min: 200, max: `$('#dataRow').width() - $('#rightContent').width() - 200`}, function () {
+        refreshALlWorkBook();
+    });
+    //人材机表与人材机组成物表
+    let rightElesObj = {};
+    rightElesObj.resize = $('#slideResizeRight');
+    rightElesObj.parent = $('#dataRow');
+    rightElesObj.left = $('#midContent');
+    rightElesObj.right = $('#rightContent');
+    horizontalSlide(moduleName, rightElesObj, {min: 200, max: `$('#dataRow').width() - $('#leftContent').width() - 200`}, function () {
+       refreshALlWorkBook();
+    });
+});
+
+
 const digital = {
     basePrice: -2,
     consumeAmt: -3

+ 39 - 1
web/maintain/std_glj_lib/js/global.js

@@ -40,4 +40,42 @@ $(function(){
         $(this).tooltip('show');
     });
     /*工具提示*/
-});
+});
+/**
+ * 设置本地缓存
+ *
+ * @param {String} key
+ * @param {String|Number} value
+ * @return {void}
+ */
+function setLocalCache(key, value) {
+    const storage = window.localStorage;
+    if (!storage || key === '' || value === '') {
+        return;
+    }
+
+    storage.setItem(key, value);
+}
+
+/**
+ * 获取本地缓存
+ *
+ * @param {String} key
+ * @return {String}
+ */
+function getLocalCache(key) {
+    const storage = window.localStorage;
+    if (!storage || key === '') {
+        return null;
+    }
+
+    return storage.getItem(key);
+}
+
+function removeLocalCache(key) {
+    const storage = window.localStorage;
+    if (!storage || key === '') {
+        return null;
+    }
+    return storage.removeItem(key);
+}