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 @@ +
+ {block name='style'}{/block} + {notempty name='title'} +
+ {$title|default=''} +
{block name='button'}{/block}
+
+ {/notempty} +
{block name='content'}{/block}
+ {block name='script'}{/block} +
\ No newline at end of file diff --git a/plugs/think-plugs-inspection/src/view/staff/form.html b/plugs/think-plugs-inspection/src/view/staff/form.html new file mode 100644 index 0000000..2bc1e25 --- /dev/null +++ b/plugs/think-plugs-inspection/src/view/staff/form.html @@ -0,0 +1,93 @@ +
+
+
+
+ +
+ {if isset($id)} + + {else} + + {/if} +
+
+ {if !isset($id)} +
+ +
+ +
+
+ {/if} +
+ +
+ +
+
+ +
+ +
+
+
+ {foreach $_GENDER as $k=>$v} + + + + + + {/foreach} +
+
+
+
+
+ +
+ +
+
+ +
+
+ {notempty name='vo.id'}{/notempty} +
+ + +
+
+
+ + + diff --git a/plugs/think-plugs-inspection/src/view/staff/index.html b/plugs/think-plugs-inspection/src/view/staff/index.html new file mode 100644 index 0000000..c126272 --- /dev/null +++ b/plugs/think-plugs-inspection/src/view/staff/index.html @@ -0,0 +1,72 @@ +{extend name="table"} + +{block name="button"} + + + +{/block} + +{block name="content"} +
+
+ {include file='staff/index_search'} +
+
+
+ + +{/block} + +{block name='style'} + +{/block} + +{block name='script'} + +{/block} \ No newline at end of file diff --git a/plugs/think-plugs-inspection/src/view/staff/index_search.html b/plugs/think-plugs-inspection/src/view/staff/index_search.html new file mode 100644 index 0000000..5306534 --- /dev/null +++ b/plugs/think-plugs-inspection/src/view/staff/index_search.html @@ -0,0 +1,16 @@ +
+ 条件搜索 + + +
diff --git a/plugs/think-plugs-inspection/src/view/table.html b/plugs/think-plugs-inspection/src/view/table.html new file mode 100644 index 0000000..290b1b6 --- /dev/null +++ b/plugs/think-plugs-inspection/src/view/table.html @@ -0,0 +1,23 @@ +
+ {block name='style'}{/block} + {block name='header'} + {notempty name='title'} +
+ {$title|lang} +
{block name='button'}{/block}
+
+ {/notempty} + {/block} +
+
+
+ {notempty name='showErrorMessage'} +
+ 系统提示:{$showErrorMessage|raw} +
+ {/notempty} + {block name='content'}{/block} +
+
+ {block name='script'}{/block} +
\ No newline at end of file