Browse Source

修复列表bug

laiguoran 5 years ago
parent
commit
22e2ccabae

+ 0 - 1
app/public/js/tender_list_info.js

@@ -326,7 +326,6 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
     // 0号台账合同
     html.push('<td class="text-right">');
     html.push(node.total_price);
-    console.log(node);
     html.push('</td>');
     // 本期完成
     html.push('<td class="text-right">');

+ 0 - 1
app/public/js/tender_list_manage.js

@@ -255,7 +255,6 @@ function initTenderTree () {
             tenderTree.push(t);
         }
     }
-    console.log(tenderTree);
 }
 function recursiveGetTenderNodeHtml (node, arr, pid) {
     const html = [];

+ 28 - 25
app/public/js/tender_showhide.js

@@ -43,6 +43,7 @@ function localHideList() {
                 $('.c-body tr td span[cid="' + cid + '"]').children('i').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
                 $('.c-body tr td span[cid="' + cid + '"]').attr('title', '展开');
                 doTrStatus(returnItem, 'hide');
+                console.log(returnItem);
             }
         }
     } else {
@@ -61,34 +62,36 @@ function setTopTr() {
 }
 
 function doTrStatus(node, status, all = '') {
-    if (status === 'show') {
-        $('.c-body').find('tr[pid="'+ node.sort_id +'"]').show();
-        if (all === 'all') {
-            $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '收起');
-            $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-plus-square-o').removeClass('fa-minus-square-o').addClass('fa-minus-square-o');
-        }
-    } else {
-        $('.c-body').find('tr[pid="'+ node.sort_id +'"]').hide();
-        if (all === 'all') {
-            if (node.children) {
-                hideList.push({sort_id: node.sort_id});
-                setLocalCache(uphlname, JSON.stringify(hideList));
+    if (node) {
+        if (status === 'show') {
+            $('.c-body').find('tr[pid="'+ node.sort_id +'"]').show();
+            if (all === 'all') {
+                $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '收起');
+                $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-plus-square-o').removeClass('fa-minus-square-o').addClass('fa-minus-square-o');
             }
-            $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '展开');
-            $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-minus-square-o').removeClass('fa-plus-square-o').addClass('fa-plus-square-o');
-        }
-    }
-    // 判断是否还有一层
-    if (node.children && all === '') {
-        for (const [index,c] of node.children.entries()) {
-            const title = $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').eq(index).attr('title');
-            if (title === '收起') {
-                doTrStatus(c, status);
+        } else {
+            $('.c-body').find('tr[pid="'+ node.sort_id +'"]').hide();
+            if (all === 'all') {
+                if (node.children) {
+                    hideList.push({sort_id: node.sort_id});
+                    setLocalCache(uphlname, JSON.stringify(hideList));
+                }
+                $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '展开');
+                $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-minus-square-o').removeClass('fa-plus-square-o').addClass('fa-plus-square-o');
             }
         }
-    } else if (node.children && all === 'all') {
-        for (const c of node.children) {
-            doTrStatus(c, status, 'all');
+        // 判断是否还有一层
+        if (node.children && all === '') {
+            for (const [index,c] of node.children.entries()) {
+                const title = $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').eq(index).attr('title');
+                if (title === '收起') {
+                    doTrStatus(c, status);
+                }
+            }
+        } else if (node.children && all === 'all') {
+            for (const c of node.children) {
+                doTrStatus(c, status, 'all');
+            }
         }
     }
 }