From e08dc78904986e8dffaa34d5ef42645cfffc7b5b Mon Sep 17 00:00:00 2001 From: xman <1946321327@qq.com> Date: Mon, 7 Jul 2025 16:05:27 +0800 Subject: [PATCH] tts --- .../admin/controller/statistics/Item.php | 25 +++++++++++++++++-- .../admin/view/statistics/item/index.html | 11 ++++++++ public/assets/js/backend/statistics/item.js | 13 ++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/statistics/Item.php b/application/admin/controller/statistics/Item.php index 08f9736..d5ba0e4 100644 --- a/application/admin/controller/statistics/Item.php +++ b/application/admin/controller/statistics/Item.php @@ -25,7 +25,7 @@ use function Symfony\Component\Clock\now; */ class Item extends Backend { - + protected $itemsformattedTree = null; protected $noNeedRight = ['list','chartData']; @@ -54,8 +54,21 @@ class Item extends Backend ]; } } - $this->view->assign("sources", $res); + $items = Db::name('item') + ->where('status', 1) + ->field(['id', 'title', 'key_word', 'pid']) + ->order('pid', 'asc') + ->order('sort', 'desc') + ->select(); + $tree = $this->buildTree($items); + $formattedTree = $this->formatTree($tree); + + $this->items = $items; + $this->itemsformattedTree = $formattedTree; + + $this->view->assign("sources", $res); + $this->view->assign("items", $formattedTree); } @@ -188,6 +201,14 @@ class Item extends Backend $build->where('area_id','LIKE',request()->post('source').'%'); } + if(!empty(request()->post('item_id',null))){ + $item_id =request()->post('item_id'); + $item_ids = $this->getItemsById($item_id); + $item_ids [] = $item_id; + $build->whereIn('item_id', $item_ids); + } + + $res = $build->field([ 'item_title name', // 类型 'sum(total) total', // 营业额 diff --git a/application/admin/view/statistics/item/index.html b/application/admin/view/statistics/item/index.html index 4881a88..da9d918 100644 --- a/application/admin/view/statistics/item/index.html +++ b/application/admin/view/statistics/item/index.html @@ -46,6 +46,14 @@ +