You've already forked guangan
巡检人员
This commit is contained in:
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"plugin\\ticket\\": "src"
|
"plugin\\inspection\\": "src"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -4,33 +4,38 @@ namespace plugin\inspection;
|
|||||||
|
|
||||||
|
|
||||||
use think\admin\Plugin;
|
use think\admin\Plugin;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
class Service extends Plugin
|
class Service extends Plugin
|
||||||
{
|
{
|
||||||
protected $appName = '巡检端';
|
protected $appName = '巡检管理';
|
||||||
protected $appCode = 'inspection';
|
protected $appCode = 'inspection';
|
||||||
protected $package = 'jerryyan/think-plugs-inspection';
|
protected $package = 'jerryyan/think-plugs-inspection';
|
||||||
|
|
||||||
public static function register(): void
|
public static function register(): void
|
||||||
{
|
{
|
||||||
|
View::assign("_GENDER", [
|
||||||
|
'1' => '女',
|
||||||
|
'0' => '男'
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function menu(): array
|
public static function menu(): array
|
||||||
{
|
{
|
||||||
$code = app(static::class)->appCode;
|
$code = app(static::class)->appCode;
|
||||||
return [
|
return [
|
||||||
|
[
|
||||||
|
'name' => '巡检人员',
|
||||||
|
'subs' => [
|
||||||
|
['name' => '人员列表', 'icon' => 'layui-icon layui-icon-template-1', 'node' => "{$code}/staff/index"],
|
||||||
|
]
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => '巡检管理',
|
'name' => '巡检管理',
|
||||||
'subs' => [
|
'subs' => [
|
||||||
['name' => '巡检记录', 'icon' => 'layui-icon layui-icon-template-1', 'node' => "{$code}/record/index"],
|
['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"],
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,6 +11,15 @@ use think\admin\helper\QueryHelper;
|
|||||||
*/
|
*/
|
||||||
class Staff extends Controller
|
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()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->title = '巡检人员管理';
|
$this->title = '巡检人员管理';
|
||||||
@ -20,4 +29,54 @@ class Staff extends Controller
|
|||||||
$query->like(['name|phone|address#keyword'])->equal(['status']);
|
$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');
|
||||||
|
}
|
||||||
}
|
}
|
11
plugs/think-plugs-inspection/src/view/main.html
Normal file
11
plugs/think-plugs-inspection/src/view/main.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<div class="layui-card layui-bg-gray">
|
||||||
|
{block name='style'}{/block}
|
||||||
|
{notempty name='title'}
|
||||||
|
<div class="layui-card-header notselect">
|
||||||
|
<span class="layui-icon layui-icon-next font-s10 color-desc margin-right-5"></span>{$title|default=''}
|
||||||
|
<div class="pull-right">{block name='button'}{/block}</div>
|
||||||
|
</div>
|
||||||
|
{/notempty}
|
||||||
|
<div class="layui-card-body">{block name='content'}{/block}</div>
|
||||||
|
{block name='script'}{/block}
|
||||||
|
</div>
|
93
plugs/think-plugs-inspection/src/view/staff/form.html
Normal file
93
plugs/think-plugs-inspection/src/view/staff/form.html
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">巡检员账号(用于登录)</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
{if isset($id)}
|
||||||
|
<input type="text" disabled name="account" value='{$vo.account|default=""}' required placeholder="请输入巡检员账号" class="layui-input">
|
||||||
|
{else}
|
||||||
|
<input type="text" name="account" value='{$vo.account|default=""}' required placeholder="请输入巡检员账号" class="layui-input">
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{if !isset($id)}
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">巡检员密码(用于登录)</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="password" value='{$vo.password|default=""}' required placeholder="请输入巡检员密码" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">巡检员名称</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="name" value='{$vo.name|default=""}' required placeholder="请输入巡检员名称" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">巡检员性别</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-col-space15" style="content: none">
|
||||||
|
<div class="layui-col-xs2">
|
||||||
|
{foreach $_GENDER as $k=>$v}
|
||||||
|
<!--{if (!isset($vo.gender) and $k eq '0') or (isset($vo.gender) and $vo.gender eq $k)}-->
|
||||||
|
<input type="radio" name="is_link" lay-filter="islink_filter" checked value="{$k}" title="{$v}">
|
||||||
|
<!--{else}-->
|
||||||
|
<input type="radio" name="is_link" lay-filter="islink_filter" value="{$k}" title="{$v}">
|
||||||
|
<!--{/if}-->
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">巡检员联系方式</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="phone" value='{$vo.phone|default=""}' required placeholder="请输入巡检员联系方式" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="hr-line-dashed"></div>
|
||||||
|
{notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
|
||||||
|
<div class="layui-form-item text-center">
|
||||||
|
<button class="layui-btn layui-btn-normal" type='submit'>保存数据</button>
|
||||||
|
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.layui-tab-item{ min-height: 400px;}
|
||||||
|
.input-group-addon {
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
color: #eee;
|
||||||
|
width: 25px;
|
||||||
|
padding: 7px;
|
||||||
|
position: absolute;
|
||||||
|
margin-top: -1px;
|
||||||
|
text-align: center;
|
||||||
|
background: #393D49;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
layui.form.render();
|
||||||
|
layui.use(['layer', 'jquery', 'form','element'], function () {
|
||||||
|
var layer = layui.layer,
|
||||||
|
$ = layui.jquery,
|
||||||
|
form = layui.form,
|
||||||
|
element = layui.element;
|
||||||
|
|
||||||
|
//监听是否为跳转链接的选择变化
|
||||||
|
form.on("radio(islink_filter)", function (data) {
|
||||||
|
if(parseInt(data.value)){
|
||||||
|
$('#category_link_url').show();
|
||||||
|
}else{
|
||||||
|
$('#category_link_url').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
72
plugs/think-plugs-inspection/src/view/staff/index.html
Normal file
72
plugs/think-plugs-inspection/src/view/staff/index.html
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{extend name="table"}
|
||||||
|
|
||||||
|
{block name="button"}
|
||||||
|
<!--{if auth("add")}-->
|
||||||
|
<button data-modal='{:url("add")}' data-title="添加巡检员" class='layui-btn layui-btn-sm layui-btn-primary'>添加巡检员</button>
|
||||||
|
<!--{/if}-->
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name="content"}
|
||||||
|
<div class="layui-tab layui-tab-card think-bg-white">
|
||||||
|
<div class="layui-tab-content think-box-shadow">
|
||||||
|
{include file='staff/index_search'}
|
||||||
|
<table class="layui-table margin-top-10" data-url="{$request->url()}" data-target-search="form.form-search" lay-skin="line" id="staffTable"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/html" id="toolbar">
|
||||||
|
|
||||||
|
<!--{if auth("edit")}-->
|
||||||
|
<a data-modal="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal" title="修改">修改</a>
|
||||||
|
<!--{/if}-->
|
||||||
|
|
||||||
|
<!--{if auth("status")}-->
|
||||||
|
{{# if(d.status == 0){ }}
|
||||||
|
<a class="layui-btn layui-btn-xs layui-btn-normal" data-title="启用" data-modal='{:url("status")}?id={{ d.id }}&status=1'>启 用</a>
|
||||||
|
{{# } else { }}
|
||||||
|
<a class="layui-btn layui-btn-xs layui-btn-primary" data-title="禁用" data-modal='{:url("status")}?id={{ d.id }}&status=0'>禁 用</a>
|
||||||
|
{{# } }}
|
||||||
|
<!--{/if}-->
|
||||||
|
|
||||||
|
<!--{if auth("remove")}-->
|
||||||
|
<a data-confirm="确定要永久删除此巡检员吗?" data-action="{:url('remove')}" data-value="id#{{ d.id }}" data-csrf="{:systoken('remove')}" class="layui-btn layui-btn-xs layui-btn-danger" title="删除">删除</a>
|
||||||
|
<!--{/if}-->
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name='style'}
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
|
||||||
|
{block name='script'}
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('#staffTable').layTable({
|
||||||
|
height: 'full-240',
|
||||||
|
toolbar: true,
|
||||||
|
sort: {field: 'create_at', type: 'desc'},
|
||||||
|
cols: [[
|
||||||
|
{field: 'account', title: '账号'},
|
||||||
|
{field: 'name', title: '巡检员名称', minWidth: 165},
|
||||||
|
{field: 'phone', title: '手机号'},
|
||||||
|
{field: 'status', title: '状态', width: 60,templet:function(item){
|
||||||
|
if(item.status == 0){
|
||||||
|
return '<span style="color:red;">禁用</span>';
|
||||||
|
}else if(item.status == 1){
|
||||||
|
return '<span style="color:green;">启用</span>';
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{field: 'last_login_at', title: '最后一次登录时间', width: 150},
|
||||||
|
{align: 'center', toolbar: '#toolbar', title: '操作', width: 240}
|
||||||
|
]]
|
||||||
|
})
|
||||||
|
layui.use(['table'], function(){
|
||||||
|
var table = layui.table,
|
||||||
|
layer = layui.layer;
|
||||||
|
table.on('edit(staffTable)', function(obj) {
|
||||||
|
});
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{/block}
|
@ -0,0 +1,16 @@
|
|||||||
|
<fieldset>
|
||||||
|
<legend>条件搜索</legend>
|
||||||
|
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
|
||||||
|
<div class="layui-form-item layui-inline">
|
||||||
|
<label class="layui-form-label">巡检员名称</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input name="name" value="{:input('get.name')}" placeholder="请输入巡检员名称" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item layui-inline">
|
||||||
|
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="searchData"><i class="layui-icon"></i> 搜 索</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</fieldset>
|
23
plugs/think-plugs-inspection/src/view/table.html
Normal file
23
plugs/think-plugs-inspection/src/view/table.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<div class="layui-card">
|
||||||
|
{block name='style'}{/block}
|
||||||
|
{block name='header'}
|
||||||
|
{notempty name='title'}
|
||||||
|
<div class="layui-card-header">
|
||||||
|
<span class="layui-icon font-s10 color-desc ta-mr-5"></span>{$title|lang}
|
||||||
|
<div class="pull-right">{block name='button'}{/block}</div>
|
||||||
|
</div>
|
||||||
|
{/notempty}
|
||||||
|
{/block}
|
||||||
|
<div class="layui-card-line"></div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-card-table">
|
||||||
|
{notempty name='showErrorMessage'}
|
||||||
|
<div class="think-box-notify" type="error">
|
||||||
|
<b>系统提示:</b><span>{$showErrorMessage|raw}</span>
|
||||||
|
</div>
|
||||||
|
{/notempty}
|
||||||
|
{block name='content'}{/block}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{block name='script'}{/block}
|
||||||
|
</div>
|
Reference in New Issue
Block a user