rabin 1 éve
szülő
commit
8111742cb7

+ 32 - 1
vendor/dever-main/framework/src/Dever/Template/Common.php

@@ -366,11 +366,42 @@ class Common
             $html .= '<div class="layui-card-body order-box '.$class.'">';
             
             $i = 0;
+            if (isset($body['tab'])) {
+                $tab = $body['tab'];
+                unset($body['tab']);
+            }
             foreach ($body as $k => $v) {
                 $method = 'show_' . $v['type'];
                 $html .= self::$method($k, $v['content'], isset($v['total']) ? $v['total'] : false, isset($v['head']) ? $v['head'] : false, isset($v['pic']) ? $v['pic'] : '', $i);
                 $i++;
             }
+            if (isset($tab)) {
+                $tab_title = '<ul class="layui-tab-title">';
+                $tab_content = '<div class="layui-tab-content">';
+
+                $tab_state = false;
+                foreach ($tab as $k => $v) {
+                    if (isset($v['show']) && $v['show']) {
+                        $tab_state = true;
+                    }
+                }
+                $i = 0;
+                foreach ($tab as $k => $v) {
+                    $tab_title_class = '';
+                    $tab_content_class = '';
+                    if ((!$tab_state && $i == 0) || ($tab_state && isset($v['show']) && $v['show'])) {
+                        $tab_title_class = 'layui-this';
+                        $tab_content_class = 'layui-show';
+                    }
+                    $tab_title .= '<li class="'.$tab_title_class.'">'.$k.'</li>';
+                    $method = 'show_' . $v['type'];
+                    $tab_content .= '<div class="layui-tab-item  '.$tab_content_class.'">' . self::$method('', $v['content'], isset($v['total']) ? $v['total'] : false, isset($v['head']) ? $v['head'] : false, isset($v['pic']) ? $v['pic'] : '', $i) . '</div>';
+                    $i++;
+                }
+                $tab_title .= '</ul>';
+                $tab_content .= '</div>';
+                $html .= '<div class="layui-tab layui-tab-brief" style="margin-top:10px">'.$tab_title.$tab_content.'</div>';
+            }
             $html .= '</div>';
         } else {
             $html .= $body;
@@ -627,7 +658,7 @@ class Common
      */
     public static function show_table($name, $content, $total = false, $head = false, $pic = '', $index = 0)
     {
-        $html = '<section style="width: 100%;">';
+        $html = '<section style="width: fit-content;">';
         if ($name && is_string($name)) {
             $html .= '<h3>'.$name.'</h3>';
         }