DCAT ADMIN 选项卡点击不切换的问题
1. 运行环境
1). 当前使用的 Laravel 版本?
Laravel Framework 9.52.20
2). 当前使用的 php/php-fpm 版本?
PHP 版本:
PHP 8.0.26
php-fpm 版本:
3). 当前系统
//: <> Centos 7
4). 业务环境
//: <> 测试环境
//: <> (是否使用负载均衡?请提供相关信息)
否
5). 相关软件版本
2. 问题描述?
namespace App\Admin\Renderable;
use Dcat\Admin\Support\LazyRenderable;
use Dcat\Admin\Widgets\Tab;
use Dcat\Admin\Widgets\Table;
use App\Models\Withdrewal;
use Illuminate\Support\Facades\DB;
public function render()
{
$totalAmount = Withdrewal::where('with_id', $this->id)->sum('amount');
$firstRecord = Withdrewal::where('with_id', $this->id)->first();
// 构建汇总信息表格
$summaryData = [];
if ($firstRecord) {
$summaryData = [
[
'合计金额' => '¥'.$totalAmount,
'收款人' => $firstRecord->recipient_name ?? '无',
'收款账号' => $firstRecord->recipient_account ?? '无',
'收款人身份证' => $firstRecord->recipient_id_card ?? '无'
]
];
}
$summaryTitles = ['合计金额', '收款人', '收款账号', '收款人身份证'];
$summaryTable = Table::make($summaryTitles, $summaryData);
// 获取明细数据并添加行号
$detailData = Withdrewal::where('with_id', $this->id)
->get(['amount', 'u_id', 'w_time'])
->map(function ($item, $index) {
return [
'序号' => $index + 1, // 添加行号
'金额' => '¥'.number_format($item->amount, 2),
'付款人' => $item->u_id,
'付款日期' => date('Y-m-d H:i:s', strtotime($item->w_time))
];
})
->toArray();
$detailTitles = ['序号', '金额', '付款人', '付款日期'];
$detailTable = Table::make($detailTitles, $detailData);
// 创建标签页并确保JS初始化
$tab = Tab::make();
$tab->add('提现信息汇总', $summaryTable, true);
$tab->add('提现明细', $detailTable);
// $tab->addLink('跳转链接', 'http://xxx');
return $tab->withCard();
}
3. 您期望得到的结果?
![]
4. 您实际得到的结果?
链接地址有反应,页面没有变化。
推荐文章: