Procházet zdrojové kódy

清单对比,默认展开章节合计

MaiXinRong před 5 roky
rodič
revize
31ca8efcab
2 změnil soubory, kde provedl 27 přidání a 25 odebrání
  1. 26 24
      app/public/js/ledger_gather.js
  2. 1 1
      app/view/ledger/gather.ejs

+ 26 - 24
app/public/js/ledger_gather.js

@@ -8,7 +8,33 @@
  * @version
  */
 
+
+const showTools = function (show) {
+    const left = $('#left-view'), right = $('#right-view'), parent = left.parent();
+    if (show) {
+        right.show();
+        autoFlashHeight();
+        /**
+         * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
+         * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
+         * 故需要通过最终的parent.width再计算一次left.width
+         *
+         * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
+         * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
+         *
+         */
+            //left.css('width', parent.width() - right.outerWidth());
+            //left.css('width', parent.width() - right.outerWidth());
+        const percent = 100 - right.outerWidth() /parent.width() * 100;
+        left.css('width', percent + '%');
+    } else {
+        right.hide();
+        left.css('width', '100%');
+    }
+};
+
 $(document).ready(() => {
+    showTools(true);
     autoFlashHeight();
     const gclSpread = SpreadJsObj.createNewSpread($('#gcl-spread')[0]);
     const gclSpreadSetting = {
@@ -161,33 +187,9 @@ $(document).ready(() => {
     $('#compare-tag').click(() => {
         SpreadJsObj.reLoadSheetData(gclSheet);
     });
-
     // 展开收起附件
     $('a', '.right-nav').bind('click', function () {
         const tab = $(this), tabPanel = $(tab.attr('content'));
-        const showTools = function (show) {
-            const left = $('#left-view'), right = $('#right-view'), parent = left.parent();
-            if (show) {
-                right.show();
-                autoFlashHeight();
-                /**
-                 * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
-                 * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
-                 * 故需要通过最终的parent.width再计算一次left.width
-                 *
-                 * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
-                 * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
-                 *
-                 */
-                    //left.css('width', parent.width() - right.outerWidth());
-                    //left.css('width', parent.width() - right.outerWidth());
-                const percent = 100 - right.outerWidth() /parent.width() * 100;
-                left.css('width', percent + '%');
-            } else {
-                right.hide();
-                left.css('width', '100%');
-            }
-        };
         if (!tab.hasClass('active')) {
             $('a', '.side-menu').removeClass('active');
             $('.tab-content .tab-select-show').removeClass('active');

+ 1 - 1
app/view/ledger/gather.ejs

@@ -59,7 +59,7 @@
             <!--右侧菜单-->
             <ul class="nav flex-column right-nav" id="side-menu">
                 <li class="nav-item">
-                    <a class="nav-link" content="#chapter" href="javascript: void(0);">章节合计</a>
+                    <a class="nav-link active" content="#chapter" href="javascript: void(0);">章节合计</a>
                 </li>
             </ul>
         </div>