From e37c3eae2d494519bc6192d7e1e72a59a029a107 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 18 Mar 2025 11:50:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=9F=E8=B4=A3=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/Dept.php | 5 ++++- .../src/model/TicketDept.php | 6 ++++++ .../src/view/dept/form.html | 20 ++++++++++--------- .../src/view/dept/index.html | 7 +++++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/plugs/think-plugs-ticket/src/controller/Dept.php b/plugs/think-plugs-ticket/src/controller/Dept.php index 9a53836..70b4a51 100644 --- a/plugs/think-plugs-ticket/src/controller/Dept.php +++ b/plugs/think-plugs-ticket/src/controller/Dept.php @@ -5,6 +5,7 @@ namespace plugin\ticket\controller; use plugin\ticket\model\TicketDept; use think\admin\Controller; use think\admin\helper\QueryHelper; +use think\admin\model\SystemUser; class Dept extends Controller { @@ -14,19 +15,21 @@ class Dept extends Controller TicketDept::mQuery()->layTable(function () { }, function (QueryHelper $query) { - $query->like('name')->equal('status'); + $query->like('name')->with('fz_user')->equal('status'); }); } public function add() { $this->title = '添加部门'; + $this->users = SystemUser::query()->where(['status' => 1])->order('sort desc,id desc')->select(); TicketDept::mForm('form'); } public function edit() { $this->title = '编辑部门'; + $this->users = SystemUser::query()->where(['status' => 1])->order('sort desc,id desc')->select(); TicketDept::mForm('form'); } diff --git a/plugs/think-plugs-ticket/src/model/TicketDept.php b/plugs/think-plugs-ticket/src/model/TicketDept.php index 0d46999..66b59cf 100644 --- a/plugs/think-plugs-ticket/src/model/TicketDept.php +++ b/plugs/think-plugs-ticket/src/model/TicketDept.php @@ -3,6 +3,7 @@ namespace plugin\ticket\model; use think\admin\Model; +use think\admin\model\SystemUser; class TicketDept extends Model { @@ -10,4 +11,9 @@ class TicketDept extends Model { $query->where('status', '=', 1); } + + public function fz_user() + { + return $this->hasOne(SystemUser::class, 'id', 'fz_user_id'); + } } \ No newline at end of file diff --git a/plugs/think-plugs-ticket/src/view/dept/form.html b/plugs/think-plugs-ticket/src/view/dept/form.html index bad18e6..cdf31d4 100644 --- a/plugs/think-plugs-ticket/src/view/dept/form.html +++ b/plugs/think-plugs-ticket/src/view/dept/form.html @@ -1,21 +1,23 @@