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 @@ +