From d058cc7cc339d1f23746ff615c6019991ada016a Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 29 Nov 2024 14:20:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A1=E6=A3=80=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugs/think-plugs-inspection/composer.json | 2 +- plugs/think-plugs-inspection/src/Service.php | 19 ++-- .../src/controller/Staff.php | 59 ++++++++++++ .../think-plugs-inspection/src/view/main.html | 11 +++ .../src/view/staff/form.html | 93 +++++++++++++++++++ .../src/view/staff/index.html | 72 ++++++++++++++ .../src/view/staff/index_search.html | 16 ++++ .../src/view/table.html | 23 +++++ 8 files changed, 287 insertions(+), 8 deletions(-) create mode 100644 plugs/think-plugs-inspection/src/view/main.html create mode 100644 plugs/think-plugs-inspection/src/view/staff/form.html create mode 100644 plugs/think-plugs-inspection/src/view/staff/index.html create mode 100644 plugs/think-plugs-inspection/src/view/staff/index_search.html create mode 100644 plugs/think-plugs-inspection/src/view/table.html diff --git a/plugs/think-plugs-inspection/composer.json b/plugs/think-plugs-inspection/composer.json index 3efae88..be8cccc 100644 --- a/plugs/think-plugs-inspection/composer.json +++ b/plugs/think-plugs-inspection/composer.json @@ -16,7 +16,7 @@ }, "autoload": { "psr-4": { - "plugin\\ticket\\": "src" + "plugin\\inspection\\": "src" } }, "extra": { diff --git a/plugs/think-plugs-inspection/src/Service.php b/plugs/think-plugs-inspection/src/Service.php index 1037a35..6d63e1f 100644 --- a/plugs/think-plugs-inspection/src/Service.php +++ b/plugs/think-plugs-inspection/src/Service.php @@ -4,33 +4,38 @@ namespace plugin\inspection; use think\admin\Plugin; +use think\facade\View; class Service extends Plugin { - protected $appName = '巡检端'; + protected $appName = '巡检管理'; protected $appCode = 'inspection'; protected $package = 'jerryyan/think-plugs-inspection'; public static function register(): void { + View::assign("_GENDER", [ + '1' => '女', + '0' => '男' + ]); } public static function menu(): array { $code = app(static::class)->appCode; return [ + [ + 'name' => '巡检人员', + 'subs' => [ + ['name' => '人员列表', 'icon' => 'layui-icon layui-icon-template-1', 'node' => "{$code}/staff/index"], + ] + ], [ 'name' => '巡检管理', 'subs' => [ ['name' => '巡检记录', 'icon' => 'layui-icon layui-icon-template-1', 'node' => "{$code}/record/index"], ] ], - [ - 'name' => '巡检人员', - 'subs' => [ - ['name' => '人员列表', 'icon' => 'layui-icon layui-icon-template-1', 'node' => "{$code}/user/index"], - ] - ] ]; } } \ No newline at end of file diff --git a/plugs/think-plugs-inspection/src/controller/Staff.php b/plugs/think-plugs-inspection/src/controller/Staff.php index 4cc0d83..c1be4d0 100644 --- a/plugs/think-plugs-inspection/src/controller/Staff.php +++ b/plugs/think-plugs-inspection/src/controller/Staff.php @@ -11,6 +11,15 @@ use think\admin\helper\QueryHelper; */ class Staff extends Controller { + /** + * 巡检人员列表 + * @auth true + * @menu true + * @return void + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ public function index() { $this->title = '巡检人员管理'; @@ -20,4 +29,54 @@ class Staff extends Controller $query->like(['name|phone|address#keyword'])->equal(['status']); }); } + + /** + * 添加巡检人员 + * @auth true + * @menu true + * @return void + */ + public function add() + { + $this->title = '添加巡检人员'; + InspectionStaff::mForm('form'); + } + + /** + * 编辑巡检人员 + * @auth true + * @menu true + * @return void + */ + public function edit() + { + $this->title = '编辑巡检人员'; + InspectionStaff::mForm('form'); + } + + /** + * 启用/禁用人员 + * @auth true + * @menu true + * @return void + */ + public function status() + { + InspectionStaff::mSave($this->_vali([ + 'id.require' => '人员ID不能为空', + 'status.in:0,1' => '状态值范围异常!', + 'status.require' => '状态值不能为空!', + ]), 'id'); + } + + /** + * 删除巡检人员 + * @auth true + * @menu true + * @return void + */ + public function remove() + { + InspectionStaff::mDelete('id'); + } } \ No newline at end of file diff --git a/plugs/think-plugs-inspection/src/view/main.html b/plugs/think-plugs-inspection/src/view/main.html new file mode 100644 index 0000000..2ff0f5e --- /dev/null +++ b/plugs/think-plugs-inspection/src/view/main.html @@ -0,0 +1,11 @@ +