OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
<?php
namespace Leantime\Domain\Bom\Controllers;
use Leantime\Core\Auth\Permissions\RequiresPermission;
use Leantime\Core\Controller\Controller;
use Leantime\Domain\Bom\Permissions\BomPermissions;
use Leantime\Domain\Bom\Services\Bom as BomService;
use Symfony\Component\HttpFoundation\Response;
/**
* BOM 页面(项目清单"目标及里程碑"下方入口)。
* 约定路由GET /bom/show 列表
* GET /bom/show/{id} 详情(可编辑表格)
*/
class Show extends Controller
{
private BomService $bomService;
public function init(BomService $bomService): void
{
$this->bomService = $bomService;
}
#[RequiresPermission(BomPermissions::VIEW)]
public function get(array $params): Response
{
$projectId = (int) session('currentProject');
$bomId = isset($params['id']) ? (int) $params['id'] : 0;
// ?type=bom|process|toolingquery string经 incomingRequest 读取)
$type = (string) $this->incomingRequest->query('type', 'bom');
if (! in_array($type, ['bom', 'process', 'tooling'], true)) {
$type = 'bom';
}
if ($bomId > 0) {
$detail = $this->bomService->getBomDetail($bomId);
if ($detail === false) {
$this->tpl->setNotification($this->language->__('notification.bom_not_found', 'BOM 不存在'), 'error');
return $this->tpl->display('bom.show', 'app', 404);
}
$this->tpl->assign('detail', $detail);
$this->tpl->assign('fixedColumns', BomService::FIXED_COLUMNS);
$this->tpl->assign('projectId', $projectId);
return $this->tpl->display('bom.detail');
}
// 三类主数据bom/process/tooling共用列表type 参数切换
$masters = $this->bomService->getMasters($type, $projectId);
$this->tpl->assign('boms', $masters);
$this->tpl->assign('type', $type);
$this->tpl->assign('projectId', $projectId);
$this->tpl->assign('fixedColumns', BomService::FIXED_COLUMNS);
return $this->tpl->display('bom.show');
}
}