From 9fb69e35091a5043bdc5a756ba5d231c4a99bde7 Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Mon, 23 Jun 2025 17:33:15 +0800 Subject: [PATCH] 11 --- .../controller/LogisticsShipController.php | 26 ++- plugin/admin/app/view/location/index.html | 6 +- .../admin/app/view/logistics-ship/index.html | 216 +++++++++++++----- .../admin/app/view/logistics-ship/update.html | 119 ++++++---- plugin/admin/app/view/vehicle/index.html | 13 +- 5 files changed, 266 insertions(+), 114 deletions(-) diff --git a/plugin/admin/app/controller/LogisticsShipController.php b/plugin/admin/app/controller/LogisticsShipController.php index 80e000f..1caa267 100644 --- a/plugin/admin/app/controller/LogisticsShipController.php +++ b/plugin/admin/app/controller/LogisticsShipController.php @@ -34,7 +34,18 @@ class LogisticsShipController extends Crud */ public function index(): Response { - return view('logistics-ship/index'); + $lang = session('lang', 'zh-cn'); + $translations = (array)require __DIR__ . '/../lang/' . $lang . '/ship.php'; + var_dump($translations); + $common = (array)require __DIR__ . '/../lang/' . $lang . '/common.php'; + $translations = array_merge($common, $translations); // 确保 common.php 的翻译优先 + + // 合并翻译,确保语言文件中的翻译优先 +// $translations = array_merge($required_translations, $translations); + return view('logistics-ship/index', [ + 'lang' => $lang, + 'translations' => $translations + ]); } /** @@ -59,10 +70,21 @@ class LogisticsShipController extends Crud */ public function update(Request $request): Response { + $id = $request->input('id'); + $lang = session('lang', 'zh-cn'); + $translations = (array)require __DIR__ . '/../lang/' . $lang . '/ship.php'; + $common = (array)require __DIR__ . '/../lang/' . $lang . '/common.php'; + $translations = array_merge($translations, $common); + if ($request->method() === 'POST') { return parent::update($request); } - return view('logistics-ship/update'); + return view('logistics-ship/update', [ + 'id' => $id, +// 'data' => $data, + 'lang' => $lang, + 'translations' => $translations + ]); } } diff --git a/plugin/admin/app/view/location/index.html b/plugin/admin/app/view/location/index.html index c9024b5..48c54bd 100644 --- a/plugin/admin/app/view/location/index.html +++ b/plugin/admin/app/view/location/index.html @@ -29,9 +29,9 @@ - + + + diff --git a/plugin/admin/app/view/logistics-ship/index.html b/plugin/admin/app/view/logistics-ship/index.html index 52fa4e2..3eb18e5 100644 --- a/plugin/admin/app/view/logistics-ship/index.html +++ b/plugin/admin/app/view/logistics-ship/index.html @@ -1,11 +1,27 @@ - - +
-